|
1
|
|
-(()=>{"use strict";var e,t,o,n,s,a={114(e,t,o){o.d(t,{A:()=>s});const n=window.fcomEditorI18n||{};function s(e){return n[e]||e}},144(e,t,o){o.a(e,async(e,t)=>{try{var n=o(279),s=o(656),a=o(427),i=o(87),r=o(143),c=o(619),d=o(997),l=o(114),m=o(445),u=o(730),p=o(823),h=o(790);const f=()=>{const[e,t]=(0,i.useState)(window.fcomMetaSettings||null);(0,i.useEffect)(()=>{const e=e=>{e.detail&&t({...e.detail})};return window.addEventListener("fcomMetaSettingsReady",e),()=>window.removeEventListener("fcomMetaSettingsReady",e)},[]);const[o,n]=(0,i.useState)(!!e&&"yes"===e.enable_media),r=(0,i.useRef)(e?e.enable_media:"no");(0,i.useEffect)(()=>{e&&e.enable_media!==r.current&&(r.current=e.enable_media,"yes"===e.enable_media&&n(!0))},[e]);const c=(e,o)=>{const n={...window.fcomMetaSettings,[e]:o};window.fcomMetaSettings=n,t({...n}),window.parent.postMessage({action:"META_UPDATED",content:n},"*")};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.PluginPostStatusInfo,{children:e&&(0,h.jsxs)("div",{className:"fcom_feature_checkboxes",style:{width:"100%"},children:[(0,h.jsx)(a.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,l.A)("Enable Video Embed"),checked:"yes"===e.enable_media,onChange:e=>c("enable_media",e?"yes":"no")}),(0,h.jsx)(a.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,l.A)("Enable Comments"),checked:"yes"===e.enable_comments,onChange:e=>c("enable_comments",e?"yes":"no")}),(0,h.jsx)(a.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,l.A)("Free Preview Lesson"),help:(0,l.A)("If enabled, public users can view this lesson without enrolling the course."),checked:"yes"===e.free_preview_lesson,onChange:e=>c("free_preview_lesson",e?"yes":"no")})]})}),(0,h.jsx)(s.PluginDocumentSettingPanel,{name:"fcom-media-embed",title:(0,l.A)("Media Embed"),className:e&&"yes"===e.enable_media?"":"fcom-panel-hidden",isOpen:o,onToggle:()=>n(!o),children:e&&"yes"===e.enable_media&&(0,h.jsx)(u.A,{media:e.media,videoLength:e.video_length,onUpdate:(e,t)=>c(e,t)})}),(0,h.jsx)(s.PluginDocumentSettingPanel,{name:"fcom-documents",title:(0,l.A)("Documents & Files"),className:e?"":"fcom-panel-hidden",initialOpen:!1,children:e&&(0,h.jsx)(p.A,{})}),(0,h.jsx)(s.PluginDocumentSettingPanel,{name:"fcom-smartcodes",title:(0,l.A)("Smartcodes"),initialOpen:!1,children:(0,h.jsxs)("div",{className:"fcom_lesson_info_codes",children:[(0,h.jsx)("p",{children:(0,l.A)("You may use following smartcode in your lesson:")}),(0,h.jsxs)("ul",{children:[(0,h.jsxs)("li",{children:[(0,h.jsx)("b",{children:(0,l.A)("User's Name:")})," ",(0,h.jsx)("span",{children:"{{user.display_name|fallback}}"})]}),(0,h.jsxs)("li",{children:[(0,h.jsx)("b",{children:(0,l.A)("User's Email:")})," ",(0,h.jsx)("span",{children:"{{user.user_email|fallback}}"})]}),(0,h.jsxs)("li",{children:[(0,h.jsx)("b",{children:(0,l.A)("User's photo HTML:")})," ",(0,h.jsx)("span",{children:"{{user.photo_html.50px}}"})]}),(0,h.jsxs)("li",{children:[(0,h.jsx)("b",{children:(0,l.A)("User's Profile Link:")})," ",(0,h.jsx)("span",{children:"##user.profile_link##"})]})]})]})})]})};(0,n.registerPlugin)("fcom-document-settings",{render:f});let w=!1;const x=()=>(w||((0,r.select)("core/edit-post").isFeatureActive("welcomeGuide")&&(0,r.dispatch)("core/edit-post").toggleFeature("welcomeGuide"),(0,r.select)("core/edit-post").isFeatureActive("fullscreenMode")||(0,r.dispatch)("core/edit-post").toggleFeature("fullscreenMode"),"text"===(0,r.select)("core/edit-post").getEditorMode()&&(0,r.dispatch)("core/edit-post").switchEditorMode("visual"),(0,r.dispatch)("core/editor").lockPostSaving(),(0,r.dispatch)("core/editor").lockPostAutosaving(),w=!0),null);async function _(){await new Promise(e=>{const t=(0,r.subscribe)(()=>{((0,r.select)("core/editor").isCleanNewPost()||(0,r.select)("core/block-editor").getBlockCount()>0)&&(t(),e())})});const e=document.querySelector('[name="editor-canvas"]');return new Promise(t=>{e?e.loading?e.onload=()=>{t(e)}:t(e):t(null)})}(0,n.registerPlugin)("fluent-com-disable-gutenberg-features",{render:x}),(0,c.addFilter)("editor.DocumentBar","fluentcom-custom-document-bar",()=>null),(0,c.addFilter)("editor.Autocomplete.completers","fluent_com/add_autocmplete",function(e,t){return e=e.filter(e=>"users"!==e.name),[...e,m.A]}),window.addEventListener("beforeunload",function(e){e.stopImmediatePropagation()}),await _(),console.log("editor iframe is now ready");let v=!1;window.addEventListener("message",e=>{if("SYNC_META"===e.data?.type)return window.fcomMetaSettings=e.data.data,window.dispatchEvent(new CustomEvent("fcomMetaSettingsReady",{detail:e.data.data})),void window.dispatchEvent(new CustomEvent("fcomDocumentsUpdated"));if("UPDATE_EDITOR"!==e.data?.type)return;const{content:t,title:o,featured_image_id:n,metaSettings:s}=e.data.data;console.log("UPDATE_EDITOR",s,e.data.data),s?(window.fcomMetaSettings=s,window.dispatchEvent(new CustomEvent("fcomMetaSettingsReady",{detail:s}))):window.fcomMetaSettings=null,t&&(0,r.dispatch)("core/block-editor").resetBlocks((0,d.parse)(t));let a=null;o&&(a={title:o}),n&&(a?a.featured_media=n:a={featured_media:n}),a&&(0,r.dispatch)("core/editor").editPost(a),setTimeout(()=>{v=!0},1e3)}),window._wpLoadBlockEditor.then(()=>{window.parent.postMessage({content:"ping",action:"EDITOR_READY"},"*");let e="",t="",o=null;(0,r.subscribe)(()=>{if(!v)return;const n=(0,r.select)("core/editor").getEditedPostAttribute("title");n!=t&&(t=n,window.parent.postMessage({content:n,action:"TITLE_UPDATED"},"*"));const s=(0,r.select)("core/editor").getEditedPostAttribute("featured_media");o!=s&&(o=s,window.parent.postMessage({content:s,action:"FEATURED_MEDIA_UPDATED"},"*"));const a=(0,r.select)("core/block-editor").getBlocks(),i=(0,d.serialize)(a);e!=i&&(e=i,window.parent.postMessage({content:i,action:"EDITOR_UPDATED"},"*"))})}),t()}catch(g){t(g)}},1)},823(e,t,o){o.d(t,{A:()=>r});var n=o(427),s=o(87),a=o(114),i=o(790);const r=()=>{const[e,t]=(0,s.useState)(window.fcomMetaSettings&&Array.isArray(window.fcomMetaSettings.document_lists)?window.fcomMetaSettings.document_lists:[]);return(0,s.useEffect)(()=>{const e=e=>{e.detail&&Array.isArray(e.detail.document_lists)&&t([...e.detail.document_lists])};window.addEventListener("fcomMetaSettingsReady",e);const o=()=>{window.fcomMetaSettings&&Array.isArray(window.fcomMetaSettings.document_lists)&&t([...window.fcomMetaSettings.document_lists])};return window.addEventListener("fcomDocumentsUpdated",o),()=>{window.removeEventListener("fcomMetaSettingsReady",e),window.removeEventListener("fcomDocumentsUpdated",o)}},[]),(0,i.jsxs)("div",{className:"fcom-documents-panel",children:[e.length>0?(0,i.jsx)("ul",{className:"fcom-documents-list",children:e.map(e=>{return(0,i.jsxs)("li",{className:"fcom-document-item",children:[(0,i.jsx)("span",{className:"fcom-document-icon",children:(t=e.type,t?t.includes("pdf")?"📄":t.includes("image")?"🖼️":t.includes("video")?"🎥":t.includes("audio")?"🎵":t.includes("zip")||t.includes("rar")||t.includes("archive")?"🗜️":"📄":"📄")}),(0,i.jsx)("span",{className:"fcom-document-title",children:e.title}),e.url&&(0,i.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"fcom-document-view",title:(0,a.A)("View"),children:(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor",children:(0,i.jsx)("path",{d:"M19.5 14.5v3c0 .8-.7 1.5-1.5 1.5H6c-.8 0-1.5-.7-1.5-1.5v-3H6v3h12v-3h1.5zM12 4.5C7.3 4.5 3.4 7.6 2 12c1.4 4.4 5.3 7.5 10 7.5s8.6-3.1 10-7.5c-1.4-4.4-5.3-7.5-10-7.5zm0 12.5c-2.8 0-5-2.2-5-5s2.2-5 5-5 5 2.2 5 5-2.2 5-5 5zm0-8c-1.7 0-3 1.3-3 3s1.3 3 3 3 3-1.3 3-3-1.3-3-3-3z"})})})]},e.id);var t})}):(0,i.jsx)("p",{className:"fcom-documents-empty",children:(0,a.A)("No documents attached yet.")}),(0,i.jsx)(n.Button,{variant:"secondary",onClick:()=>{window.parent.postMessage({action:"MANAGE_DOCUMENTS",content:null},"*")},size:"compact",className:"fcom-documents-manage-btn",children:(0,a.A)("Manage Documents & Files")})]})}},730(e,t,o){o.d(t,{A:()=>l});var n=o(427),s=o(87);const a=window.wp.apiFetch;var i=o.n(a),r=o(114),c=o(790);const d={type:"oembed",url:"",inner_html:"",content_type:"video",html:"",provider:"",title:"",author_name:"",image:""},l=({media:e,videoLength:t,onUpdate:o})=>{const a=e&&"object"==typeof e?e:d,[l,m]=(0,s.useState)(a.html?{...a}:null),[u,p]=(0,s.useState)(!1),[h,f]=(0,s.useState)("oembed"),[w,x]=(0,s.useState)(""),[_,v]=(0,s.useState)(""),[g,b]=(0,s.useState)(!1),[j,y]=(0,s.useState)(""),A=parseInt(t)||0,[E,M]=(0,s.useState)(Math.floor(A/60)),[N,S]=(0,s.useState)(A%60),k=(e,t)=>{const n=Math.max(0,parseInt(e)||0),s=Math.min(59,Math.max(0,parseInt(t)||0));M(n),S(s),o("video_length",60*n+s)},C=e=>{o("media",{...e})},P=()=>{if(l){const e="iframe_html"===l.type?"iframe_html":"oembed";f(e),x("oembed"===e&&l.url||""),v("iframe_html"===e&&l.html||"")}else f("oembed"),x(""),v("");y(""),p(!0)},D=()=>{p(!1),y("")},L=e=>{f(e),x(""),v(""),y("")},T=()=>{w&&(b(!0),y(""),i()({path:`/fluent-community/v2/feeds/oembed?url=${encodeURIComponent(w)}`}).then(e=>{const t=e.oembed,o={type:t.type||"oembed",url:w,inner_html:"",content_type:"video",html:t.html,provider:t.provider||"",title:t.title||"",author_name:t.author_name||"",image:t.image||""};m(o),C(o),D()}).catch(()=>{y((0,r.A)("Failed to fetch embed. Please check the URL."))}).finally(()=>{b(!1)}))};return(0,c.jsxs)("div",{className:"fcom-media-embedder",children:[l?(0,c.jsxs)("div",{className:"fcom-media-preview",children:["iframe_html"===l.type?(0,c.jsx)("div",{className:"fcom-media-iframe-preview",dangerouslySetInnerHTML:{__html:l.html},style:{width:"100%"}}):(0,c.jsxs)(c.Fragment,{children:[l.image&&(0,c.jsx)("img",{src:l.image,alt:l.title||(0,r.A)("Video thumbnail"),style:{width:"100%",borderRadius:"4px",display:"block"}}),l.title&&(0,c.jsx)("p",{className:"fcom-media-preview__title",children:l.title}),l.provider&&(0,c.jsxs)("p",{className:"fcom-media-preview__meta",children:[l.provider,l.author_name?` — ${l.author_name}`:""]}),!l.image&&!l.title&&(0,c.jsx)("p",{className:"fcom-media-preview__meta",children:(0,r.A)("Media embedded successfully")})]}),(0,c.jsxs)("div",{className:"fcom-media-preview__actions",children:[(0,c.jsx)(n.Button,{variant:"secondary",size:"compact",onClick:P,children:(0,r.A)("Edit media")}),(0,c.jsx)(n.Button,{variant:"tertiary",size:"compact",isDestructive:!0,onClick:()=>{m(null),C({...d})},children:(0,r.A)("Remove")})]})]}):(0,c.jsx)("div",{className:"fcom-media-empty",children:(0,c.jsx)(n.Button,{variant:"secondary",size:"compact",onClick:P,className:"fcom-media-add-btn",children:(0,r.A)("+ Add Media")})}),u&&(0,c.jsx)(n.Modal,{title:l?(0,r.A)("Edit Media"):(0,r.A)("Add Media"),onRequestClose:D,className:"fcom-media-modal",size:"medium",children:(0,c.jsxs)("div",{className:"fcom-media-modal__body",children:[(0,c.jsxs)(n.ButtonGroup,{className:"fcom-media-mode-toggle",children:[(0,c.jsx)(n.Button,{variant:"oembed"===h?"primary":"secondary",onClick:()=>L("oembed"),size:"compact",children:(0,r.A)("Oembed URL")}),(0,c.jsx)(n.Button,{variant:"iframe_html"===h?"primary":"secondary",onClick:()=>L("iframe_html"),size:"compact",children:(0,r.A)("Custom HTML")})]}),"iframe_html"===h?(0,c.jsxs)("div",{className:"fcom-media-field",children:[(0,c.jsx)(n.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,r.A)("Custom HTML Code"),value:_,onChange:v,placeholder:(0,r.A)("Paste an iframe code"),rows:5}),j&&(0,c.jsx)("p",{className:"fcom-media-error",children:j}),(0,c.jsxs)("div",{className:"fcom-media-modal__footer",children:[(0,c.jsx)(n.Button,{variant:"tertiary",onClick:D,children:(0,r.A)("Cancel")}),(0,c.jsx)(n.Button,{variant:"primary",onClick:()=>{const e={...d,type:"iframe_html",html:_,content_type:"video"};m(e),C(e),D()},disabled:!_,children:(0,r.A)("Embed")})]})]}):(0,c.jsxs)("div",{className:"fcom-media-field",children:[(0,c.jsx)("label",{className:"fcom-media-url-label",children:(0,r.A)("Video URL")}),(0,c.jsx)("div",{className:"fcom-url-input-row",children:(0,c.jsx)("input",{type:"url",className:"components-text-control__input",value:w,onChange:e=>x(e.target.value),placeholder:(0,r.A)("Paste a URL to embed"),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),T())},autoFocus:!0})}),(0,c.jsx)("p",{className:"fcom-media-help",children:(0,r.A)("Supports Vimeo, YouTube, Wistia and more")}),j&&(0,c.jsx)("p",{className:"fcom-media-error",children:j}),(0,c.jsxs)("div",{className:"fcom-media-modal__footer",children:[(0,c.jsx)(n.Button,{variant:"tertiary",onClick:D,children:(0,r.A)("Cancel")}),(0,c.jsx)(n.Button,{variant:"primary",onClick:T,disabled:!w||g,isBusy:g,children:g?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.Spinner,{}),(0,r.A)("Embedding…")]}):(0,r.A)("Embed")})]})]})]})}),(0,c.jsxs)("div",{className:"fcom-duration-section",children:[(0,c.jsx)("p",{className:"fcom-duration-label",children:(0,r.A)("Lesson Duration")}),(0,c.jsxs)("div",{className:"fcom-duration-row",children:[(0,c.jsxs)("div",{className:"fcom-duration-field",children:[(0,c.jsx)("input",{type:"number",className:"components-text-control__input",value:E,onChange:e=>k(e.target.value,N),min:0,max:1444}),(0,c.jsx)("span",{className:"fcom-duration-unit",children:(0,r.A)("Minutes")})]}),(0,c.jsx)("span",{className:"fcom-duration-separator",children:":"}),(0,c.jsxs)("div",{className:"fcom-duration-field",children:[(0,c.jsx)("input",{type:"number",className:"components-text-control__input",value:N,onChange:e=>k(E,e.target.value),min:0,max:59}),(0,c.jsx)("span",{className:"fcom-duration-unit",children:(0,r.A)("Seconds")})]})]})]})]})}},445(e,t,o){o.d(t,{A:()=>a});var n=o(114),s=o(790);const a={name:"fcom_prefixed",className:"editor-autocompleters__fcom",triggerPrefix:"@",options:e=>[{code:"{{user.display_name|fallback}}",title:(0,n.A)("User's Name"),prefix:"user"},{code:"{{user.user_email|fallback}}",title:(0,n.A)("User's Email"),prefix:"user"},{code:"{{user.photo_html.50px}}",title:(0,n.A)("User's photo HTML"),prefix:"user"},{code:"##user.profile_link##",title:(0,n.A)("Profile Link"),prefix:"user"}],isDebounced:!0,getOptionKeywords:e=>[e.title,e.code],getOptionLabel:e=>[(0,s.jsx)("span",{className:"editor-autocompleters__user-name",children:e.title},"name")],getOptionCompletion:e=>e.code}},790(e){e.exports=window.ReactJSXRuntime},997(e){e.exports=window.wp.blocks},427(e){e.exports=window.wp.components},143(e){e.exports=window.wp.data},656(e){e.exports=window.wp.editor},87(e){e.exports=window.wp.element},619(e){e.exports=window.wp.hooks},279(e){e.exports=window.wp.plugins}},i={};function r(e){var t=i[e];if(void 0!==t)return t.exports;var o=i[e]={exports:{}};return a[e](o,o.exports,r),o.exports}e="function"==typeof Symbol,t=e?Symbol("webpack queues"):"__webpack_queues__",o=e?Symbol("webpack exports"):"__webpack_exports__",n=e?Symbol("webpack error"):"__webpack_error__",s=e=>{e&&e.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))},r.a=(e,a,i)=>{var r;i&&((r=[]).d=-1);var c,d,l,m=new Set,u=e.exports,p=new Promise((e,t)=>{l=t,d=e});p[o]=u,p[t]=e=>(r&&e(r),m.forEach(e),p.catch(e=>{})),e.exports=p,a(e=>{var a;c=(e=>e.map(e=>{if(null!==e&&"object"==typeof e){if(e[t])return e;if(e.then){var a=[];a.d=0,e.then(e=>{i[o]=e,s(a)},e=>{i[n]=e,s(a)});var i={};return i[t]=e=>e(a),i}}var r={};return r[t]=e=>{},r[o]=e,r}))(e);var i=()=>c.map(e=>{if(e[n])throw e[n];return e[o]}),d=new Promise(e=>{(a=()=>e(i)).r=0;var o=e=>e!==r&&!m.has(e)&&(m.add(e),e&&!e.d&&(a.r++,e.push(a)));c.map(e=>e[t](o))});return a.r?d:i()},e=>(e?l(p[n]=e):d(u),s(r))),r&&r.d<0&&(r.d=0)},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r(144)})(); |
|
1
|
+(()=>{"use strict";var e,t,o,a,n,i={114(e,t,o){o.d(t,{A:()=>n});const a=window.fcomEditorI18n||{};function n(e){return a[e]||e}},144(e,t,o){o.a(e,async(e,t)=>{try{var a=o(279),n=o(656),i=o(427),s=o(87),r=o(143),l=o(619),c=o(997),d=o(114),m=o(445),h=o(433),u=o(823),p=o(638),x=o(150),f=o(790);const g=parseInt(window.fcomEditorVars?.video_gate_default_threshold)||80,w=new URLSearchParams(window.location.search).get("context")||"",_=()=>{const[e,t]=(0,s.useState)(window.fcomMetaSettings||null);return(0,s.useEffect)(()=>{const e=e=>{e.detail&&t({...e.detail})};return window.addEventListener("fcomMetaSettingsReady",e),()=>window.removeEventListener("fcomMetaSettingsReady",e)},[]),[e,(e,o)=>{const a={...window.fcomMetaSettings,[e]:o};window.fcomMetaSettings=a,t({...a}),window.parent.postMessage({action:"META_UPDATED",content:a},"*")}]},b=()=>{const[e,t]=_(),[o,a]=(0,s.useState)(!!e&&"yes"===e.enable_media),r=(0,s.useRef)(e?e.enable_media:"no");(0,s.useEffect)(()=>{e&&e.enable_media!==r.current&&(r.current=e.enable_media,"yes"===e.enable_media&&a(!0))},[e]);const l=!(!e||"yes"!==e.enable_media||"fluent_player"!==e.media?.type);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.PluginPostStatusInfo,{children:e&&(0,f.jsxs)("div",{className:"fcom_feature_checkboxes",style:{width:"100%"},children:[(0,f.jsx)(i.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,d.A)("Enable Video Embed"),checked:"yes"===e.enable_media,onChange:o=>{o||"fluent_player"!==e.media?.type||(0,x.dU)(),t("enable_media",o?"yes":"no")}}),(0,f.jsx)(i.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,d.A)("Enable Comments"),checked:"yes"===e.enable_comments,onChange:e=>t("enable_comments",e?"yes":"no")}),(0,f.jsx)(i.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,d.A)("Free Preview Lesson"),help:(0,d.A)("If enabled, public users can view this lesson without enrolling the course."),checked:"yes"===e.free_preview_lesson,onChange:e=>t("free_preview_lesson",e?"yes":"no")})]})}),(0,f.jsx)(n.PluginDocumentSettingPanel,{name:"fcom-media-embed",title:(0,d.A)("Media Embed"),className:e&&"yes"===e.enable_media?"":"fcom-panel-hidden",isOpen:o,onToggle:()=>a(!o),children:e&&"yes"===e.enable_media&&(0,f.jsx)(h.A,{media:e.media,videoLength:e.video_length,onUpdate:(e,o)=>t(e,o)})}),(0,f.jsx)(n.PluginDocumentSettingPanel,{name:"fcom-video-completion",title:(0,d.A)("Video Completion"),className:l?"":"fcom-panel-hidden",initialOpen:!1,children:l&&(0,f.jsxs)("div",{className:"fcom-video-gate",children:[(0,f.jsx)(i.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,d.A)("Require video watch to complete"),help:(0,d.A)("Students must watch the video before they can mark this lesson as completed."),checked:"yes"===e.require_video_completion,onChange:e=>t("require_video_completion",e?"yes":"no")}),(0,f.jsx)(i.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,d.A)("Auto-complete lesson when the video ends"),help:(0,d.A)("Marks the lesson complete a few seconds after the student watches the video to the end."),checked:"yes"===e.auto_complete_on_video_end,onChange:e=>t("auto_complete_on_video_end",e?"yes":"no")}),"yes"===e.require_video_completion&&(0,f.jsx)("div",{className:"fcom-video-gate__threshold",children:(0,f.jsx)(i.RangeControl,{__nextHasNoMarginBottom:!0,label:(0,d.A)("Required watch percentage"),help:(0,d.A)("100% means the video must be watched to the end."),min:1,max:100,value:Math.min(100,Math.max(1,parseInt(e.video_completion_threshold)||g)),onChange:e=>t("video_completion_threshold",Math.min(100,Math.max(1,parseInt(e)||g)))})})]})}),(0,f.jsx)(n.PluginDocumentSettingPanel,{name:"fcom-documents",title:(0,d.A)("Documents & Files"),className:e?"":"fcom-panel-hidden",initialOpen:!1,children:e&&(0,f.jsx)(u.A,{})}),(0,f.jsx)(n.PluginDocumentSettingPanel,{name:"fcom-smartcodes",title:(0,d.A)("Smartcodes"),initialOpen:!1,children:(0,f.jsxs)("div",{className:"fcom_lesson_info_codes",children:[(0,f.jsx)("p",{children:(0,d.A)("You may use following smartcode in your lesson:")}),(0,f.jsxs)("ul",{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:(0,d.A)("User's Name:")})," ",(0,f.jsx)("span",{children:"{{user.display_name|fallback}}"})]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:(0,d.A)("User's Email:")})," ",(0,f.jsx)("span",{children:"{{user.user_email|fallback}}"})]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:(0,d.A)("User's photo HTML:")})," ",(0,f.jsx)("span",{children:"{{user.photo_html.50px}}"})]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:(0,d.A)("User's Profile Link:")})," ",(0,f.jsx)("span",{children:"##user.profile_link##"})]})]})]})})]})},y={unified:{surface:"sheet",container:"100%",titleWidth:"1016px",content:"1016px",wide:"1016px",padding:"32px 32px"},standard:{surface:"card",container:"1016px",titleWidth:"720px",content:"720px",wide:"900px",padding:"32px"},classic:{surface:"card",container:"680px",titleWidth:"680px",content:"680px",wide:"680px",padding:"24px"},full_width:{surface:"none",container:"1016px",titleWidth:"720px",content:"720px",wide:"900px",padding:"0px"}},v="unified",j="fcom-page-canvas-preview";let A=null,N=null;const k=()=>{const e=document.querySelector('iframe[name="editor-canvas"]');return e&&e.contentDocument&&e.contentDocument.head?e.contentDocument:document.querySelector(".editor-styles-wrapper")?document:null},M=()=>{const e=k();if(!e||!A)return!1;let t=e.getElementById(j);return t||(t=e.createElement("style"),t.setAttribute("id",j),e.head.appendChild(t)),t.textContent!==A.css&&(t.textContent=A.css),e.body&&(e.body.style.setProperty("--theme-block-max-width",A.content),e.body.style.setProperty("--theme-block-wide-max-width",A.wide)),!0},C=(e,t)=>{const o=y[e]||y[v],a=".editor-visual-editor__post-title-wrapper.editor-visual-editor__post-title-wrapper,.edit-post-visual-editor__post-title-wrapper.edit-post-visual-editor__post-title-wrapper",n=".editor-styles-wrapper .is-root-container.is-root-container",i="card"===o.surface,s="sheet"===o.surface,r="var(--fcom-primary-bg, #fff)",l=s?r:"var(--fcom-secondary-bg, #f0f2f5)",c=i?`background:${r};border:1px solid var(--fcom-primary-border, #e3e8ee);`:"background:transparent;border:0;",d=s?"0":"24px",m=`max-width:${o.container};box-sizing:border-box;display:flow-root;`,h=String(o.padding).trim().split(/\s+/)[0],u=[`.editor-styles-wrapper.editor-styles-wrapper{--wp--style--global--content-size:${o.content};--wp--style--global--wide-size:${o.wide};background:${l};${s?"width:100%;margin-block:0;":""}}`,`${a} .editor-post-title,${a} h1{max-width:${o.titleWidth};margin:0 auto;}`,`${a}{${m}${c}margin:${d} auto 0;margin-bottom:0 !important;padding:${o.padding};padding-top:${h} !important;padding-bottom:20px;border-bottom:0;border-radius:8px 8px 0 0;}`,`${n}{${m}${c}margin:0 auto ${d};padding:${o.padding};padding-top:0;border-top:0;border-radius:0 0 8px 8px;}`,`${n} > :not(.alignleft):not(.alignright):not(.alignfull):not(.alignwide){max-width:${o.content};}`,`${n} > .alignwide{max-width:${o.wide};}`];t||u.push(`${a} .editor-post-title,${a} h1{opacity:0.4;}`),A={css:u.join(""),content:o.content,wide:o.wide},M(),N||(N=setInterval(M,1e3))},S=({children:e})=>(0,f.jsxs)("svg",{viewBox:"0 0 100 70",className:"fcom-layout-thumb__svg","aria-hidden":"true",focusable:"false",children:[(0,f.jsx)("rect",{x:"0",y:"0",width:"100",height:"70",rx:"2",className:"fcom-thumb-page"}),(0,f.jsx)("rect",{x:"0",y:"0",width:"100",height:"9",className:"fcom-thumb-chrome"}),e]}),E={unified:(0,f.jsxs)(S,{children:[(0,f.jsx)("rect",{x:"0",y:"9",width:"100",height:"61",className:"fcom-thumb-sheet"}),(0,f.jsx)("rect",{x:"0",y:"9",width:"100",height:"15",className:"fcom-thumb-block"}),(0,f.jsx)("rect",{x:"30",y:"30",width:"40",height:"4",rx:"1",className:"fcom-thumb-title"}),(0,f.jsx)("rect",{x:"30",y:"40",width:"40",height:"2.5",rx:"1",className:"fcom-thumb-line"}),(0,f.jsx)("rect",{x:"30",y:"46",width:"40",height:"2.5",rx:"1",className:"fcom-thumb-line"}),(0,f.jsx)("rect",{x:"30",y:"52",width:"26",height:"2.5",rx:"1",className:"fcom-thumb-line"})]}),standard:(0,f.jsxs)(S,{children:[(0,f.jsx)("rect",{x:"8",y:"15",width:"84",height:"48",rx:"2",className:"fcom-thumb-card"}),(0,f.jsx)("rect",{x:"16",y:"21",width:"68",height:"11",rx:"1",className:"fcom-thumb-block"}),(0,f.jsx)("rect",{x:"16",y:"38",width:"68",height:"2.5",rx:"1",className:"fcom-thumb-line"}),(0,f.jsx)("rect",{x:"16",y:"44",width:"68",height:"2.5",rx:"1",className:"fcom-thumb-line"}),(0,f.jsx)("rect",{x:"16",y:"50",width:"44",height:"2.5",rx:"1",className:"fcom-thumb-line"})]}),classic:(0,f.jsxs)(S,{children:[(0,f.jsx)("rect",{x:"6",y:"15",width:"58",height:"48",rx:"2",className:"fcom-thumb-card"}),(0,f.jsx)("rect",{x:"12",y:"21",width:"46",height:"9",rx:"1",className:"fcom-thumb-block"}),(0,f.jsx)("rect",{x:"12",y:"36",width:"46",height:"2.5",rx:"1",className:"fcom-thumb-line"}),(0,f.jsx)("rect",{x:"12",y:"42",width:"46",height:"2.5",rx:"1",className:"fcom-thumb-line"}),(0,f.jsx)("rect",{x:"12",y:"48",width:"30",height:"2.5",rx:"1",className:"fcom-thumb-line"}),(0,f.jsx)("rect",{x:"70",y:"15",width:"24",height:"30",rx:"2",className:"fcom-thumb-card"}),(0,f.jsx)("rect",{x:"74",y:"20",width:"16",height:"2.5",rx:"1",className:"fcom-thumb-line"}),(0,f.jsx)("rect",{x:"74",y:"26",width:"16",height:"2.5",rx:"1",className:"fcom-thumb-line"}),(0,f.jsx)("rect",{x:"74",y:"32",width:"10",height:"2.5",rx:"1",className:"fcom-thumb-line"})]}),full_width:(0,f.jsxs)(S,{children:[(0,f.jsx)("rect",{x:"6",y:"15",width:"88",height:"18",rx:"1",className:"fcom-thumb-block"}),(0,f.jsx)("rect",{x:"6",y:"37",width:"42",height:"16",rx:"1",className:"fcom-thumb-line"}),(0,f.jsx)("rect",{x:"52",y:"37",width:"42",height:"16",rx:"1",className:"fcom-thumb-line"}),(0,f.jsx)("rect",{x:"6",y:"58",width:"88",height:"2.5",rx:"1",className:"fcom-thumb-line"})]})},P=(0,f.jsx)(S,{children:(0,f.jsx)("rect",{x:"20",y:"18",width:"60",height:"42",rx:"2",className:"fcom-thumb-card"})}),B=()=>{const e=window.fcomEditorVars?.page_layouts;return e&&Object.keys(e).length?e:{unified:{label:(0,d.A)("Unified")},standard:{label:(0,d.A)("Standard")},classic:{label:(0,d.A)("Classic")},full_width:{label:(0,d.A)("Full Width")}}},D=({meta:e,updateMeta:t})=>{const o=B(),a=o[e.layout]?e.layout:v,s="no"!==e.show_title;return(0,f.jsxs)(n.PluginDocumentSettingPanel,{name:"fcom-page-layout",title:(0,d.A)("Page Layout"),initialOpen:!0,children:[(0,f.jsx)("div",{className:"fcom-layout-picker",role:"radiogroup","aria-label":(0,d.A)("Page Layout"),children:Object.keys(o).map(e=>{const n=e===a;return(0,f.jsxs)("button",{type:"button",role:"radio","aria-checked":n,title:o[e]?.description||"",className:"fcom-layout-thumb"+(n?" is-active":""),onClick:()=>t("layout",e),children:[E[e]||P,(0,f.jsx)("span",{className:"fcom-layout-thumb__label",children:o[e]?.label||e})]},e)})}),o[a]?.description&&(0,f.jsx)("p",{className:"fcom-layout-picker__help",children:o[a].description}),(0,f.jsxs)("div",{className:"fcom-layout-picker__toggles",children:[(0,f.jsx)(i.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,d.A)("Show the page title"),help:(0,d.A)("The title stays editable here and still names the page in the menu."),checked:s,onChange:e=>t("show_title",e?"yes":"no")}),(0,f.jsx)(i.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,d.A)("Show the featured image"),help:(0,d.A)("The image still appears in search results and link previews."),checked:"yes"===e.show_featured_image,onChange:e=>t("show_featured_image",e?"yes":"no")})]})]})},U=()=>{const[e,t]=_(),o=B(),a=e&&o[e.layout]?e.layout:v,r=!e||"no"!==e.show_title;return(0,s.useEffect)(()=>{C(a,r)},[a,r]),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.PluginPostStatusInfo,{children:(0,f.jsxs)("div",{className:"fcom_page_settings",style:{width:"100%"},children:[(0,f.jsx)(i.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,d.A)("Who can view this page"),value:"members_only"===e.privacy?"members_only":"public",options:[{label:(0,d.A)("Everyone who can view the space"),value:"public"},{label:(0,d.A)("Space members only"),value:"members_only"}],onChange:e=>t("privacy",e)}),(0,f.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,d.A)("URL Slug"),value:e.slug||"",help:(0,d.A)("Changing the slug will break existing links to this page."),onChange:e=>t("slug",e)}),(0,f.jsx)(i.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,d.A)("Show in space menu"),checked:"yes"===e.show_in_nav,onChange:e=>t("show_in_nav",e?"yes":"no")}),"yes"===e.show_in_nav&&(0,f.jsx)(i.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,d.A)("Menu Label"),value:e.nav_label||"",help:(0,d.A)("Leave empty to use the page title."),onChange:e=>t("nav_label",e)}),(0,f.jsx)(i.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,d.A)("Enable Comments"),checked:"yes"===e.enable_comments,onChange:e=>t("enable_comments",e?"yes":"no")})]})}),(0,f.jsx)(D,{meta:e,updateMeta:t}),(0,f.jsx)(n.PluginDocumentSettingPanel,{name:"fcom-page-seo",title:(0,d.A)("SEO"),initialOpen:!1,children:(0,f.jsx)(i.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,d.A)("SEO Description"),help:(0,d.A)("Used for search engines and link previews"),rows:3,value:e.seo_description||"",onChange:e=>t("seo_description",e)})})]}):null};(0,a.registerPlugin)("fcom-document-settings",{render:"space_page"===w?U:b});let T=!1;const L=()=>{if(T)return null;(0,r.select)("core/preferences").get("core/edit-post","welcomeGuide")&&(0,r.dispatch)("core/preferences").toggle("core/edit-post","welcomeGuide"),(0,r.select)("core/preferences").get("core/edit-post","fullscreenMode")||(0,r.dispatch)("core/preferences").toggle("core/edit-post","fullscreenMode");const e=(0,r.select)("core/editor"),t=(0,r.dispatch)("core/editor");return e.getEditorMode&&t.switchEditorMode?"text"===e.getEditorMode()&&t.switchEditorMode("visual"):"text"===(0,r.select)("core/edit-post").getEditorMode()&&(0,r.dispatch)("core/edit-post").switchEditorMode("visual"),(0,r.dispatch)("core/editor").lockPostSaving(),(0,r.dispatch)("core/editor").lockPostAutosaving(),T=!0,null};async function R(){await new Promise(e=>{const t=(0,r.subscribe)(()=>{((0,r.select)("core/editor").isCleanNewPost()||(0,r.select)("core/block-editor").getBlockCount()>0)&&(t(),e())})});const e=document.querySelector('[name="editor-canvas"]');return new Promise(t=>{e?e.loading?e.onload=()=>{t(e)}:t(e):t(null)})}(0,a.registerPlugin)("fluent-com-disable-gutenberg-features",{render:L}),(0,l.addFilter)("editor.DocumentBar","fluentcom-custom-document-bar",()=>null),(0,l.addFilter)("editor.BlockEdit","fluent_com/html_block_warning",p.A),(0,l.addFilter)("editor.Autocomplete.completers","fluent_com/add_autocmplete",function(e,t){return e=e.filter(e=>"users"!==e.name),[...e,m.A]}),window.addEventListener("beforeunload",function(e){e.stopImmediatePropagation()}),await R(),console.log("editor iframe is now ready");let H=!1,$=null,F=null;window.addEventListener("message",e=>{if("SYNC_META"===e.data?.type)return window.fcomMetaSettings=e.data.data,window.dispatchEvent(new CustomEvent("fcomMetaSettingsReady",{detail:e.data.data})),void window.dispatchEvent(new CustomEvent("fcomDocumentsUpdated"));if("UPDATE_EDITOR"!==e.data?.type)return;H=!1,F=null;const{content:t,title:o,featured_image_id:a,metaSettings:n}=e.data.data;console.log("UPDATE_EDITOR",n,e.data.data),n?(window.fcomMetaSettings=n,window.dispatchEvent(new CustomEvent("fcomMetaSettingsReady",{detail:n}))):window.fcomMetaSettings=null,t&&(0,r.dispatch)("core/block-editor").resetBlocks((0,c.parse)(t));let i=null;o&&(i={title:o}),a&&(i?i.featured_media=a:i={featured_media:a}),i&&(0,r.dispatch)("core/editor").editPost(i),clearTimeout($),$=setTimeout(()=>{H=!0},1e3)});const I=()=>{const e=window.fcomMetaSettings;if(!e||"fluent_player"!==e.media?.type)return;if(!(0,x.VH)())return;if((0,x.G8)().length)return;const t={...e,media:{...h.U}};window.fcomMetaSettings=t,window.dispatchEvent(new CustomEvent("fcomMetaSettingsReady",{detail:t})),window.parent.postMessage({action:"META_UPDATED",content:t},"*")},O=()=>{const e=window.fcomMetaSettings;if(!e||"fluent_player"!==e.media?.type||!(0,x.VH)())return void(F=null);const t=(0,x._M)();null!==F?t!==F&&(F=t,t&&(0,x.fn)(t).then(({duration:e,image:o})=>{if(!e&&!o||!H||t!==F)return;const a=window.fcomMetaSettings;if(!a||"fluent_player"!==a.media?.type)return;const n={...a,media:{...a.media,image:o}};e&&(n.video_length=e),window.fcomMetaSettings=n,window.dispatchEvent(new CustomEvent("fcomMetaSettingsReady",{detail:n})),window.parent.postMessage({action:"META_UPDATED",content:n},"*")})):F=t};window._wpLoadBlockEditor.then(()=>{window.parent.postMessage({content:"ping",action:"EDITOR_READY"},"*");let e="",t="",o=null;(0,r.subscribe)(()=>{if(!H)return;I(),O();const a=(0,r.select)("core/editor").getEditedPostAttribute("title");a!=t&&(t=a,window.parent.postMessage({content:a,action:"TITLE_UPDATED"},"*"));const n=(0,r.select)("core/editor").getEditedPostAttribute("featured_media");o!=n&&(o=n,window.fcomMetaSettings&&(window.fcomMetaSettings={...window.fcomMetaSettings,featured_image_id:n}),window.parent.postMessage({content:n,action:"FEATURED_MEDIA_UPDATED"},"*"));const i=(0,r.select)("core/block-editor").getBlocks(),s=(0,c.serialize)(i);e!=s&&(e=s,window.parent.postMessage({content:s,action:"EDITOR_UPDATED"},"*"))})}),t()}catch(z){t(z)}},1)},823(e,t,o){o.d(t,{A:()=>r});var a=o(427),n=o(87),i=o(114),s=o(790);const r=()=>{const[e,t]=(0,n.useState)(window.fcomMetaSettings&&Array.isArray(window.fcomMetaSettings.document_lists)?window.fcomMetaSettings.document_lists:[]);return(0,n.useEffect)(()=>{const e=e=>{e.detail&&Array.isArray(e.detail.document_lists)&&t([...e.detail.document_lists])};window.addEventListener("fcomMetaSettingsReady",e);const o=()=>{window.fcomMetaSettings&&Array.isArray(window.fcomMetaSettings.document_lists)&&t([...window.fcomMetaSettings.document_lists])};return window.addEventListener("fcomDocumentsUpdated",o),()=>{window.removeEventListener("fcomMetaSettingsReady",e),window.removeEventListener("fcomDocumentsUpdated",o)}},[]),(0,s.jsxs)("div",{className:"fcom-documents-panel",children:[e.length>0?(0,s.jsx)("ul",{className:"fcom-documents-list",children:e.map(e=>{return(0,s.jsxs)("li",{className:"fcom-document-item",children:[(0,s.jsx)("span",{className:"fcom-document-icon",children:(t=e.type,t?t.includes("pdf")?"📄":t.includes("image")?"🖼️":t.includes("video")?"🎥":t.includes("audio")?"🎵":t.includes("zip")||t.includes("rar")||t.includes("archive")?"🗜️":"📄":"📄")}),(0,s.jsx)("span",{className:"fcom-document-title",children:e.title}),e.url&&(0,s.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"fcom-document-view",title:(0,i.A)("View"),children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor",children:(0,s.jsx)("path",{d:"M19.5 14.5v3c0 .8-.7 1.5-1.5 1.5H6c-.8 0-1.5-.7-1.5-1.5v-3H6v3h12v-3h1.5zM12 4.5C7.3 4.5 3.4 7.6 2 12c1.4 4.4 5.3 7.5 10 7.5s8.6-3.1 10-7.5c-1.4-4.4-5.3-7.5-10-7.5zm0 12.5c-2.8 0-5-2.2-5-5s2.2-5 5-5 5 2.2 5 5-2.2 5-5 5zm0-8c-1.7 0-3 1.3-3 3s1.3 3 3 3 3-1.3 3-3-1.3-3-3-3z"})})})]},e.id);var t})}):(0,s.jsx)("p",{className:"fcom-documents-empty",children:(0,i.A)("No documents attached yet.")}),(0,s.jsx)(a.Button,{variant:"secondary",onClick:()=>{window.parent.postMessage({action:"MANAGE_DOCUMENTS",content:null},"*")},size:"compact",className:"fcom-documents-manage-btn",children:(0,i.A)("Manage Documents & Files")})]})}},638(e,t,o){o.d(t,{A:()=>l});const a=window.wp.compose;var n=o(427),i=o(114),s=o(790);const r=/<\s*\/?\s*(script|iframe|style|link|meta|object|embed|form|input|select|textarea|button|svg|canvas|noscript|base|frame|frameset|applet)\b|\son[a-z]+\s*=|javascript:/i,l=(0,a.createHigherOrderComponent)(e=>t=>{const o="yes"===window.fcomEditorVars?.can_unfiltered_html;return"core/html"!==t.name||o?(0,s.jsx)(e,{...t}):r.test(t.attributes?.content||"")?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(e,{...t}),(0,s.jsx)(n.Notice,{status:"warning",isDismissible:!1,className:"fcom-html-block-warning",children:(0,i.A)("Your account cannot save custom HTML. Scripts, iframes and similar tags are removed on save.")})]}):(0,s.jsx)(e,{...t})},"withHtmlBlockWarning")},433(e,t,o){o.d(t,{A:()=>h,U:()=>d});var a=o(427),n=o(87),i=o(455),s=o.n(i),r=o(114),l=o(150),c=o(790);const d={type:"oembed",url:"",inner_html:"",content_type:"video",html:"",provider:"",title:"",author_name:"",image:""},m=e=>!(!e||!e.html&&"fluent_player"!==e.type),h=({media:e,videoLength:t,onUpdate:o})=>{const i=e&&"object"==typeof e?e:d,h=(0,l.VH)(),[u,p]=(0,n.useState)(m(i)?{...i}:null),[x,f]=(0,n.useState)(!1);(0,n.useEffect)(()=>{p(m(i)?{...i}:null)},[e]);const[g,w]=(0,n.useState)("oembed"),[_,b]=(0,n.useState)(""),[y,v]=(0,n.useState)(""),[j,A]=(0,n.useState)(!1),[N,k]=(0,n.useState)(""),M=parseInt(t)||0,[C,S]=(0,n.useState)(Math.floor(M/60)),[E,P]=(0,n.useState)(M%60);(0,n.useEffect)(()=>{S(Math.floor(M/60)),P(M%60)},[M]);const B=(e,t)=>{const a=Math.max(0,parseInt(e)||0),n=Math.min(59,Math.max(0,parseInt(t)||0));S(a),P(n),o("video_length",60*a+n)},D=e=>{o("media",{...e})},U=()=>{if(u){let e="iframe_html"===u.type?"iframe_html":"oembed";"fluent_player"===u.type&&h&&(e="fluent_player"),w(e),b("oembed"===e&&u.url||""),v("iframe_html"===e&&u.html||"")}else w("oembed"),b(""),v("");k(""),f(!0)},T=()=>{f(!1),k("")},L=e=>{w(e),b(""),v(""),k("")},R=()=>{_&&(A(!0),k(""),s()({path:`/fluent-community/v2/feeds/oembed?url=${encodeURIComponent(_)}`}).then(e=>{const t=e.oembed,o={type:t.type||"oembed",url:_,inner_html:"",content_type:"video",html:t.html,provider:t.provider||"",title:t.title||"",author_name:t.author_name||"",image:t.image||""};(0,l.dU)(),p(o),D(o),T()}).catch(()=>{k((0,r.A)("Failed to fetch embed. Please check the URL."))}).finally(()=>{A(!1)}))};return(0,c.jsxs)("div",{className:"fcom-media-embedder",children:[u?(0,c.jsxs)("div",{className:"fcom-media-preview",children:["fluent_player"===u.type?(0,c.jsx)("p",{className:"fcom-media-preview__meta",children:(0,r.A)("The feature video is managed by the FluentPlayer block in the editor.")}):"iframe_html"===u.type?(0,c.jsx)("div",{className:"fcom-media-iframe-preview",dangerouslySetInnerHTML:{__html:u.html},style:{width:"100%"}}):(0,c.jsxs)(c.Fragment,{children:[u.image&&(0,c.jsx)("img",{src:u.image,alt:u.title||(0,r.A)("Video thumbnail"),style:{width:"100%",borderRadius:"4px",display:"block"}}),u.title&&(0,c.jsx)("p",{className:"fcom-media-preview__title",children:u.title}),u.provider&&(0,c.jsxs)("p",{className:"fcom-media-preview__meta",children:[u.provider,u.author_name?` — ${u.author_name}`:""]}),!u.image&&!u.title&&(0,c.jsx)("p",{className:"fcom-media-preview__meta",children:(0,r.A)("Media embedded successfully")})]}),(0,c.jsxs)("div",{className:"fcom-media-preview__actions",children:[(0,c.jsx)(a.Button,{variant:"secondary",size:"compact",onClick:U,children:(0,r.A)("Edit Media")}),(0,c.jsx)(a.Button,{variant:"tertiary",size:"compact",isDestructive:!0,onClick:()=>{u&&"fluent_player"===u.type&&(0,l.dU)(),p(null),D({...d})},children:(0,r.A)("Remove")})]})]}):(0,c.jsx)("div",{className:"fcom-media-empty",children:(0,c.jsx)(a.Button,{variant:"secondary",size:"compact",onClick:U,className:"fcom-media-add-btn",children:(0,r.A)("+ Add Media")})}),x&&(0,c.jsx)(a.Modal,{title:u?(0,r.A)("Edit Media"):(0,r.A)("Add Media"),onRequestClose:T,className:"fcom-media-modal",size:"medium",children:(0,c.jsxs)("div",{className:"fcom-media-modal__body",children:[(0,c.jsxs)(a.ButtonGroup,{className:"fcom-media-mode-toggle",children:[(0,c.jsx)(a.Button,{variant:"oembed"===g?"primary":"secondary",onClick:()=>L("oembed"),size:"compact",children:(0,r.A)("Oembed URL")}),(0,c.jsx)(a.Button,{variant:"iframe_html"===g?"primary":"secondary",onClick:()=>L("iframe_html"),size:"compact",children:(0,r.A)("Custom HTML")}),h&&(0,c.jsx)(a.Button,{variant:"fluent_player"===g?"primary":"secondary",onClick:()=>L("fluent_player"),size:"compact",children:(0,r.A)("FluentPlayer")})]}),"fluent_player"===g?(0,c.jsxs)("div",{className:"fcom-media-field",children:[(0,c.jsx)("p",{className:"fcom-media-help",children:(0,r.A)("A FluentPlayer block will be added at the top of the lesson content. Add or edit the video directly from that block in the editor.")}),(0,c.jsxs)("div",{className:"fcom-media-modal__footer",children:[(0,c.jsx)(a.Button,{variant:"tertiary",onClick:T,children:(0,r.A)("Cancel")}),(0,c.jsx)(a.Button,{variant:"primary",onClick:()=>{(0,l.X8)();const e={...d,type:"fluent_player"};p(e),D(e),T()},children:u&&"fluent_player"===u.type?(0,r.A)("Select Player Block"):(0,r.A)("Use FluentPlayer Block")})]})]}):"iframe_html"===g?(0,c.jsxs)("div",{className:"fcom-media-field",children:[(0,c.jsx)(a.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,r.A)("Custom HTML Code"),value:y,onChange:v,placeholder:(0,r.A)("Paste an iframe code"),rows:5}),N&&(0,c.jsx)("p",{className:"fcom-media-error",children:N}),(0,c.jsxs)("div",{className:"fcom-media-modal__footer",children:[(0,c.jsx)(a.Button,{variant:"tertiary",onClick:T,children:(0,r.A)("Cancel")}),(0,c.jsx)(a.Button,{variant:"primary",onClick:()=>{const e={...d,type:"iframe_html",html:y,content_type:"video"};(0,l.dU)(),p(e),D(e),T()},disabled:!y,children:(0,r.A)("Embed")})]})]}):(0,c.jsxs)("div",{className:"fcom-media-field",children:[(0,c.jsx)("label",{className:"fcom-media-url-label",children:(0,r.A)("Video URL")}),(0,c.jsx)("div",{className:"fcom-url-input-row",children:(0,c.jsx)("input",{type:"url",className:"components-text-control__input",value:_,onChange:e=>b(e.target.value),placeholder:(0,r.A)("Paste a URL to embed"),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),R())},autoFocus:!0})}),(0,c.jsx)("p",{className:"fcom-media-help",children:(0,r.A)("Supports Vimeo, YouTube, Wistia and more")}),N&&(0,c.jsx)("p",{className:"fcom-media-error",children:N}),(0,c.jsxs)("div",{className:"fcom-media-modal__footer",children:[(0,c.jsx)(a.Button,{variant:"tertiary",onClick:T,children:(0,r.A)("Cancel")}),(0,c.jsx)(a.Button,{variant:"primary",onClick:R,disabled:!_||j,isBusy:j,children:j?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Spinner,{}),(0,r.A)("Embedding…")]}):(0,r.A)("Embed")})]})]})]})}),(0,c.jsxs)("div",{className:"fcom-duration-section",children:[(0,c.jsx)("p",{className:"fcom-duration-label",children:(0,r.A)("Lesson Duration")}),(0,c.jsxs)("div",{className:"fcom-duration-row",children:[(0,c.jsxs)("div",{className:"fcom-duration-field",children:[(0,c.jsx)("input",{type:"number",className:"components-text-control__input",value:C,onChange:e=>B(e.target.value,E),min:0,max:1444}),(0,c.jsx)("span",{className:"fcom-duration-unit",children:(0,r.A)("Minutes")})]}),(0,c.jsx)("span",{className:"fcom-duration-separator",children:":"}),(0,c.jsxs)("div",{className:"fcom-duration-field",children:[(0,c.jsx)("input",{type:"number",className:"components-text-control__input",value:E,onChange:e=>B(C,e.target.value),min:0,max:59}),(0,c.jsx)("span",{className:"fcom-duration-unit",children:(0,r.A)("Seconds")})]})]})]})]})}},445(e,t,o){o.d(t,{A:()=>i});var a=o(114),n=o(790);const i={name:"fcom_prefixed",className:"editor-autocompleters__fcom",triggerPrefix:"@",options:e=>[{code:"{{user.display_name|fallback}}",title:(0,a.A)("User's Name"),prefix:"user"},{code:"{{user.user_email|fallback}}",title:(0,a.A)("User's Email"),prefix:"user"},{code:"{{user.photo_html.50px}}",title:(0,a.A)("User's photo HTML"),prefix:"user"},{code:"##user.profile_link##",title:(0,a.A)("Profile Link"),prefix:"user"}],isDebounced:!0,getOptionKeywords:e=>[e.title,e.code],getOptionLabel:e=>[(0,n.jsx)("span",{className:"editor-autocompleters__user-name",children:e.title},"name")],getOptionCompletion:e=>e.code}},150(e,t,o){o.d(t,{G8:()=>c,VH:()=>l,X8:()=>u,_M:()=>m,dU:()=>d,fn:()=>h});var a=o(143),n=o(997),i=o(455),s=o.n(i);const r="fluent-player/media",l=()=>{const e=(0,n.getBlockType)(r);return!!(e&&e.attributes&&e.attributes.isFcomFeatureMedia)},c=()=>{const{getClientIdsWithDescendants:e,getBlock:t}=(0,a.select)("core/block-editor");return e().filter(e=>{const o=t(e);return o&&o.name===r&&o.attributes?.isFcomFeatureMedia})},d=()=>{const e=c();e.length&&(0,a.dispatch)("core/block-editor").removeBlocks(e)},m=()=>{const e=c();if(!e.length)return 0;const t=(0,a.select)("core/block-editor").getBlock(e[0]);return parseInt(t?.attributes?.mediaId)||0},h=e=>s()({path:`/fluent-player/v2/media/${e}`}).then(e=>{const t=(e.media||e)?.settings;let o=t?.posterSrc||"";return o.includes("/wp-includes/images/media/")&&(o=""),{duration:Math.round(parseFloat(t?.duration))||0,image:o}}).catch(()=>({duration:0,image:""})),u=()=>{const e=c();e.length?(0,a.dispatch)("core/block-editor").selectBlock(e[0]):(0,a.dispatch)("core/block-editor").insertBlock((0,n.createBlock)(r,{isFcomFeatureMedia:!0}),0)}},790(e){e.exports=window.ReactJSXRuntime},455(e){e.exports=window.wp.apiFetch},997(e){e.exports=window.wp.blocks},427(e){e.exports=window.wp.components},143(e){e.exports=window.wp.data},656(e){e.exports=window.wp.editor},87(e){e.exports=window.wp.element},619(e){e.exports=window.wp.hooks},279(e){e.exports=window.wp.plugins}},s={};function r(e){var t=s[e];if(void 0!==t)return t.exports;var o=s[e]={exports:{}};return i[e](o,o.exports,r),o.exports}e="function"==typeof Symbol,t=e?Symbol("webpack queues"):"__webpack_queues__",o=e?Symbol("webpack exports"):"__webpack_exports__",a=e?Symbol("webpack error"):"__webpack_error__",n=e=>{e&&e.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))},r.a=(e,i,s)=>{var r;s&&((r=[]).d=-1);var l,c,d,m=new Set,h=e.exports,u=new Promise((e,t)=>{d=t,c=e});u[o]=h,u[t]=e=>(r&&e(r),m.forEach(e),u.catch(e=>{})),e.exports=u,i(e=>{var i;l=(e=>e.map(e=>{if(null!==e&&"object"==typeof e){if(e[t])return e;if(e.then){var i=[];i.d=0,e.then(e=>{s[o]=e,n(i)},e=>{s[a]=e,n(i)});var s={};return s[t]=e=>e(i),s}}var r={};return r[t]=e=>{},r[o]=e,r}))(e);var s=()=>l.map(e=>{if(e[a])throw e[a];return e[o]}),c=new Promise(e=>{(i=()=>e(s)).r=0;var o=e=>e!==r&&!m.has(e)&&(m.add(e),e&&!e.d&&(i.r++,e.push(i)));l.map(e=>e[t](o))});return i.r?c:s()},e=>(e?d(u[a]=e):c(h),n(r))),r&&r.d<0&&(r.d=0)},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r(144)})(); |