cft-builder 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { C as o, B as s, D as d, F as a, R as i, T as u, A as B, z as l } from "./main-DezaxtIM.js";
1
+ import { C as o, B as s, D as d, F as a, R as i, T as u, A as B, z as l } from "./main-yFHfZGS2.js";
2
2
  export {
3
3
  o as BuilderItems,
4
4
  s as BuilderItemsRender,
@@ -2386,7 +2386,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
2386
2386
  }
2387
2387
  }
2388
2388
  `}}),hi=y.forwardRef(function(t,e){var n=jn(),r=y.useContext(nr),i=Z3.getProps(t,r),a=y.useState(i.id),s=gF(a,2),l=s[0],c=s[1],u=y.useState(i.collapsed),d=gF(u,2),f=d[0],h=d[1],m=y.useRef(null),g=y.useRef(null),v=i.toggleable?i.onToggle?i.collapsed:f:!1,A=l+"_header",w=l+"_content",x=Z3.setMetaData({props:i,state:{id:l,collapsed:v}}),S=x.ptm,E=x.cx,C=x.isUnstyled;fi(Z3.css.styles,C,{name:"panel"});var _=function(W){i.toggleable&&(v?T(W):O(W),W&&(i.onToggle&&i.onToggle({originalEvent:W,value:!v}),W.preventDefault()))},T=function(W){i.onToggle||h(!1),i.onExpand&&W&&i.onExpand(W)},O=function(W){i.onToggle||h(!0),i.onCollapse&&W&&i.onCollapse(W)};y.useImperativeHandle(e,function(){return{props:i,toggle:_,expand:T,collapse:O,getElement:function(){return m.current},getContent:function(){return g.current}}}),Mi(function(){l||c(Ho())});var F=function(){if(i.toggleable){var W=l+"_label",ae=n({className:E("toggler"),onClick:_,id:W,"aria-controls":w,"aria-expanded":!v,type:"button",role:"button","aria-label":i.header},S("toggler")),Y=n(S("togglericon")),pe=v?i.expandIcon||y.createElement(jm,Y):i.collapseIcon||y.createElement(u8,Y),ie=Wn.getJSXIcon(pe,Y,{props:i,collapsed:v});return y.createElement("button",ae,ie,y.createElement(Qt,null))}return null},B=function(){var W=Fe.getJSXElement(i.header,i),ae=Fe.getJSXElement(i.icons,i),Y=F(),pe=n({id:A,className:E("title")},S("title")),ie=y.createElement("span",pe,W),J=n({className:E("icons")},S("icons")),Q=y.createElement("div",J,ae,Y),oe=n({className:E("header")},S("header")),ye=y.createElement("div",oe,ie,Q);if(i.headerTemplate){var Te={className:"p-panel-header",titleClassName:"p-panel-title",iconsClassName:"p-panel-icons",togglerClassName:"p-panel-header-icon p-panel-toggler p-link",onTogglerClick:_,titleElement:ie,iconsElement:Q,togglerElement:Y,element:ye,id:l+"_header",props:i,collapsed:v};return Fe.getJSXElement(i.headerTemplate,Te)}else if(i.header||i.toggleable)return ye;return null},M=function(){var W=Fe.getJSXElement(i.footer,i),ae=n({className:E("footer")},S("footer")),Y=y.createElement("div",ae,W);if(i.footerTemplate){var pe={className:E("footer"),element:Y,props:i};return Fe.getJSXElement(i.footerTemplate,pe)}else if(i.footer)return Y;return null},z=function(){var W=n({ref:g,className:E("toggleableContent"),"aria-hidden":v,role:"region",id:w,"aria-labelledby":A},S("toggleablecontent")),ae=n({className:E("content")},S("content")),Y=n({classNames:E("transition"),timeout:{enter:1e3,exit:450},in:!v,unmountOnExit:!0,options:i.transitionOptions},S("transition"));return y.createElement(zo,db({nodeRef:g},Y),y.createElement("div",W,y.createElement("div",ae,i.children)))},P=n({id:l,ref:m,style:i.style,className:pt(i.className,E("root"))},Z3.getOtherProps(i),S("root")),H=B(),de=z(),fe=M();return y.createElement("div",P,H,de,fe)});hi.displayName="Panel";const Qde=t=>{var g;const{fieldState:e,setFieldState:n,pageIndex:r,formBuilderFormLayout:i,pageSettingUpdate:a}=t,s=(v,A)=>{const w=`${v.className} justify-content-start`,x=`${v.titleClassName} pl-1`;return o.jsxs("div",{className:w,children:[o.jsx(kt,{text:!0,icon:"pi pi-trash",className:v.togglerClassName,onClick:()=>c(A),"aria-label":"Submit"}),o.jsx("span",{className:x,children:`Rule ${A+1}`})]})},l=(v,A)=>{var x;const w=[...((x=e==null?void 0:e.conditionalTabRules)==null?void 0:x.rules)||[]];w[v].conditions=w[v].conditions.filter((S,E)=>A!==E),n(S=>({...S,conditionalTabRules:{...S.conditionalTabRules,rules:w}}))},c=v=>{var S;const A=[...(e==null?void 0:e.conditionalTabRules.rules)||[]],w=A.filter((E,C)=>v!==C);n(E=>({...E,conditionalTabRules:{...E.conditionalTabRules,rules:w}}));const x=A[v];(S=x==null?void 0:x.conditions)==null||S.map(E=>{const C=i?Et.findIndex(i,T=>{var O;return(T==null?void 0:T.uuid)===((O=E==null?void 0:E.tab)==null?void 0:O.uuid)}):-1,_=i[C];_&&(_.isHidden=!1,a(C,_))})};let u=[...i].filter(function(v,A){return A!==r});u.map(v=>({uuid:v==null?void 0:v.uuid,title:v==null?void 0:v.title}));const d=(v,A,w)=>{const x=[...(e==null?void 0:e.conditionalTabRules.rules)||[]];x[A].conditions[w].option=v==null?void 0:v.value,n(S=>({...S,conditionalTabRules:{...S.conditionalTabRules,rules:x}}))},f=(v,A,w)=>{const x=[...(e==null?void 0:e.conditionalTabRules.rules)||[]];x[A].conditions[w].tab=v==null?void 0:v.value,n(C=>({...C,conditionalTabRules:{...C.conditionalTabRules,rules:x}}));const S=Et.findIndex(i,C=>{var _;return(C==null?void 0:C.uuid)===((_=v==null?void 0:v.value)==null?void 0:_.uuid)}),E=i[S];E&&(E.isHidden=!0,a(S,E))},h=()=>{n(v=>({...v,conditionalTabRules:{...v.conditionalTabRules,rules:[...v.conditionalTabRules.rules,{conditions:[]}]}}))},m=v=>{const A=[...(e==null?void 0:e.conditionalTabRules.rules)||[]];A[v].conditions=[...A[v].conditions,{option:null,tab:null}],n(w=>({...w,conditionalTabRules:{...w.conditionalTabRules,rules:[...A]}}))};return o.jsxs("div",{children:[o.jsx("h4",{children:"Conditional Tabs"}),i&&(i==null?void 0:i.length)>1&&((g=e==null?void 0:e.conditionalTabRules)==null?void 0:g.rules.map((v,A)=>o.jsx(hi,{className:"mb-3",header:`Rule ${A+1}`,headerTemplate:w=>s(w,A),children:o.jsxs("div",{children:[v==null?void 0:v.conditions.map((w,x)=>o.jsx("div",{className:"p-field pb-6",children:o.jsxs("div",{className:"grid",children:[o.jsx("div",{className:"col-2",children:o.jsxs("label",{children:["Show tab",w.value]})}),o.jsx("div",{className:"col-3 p-fluid",children:o.jsx(xa,{value:w.tab,options:u,onChange:S=>f(S,A,x),optionLabel:"title.english",placeholder:"Select option"})}),o.jsx("div",{className:"col-3",children:"when option is selected"}),o.jsx("div",{className:"col-3 p-fluid",children:o.jsx(xa,{value:w==null?void 0:w.option,options:e==null?void 0:e.options,onChange:S=>d(S,A,x),optionLabel:"optionText.english",placeholder:"Select option"})}),o.jsx("div",{className:"col-1",children:o.jsx(kt,{text:!0,icon:"pi pi-trash",className:"p-button-danger button-sm",tooltip:"Field Settings",onClick:()=>l(A,x),tooltipOptions:{position:"top"}})})]})},x)),o.jsx(kt,{text:!0,size:"small",onClick:()=>m(A),icon:"pi pi-plus",className:"p-mt-4",label:"Add Condition"})]})},"conditional_tab_rule"+A))),i&&(i==null?void 0:i.length)>1&&o.jsx(kt,{text:!0,onClick:()=>h(),className:"p-mt-4",icon:"pi pi-plus",label:"Add Rule",size:"small"}),i&&(i==null?void 0:i.length)<2&&o.jsx("p",{className:"error",children:"Please needs to have two or more tabs to enable the conditional tabs"})]})},Jde=t=>{var S;const{fieldState:e,setFieldState:n,section:r,formBuilderFormLayout:i,sectionSettingUpdate:a,page:s}=t,[l]=N.useState([]),{schemaBuilderUpdate:c,formBuilderFormSchema:u}=ln(),d=(E,C)=>{const _=`${E.className} justify-content-start`,T=`${E.titleClassName} pl-1`;return o.jsxs("div",{className:_,children:[o.jsx(kt,{text:!0,icon:"pi pi-trash",className:E.togglerClassName,onClick:()=>f(C),"aria-label":"Submit"}),o.jsx("span",{className:T,children:`Rule ${C+1}`})]})},f=E=>{var O;const C=[...(e==null?void 0:e.conditionalSectionRules.rules)||[]],_=C[E];(O=_==null?void 0:_.conditions)==null||O.map(F=>{var z;const B=Et.findIndex(i,P=>{var H;return(P==null?void 0:P.uuid)===((H=F==null?void 0:F.tab)==null?void 0:H.uuid)}),M=i?Et.findIndex(i[B].children,P=>{var H;return(P==null?void 0:P.uuid)===((H=F==null?void 0:F.section)==null?void 0:H.uuid)}):-1;if(M>=0){const P=(z=i[B])==null?void 0:z.children[M];P&&(P.isHidden=!1,a(B,M,P))}});const T=C.filter((F,B)=>E!==B);n(F=>({...F,conditionalSectionRules:{...F.conditionalSectionRules,rules:T}}))},h=E=>{var T;let C=!1;const _=i?i.filter(function(O){return(O==null?void 0:O.uuid)===(E==null?void 0:E.uuid)}):[];return(_==null?void 0:_.length)>0&&((T=_[0].children)==null?void 0:T.length)>1&&(C=!0),C},m=(E,C,_)=>{const T=[...(e==null?void 0:e.conditionalSectionRules.rules)||[]];T[C].conditions[_].option=E==null?void 0:E.value,n(O=>({...O,conditionalSectionRules:{...O.conditionalSectionRules,rules:T}}))},g=(E,C)=>{var O;const _=[...(e==null?void 0:e.conditionalSectionRules.rules)||[]],T=_[E];(O=T==null?void 0:T.conditions)==null||O.map(F=>{var P;const B=Et.findIndex(i,H=>{var de;return(H==null?void 0:H.uuid)===((de=F==null?void 0:F.tab)==null?void 0:de.uuid)}),M=i?Et.findIndex(i[B].children,H=>{var de;return(H==null?void 0:H.uuid)===((de=F==null?void 0:F.section)==null?void 0:de.uuid)}):-1,z=(P=i[B])==null?void 0:P.children[M];console.log("sectionData",z),z&&(z.isHidden=!1,console.log("sectionData",z),a(B,M,z))}),_[E].conditions=_[E].conditions.filter((F,B)=>C!==B),n(F=>({...F,conditionalSectionRules:{...F.conditionalSectionRules,rules:_}}))},v=(E,C,_)=>{var z,P;const T=[...(e==null?void 0:e.conditionalSectionRules.rules)||[]];T[C].conditions[_].section=E==null?void 0:E.value;const O=(P=(z=T[C].conditions[_])==null?void 0:z.tab)==null?void 0:P.uuid,F=Et.findIndex(i,H=>(H==null?void 0:H.uuid)===O);n(H=>({...H,conditionalSectionRules:{...H.conditionalSectionRules,rules:T}}));const B=i?Et.findIndex(i[F].children,H=>{var de;return(H==null?void 0:H.uuid)===((de=E==null?void 0:E.value)==null?void 0:de.uuid)}):-1,M=i[F].children[B];M&&(M.isHidden=!0,a(F,B,M))},A=E=>{const C=[...(e==null?void 0:e.conditionalSectionRules.rules)||[]];C[E].conditions=[...C[E].conditions,{option:null,tab:{title:s==null?void 0:s.title,uuid:s==null?void 0:s.uuid},section:null}],n(_=>({..._,conditionalSectionRules:{..._.conditionalSectionRules,rules:C}}))},w=()=>{n(C=>({...C,conditionalSectionRules:{...C.conditionalSectionRules,rules:[...C.conditionalSectionRules.rules,{uuid:tt(),conditions:[]}]}}));const E=[...(u==null?void 0:u.conditionalSectionsRules)||[]];c({conditionalSectionsRules:[...E,{fieldId:e==null?void 0:e.uuid,uuid:tt(),conditions:[]}]})},x=E=>{var _;const C=i==null?void 0:i.filter(function(T){return(T==null?void 0:T.uuid)===(E==null?void 0:E.uuid)});if(C&&(C==null?void 0:C.length)>0){const T=(_=C[0])==null?void 0:_.children.filter(function(O){return(O==null?void 0:O.uuid)!==(r==null?void 0:r.uuid)});if((T==null?void 0:T.length)>0)return T}return l};return o.jsxs("div",{children:[o.jsx("h4",{children:"Conditional Sections"}),(S=e==null?void 0:e.conditionalSectionRules)==null?void 0:S.rules.map((E,C)=>o.jsx(hi,{className:"mb-3",header:`Rule ${C+1}`,headerTemplate:_=>d(_,C),children:o.jsxs("div",{children:[E==null?void 0:E.conditions.map((_,T)=>{var O,F;return o.jsx("div",{className:"p-field pb-2",children:o.jsxs("div",{className:"grid",children:[o.jsxs("div",{className:"col-3 p-fluid",children:[o.jsx("label",{children:"In Tab"}),o.jsx("p",{children:(F=(O=_==null?void 0:_.tab)==null?void 0:O.title)==null?void 0:F.english})]}),o.jsxs("div",{className:"col-3 p-fluid",children:[o.jsxs("label",{children:["Select section",_.value]}),o.jsx(xa,{disabled:!h(_==null?void 0:_.tab),value:_.section,options:x(_.tab),onChange:B=>v(B,C,T),optionLabel:"heading.english",placeholder:"Select option"})]}),o.jsxs("div",{className:"col-4 p-fluid",children:["when option is selected",o.jsx(xa,{disabled:!h(_==null?void 0:_.tab),value:_==null?void 0:_.option,options:e==null?void 0:e.options,onChange:B=>m(B,C,T),optionLabel:"optionText.english",placeholder:"Select option"})]}),o.jsxs("div",{className:"col-1",children:[o.jsx("br",{}),o.jsx(kt,{text:!0,icon:"pi pi-trash",className:"p-button-danger button-sm",tooltip:"Field Settings",onClick:()=>g(C,T),tooltipOptions:{position:"top"}})]}),!h(_.tab)&&o.jsx("div",{className:"col-12",children:o.jsxs("p",{className:"error",children:[" ","At least two or more sections should exist in a page"]})})]})},T)}),o.jsx("div",{children:o.jsx("div",{className:"flex",children:o.jsx(kt,{text:!0,className:"btn-sm mt-3 ",label:"+ Add Condition",onClick:()=>A(C),size:"small"})})})]})},C)),o.jsx(kt,{text:!0,icon:"pi pi-plus",onClick:()=>w(),className:"p-mt-4",label:"Add Rule",size:"small"})]})},Zde=t=>{var u;const{fieldState:e,setFieldState:n}=t,r=d=>{var m;const h=[...((m=e==null?void 0:e.inlineConditionalRules)==null?void 0:m.rules)||[]].filter((g,v)=>d!==v);n(g=>({...g,inlineConditionalRules:{...g.inlineConditionalRules,rules:h}}))},i=(d,f)=>{const h=`${d.className} justify-content-start`,m=`${d.titleClassName} pl-1`;return o.jsxs("div",{className:h,children:[o.jsx(kt,{text:!0,icon:"pi pi-trash",className:d.togglerClassName,onClick:()=>r(f),"aria-label":"Submit"}),o.jsx("span",{className:m,children:`Rule ${f+1}`})]})},a=(d,f,h)=>{const m=[...(e==null?void 0:e.inlineConditionalRules.rules)||[]];m[f].conditions[h].value=d==null?void 0:d.value,n(g=>({...g,inlineConditionalRules:{...g.inlineConditionalRules,rules:m}}))},s=(d,f)=>{const h=[...(e==null?void 0:e.inlineConditionalRules.rules)||[]];h[d].conditions=h[d].conditions.filter((m,g)=>f!==g),n(m=>({...m,inlineConditionalRules:{...m.inlineConditionalRules,rules:h}}))},l=d=>{const f=[...(e==null?void 0:e.inlineConditionalRules.rules)||[]];f[d].conditions=[...f[d].conditions,{value:"",children:[]}],n(h=>({...h,inlineConditionalRules:{...h.inlineConditionalRules,rules:f}}))},c=()=>{n(d=>({...d,inlineConditionalRules:{...d.inlineConditionalRules,rules:[...d.inlineConditionalRules.rules,{conditions:[]}]}}))};return o.jsxs("div",{children:[o.jsx("h4",{children:"Inline Conditions"}),(u=e==null?void 0:e.inlineConditionalRules)==null?void 0:u.rules.map((d,f)=>o.jsx(hi,{className:"mb-3",header:`Rule ${f+1}`,headerTemplate:h=>i(h,f),children:o.jsxs("div",{children:[d==null?void 0:d.conditions.map((h,m)=>o.jsx("div",{className:"p-field p-pt-2",children:o.jsxs("div",{className:"grid",children:[o.jsx("label",{className:"block",children:"Show when selected option is:"}),o.jsx("div",{className:" p-fluid col-11",children:o.jsx(xa,{value:h.value,options:e==null?void 0:e.options,onChange:g=>a(g,f,m),optionLabel:"optionText.english",placeholder:"Select option"})}),o.jsx("div",{className:"col-1",children:o.jsx(kt,{text:!0,icon:"pi pi-trash",className:"p-button-danger button-sm",tooltip:"Field Settings",onClick:()=>s(f,m),tooltipOptions:{position:"top"}})})]})},"inline-rules-"+m)),o.jsx(kt,{text:!0,onClick:()=>l(f),className:"p-mt-4",icon:"pi pi-plus",label:"Add Condition",size:"small"})]})},f)),o.jsx(kt,{text:!0,onClick:()=>c(),className:"p-mt-4",icon:"pi pi-plus",label:"Add Rule",size:"small"})]})},e0e=t=>{const{fieldState:e,pageIndex:n,section:r,setFieldState:i,page:a}=t,{pageSettingUpdate:s,formBuilderFormLayout:l,sectionSettingUpdate:c}=ln();return o.jsx(o.Fragment,{children:o.jsxs("div",{className:" scroll-height-250",children:[o.jsx(Zde,{fieldState:e,setFieldState:i}),o.jsx("hr",{}),o.jsx(Qde,{fieldState:e,setFieldState:i,pageIndex:n,formBuilderFormLayout:l,pageSettingUpdate:s}),o.jsx("hr",{}),o.jsx(Jde,{fieldState:e,setFieldState:i,section:r,formBuilderFormLayout:l,sectionSettingUpdate:c,page:a}),o.jsx("hr",{})]})})},t0e=t=>{const{fieldState:e,setFieldState:n}=t,[r,i]=N.useState(""),[a,s]=N.useState([""]),[l,c]=N.useState(!1),[u,d]=N.useState(0),[f,h]=N.useState(!1),{updateGlobalToast:m}=tn(),g=()=>{h(!0)},v=()=>{var H;const z=((H=e==null?void 0:e.reviewerChecklist)==null?void 0:H.length)>=0?[...e.reviewerChecklist]:[];z.push({uuid:tt(),checklist:r,action:a,agree:null,selectAction:[],other:{isOther:!1,description:""},reviewerComments:""});const P={...e,reviewerChecklist:z};n(de=>({...de,...P})),h(!1),i(""),s([""])},A=()=>{h(!1),i(""),s([""])},w=z=>{const P=[...e.reviewerChecklist];P.splice(z,1);const H={...e,reviewerChecklist:P};n(de=>({...de,...H}))},x=(z,P)=>{c(!0);const{checklist:H,action:de}=z;h(!0),d(P),setTimeout(()=>{i(H),s(de)},1e3)},S=(z,P)=>o.jsxs(o.Fragment,{children:[o.jsx(kt,{text:!0,type:"button",className:"p-button-info",icon:"pi pi-pencil",onClick:()=>x(z,P==null?void 0:P.rowIndex)}),o.jsx(kt,{text:!0,type:"button",className:"p-button-danger",icon:"pi pi-trash",onClick:()=>w(P==null?void 0:P.rowIndex)})]}),E=z=>{var P;return o.jsx(o.Fragment,{children:(P=z==null?void 0:z.action)==null?void 0:P.length})},C=z=>{const P=[...a];P.splice(z,1),s(P)},_=()=>{const z=[...e.reviewerChecklist];z[u]={checklist:r,action:a};const P={...e,reviewerChecklist:z};n(H=>({...H,...P})),h(!1),c(!1)},T=()=>o.jsx("div",{children:l?o.jsx(kt,{text:!0,className:"mb-5 p-button-success",label:"Edit Checklist",onClick:()=>{_()}}):o.jsx(kt,{text:!0,className:"mb-5 p-button-success",label:"Add Checklist",onClick:()=>{v()}})}),O=z=>{n(P=>({...P,reviewerChecklist:z==null?void 0:z.value}))},F=z=>{navigator.clipboard.writeText(JSON.stringify(z))};function B(z){try{JSON.parse(z)}catch{return!1}return!0}const M=async()=>{var H;const z=await navigator.clipboard.readText();let P="";if(B(z)){const de=JSON.parse(z);if((H=de[0])!=null&&H.checklist){const fe={...Et.cloneDeep(e),reviewerChecklist:de};n(ne=>({...ne,...fe}));return}else P="Empty or Invalid Schema"}else P="Invalid Schema";m({showToast:!0,toastMessage:P,toastDetail:"",toastType:"error"})};return o.jsxs("div",{children:[o.jsx(As,{maximizable:!0,header:"Add Checklist",visible:f,style:{width:"30vw"},onHide:()=>A(),footer:T(),children:o.jsxs("div",{className:"scroll-height-500",children:[o.jsx("h5",{children:"Checklist"}),o.jsx(Ds,{rows:2,cols:50,value:r,onChange:z=>{var P;i((P=z==null?void 0:z.target)==null?void 0:P.value)}}),o.jsx("h5",{children:"Actions when user selects No"}),a.map((z,P)=>o.jsxs("div",{children:[P+1,"."," ",o.jsx(Ds,{value:z,onChange:H=>{var fe;const de=[...a];de[P]=(fe=H==null?void 0:H.target)==null?void 0:fe.value,s(de)},rows:2,cols:50})," ",o.jsx(kt,{text:!0,type:"button",icon:"pi pi-trash",className:"p-button-danger",onClick:()=>C(P)}),o.jsx("br",{}),o.jsx("br",{})]},`actionIndex-${P}`)),o.jsx(kt,{text:!0,className:" p-button-info mr-2",onClick:()=>{s([...a,""])},children:"Add Action"})]})})," ",o.jsx("h5",{children:"Reviewer Checklist"}),o.jsx(kt,{text:!0,className:"mb-5 mr-2 p-button-success",label:"Add Review Checklist",onClick:()=>{g()}}),o.jsx(kt,{text:!0,label:"Copy Schema ",onClick:()=>{F([...(e==null?void 0:e.reviewerChecklist)||[]])},className:"mb-5 mr-2"}),o.jsx(kt,{text:!0,label:"Paste Checklist ",onClick:()=>{M()},className:"mb-5 p-button-info"}),o.jsx("div",{className:"card",children:o.jsxs(Hs,{value:e==null?void 0:e.reviewerChecklist,reorderableRows:!0,onRowReorder:O,scrollable:!0,children:[o.jsx(fr,{rowReorder:!0,style:{width:"3em"}}),o.jsx(fr,{field:"checklist",header:"Checklist"}),o.jsx(fr,{field:"actions",header:"Actions",body:z=>E(z)}),o.jsx(fr,{header:"",body:(z,P)=>S(z,P)})]})})]})},n0e=t=>{const{onHandleChangeLayoutSettings:e,fieldState:n}=t;return o.jsxs("form",{className:"p-fluid",children:[o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Or,{inputId:"isFieldAnFilterOption",checked:(n==null?void 0:n.isFieldAnFilterOption)||!1,onChange:r=>e("isFieldAnFilterOption",r.checked)}),o.jsx("label",{htmlFor:"isFieldAnFilterOption",children:"Is Field an filter option to filter Data"}),"     ",o.jsx(rn,{target:".isFieldAnFilterOption",content:"Make the field a filter for sorting data"}),o.jsx("i",{className:"isFieldAnFilterOption pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Or,{inputId:"isSortable",checked:(n==null?void 0:n.isSortable)||!1,onChange:r=>e("isSortable",r.checked)}),o.jsx("label",{htmlFor:"isSortable",children:"Enable Sortable"}),"     ",o.jsx(rn,{target:".isSortable",content:"Make the field as column sortable"}),o.jsx("i",{className:"isSortable pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Or,{inputId:"isFilterable",checked:(n==null?void 0:n.isFilterable)||!1,onChange:r=>e("isFilterable",r.checked)}),o.jsx("label",{htmlFor:"isFilterable",children:"Enable Filter"}),"     ",o.jsx(rn,{target:".isFilterable",content:"Filter the column data"}),o.jsx("i",{className:"isFilterable pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Or,{inputId:"resizableColumns",checked:n==null?void 0:n.resizableColumns,onChange:r=>e("resizableColumns",r.checked)}),o.jsx("label",{htmlFor:"resizableColumns",children:"Enable Resizable Columns"}),"     ",o.jsx(rn,{target:".resizableColumns",content:"Column width can be increase or decreased by dragging"}),o.jsx("i",{className:"resizableColumns pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Or,{inputId:"reorderableColumns",checked:n==null?void 0:n.reorderableColumns,onChange:r=>e("reorderableColumns",r.checked)}),o.jsx("label",{htmlFor:"reorderableColumns",children:"Enable Reorderable Columns"}),"     ",o.jsx(rn,{target:".reorderableColumns",content:"Column can ordered to show as first or last"}),o.jsx("i",{className:"reorderableColumns pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Or,{inputId:"colToggle",checked:(n==null?void 0:n.colToggle)||!1,onChange:r=>e("colToggle",r.checked)}),o.jsx("label",{htmlFor:"colToggle",children:"Enable Column Toggle"}),"     ",o.jsx(rn,{target:".colToggle",content:"Column can be shown and hide by settings by user"}),o.jsx("i",{className:"colToggle pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Or,{inputId:"freezeColumn",checked:(n==null?void 0:n.freezeColumn)||!1,onChange:r=>e("freezeColumn",r.checked)}),o.jsx("label",{htmlFor:"freezeColumn",children:"Enable Freeze Columns"}),"     ",o.jsx(rn,{target:".freezeColumn",content:"Column can sticky so the important can be in view all the time"}),o.jsx("i",{className:"freezeColumn pi pi-question-circle text-secondary overlay-badge",style:{fontSize:"15px",cursor:"pointer",backgroundColor:"#000",color:"#fff",borderRadius:50}})]})]})},r0e=t=>{var c,u,d;const{fieldState:e,setFieldState:n}=t,{formBuilderSchemaLanguages:r}=ln(),i=()=>{n(f=>Object.assign({},f,{options:[...f.options,{uuid:tt(),optionText:{english:""},value:"",score:0,hyperlinkText:{english:""},abbreviationText:{english:""},custom_values:{}}]}))},a=f=>{n(h=>({...h,fieldType:{...h==null?void 0:h.fieldType,type:f}}))},s=(f,h)=>{n(m=>({...m,[f]:h}))},l=[{label:"Employee",api:"/employees/list",availableId:["user_id","employee_id"],optionValue:"employee_id",optionLabel:"first_name"},{label:"Departments",api:"/department/",availableId:["department_id"],optionValue:"department_id",optionLabel:"department_name"}];return o.jsxs("div",{className:"p-fluid",children:[o.jsx("h4",{children:"Render Type"}),o.jsxs("div",{className:"flex flex-wrap gap-3 my-2",children:[o.jsxs("div",{className:"flex align-items-center",children:[o.jsx(Zi,{inputId:"renderType1",name:"renderType",value:"radio",onChange:f=>{a(f==null?void 0:f.value)},checked:((c=e==null?void 0:e.fieldType)==null?void 0:c.type)==="radio"}),o.jsx("label",{htmlFor:"ingredient1",className:"ml-2",children:"Radio"})]}),o.jsxs("div",{className:"flex align-items-center",children:[o.jsx(Zi,{inputId:"renderType2",name:"renderType",value:"dropdown",onChange:f=>{a(f==null?void 0:f.value)},checked:((u=e==null?void 0:e.fieldType)==null?void 0:u.type)==="dropdown"}),o.jsx("label",{htmlFor:"ingredient2",className:"ml-2",children:"Dropdown"})]})]}),o.jsx("label",{htmlFor:"",className:"pb-2",children:"Data Source"}),o.jsxs("div",{className:"flex flex-wrap gap-3 mt-2",children:[o.jsxs("div",{className:"flex align-items-center",children:[o.jsx(Zi,{inputId:"dataSourceType1",name:"dataSourceType",value:"custom",onChange:f=>{s("dataSourceType",f==null?void 0:f.value)},checked:(e==null?void 0:e.dataSourceType)==="custom"}),o.jsx("label",{htmlFor:"ingredient1",className:"ml-2",children:"Custom"})]}),o.jsxs("div",{className:"flex align-items-center",children:[o.jsx(Zi,{inputId:"dataSourceType2",name:"dataSourceType",value:"database",onChange:f=>{s("dataSourceType",f==null?void 0:f.value)},checked:(e==null?void 0:e.dataSourceType)==="database"}),o.jsx("label",{htmlFor:"ingredient2",className:"ml-2",children:"Database"})]})]}),(e==null?void 0:e.dataSourceType)==="database"&&o.jsxs(o.Fragment,{children:[o.jsx("h4",{children:"Select Data Source"}),o.jsx("div",{children:o.jsxs("div",{className:"grid",children:[o.jsxs("div",{className:"col-6",children:[o.jsx("div",{className:"py-2",children:o.jsx("label",{children:"Datasources"})}),o.jsx(xa,{value:e==null?void 0:e.dataSource,onChange:f=>{var h;s("optionLabel",(h=f.value)==null?void 0:h.optionLabel),s("dataSource",f.value)},options:l,placeholder:"Select a Data Source",className:"w-full "})]}),o.jsxs("div",{className:"col-6",children:[o.jsx("div",{className:"py-2",children:o.jsx("label",{htmlFor:"",className:"py-2",children:"Select Datasource Id"})}),o.jsx(xa,{value:e==null?void 0:e.optionValue,onChange:f=>s("optionValue",f.value),options:(d=e==null?void 0:e.dataSource)==null?void 0:d.availableId,placeholder:"Source Id",className:"w-full "})]})]})})]}),(e==null?void 0:e.dataSourceType)==="custom"&&o.jsx(o.Fragment,{children:(e==null?void 0:e.options)!==void 0&&e.componentType!=="grid-component"&&e.componentType!=="matrix-dropdown"&&e.componentType!=="table"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"scroll-height-300 pt-5",children:o.jsx(ao,{activeIndex:0,children:r!=null&&r.length?r.map((f,h)=>o.jsx(io,{tabIndex:h,header:f==null?void 0:f.language,children:o.jsx(hF,{enableCopyPaste:!0,isCustomValue:!0,fieldState:e,setFieldState:n,language:f})},h)):""})}),o.jsx(kt,{text:!0,className:"mr-3",label:"Add",icon:"pi pi-plus",onClick:()=>i(),"aria-label":"Add"})]})})]})},i0e=t=>{var u,d;const{option:e,updateCondtionOption:n,updateChildrenField:r,addChildrenField:i,removeChildrenField:a}=t,{userSelectedLanguage:s}=ln(),l=[{type:"radio",label:"Radio"},{type:"text",label:"Input Text"},{type:"text-area",label:"Text Area"},{type:"date",label:"Date Field"}],c=(f,h)=>{var m;return o.jsxs("div",{onClick:f.onClick,className:f.className,children:[o.jsx("span",{children:f.titleElement}),e.children&&((m=e.children)==null?void 0:m.length)>1&&o.jsx(kt,{text:!0,icon:"pi pi-trash",size:"small",onClick:()=>{console.log("field",h==null?void 0:h.uuid),a(h==null?void 0:h.uuid)},"aria-label":"Filter"})]})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"field-checkbox mt-3",children:[o.jsx(Or,{inputId:"showConditionalFields",onChange:f=>{n(e==null?void 0:e.uuid,f.checked,{enableConditionalField:f.checked})},checked:e==null?void 0:e.enableConditionalField}),o.jsx("label",{htmlFor:"showConditionalFields",children:"Enable Conditional Field"})]}),(e==null?void 0:e.enableConditionalField)===!0&&o.jsxs(o.Fragment,{children:[o.jsx(kt,{text:!0,label:"Add Field",onClick:()=>{i(e==null?void 0:e.uuid)}}),o.jsx(Ka,{children:((u=e.children)==null?void 0:u.length)&&((d=e.children)==null?void 0:d.map((f,h)=>{var m,g;return o.jsx(hr,{header:(m=f.label)==null?void 0:m[s==null?void 0:s.type],headerTemplate:v=>c(v,f),children:o.jsxs("div",{className:"card",children:[o.jsx("p",{children:"Choose Field Type"}),o.jsx("div",{className:"flex mb-3",children:(l==null?void 0:l.length)&&(l==null?void 0:l.map(v=>o.jsxs("div",{className:"mr-3",children:[o.jsx(Zi,{inputId:"ingredient1",name:"fieldType",value:v==null?void 0:v.type,onChange:()=>r(f==null?void 0:f.uuid,{type:v==null?void 0:v.type}),checked:(f==null?void 0:f.type)===(v==null?void 0:v.type)}),o.jsx("label",{htmlFor:"ingredient1",className:"ml-2",children:v==null?void 0:v.label})]},`field_type_${f==null?void 0:f.uuid}`)))}),o.jsxs("div",{className:"field-checkbox mt-3",children:[o.jsx(Or,{inputId:"isRequired",onChange:v=>{r(f==null?void 0:f.uuid,{attributes:{required:v.checked}})},checked:(g=f==null?void 0:f.attributes)==null?void 0:g.required}),o.jsxs("label",{htmlFor:"showConditionalFields",children:["Is Required"," "]})]}),o.jsxs(Ka,{children:[o.jsx(hr,{header:"Text",children:o.jsx(hi,{header:"Text Settings",toggleable:!0,collapsed:!0,children:o.jsx("div",{className:"",children:o.jsx(cN,{language:s,fieldState:f,onHandleChange:(v,A,w)=>{r(f==null?void 0:f.uuid,{[v]:{[A==null?void 0:A.type]:w}})}})})})}),(f==null?void 0:f.type)==="radio"&&o.jsx(hr,{header:"Radio",children:o.jsx("div",{style:{width:"100%"},children:o.jsx(fb,{option:e,fieldState:f,updateCondtionOption:n,updateChildrenField:r,addChildrenField:i,removeChildrenField:a})})})]})]})},`field-tab-${h}-${f==null?void 0:f.uuid}-${e==null?void 0:e.uuid}`)}))})]})]})},fb=t=>{var s,l;const{fieldState:e,updateCondtionOption:n,updateChildrenField:r,addChildrenField:i,removeChildrenField:a}=t;return o.jsx(o.Fragment,{children:o.jsx(Ka,{children:((s=e==null?void 0:e.options)==null?void 0:s.length)&&((l=e==null?void 0:e.options)==null?void 0:l.map((c,u)=>o.jsx(hr,{header:`Option - ${c==null?void 0:c.label}`,children:o.jsx(i0e,{option:c,updateCondtionOption:n,updateChildrenField:r,addChildrenField:i,removeChildrenField:a})},`hirarchey-option-${u}`)))})})};var mF={},a0e=Ni&&Ni.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),e4=Ni&&Ni.__assign||function(){return e4=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},e4.apply(this,arguments)},s0e=Ni&&Ni.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),o0e=Ni&&Ni.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vF=Ni&&Ni.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&s0e(e,t,n);return o0e(e,t),e},l0e=Ni&&Ni.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n},c0e=Ni&&Ni.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mF,"__esModule",{value:!0});var hb=vF(N),u0e=c0e(F_),cd=vF(ia);function bF(t){return t&&t.replace(/&nbsp;|\u202F|\u00A0/g," ").replace(/<br \/>/g,"<br>")}function d0e(t){var e=document.createTextNode("");t.appendChild(e);var n=document.activeElement===t;if(e!==null&&e.nodeValue!==null&&n){var r=window.getSelection();if(r!==null){var i=document.createRange();i.setStart(e,e.nodeValue.length),i.collapse(!0),r.removeAllRanges(),r.addRange(i)}t instanceof HTMLElement&&t.focus()}}var f0e=function(t){a0e(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.lastHtml=n.props.html,n.el=typeof n.props.innerRef=="function"?{current:null}:hb.createRef(),n.getEl=function(){return(n.props.innerRef&&typeof n.props.innerRef!="function"?n.props.innerRef:n.el).current},n.emitChange=function(r){var i=n.getEl();if(i){var a=i.innerHTML;if(n.props.onChange&&a!==n.lastHtml){var s=Object.assign({},r,{target:{value:a}});n.props.onChange(s)}n.lastHtml=a}},n}return e.prototype.render=function(){var n=this,r=this.props,i=r.tagName,a=r.html,s=r.innerRef,l=l0e(r,["tagName","html","innerRef"]);return hb.createElement(i||"div",e4(e4({},l),{ref:typeof s=="function"?function(c){s(c),n.el.current=c}:s||this.el,onInput:this.emitChange,onBlur:this.props.onBlur||this.emitChange,onKeyUp:this.props.onKeyUp||this.emitChange,onKeyDown:this.props.onKeyDown||this.emitChange,contentEditable:!this.props.disabled,dangerouslySetInnerHTML:{__html:a}}),this.props.children)},e.prototype.shouldComponentUpdate=function(n){var r=this.props,i=this.getEl();return!i||bF(n.html)!==bF(i.innerHTML)?!0:r.disabled!==n.disabled||r.tagName!==n.tagName||r.className!==n.className||r.innerRef!==n.innerRef||r.placeholder!==n.placeholder||!(0,u0e.default)(r.style,n.style)},e.prototype.componentDidUpdate=function(){var n=this.getEl();n&&(this.props.html!==n.innerHTML&&(n.innerHTML=this.props.html),this.lastHtml=this.props.html,d0e(n))},e.propTypes={html:cd.string.isRequired,onChange:cd.func,disabled:cd.bool,tagName:cd.string,className:cd.string,style:cd.object,innerRef:cd.oneOfType([cd.object,cd.func])},e}(hb.Component),t4=mF.default=f0e;const h0e=t=>{var w;const e=N.useRef(null),{field:n,fieldIndex:r,pageIndex:i,sectionIndex:a,rowIndex:s,columnIndex:l,path:c}=t,[u,d]=N.useState(n),{userSelectedLanguage:f,fieldSettingUpdate:h,fieldSettingUpdateInlineConditional:m,gridComponentFieldSettingUpdate:g}=ln(),v=(x,S,E)=>{d(C=>({...C,[x]:{...C[x],[S==null?void 0:S.type]:E}}))};N.useEffect(()=>(A(),()=>{}),[u]);const A=()=>{const x=c.split("-").map(Number);(t==null?void 0:t.fieldContainer)==="inline-condition-container"?m(x[la],x[ca],x[ha],x[pa],x[ga],x[Sa],x[$o],x[yo],u):(x==null?void 0:x.length)>Sa&&(x==null?void 0:x.length)===Vl+1&&(n!=null&&n.componentType)&&(t==null?void 0:t.fieldContainer)==="grid-container"?g(x[la],x[ca],x[ha],x[pa],x[ga],x[5],x[6],x[7],u):h(i,a,s,l,r,{...n,label:u==null?void 0:u.label})};return o.jsx(o.Fragment,{children:o.jsx(t4,{style:{display:"inline-block"},className:"builder-input-label-edit",innerRef:e,html:(w=n==null?void 0:n.label)==null?void 0:w[f==null?void 0:f.type],disabled:!1,onChange:x=>{var S;v("label",f,(S=x==null?void 0:x.target)==null?void 0:S.value)},tagName:"article"})})},sa=t=>{const{sectionIndex:e,fieldIndex:n}=t,{formBuilderFormSchema:r}=ln();return(r==null?void 0:r.enableFieldEnumeration)===!0?o.jsx("span",{className:"mr-2",children:o.jsx($O,{classes:"font-medium p-1 bg-primary",level:"purple",value:`${e+1}.${n+1}`})}):o.jsx(o.Fragment,{})},pb=t=>{var u,d,f,h,m,g,v,A,w,x,S,E,C,_;const{field:e,update:n,value:r,isFirst:i}=t,{isPreview:a}=tn(),{userSelectedLanguage:s}=ln(),[l,c]=N.useState(0);return N.useEffect(()=>{const T=Rt.addListener("onSubmitUserForm",()=>{var F;(F=e==null?void 0:e.attributes)!=null&&F.required?r!=null&&r[e.uuid]?e.isValid=1:e.isValid=0:e.isValid=1}),O=Rt.addListener("OnInvalidFieldCatch",F=>{(e==null?void 0:e.uuid)===(F==null?void 0:F.fieldId)?c(1):c(0)});return()=>{T.remove(),O.remove()}}),o.jsxs("div",{className:"ml-3 p-2",children:[(e==null?void 0:e.type)==="radio"&&o.jsxs(o.Fragment,{children:[o.jsxs("h5",{children:[" ",i===!0&&o.jsx(sa,{...t}),((u=e==null?void 0:e.attributes)==null?void 0:u.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",a?o.jsx(o.Fragment,{children:(d=e==null?void 0:e.label)==null?void 0:d[s==null?void 0:s.type]}):o.jsx(h0e,{...t})]}),((f=e==null?void 0:e.options)==null?void 0:f.length)&&((h=e==null?void 0:e.options)==null?void 0:h.map(T=>{var O,F;return o.jsxs("div",{children:[o.jsxs("div",{className:"flex align-items-center mb-2",children:[o.jsx(Zi,{inputId:T.uuid,name:e==null?void 0:e.uuid,value:T.uuid,onChange:B=>n(e==null?void 0:e.uuid,B==null?void 0:B.value),checked:(r==null?void 0:r[e.uuid])===T.uuid}),o.jsx("label",{htmlFor:T.uuid,className:"ml-2",children:T.label})]}),(T==null?void 0:T.enableConditionalField)===!0&&(r==null?void 0:r[e==null?void 0:e.uuid])===(T==null?void 0:T.uuid)&&(T==null?void 0:T.children)&&((O=T==null?void 0:T.children)==null?void 0:O.length)>0&&((F=T==null?void 0:T.children)==null?void 0:F.map(()=>o.jsx(pb,{...t},`radio_child_${r==null?void 0:r[e==null?void 0:e.uuid]}`)))]},`${T.uuid}-radio-wrapper-${e==null?void 0:e.uuid}`)}))]}),(e==null?void 0:e.type)==="text"&&o.jsx(o.Fragment,{children:o.jsxs("div",{className:"card p-fluid",children:[o.jsxs("label",{htmlFor:"",children:[" ",((m=e==null?void 0:e.attributes)==null?void 0:m.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",e==null?void 0:e.label[s==null?void 0:s.type]]}),o.jsx(gn,{className:"mt-2",onChange:T=>{var O;return n(e==null?void 0:e.uuid,(O=T==null?void 0:T.target)==null?void 0:O.value)},value:r==null?void 0:r.uuid,placeholder:(g=e==null?void 0:e.placeholder)==null?void 0:g[s==null?void 0:s.type]})]})}),(e==null?void 0:e.type)==="date"&&o.jsx(o.Fragment,{children:o.jsxs("div",{className:"card p-fluid",children:[o.jsxs("label",{htmlFor:"",children:[" ",((v=e==null?void 0:e.attributes)==null?void 0:v.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",e==null?void 0:e.label[s==null?void 0:s.type]]}),o.jsx(W1,{className:"mt-2",onChange:T=>{var O;return n(e==null?void 0:e.uuid,(O=T==null?void 0:T.target)==null?void 0:O.value)},value:r==null?void 0:r.uuid,placeholder:(A=e==null?void 0:e.placeholder)==null?void 0:A[s==null?void 0:s.type]})]})}),(e==null?void 0:e.type)==="text-area"&&o.jsx(o.Fragment,{children:o.jsxs("div",{className:"card p-fluid",children:[o.jsxs("label",{htmlFor:"",children:[" ",((w=e==null?void 0:e.attributes)==null?void 0:w.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",e==null?void 0:e.label[s==null?void 0:s.type]]}),o.jsx(Ds,{className:"mt-2",onChange:T=>{var O;return n(e==null?void 0:e.uuid,(O=T==null?void 0:T.target)==null?void 0:O.value)},value:r==null?void 0:r.uuid,placeholder:(x=e==null?void 0:e.placeholder)==null?void 0:x[s==null?void 0:s.type]})]})}),o.jsx("div",{children:((S=e==null?void 0:e.helperText)==null?void 0:S[s==null?void 0:s.type])!==""&&o.jsx("small",{children:(E=e==null?void 0:e.helperText)==null?void 0:E[s==null?void 0:s.type]})}),o.jsx("div",{children:((C=e==null?void 0:e.attributes)==null?void 0:C.required)&&o.jsx("small",{className:"error",children:l===1&&!(r!=null&&r[e.uuid])?(_=e==null?void 0:e.validationMesssage)==null?void 0:_.language:""})})]},`${e==null?void 0:e.uuid}-radio`)},p0e=t=>{const{hirarechicalRadioSchemaState:e}=t,[n,r]=N.useState({});return o.jsx("div",{children:o.jsx(pb,{schema:e,field:e,update:(i,a)=>{const s={...n};s[i]=a,r(s)},value:n,sectionIndex:0,fieldIndex:0,pageIndex:0,rowIndex:0,columnIndex:0,path:""})})},gb={showHeaderText:!1,showHelperText:!1,showToolTip:!1,showLabel:!0,label:{english:"Field label"},abbreviationLabel:{english:""},helperText:{english:"Helper Text"},guidelines:{english:""},headerText:{english:"Header Text"},textTable:{english:""},toolTip:{english:""},validationMesssage:{english:"This field is required"},placeholder:{english:""},enableConditionalField:!0},g0e={uuid:tt(),...gb,type:"radio",value:null,options:[{uuid:tt(),label:"Yes",value:null,enableConditionalField:!0,children:[]},{uuid:tt(),label:"No",value:null,enableConditionalField:!0,children:[]}]};({uuid:tt(),...gb,options:(tt(),{uuid:tt(),...gb,options:(tt(),tt())},tt())});const m0e=t=>{const{fieldState:e,setFieldState:n}=t,r=(f,h,m)=>m==null?void 0:m.map(g=>{var v;return g.uuid===f?{...g,...h}:{...g,children:g!=null&&g.children&&((v=g==null?void 0:g.children)==null?void 0:v.length)>0?[...g.children.map(A=>A.type==="radio"?{...A,options:r(f,h,(A==null?void 0:A.options)||[])}:{...A})]:[]}}),i=(f,h,m)=>{const g=r(f,m,e.options);n(v=>({...v,options:g}))},a=(f,h,m)=>m==null?void 0:m.map(g=>{var v;return{...g,children:g!=null&&g.children&&((v=g==null?void 0:g.children)==null?void 0:v.length)>0?[...g.children.map(A=>A.uuid===f?{...A,...h}:{...A,options:a(f,h,A==null?void 0:A.options)})]:[]}}),s=(f,h)=>{const m=a(f,h,e.options);n(g=>({...g,options:m}))},l=(f,h)=>h==null?void 0:h.map(m=>{var g;return{...m,children:m!=null&&m.children&&((g=m==null?void 0:m.children)==null?void 0:g.length)>0?[...m.children.filter(v=>{if(v.uuid!==f)return{...v,options:l(f,v==null?void 0:v.options)}})]:[]}}),c=(f,h,m)=>m==null?void 0:m.map(g=>{var v;return g.children&&g.uuid===f?{...g,children:[...g.children,h]}:{...g,children:g!=null&&g.children&&((v=g==null?void 0:g.children)==null?void 0:v.length)>0?[...g.children.map(A=>({...A,options:c(f,h,A==null?void 0:A.options)}))]:[]}}),u=f=>{const h=c(f,{...g0e,isValid:0,uuid:tt(),options:[{uuid:tt(),label:"Yes",value:null,enableConditionalField:!0,children:[]},{uuid:tt(),label:"No",value:null,enableConditionalField:!0,children:[]}],isPostField:!1,showAlphabetList:!1,showButtonLayout:!1,answerOptions:[],isExternalSource:!1,underLined:!1,noOfMultpleAnswer:void 0,isAllowMultipleAnswer:!1,isIcon:!1,isTodayBtn:!1,resizableColumns:!1,isFilterable:!1,freezeColumn:!1,colToggle:!1,isFieldAnFilterOption:!1,isSortable:!1,reorderableColumns:!1,timeLimit:0,score:0,subject_id:0,course_category_id:0,TextEditorProps:!1,fieldData:void 0},e.options);n(m=>({...m,options:h}))},d=f=>{const h=l(f,e.options);n(m=>({...m,options:h}))};return o.jsx("div",{children:o.jsx("div",{className:" px-4",children:o.jsxs("div",{className:"grid",children:[o.jsx("div",{className:"col-6 scroll-height-200",children:(e==null?void 0:e.isHierarchalCondionalTabEnabled)===!0&&o.jsx(fb,{fieldState:e,updateCondtionOption:i,updateChildrenField:s,addChildrenField:u,removeChildrenField:d})}),o.jsxs("div",{className:"col-6 p-3 scroll-height-200",children:[o.jsx("h4",{className:"flex justify-content-center align-items-center",children:"Preview"}),o.jsx(p0e,{hirarechicalRadioSchemaState:e})]})]})})})},Ri=t=>{var pe,ie;const{formBuilderFormSchema:e,fieldSettingUpdate:n,fieldSettingUpdateInlineConditional:r,formBuilderSchemaLanguages:i,pageSettingUpdate:a,formBuilderFormLayout:s,formBuilderPublishedStatus:l,gridComponentFieldSettingUpdate:c}=ln(),{renderType:u}=tn(),{visibilty:d,field:f,closeSettingFieldSidebar:h,pageIndex:m,sectionIndex:g,rowIndex:v,columnIndex:A,fieldIndex:w,path:x,row:S}=t,[E,C]=N.useState(f),_=x.split("-"),T=()=>{const J=x.split("-").map(Number);(t==null?void 0:t.fieldContainer)==="inline-condition-container"?r(J[la],J[ca],J[ha],J[pa],J[ga],J[Sa],J[$o],J[yo],E):(J==null?void 0:J.length)>Sa&&(J==null?void 0:J.length)===Vl+1&&(E!=null&&E.componentType)&&(t==null?void 0:t.fieldContainer)==="grid-container"?c(J[la],J[ca],J[ha],J[pa],J[ga],J[5],J[6],J[7],E):(n(m,g,v,A,w,E),setTimeout(()=>{Rt.emit("OnSignatureSettingChange",{})},1e3),setTimeout(()=>{Rt.emit("onUpdateField",{})},1e3))},O=(J,Q,oe)=>{C(ye=>({...ye,[J]:{...ye[J],[Q==null?void 0:Q.type]:oe}}))},F=(J,Q)=>{C(oe=>({...oe,attributes:{...oe.attributes,[J]:Q}}))},B=(J,Q)=>{C(oe=>({...oe,[J]:Q}))},M=(J,Q)=>{C(oe=>({...oe,inlineConditional:{...oe.inlineConditional,[J]:Q}}))},z=()=>{},P=()=>{C(J=>({...J,data:[...J.data,{uuid:tt(),dataKey:"",value:""}]}))},H=()=>{C(J=>Object.assign({},J,{options:[...J.options,{uuid:tt(),optionText:{english:""},value:"",score:0,hyperlinkText:{english:""},abbreviationText:{english:""},custom_values:{}}]}))},de=()=>{},fe=()=>{},ne=()=>{},W=()=>{},ae=J=>{var Te;const Q=[...(E==null?void 0:E.conditionalTabRules.rules)||[]],oe=Q.filter((Ae,be)=>J!==be);C(Ae=>({...Ae,conditionalTabRules:{...Ae.conditionalTabRules,rules:oe}}));const ye=Q[J];(Te=ye==null?void 0:ye.conditions)==null||Te.map(Ae=>{const be=Et.findIndex(s,re=>{var U;return(re==null?void 0:re.uuid)===((U=Ae==null?void 0:Ae.tab)==null?void 0:U.uuid)}),we=s[be];we&&(we.isHidden=!1,a(be,we))})},Y=(J,Q)=>{const oe=[...(E==null?void 0:E.conditionalTabRules.rules)||[]];oe[J].conditions=oe[J].conditions.filter((ye,Te)=>Q!==Te),C(ye=>({...ye,conditionalTabRules:{...ye.conditionalTabRules,rules:oe}}))};return o.jsx(o.Fragment,{children:o.jsxs(Io,{style:{width:"60vw"},visible:d,position:"left",className:"p-sidebar-lg",onHide:()=>h(),children:[o.jsxs("div",{className:"flex justify-content-between flex-wrap card-container ",children:[o.jsxs("div",{className:"flex align-items-center justify-content-center ",children:[" ",o.jsxs("h5",{className:"mb-0",children:[t==null?void 0:t.typeName," Settings - ",(pe=f==null?void 0:f.label)==null?void 0:pe.english," "]})]}),!l&&o.jsx("div",{className:"flex align-items-center justify-content-center",children:o.jsx(kt,{className:"mt-3",label:"Update",onClick:()=>T(),"aria-label":"Update"})})]}),o.jsx("div",{className:" mt-4",children:o.jsxs(Ka,{children:[o.jsx(hr,{header:"Text",children:o.jsx("div",{className:"scroll-height-200",children:o.jsx(ao,{activeIndex:0,children:i!=null&&i.length?i.map((J,Q)=>o.jsx(io,{tabIndex:Q,header:J==null?void 0:J.language,children:o.jsx(cN,{language:J,fieldState:E,onHandleChange:O,...t})},Q)):""})})}),(E==null?void 0:E.isValidationTabEnabled)===!0&&o.jsx(hr,{header:"Validation",children:o.jsx(Doe,{fieldState:E,onHandleChangeLayoutSettings:B,onHandleChangeAttributesSetttings:F,...t})}),o.jsx(hr,{header:"Attributes",children:o.jsx("div",{className:"scroll-height-200",children:o.jsx(Ooe,{fieldState:E,onHandleChangeLayoutSettings:B,onHandleChangeAttributesSetttings:F})})}),(E==null?void 0:E.isLayoutTabEnabled)===!0&&o.jsx(hr,{header:"Layout",children:o.jsx("div",{className:"scroll-height-200",children:o.jsx(Foe,{fieldState:E,onHandleChangeLayoutSettings:B})})}),(E==null?void 0:E.isDynamicListingTabEnabled)===!0&&o.jsx(hr,{header:"Dynamic Options",children:o.jsx("div",{className:"scroll-height-200",children:o.jsx(r0e,{fieldState:E,setFieldState:C})})}),(E==null?void 0:E.options)!==void 0&&(E==null?void 0:E.data)&&o.jsx(hr,{header:"Data",children:o.jsxs("div",{className:"scroll-height-200",children:[o.jsx(koe,{onHandleChangeLayoutSettings:B,fieldState:E,setFieldState:C}),o.jsx(kt,{className:"mr-3",label:"Data Option",icon:"pi pi-plus",onClick:()=>P(),"aria-label":"Add"})]})}),o.jsx(hr,{header:"Table view options",children:o.jsx(n0e,{fieldState:E,onHandleChangeLayoutSettings:B})}),(E==null?void 0:E.componentType)!=="radio-hierarchal"&&(E==null?void 0:E.options)!==void 0&&f.componentType!=="grid-component"&&f.componentType!=="matrix-dropdown"&&f.componentType!=="table"&&o.jsxs(hr,{header:"Options",children:[(E==null?void 0:E.componentType)!=="radio-hierarchal"&&o.jsx("div",{className:"flex justify-content-end",children:o.jsx(kt,{className:"mr-3 mb-2",label:"Option",icon:"pi pi-plus",onClick:()=>H(),"aria-label":"Option"})}),o.jsxs("div",{className:"scroll-height-200 px-4",children:[o.jsx(ao,{activeIndex:0,children:i!=null&&i.length?i.map((J,Q)=>o.jsx(io,{tabIndex:Q,header:J==null?void 0:J.language,children:o.jsx(hF,{enableAbbreviationColumn:(E==null?void 0:E.componentType)!=="radio-hierarchal",enableHyperTextColumn:(E==null?void 0:E.componentType)!=="radio-hierarchal",enableAddNewColumn:(E==null?void 0:E.componentType)!=="radio-hierarchal",enableCopyPaste:(E==null?void 0:E.componentType)!=="radio-hierarchal",isCustomValue:!1,fieldState:E,setFieldState:C,language:J})},Q)):""}),(E==null?void 0:E.isHierarchalCondionalTabEnabled)===!0&&o.jsx(fb,{fieldState:E,onHandleChangeLayoutSettings:B,removeChildrenField:W,addChildrenField:ne,updateChildrenField:fe,updateCondtionOption:de})]})]}),(E==null?void 0:E.componentType)==="radio-hierarchal"&&(E==null?void 0:E.options)!==void 0&&f.componentType!=="grid-component"&&f.componentType!=="matrix-dropdown"&&f.componentType!=="table"&&o.jsx(hr,{header:"Hierarchal Options",children:o.jsx(m0e,{fieldState:E,setFieldState:C})}),u===O7&&(E==null?void 0:E.inlineConditionalRules)!==void 0&&!(S!=null&&S.rowIsRepeatable)&&(_==null?void 0:_.length)<yo+1&&o.jsx(hr,{header:"Conditional",children:o.jsx(e0e,{handleRemoveConditionalTabRule:ae,handleRemoveConditionalTabRuleCondition:Y,onHandleSelectInlineConditionalOption:z,onHandleChangeLayoutSettings:B,onHandleChangeInlineConditionaltSetttings:M,fieldState:E,setFieldState:C,pageIndex:m,sectionIndex:g,...t})}),!((ie=t==null?void 0:t.row)!=null&&ie.rowIsRepeatable)&&(e==null?void 0:e.enableReviewTask)===!0&&o.jsx(hr,{header:"Admin",children:o.jsx(t0e,{fieldState:E,setFieldState:C})})]})})]})})},Fi=t=>{const[e,n]=N.useState(null),{field:r}=t,{userTaskSubmitFormData:i,updateUserFormDataSubmit:a}=Pr();N.useEffect(()=>{var h,m;if(i!==null&&e===null){let g=0;r!=null&&r.rowIsRepeatable?g=i.findIndex(v=>(v==null?void 0:v.rowId)===(r==null?void 0:r.uuid)):g=i.findIndex(v=>(v==null?void 0:v.fieldId)===(r==null?void 0:r.uuid)),n((h=i[g])!=null&&h.reviewerChecklist?(m=i[g])==null?void 0:m.reviewerChecklist:[])}return()=>{}},[r==null?void 0:r.rowIsRepeatable,r==null?void 0:r.uuid,e,i]);const s=h=>{const m=i.findIndex(v=>(v==null?void 0:v.fieldId)===(r==null?void 0:r.uuid)),g=[...i];g[m]={...g[m],reviewerChecklist:h},a(g)},l=(h,m)=>{const g=e;g[m]={...g[m],agree:h==null?void 0:h.value},n([...g]),s(g)},c=(h,m)=>{const g=e;if(m!=null&&m.checked)g[h].selectAction.push(m==null?void 0:m.value);else{const v=g[h].selectAction.findIndex(A=>A===(m==null?void 0:m.value));g[h].selectAction.splice(v,1)}n([...g]),s(g)},u=(h,m)=>{const g=e;h!=null&&h.checked?g[m]={...g[m],other:{...g[m].other,isOther:!0}}:g[m]={...g[m],other:{...g[m].other,isOther:!1}},n([...g]),s(g)},d=(h,m)=>{var v;const g=e;g[m]={...g[m],other:{...g[m].other,description:(v=h==null?void 0:h.target)==null?void 0:v.value}},n([...g]),s(g)},f=(h,m,g)=>{var A;const v=e;v[g]={...v[g],[m]:(A=h==null?void 0:h.target)==null?void 0:A.value},n([...v]),s(v)};return o.jsx(o.Fragment,{children:o.jsx("div",{className:"col-12",children:o.jsx(Ka,{children:o.jsx(hr,{header:"Admin Review",children:o.jsx("div",{className:"grid",children:e!==null&&(e==null?void 0:e.length)>0&&(e==null?void 0:e.map((h,m)=>{var g,v,A,w,x;return o.jsx("div",{className:"col-4 p-fluid p-3",children:o.jsxs("div",{className:"card",children:[o.jsx("h6",{className:"mb-2",children:h==null?void 0:h.checklist}),o.jsx("br",{}),o.jsxs("div",{className:"field-radiobutton",children:[o.jsx(Zi,{inputId:`yes-${m}`,name:"action",value:!0,onChange:S=>{l(S,m)},checked:(h==null?void 0:h.agree)===!0}),o.jsx("label",{htmlFor:`yes-${m}`,children:"Yes"})]}),o.jsxs("div",{className:"field-radiobutton",children:[o.jsx(Zi,{inputId:`no-${m}`,name:"action",value:!1,onChange:S=>{l(S,m)},checked:(h==null?void 0:h.agree)===!1}),o.jsx("label",{htmlFor:`no-${m}`,children:"No"})]}),(h==null?void 0:h.agree)===!1&&o.jsxs("div",{className:"px-5 mb-3",children:[(h==null?void 0:h.action)&&Array.isArray(h.action)&&((g=h==null?void 0:h.action)==null?void 0:g.length)>0&&((v=h==null?void 0:h.action)==null?void 0:v.map((S,E)=>{var C;return o.jsxs("div",{children:[o.jsx(Or,{value:S,checked:((C=h==null?void 0:h.selectAction)==null?void 0:C.length)>0?h==null?void 0:h.selectAction.some(_=>_===S):!1,onChange:_=>{c(m,_)}})," ",S," ",o.jsx("br",{}),o.jsx("br",{})]},`action-${m}-${E}`)})),o.jsx(Or,{checked:(A=h==null?void 0:h.other)==null?void 0:A.isOther,onChange:S=>{u(S,m)}})," Other ",o.jsx("br",{}),o.jsx("br",{}),((w=h==null?void 0:h.other)==null?void 0:w.isOther)===!0&&o.jsxs("div",{className:"",children:[o.jsx("label",{children:"If other please specify the action point"}),o.jsx("br",{}),o.jsx(Ds,{className:"mt-3",value:(x=h==null?void 0:h.other)==null?void 0:x.description,onChange:S=>d(S,m)})]})]}),(h==null?void 0:h.agree)===!1&&o.jsxs("div",{className:"",children:[o.jsx("label",{children:"Reviewer Feedback "}),o.jsx("br",{}),o.jsx(Ds,{className:"mt-3",value:h==null?void 0:h.reviewerFeedback,onChange:S=>f(S,"reviewerFeedback",m)})]}),o.jsxs("div",{className:"",children:[o.jsx("label",{children:"Reviewer Comments / Notes (internal use only)"}),o.jsx("br",{}),o.jsx(Ds,{className:"mt-3",value:h==null?void 0:h.reviewerComments,onChange:S=>f(S,"reviewerComments",m)})]})]})},`checklistIndex-${m}`)}))})})})})})},wi=t=>{const{isPreview:e,field:n,isAdmin:r,fieldWrap:i}=t,{userSelectedLanguage:a}=ln(),{globalAlignment:s}=tn(),l=m=>{const g=m.collapsed?"pi pi-chevron-down":"pi pi-chevron-up",v=`${m.className} justify-content-start`,A=`${m.titleClassName} pl-1`;return o.jsxs("div",{className:v,children:[o.jsxs("button",{className:m.togglerClassName,onClick:m.onTogglerClick,children:[o.jsx("span",{className:g}),o.jsx(Qt,{})]}),o.jsx("span",{className:A,children:d})]})},{TASK_PUBLISHED:c,task_status:u}=Pr(),[d,f]=N.useState("");N.useEffect(()=>{var m;f((m=n==null?void 0:n.label)==null?void 0:m[a==null?void 0:a.type])},[n,a==null?void 0:a.type]);const h=()=>{let m="";return e||(m=m+" field-form-builder"),u===c&&r===!0&&(m=m+" card"),m};return o.jsx(o.Fragment,{children:o.jsx("div",{dir:s,className:h(),children:u===c&&r===!0?o.jsx(hi,{headerTemplate:l,toggleable:!0,children:i}):i})})};/*! @license DOMPurify 3.1.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.5/LICENSE */const{entries:yF,setPrototypeOf:AF,isFrozen:v0e,getPrototypeOf:b0e,getOwnPropertyDescriptor:y0e}=Object;let{freeze:_o,seal:Kl,create:wF}=Object,{apply:mb,construct:vb}=typeof Reflect<"u"&&Reflect;_o||(_o=function(e){return e}),Kl||(Kl=function(e){return e}),mb||(mb=function(e,n,r){return e.apply(n,r)}),vb||(vb=function(e,n){return new e(...n)});const n4=gl(Array.prototype.forEach),SF=gl(Array.prototype.pop),v2=gl(Array.prototype.push),r4=gl(String.prototype.toLowerCase),bb=gl(String.prototype.toString),xF=gl(String.prototype.match),b2=gl(String.prototype.replace),A0e=gl(String.prototype.indexOf),w0e=gl(String.prototype.trim),Ic=gl(Object.prototype.hasOwnProperty),Do=gl(RegExp.prototype.test),y2=S0e(TypeError);function gl(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return mb(t,e,r)}}function S0e(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return vb(t,n)}}function pi(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r4;AF&&AF(t,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const a=n(i);a!==i&&(v0e(e)||(e[r]=a),i=a)}t[i]=!0}return t}function x0e(t){for(let e=0;e<t.length;e++)Ic(t,e)||(t[e]=null);return t}function r1(t){const e=wF(null);for(const[n,r]of yF(t))Ic(t,n)&&(Array.isArray(r)?e[n]=x0e(r):r&&typeof r=="object"&&r.constructor===Object?e[n]=r1(r):e[n]=r);return e}function i4(t,e){for(;t!==null;){const r=y0e(t,e);if(r){if(r.get)return gl(r.get);if(typeof r.value=="function")return gl(r.value)}t=b0e(t)}function n(){return null}return n}const CF=_o(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),yb=_o(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ab=_o(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),C0e=_o(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),wb=_o(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),T0e=_o(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),TF=_o(["#text"]),EF=_o(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Sb=_o(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),IF=_o(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),a4=_o(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),E0e=Kl(/\{\{[\w\W]*|[\w\W]*\}\}/gm),I0e=Kl(/<%[\w\W]*|[\w\W]*%>/gm),_0e=Kl(/\${[\w\W]*}/gm),D0e=Kl(/^data-[\-\w.\u00B7-\uFFFF]/),O0e=Kl(/^aria-[\-\w]+$/),_F=Kl(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),N0e=Kl(/^(?:\w+script|data):/i),F0e=Kl(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),DF=Kl(/^html$/i),k0e=Kl(/^[a-z][.\w]*(-[.\w]+)+$/i);var OF=Object.freeze({__proto__:null,MUSTACHE_EXPR:E0e,ERB_EXPR:I0e,TMPLIT_EXPR:_0e,DATA_ATTR:D0e,ARIA_ATTR:O0e,IS_ALLOWED_URI:_F,IS_SCRIPT_OR_DATA:N0e,ATTR_WHITESPACE:F0e,DOCTYPE_NAME:DF,CUSTOM_ELEMENT:k0e});const A2={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},P0e=function(){return typeof window>"u"?null:window},M0e=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const a="dompurify"+(r?"#"+r:"");try{return e.createPolicy(a,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}};function NF(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:P0e();const e=Ke=>NF(Ke);if(e.version="3.1.5",e.removed=[],!t||!t.document||t.document.nodeType!==A2.document)return e.isSupported=!1,e;let{document:n}=t;const r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:f,DOMParser:h,trustedTypes:m}=t,g=c.prototype,v=i4(g,"cloneNode"),A=i4(g,"nextSibling"),w=i4(g,"childNodes"),x=i4(g,"parentNode");if(typeof s=="function"){const Ke=n.createElement("template");Ke.content&&Ke.content.ownerDocument&&(n=Ke.content.ownerDocument)}let S,E="";const{implementation:C,createNodeIterator:_,createDocumentFragment:T,getElementsByTagName:O}=n,{importNode:F}=r;let B={};e.isSupported=typeof yF=="function"&&typeof x=="function"&&C&&C.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:M,ERB_EXPR:z,TMPLIT_EXPR:P,DATA_ATTR:H,ARIA_ATTR:de,IS_SCRIPT_OR_DATA:fe,ATTR_WHITESPACE:ne,CUSTOM_ELEMENT:W}=OF;let{IS_ALLOWED_URI:ae}=OF,Y=null;const pe=pi({},[...CF,...yb,...Ab,...wb,...TF]);let ie=null;const J=pi({},[...EF,...Sb,...IF,...a4]);let Q=Object.seal(wF(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),oe=null,ye=null,Te=!0,Ae=!0,be=!1,we=!0,re=!1,U=!0,Z=!1,K=!1,he=!1,_e=!1,ge=!1,ve=!1,Le=!0,Ne=!1;const me="user-content-";let V=!0,te=!1,X={},se=null;const ue=pi({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Se=null;const De=pi({},["audio","video","img","source","image","track"]);let je=null;const ct=pi({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Dt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",xt="http://www.w3.org/1999/xhtml";let rt=xt,mt=!1,Ot=null;const $e=pi({},[Dt,nt,xt],bb);let St=null;const Kt=["application/xhtml+xml","text/html"],An="text/html";let yn=null,vn=null;const On=n.createElement("form"),Jn=function(Oe){return Oe instanceof RegExp||Oe instanceof Function},Cn=function(){let Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(vn&&vn===Oe)){if((!Oe||typeof Oe!="object")&&(Oe={}),Oe=r1(Oe),St=Kt.indexOf(Oe.PARSER_MEDIA_TYPE)===-1?An:Oe.PARSER_MEDIA_TYPE,yn=St==="application/xhtml+xml"?bb:r4,Y=Ic(Oe,"ALLOWED_TAGS")?pi({},Oe.ALLOWED_TAGS,yn):pe,ie=Ic(Oe,"ALLOWED_ATTR")?pi({},Oe.ALLOWED_ATTR,yn):J,Ot=Ic(Oe,"ALLOWED_NAMESPACES")?pi({},Oe.ALLOWED_NAMESPACES,bb):$e,je=Ic(Oe,"ADD_URI_SAFE_ATTR")?pi(r1(ct),Oe.ADD_URI_SAFE_ATTR,yn):ct,Se=Ic(Oe,"ADD_DATA_URI_TAGS")?pi(r1(De),Oe.ADD_DATA_URI_TAGS,yn):De,se=Ic(Oe,"FORBID_CONTENTS")?pi({},Oe.FORBID_CONTENTS,yn):ue,oe=Ic(Oe,"FORBID_TAGS")?pi({},Oe.FORBID_TAGS,yn):{},ye=Ic(Oe,"FORBID_ATTR")?pi({},Oe.FORBID_ATTR,yn):{},X=Ic(Oe,"USE_PROFILES")?Oe.USE_PROFILES:!1,Te=Oe.ALLOW_ARIA_ATTR!==!1,Ae=Oe.ALLOW_DATA_ATTR!==!1,be=Oe.ALLOW_UNKNOWN_PROTOCOLS||!1,we=Oe.ALLOW_SELF_CLOSE_IN_ATTR!==!1,re=Oe.SAFE_FOR_TEMPLATES||!1,U=Oe.SAFE_FOR_XML!==!1,Z=Oe.WHOLE_DOCUMENT||!1,_e=Oe.RETURN_DOM||!1,ge=Oe.RETURN_DOM_FRAGMENT||!1,ve=Oe.RETURN_TRUSTED_TYPE||!1,he=Oe.FORCE_BODY||!1,Le=Oe.SANITIZE_DOM!==!1,Ne=Oe.SANITIZE_NAMED_PROPS||!1,V=Oe.KEEP_CONTENT!==!1,te=Oe.IN_PLACE||!1,ae=Oe.ALLOWED_URI_REGEXP||_F,rt=Oe.NAMESPACE||xt,Q=Oe.CUSTOM_ELEMENT_HANDLING||{},Oe.CUSTOM_ELEMENT_HANDLING&&Jn(Oe.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=Oe.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Oe.CUSTOM_ELEMENT_HANDLING&&Jn(Oe.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=Oe.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Oe.CUSTOM_ELEMENT_HANDLING&&typeof Oe.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=Oe.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),re&&(Ae=!1),ge&&(_e=!0),X&&(Y=pi({},TF),ie=[],X.html===!0&&(pi(Y,CF),pi(ie,EF)),X.svg===!0&&(pi(Y,yb),pi(ie,Sb),pi(ie,a4)),X.svgFilters===!0&&(pi(Y,Ab),pi(ie,Sb),pi(ie,a4)),X.mathMl===!0&&(pi(Y,wb),pi(ie,IF),pi(ie,a4))),Oe.ADD_TAGS&&(Y===pe&&(Y=r1(Y)),pi(Y,Oe.ADD_TAGS,yn)),Oe.ADD_ATTR&&(ie===J&&(ie=r1(ie)),pi(ie,Oe.ADD_ATTR,yn)),Oe.ADD_URI_SAFE_ATTR&&pi(je,Oe.ADD_URI_SAFE_ATTR,yn),Oe.FORBID_CONTENTS&&(se===ue&&(se=r1(se)),pi(se,Oe.FORBID_CONTENTS,yn)),V&&(Y["#text"]=!0),Z&&pi(Y,["html","head","body"]),Y.table&&(pi(Y,["tbody"]),delete oe.tbody),Oe.TRUSTED_TYPES_POLICY){if(typeof Oe.TRUSTED_TYPES_POLICY.createHTML!="function")throw y2('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Oe.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw y2('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=Oe.TRUSTED_TYPES_POLICY,E=S.createHTML("")}else S===void 0&&(S=M0e(m,i)),S!==null&&typeof E=="string"&&(E=S.createHTML(""));_o&&_o(Oe),vn=Oe}},jt=pi({},["mi","mo","mn","ms","mtext"]),st=pi({},["foreignobject","annotation-xml"]),et=pi({},["title","style","font","a","script"]),dt=pi({},[...yb,...Ab,...C0e]),Ht=pi({},[...wb,...T0e]),Tn=function(Oe){let Je=x(Oe);(!Je||!Je.tagName)&&(Je={namespaceURI:rt,tagName:"template"});const ot=r4(Oe.tagName),Lt=r4(Je.tagName);return Ot[Oe.namespaceURI]?Oe.namespaceURI===nt?Je.namespaceURI===xt?ot==="svg":Je.namespaceURI===Dt?ot==="svg"&&(Lt==="annotation-xml"||jt[Lt]):!!dt[ot]:Oe.namespaceURI===Dt?Je.namespaceURI===xt?ot==="math":Je.namespaceURI===nt?ot==="math"&&st[Lt]:!!Ht[ot]:Oe.namespaceURI===xt?Je.namespaceURI===nt&&!st[Lt]||Je.namespaceURI===Dt&&!jt[Lt]?!1:!Ht[ot]&&(et[ot]||!dt[ot]):!!(St==="application/xhtml+xml"&&Ot[Oe.namespaceURI]):!1},kn=function(Oe){v2(e.removed,{element:Oe});try{Oe.parentNode.removeChild(Oe)}catch{Oe.remove()}},Rn=function(Oe,Je){try{v2(e.removed,{attribute:Je.getAttributeNode(Oe),from:Je})}catch{v2(e.removed,{attribute:null,from:Je})}if(Je.removeAttribute(Oe),Oe==="is"&&!ie[Oe])if(_e||ge)try{kn(Je)}catch{}else try{Je.setAttribute(Oe,"")}catch{}},cr=function(Oe){let Je=null,ot=null;if(he)Oe="<remove></remove>"+Oe;else{const ft=xF(Oe,/^[\r\n\t ]+/);ot=ft&&ft[0]}St==="application/xhtml+xml"&&rt===xt&&(Oe='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Oe+"</body></html>");const Lt=S?S.createHTML(Oe):Oe;if(rt===xt)try{Je=new h().parseFromString(Lt,St)}catch{}if(!Je||!Je.documentElement){Je=C.createDocument(rt,"template",null);try{Je.documentElement.innerHTML=mt?E:Lt}catch{}}const Gt=Je.body||Je.documentElement;return Oe&&ot&&Gt.insertBefore(n.createTextNode(ot),Gt.childNodes[0]||null),rt===xt?O.call(Je,Z?"html":"body")[0]:Z?Je.documentElement:Gt},Zn=function(Oe){return _.call(Oe.ownerDocument||Oe,Oe,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},vr=function(Oe){return Oe instanceof f&&(typeof Oe.nodeName!="string"||typeof Oe.textContent!="string"||typeof Oe.removeChild!="function"||!(Oe.attributes instanceof d)||typeof Oe.removeAttribute!="function"||typeof Oe.setAttribute!="function"||typeof Oe.namespaceURI!="string"||typeof Oe.insertBefore!="function"||typeof Oe.hasChildNodes!="function")},Ir=function(Oe){return typeof l=="function"&&Oe instanceof l},dn=function(Oe,Je,ot){B[Oe]&&n4(B[Oe],Lt=>{Lt.call(e,Je,ot,vn)})},lt=function(Oe){let Je=null;if(dn("beforeSanitizeElements",Oe,null),vr(Oe))return kn(Oe),!0;const ot=yn(Oe.nodeName);if(dn("uponSanitizeElement",Oe,{tagName:ot,allowedTags:Y}),Oe.hasChildNodes()&&!Ir(Oe.firstElementChild)&&Do(/<[/\w]/g,Oe.innerHTML)&&Do(/<[/\w]/g,Oe.textContent)||Oe.nodeType===A2.progressingInstruction||U&&Oe.nodeType===A2.comment&&Do(/<[/\w]/g,Oe.data))return kn(Oe),!0;if(!Y[ot]||oe[ot]){if(!oe[ot]&&yt(ot)&&(Q.tagNameCheck instanceof RegExp&&Do(Q.tagNameCheck,ot)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(ot)))return!1;if(V&&!se[ot]){const Lt=x(Oe)||Oe.parentNode,Gt=w(Oe)||Oe.childNodes;if(Gt&&Lt){const ft=Gt.length;for(let Me=ft-1;Me>=0;--Me){const Qe=v(Gt[Me],!0);Qe.__removalCount=(Oe.__removalCount||0)+1,Lt.insertBefore(Qe,A(Oe))}}}return kn(Oe),!0}return Oe instanceof c&&!Tn(Oe)||(ot==="noscript"||ot==="noembed"||ot==="noframes")&&Do(/<\/no(script|embed|frames)/i,Oe.innerHTML)?(kn(Oe),!0):(re&&Oe.nodeType===A2.text&&(Je=Oe.textContent,n4([M,z,P],Lt=>{Je=b2(Je,Lt," ")}),Oe.textContent!==Je&&(v2(e.removed,{element:Oe.cloneNode()}),Oe.textContent=Je)),dn("afterSanitizeElements",Oe,null),!1)},at=function(Oe,Je,ot){if(Le&&(Je==="id"||Je==="name")&&(ot in n||ot in On))return!1;if(!(Ae&&!ye[Je]&&Do(H,Je))){if(!(Te&&Do(de,Je))){if(!ie[Je]||ye[Je]){if(!(yt(Oe)&&(Q.tagNameCheck instanceof RegExp&&Do(Q.tagNameCheck,Oe)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(Oe))&&(Q.attributeNameCheck instanceof RegExp&&Do(Q.attributeNameCheck,Je)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(Je))||Je==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&Do(Q.tagNameCheck,ot)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(ot))))return!1}else if(!je[Je]){if(!Do(ae,b2(ot,ne,""))){if(!((Je==="src"||Je==="xlink:href"||Je==="href")&&Oe!=="script"&&A0e(ot,"data:")===0&&Se[Oe])){if(!(be&&!Do(fe,b2(ot,ne,"")))){if(ot)return!1}}}}}}return!0},yt=function(Oe){return Oe!=="annotation-xml"&&xF(Oe,W)},Vt=function(Oe){dn("beforeSanitizeAttributes",Oe,null);const{attributes:Je}=Oe;if(!Je)return;const ot={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ie};let Lt=Je.length;for(;Lt--;){const Gt=Je[Lt],{name:ft,namespaceURI:Me,value:Qe}=Gt,Ft=yn(ft);let zt=ft==="value"?Qe:w0e(Qe);if(ot.attrName=Ft,ot.attrValue=zt,ot.keepAttr=!0,ot.forceKeepAttr=void 0,dn("uponSanitizeAttribute",Oe,ot),zt=ot.attrValue,ot.forceKeepAttr||(Rn(ft,Oe),!ot.keepAttr))continue;if(!we&&Do(/\/>/i,zt)){Rn(ft,Oe);continue}if(U&&Do(/((--!?|])>)|<\/(style|title)/i,zt)){Rn(ft,Oe);continue}re&&n4([M,z,P],Pe=>{zt=b2(zt,Pe," ")});const At=yn(Oe.nodeName);if(at(At,Ft,zt)){if(Ne&&(Ft==="id"||Ft==="name")&&(Rn(ft,Oe),zt=me+zt),S&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!Me)switch(m.getAttributeType(At,Ft)){case"TrustedHTML":{zt=S.createHTML(zt);break}case"TrustedScriptURL":{zt=S.createScriptURL(zt);break}}try{Me?Oe.setAttributeNS(Me,ft,zt):Oe.setAttribute(ft,zt),vr(Oe)?kn(Oe):SF(e.removed)}catch{}}}dn("afterSanitizeAttributes",Oe,null)},Pt=function Ke(Oe){let Je=null;const ot=Zn(Oe);for(dn("beforeSanitizeShadowDOM",Oe,null);Je=ot.nextNode();)dn("uponSanitizeShadowNode",Je,null),!lt(Je)&&(Je.content instanceof a&&Ke(Je.content),Vt(Je));dn("afterSanitizeShadowDOM",Oe,null)};return e.sanitize=function(Ke){let Oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Je=null,ot=null,Lt=null,Gt=null;if(mt=!Ke,mt&&(Ke="<!-->"),typeof Ke!="string"&&!Ir(Ke))if(typeof Ke.toString=="function"){if(Ke=Ke.toString(),typeof Ke!="string")throw y2("dirty is not a string, aborting")}else throw y2("toString is not a function");if(!e.isSupported)return Ke;if(K||Cn(Oe),e.removed=[],typeof Ke=="string"&&(te=!1),te){if(Ke.nodeName){const Qe=yn(Ke.nodeName);if(!Y[Qe]||oe[Qe])throw y2("root node is forbidden and cannot be sanitized in-place")}}else if(Ke instanceof l)Je=cr("<!---->"),ot=Je.ownerDocument.importNode(Ke,!0),ot.nodeType===A2.element&&ot.nodeName==="BODY"||ot.nodeName==="HTML"?Je=ot:Je.appendChild(ot);else{if(!_e&&!re&&!Z&&Ke.indexOf("<")===-1)return S&&ve?S.createHTML(Ke):Ke;if(Je=cr(Ke),!Je)return _e?null:ve?E:""}Je&&he&&kn(Je.firstChild);const ft=Zn(te?Ke:Je);for(;Lt=ft.nextNode();)lt(Lt)||(Lt.content instanceof a&&Pt(Lt.content),Vt(Lt));if(te)return Ke;if(_e){if(ge)for(Gt=T.call(Je.ownerDocument);Je.firstChild;)Gt.appendChild(Je.firstChild);else Gt=Je;return(ie.shadowroot||ie.shadowrootmode)&&(Gt=F.call(r,Gt,!0)),Gt}let Me=Z?Je.outerHTML:Je.innerHTML;return Z&&Y["!doctype"]&&Je.ownerDocument&&Je.ownerDocument.doctype&&Je.ownerDocument.doctype.name&&Do(DF,Je.ownerDocument.doctype.name)&&(Me="<!DOCTYPE "+Je.ownerDocument.doctype.name+`>
2389
- `+Me),re&&n4([M,z,P],Qe=>{Me=b2(Me,Qe," ")}),S&&ve?S.createHTML(Me):Me},e.setConfig=function(){let Ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Cn(Ke),K=!0},e.clearConfig=function(){vn=null,K=!1},e.isValidAttribute=function(Ke,Oe,Je){vn||Cn({});const ot=yn(Ke),Lt=yn(Oe);return at(ot,Lt,Je)},e.addHook=function(Ke,Oe){typeof Oe=="function"&&(B[Ke]=B[Ke]||[],v2(B[Ke],Oe))},e.removeHook=function(Ke){if(B[Ke])return SF(B[Ke])},e.removeHooks=function(Ke){B[Ke]&&(B[Ke]=[])},e.removeAllHooks=function(){B={}},e}var s4=NF();const ea=t=>{var x;const{field:e,fieldIndex:n,pageIndex:r,sectionIndex:i,rowIndex:a,columnIndex:s,path:l}=t,[c,u]=N.useState(e);N.useEffect(()=>{var S;return A((S=e==null?void 0:e.label)==null?void 0:S[d==null?void 0:d.type]),()=>{}},[e]);const{userSelectedLanguage:d,fieldSettingUpdate:f,fieldSettingUpdateInlineConditional:h,gridComponentFieldSettingUpdate:m}=ln(),g=(S,E,C)=>{u(_=>({..._,[S]:{..._[S],[E==null?void 0:E.type]:C}}))},[v,A]=N.useState((x=e==null?void 0:e.label)==null?void 0:x[d==null?void 0:d.type]);N.useEffect(()=>(w(),()=>{}),[c]);const w=()=>{const S=l.split("-").map(Number);(t==null?void 0:t.fieldContainer)==="inline-condition-container"?h(S[la],S[ca],S[ha],S[pa],S[ga],S[Sa],S[$o],S[yo],c):(S==null?void 0:S.length)>Sa&&(S==null?void 0:S.length)===Vl+1&&(e!=null&&e.componentType)&&(t==null?void 0:t.fieldContainer)==="grid-container"?m(S[la],S[ca],S[ha],S[pa],S[ga],S[5],S[6],S[7],c):f(r,i,a,s,n,{...e,label:c==null?void 0:c.label})};return o.jsx(o.Fragment,{children:o.jsx(t4,{style:{display:"inline-block"},className:"builder-input-label-edit",html:v,disabled:!1,onChange:S=>{var E;A(s4.sanitize((E=S==null?void 0:S.target)==null?void 0:E.value))},onBlur:S=>{var C;const E=s4.sanitize((C=S==null?void 0:S.target)==null?void 0:C.innerText);console.log("DOMPurify.sanitize(e?.target?.innerText)",E),A(E),g("label",d,E)},tagName:"article"})})},i1=t=>{const{onLabel:e,offLabel:n,onIcon:r,offIcon:i,onHandleChangeSetttings:a,settingsKey:s,settingsKeyValue:l}=t;return o.jsx(o.Fragment,{children:o.jsx(a2,{checked:l,onLabel:e,onChange:c=>{a(s,c.value)},offLabel:n,onIcon:r,offIcon:i,className:"mr-1 px-1",style:{fontSize:"0.8rem"}})})},Hr=t=>{var de,fe,ne,W;const{field:e,fieldIndex:n,columnIndex:r,sectionIndex:i,rowIndex:a,pageIndex:s,type:l,path:c,handleFieldSettingsSidebar:u,showFieldIcons:d=!0,showSettingsIcon:f=!0}=t,{emitSocketData:h}=tn(),m=(ae,Y)=>{B(pe=>({...pe,[ae]:Y}))},{fieldSettingUpdate:g,fieldSettingUpdateInlineConditional:v,cloneField:A,gridComponentFieldSettingUpdate:w,fieldSettingDeleteInlineConditional:x,gridComponentFieldDelete:S,removeField:E}=ln(),{updateGlobalToast:C}=tn(),_=ae=>{const Y=c.split("-").map(Number);(t==null?void 0:t.fieldContainer)==="inline-condition-container"?v(Y[la],Y[ca],Y[ha],Y[pa],Y[ga],Y[Sa],Y[$o],Y[yo],ae):(Y==null?void 0:Y.length)>Sa&&(Y==null?void 0:Y.length)===Vl+1&&(ae!=null&&ae.componentType)&&(t==null?void 0:t.fieldContainer)==="grid-container"?w(Y[la],Y[ca],Y[ha],Y[pa],Y[ga],Y[5],Y[6],Y[7],ae):g(s,i,a,r,n,ae),C({showToast:!0,toastMessage:"Updated",toastDetail:"Field Updated",toastType:"success"})},[T,O]=N.useState(!1),[F,B]=N.useState({custom_component_title:"",custom_component_description:""}),M=()=>{B(ae=>({...ae,custom_component_schema:e})),O(!0)},z=()=>{const ae=c.split("-").map(Number);l==="inline-conditional"?x(ae[la],ae[ca],ae[ha],ae[pa],ae[ga],ae[Sa],ae[$o],ae[yo]):(ae==null?void 0:ae.length)>Sa&&(ae==null?void 0:ae.length)===Vl+1&&(e!=null&&e.componentType)&&l==="grid"?S(ae[la],ae[ca],ae[ha],ae[pa],ae[ga],ae[5],ae[6],ae[7]):E(s,i,a,r,n)},P=(ae,Y)=>{const pe={...e,attributes:{...e.attributes,[ae]:Y}};_(pe)},H=(ae,Y)=>{const pe={...e,[ae]:Y};_(pe)};return o.jsx(o.Fragment,{children:o.jsxs("div",{className:`${(e==null?void 0:e.componentType)!=="hidden-field"&&(e==null?void 0:e.componentType)!=="image"&&(e==null?void 0:e.componentType)!=="href"&&(e==null?void 0:e.componentType)!=="paragraph"&&(e==null?void 0:e.componentType)!=="heading"&&(e==null?void 0:e.componentType)!=="list"&&(e==null?void 0:e.componentType)!=="hr"&&(e==null?void 0:e.componentType)!=="image-gallery"&&(e==null?void 0:e.componentType)!=="video"&&(e==null?void 0:e.componentType)!=="question"?"builder-element-quick-options mb-2 w-9 justify-content-between":"builder-element-quick-options mb-2 w-4 justify-content-center"} flex quick-setting`,children:[o.jsx(o.Fragment,{children:(e==null?void 0:e.componentType)!=="hidden-field"&&(e==null?void 0:e.componentType)!=="image"&&(e==null?void 0:e.componentType)!=="href"&&(e==null?void 0:e.componentType)!=="paragraph"&&(e==null?void 0:e.componentType)!=="heading"&&(e==null?void 0:e.componentType)!=="list"&&(e==null?void 0:e.componentType)!=="hr"&&(e==null?void 0:e.componentType)!=="image-gallery"&&(e==null?void 0:e.componentType)!=="video"&&(e==null?void 0:e.componentType)!=="question"&&d===!0&&o.jsxs("div",{className:" ",children:[o.jsx(i1,{field:e,onHandleChangeSetttings:P,settingsKey:"required",settingsKeyValue:(de=e==null?void 0:e.attributes)==null?void 0:de.required,onLabel:"Required",offLabel:"Not Required",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:(fe=e==null?void 0:e.attributes)==null?void 0:fe.required}),o.jsx(i1,{field:e,onHandleChangeSetttings:H,settingsKey:"showToolTip",settingsKeyValue:e==null?void 0:e.showToolTip,onLabel:"Tooltip",offLabel:"Tooltip",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:e==null?void 0:e.showToolTip}),o.jsx(i1,{field:e,onHandleChangeSetttings:H,settingsKey:"showHelperText",settingsKeyValue:e==null?void 0:e.showHelperText,onLabel:"Helper text",offLabel:"Helper text",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:e==null?void 0:e.showHelperText}),o.jsx(i1,{field:e,onHandleChangeSetttings:H,settingsKey:"showHeaderText",settingsKeyValue:e==null?void 0:e.showHeaderText,onLabel:"Header text",offLabel:"Header text",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:e==null?void 0:e.showHeaderText}),o.jsx(i1,{field:e,onHandleChangeSetttings:H,settingsKey:"isFluid",settingsKeyValue:e==null?void 0:e.isFluid,onLabel:"Fluid",offLabel:"Fluid",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:e==null?void 0:e.isFluid}),(e==null?void 0:e.componentType)=="radio"&&o.jsxs(o.Fragment,{children:[o.jsx(i1,{field:e,onHandleChangeSetttings:H,settingsKey:"showAlphabetList",settingsKeyValue:e==null?void 0:e.showAlphabetList,onLabel:"Alpha",offLabel:"Alpha",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:e==null?void 0:e.showAlphabetList}),o.jsx(i1,{field:e,onHandleChangeSetttings:P,settingsKey:"style",settingsKeyValue:(ne=e==null?void 0:e.attributes)==null?void 0:ne.style,onLabel:"Style",offLabel:"Style",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:(W=e==null?void 0:e.attributes)==null?void 0:W.style})]})]})}),o.jsxs("div",{className:"quick-setting",children:[f===!0&&o.jsxs("span",{className:"p-buttonset",children:[(e==null?void 0:e.componentType)!=="hr"&&o.jsx(kt,{text:!0,size:"small",label:"Advance Settings",icon:"pi pi-cog",onClick:()=>{u(!0)},className:"mr-3"}),o.jsx(kt,{size:"small",text:!0,icon:"pi pi-clone",outlined:!0,onClick:()=>{A(e,s,i,a,r,n),h()}}),o.jsx(kt,{text:!0,size:"small",outlined:!0,icon:"pi pi-trash",onClick:()=>{z()}}),o.jsx(kt,{text:!0,size:"small",outlined:!0,icon:"pi pi-file",onClick:()=>{M()}})]}),o.jsxs(As,{maximizable:!0,header:"Custom component save",visible:T,style:{width:"20vw"},footer:()=>o.jsx(o.Fragment,{children:o.jsxs("div",{children:[o.jsx(kt,{size:"small",text:!0,label:"Close",icon:"pi pi-times",onClick:()=>O(!1),className:"p-button-text"}),(e==null?void 0:e.componentType)!=="hidden-field"&&o.jsx(kt,{text:!0,label:"Save",icon:"pi pi-check",onClick:()=>{O(!1)},autoFocus:!0})]})}),onHide:()=>O(!1),children:[o.jsxs("span",{className:"p-float-label",children:[o.jsx(gn,{id:"custom_component_title",name:"custom_component_title",className:"w-full",value:(F==null?void 0:F.custom_component_title)||"",onChange:ae=>{var Y;return m("custom_component_title",(Y=ae==null?void 0:ae.target)==null?void 0:Y.value)}}),o.jsx("label",{htmlFor:"username",children:"Custom component title"})]}),o.jsxs("span",{className:"p-float-label mt-5",children:[o.jsx(Ds,{id:"custom_component_description",name:"custom_component_description",className:"w-full",value:(F==null?void 0:F.custom_component_description)||"",onChange:ae=>{var Y;return m("custom_component_description",(Y=ae==null?void 0:ae.target)==null?void 0:Y.value)}}),o.jsx("label",{htmlFor:"username",children:"Custom component description"})]})]})]})]})})},L0e=t=>{var Q,oe,ye,Te,Ae,be,we,re;const{pageIndex:e,sectionIndex:n,field:r,fieldIndex:i,row:a,rowIndex:s,columnIndex:l}=t,{isAdmin:c,isRenderView:u,isPreview:d}=tn(),{userSelectedLanguage:f,fieldSettingUpdate:h}=ln(),{task_status:m,taskRegisterData:g,updateTaskRegisterData:v,updateTaskProgressValue:A,updateUserFormDataSubmit:w,userTaskSubmitFormData:x,TASK_PUBLISHED:S}=Pr(),[E,C]=N.useState(!1),[_,T]=N.useState(!1),[O,F]=N.useState(null),[B,M]=N.useState(0),[z,P]=N.useState(!1),H=()=>{P(!0)},de=()=>{P(!1)},fe=U=>{C(U)},ne=()=>{C(!1)},W=()=>{var U,Z,K;if(a!=null&&a.rowIsRepeatable){if(a!=null&&a.repeatableFields){const he=[...a.repeatableFields],_e=Et.findIndex(he,function(ge){return ge.uuid===(r==null?void 0:r.uuid)});_e>=0&&he[_e].fieldData?F(he[_e].fieldData):(r.isValid=0,F(null))}}else{const he=x,_e=Et.cloneDeep(g);if(he!=null&&he.length){for(const ge of he)if(ge.fieldId===t.field.uuid&&((U=ge==null?void 0:ge.postData)!=null&&U.length)){F((Z=ge==null?void 0:ge.postData[0])==null?void 0:Z.postValue),_e[r==null?void 0:r.uuid]=(K=ge==null?void 0:ge.postData[0])==null?void 0:K.postValue;const ve=Object.keys(_e).length;A(ve);break}}}T(!0)},ae=U=>{var _e;F(U.target.value);const Z=x,K=Et.cloneDeep(g);if((_e=U==null?void 0:U.target)!=null&&_e.value&&(Z==null?void 0:Z.length)>0)for(const ge of Z)ge.fieldId===t.field.uuid&&(K[r==null?void 0:r.uuid]=U==null?void 0:U.value,ge.postData[0]={postValue:U.value});else delete K[r==null?void 0:r.uuid];v(K);const he=Object.keys(K).length;A(he)};N.useEffect(()=>{_||W();const U=Rt.addListener("clearRepeatableFields",he=>{he===(a==null?void 0:a.uuid)&&(F(""),M(0),r.isValid=0,h(e,n,s,l,i,r))}),Z=Rt.addListener("onSubmitUserForm",()=>{var he;(he=r==null?void 0:r.attributes)!=null&&he.required?O?r.isValid=1:r.isValid=0:r.isValid=1}),K=Rt.addListener("OnInvalidFieldCatch",he=>{r.uuid===(he==null?void 0:he.fieldId)?M(1):M(0)});return()=>{Z.remove(),K.remove(),U.remove()}});const Y=(U,Z)=>{var K;if(x){const he=[...x],_e=Et.findIndex(he,function(ve){return ve.rowId===(a==null?void 0:a.uuid)});let ge=(K=x[_e])==null?void 0:K.repeatableFields;ge={...ge,[U==null?void 0:U.uuid]:Z},he[_e]={...he[_e],repeatableFields:ge},w(he)}F(Z),Z!==null?U.isValid=1:U.isValid=0},pe=(U,Z)=>U?o.jsxs("div",{className:"country-item flex",children:[o.jsx("img",{alt:U.name,src:U==null?void 0:U.image,onError:K=>K.target.src="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png",style:{width:"20px",marginRight:10}}),o.jsx("div",{children:U.name})]}):o.jsx("span",{children:Z.placeholder}),ie=U=>o.jsxs("div",{className:"country-item flex",children:[o.jsx("img",{alt:U.name,src:U==null?void 0:U.image,onError:Z=>Z.target.src="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png",style:{width:"20px",marginRight:10}}),o.jsx("div",{children:U.name})]}),J=o.jsxs("div",{onMouseOver:H,onMouseOut:de,children:[!u&&!d&&z&&o.jsx(Hr,{handleFieldSettingsSidebar:fe,...t}),o.jsxs("div",{className:`field ${d?" ":" builder-element-wrapper "}${(r==null?void 0:r.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[o.jsx("div",{className:"grid",children:o.jsxs("div",{className:d?"col-12 ":"field-form-builder col-12 ",children:[(r==null?void 0:r.showHeaderText)&&o.jsx("h6",{children:(Q=r==null?void 0:r.headerText)==null?void 0:Q[f==null?void 0:f.type]}),(r==null?void 0:r.showLabel)&&o.jsxs("label",{htmlFor:i,className:"flex font-medium mb-3 text-700 text-2xl",children:[o.jsx(sa,{...t}),((oe=r==null?void 0:r.attributes)==null?void 0:oe.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",d?o.jsx(o.Fragment,{children:(ye=r==null?void 0:r.label)==null?void 0:ye[f==null?void 0:f.type]}):o.jsx(ea,{...t}),o.jsx("span",{className:"ml-3",children:(r==null?void 0:r.showToolTip)&&o.jsx(Vi,{message:(Te=r==null?void 0:r.toolTip)==null?void 0:Te[f==null?void 0:f.type],position:"right"})})]}),o.jsx(xa,{className:"country-select-builder-component",onFocus:()=>M(1),onChange:U=>{a!=null&&a.rowIsRepeatable?Y(r,U.target.value):ae(U)},options:r==null?void 0:r.countries,optionLabel:"name",value:O,placeholder:(Ae=r==null?void 0:r.placeholder)==null?void 0:Ae[f==null?void 0:f.type],disabled:m===S,valueTemplate:pe,itemTemplate:ie,filter:!0,filterBy:"name",showClear:!0}),((be=r==null?void 0:r.attributes)==null?void 0:be.required)&&o.jsx("small",{className:"error",children:B===1&&!O?(we=r==null?void 0:r.validationMesssage)==null?void 0:we.language:""}),o.jsx("div",{children:(r==null?void 0:r.showHelperText)&&o.jsx("small",{children:(re=r==null?void 0:r.helperText)==null?void 0:re[f==null?void 0:f.type]})})]})}),c&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(Fi,{...t})]})]})]});return o.jsxs(o.Fragment,{children:[E===!0&&o.jsx(Ri,{visibilty:E,closeSettingFieldSidebar:ne,...t},r==null?void 0:r.uuid),o.jsx(wi,{...t,fieldWrap:J})]})},B0e=t=>{var Q,oe,ye,Te,Ae,be,we,re,U,Z,K,he,_e,ge,ve;const{taskRegisterData:e,updateTaskRegisterData:n,updateTaskProgressValue:r,updateUserFormDataSubmit:i,userTaskSubmitFormData:a,task_status:s,TASK_PUBLISHED:l}=Pr(),{userSelectedLanguage:c,fieldSettingUpdate:u}=ln(),{field:d,fieldIndex:f,sectionIndex:h,pageIndex:m,row:g,rowIndex:v,columnIndex:A}=t,{isAdmin:w,isRenderView:x,isPreview:S}=tn(),[E,C]=N.useState(!1),[_,T]=N.useState(""),[O,F]=N.useState(null),[B,M]=N.useState(0),[z,P]=N.useState(!1),[H,de]=N.useState(!1),fe=()=>{de(!0)},ne=()=>{de(!1)},W=()=>{var Le,Ne,me;if(g!=null&&g.rowIsRepeatable){if(g!=null&&g.repeatableFields){const V=[...g.repeatableFields],te=Et.findIndex(V,function(X){return X.uuid===(d==null?void 0:d.uuid)});te>=0&&V[te].fieldData?T(V[te].fieldData):T("")}}else{const V=a;if(V!=null&&V.length){for(const te of V)if(te.fieldId===t.field.uuid&&((Le=te==null?void 0:te.postData[0])==null?void 0:Le.postValue)!==""&&((Ne=te==null?void 0:te.postData[0])!=null&&Ne.postValue)){T((me=te==null?void 0:te.postData[0])==null?void 0:me.postValue);break}}}P(!0)};N.useEffect(()=>{z||W();const Le=Rt.addListener("clearRepeatableFields",X=>{X===(g==null?void 0:g.uuid)&&(T(""),M(0),d.isValid=0,u(m,h,v,A,f,d))}),Ne=Rt.addListener("onSubmitUserForm",()=>{var X,se;(X=d==null?void 0:d.attributes)!=null&&X.required?_&&_.length&&(_==null?void 0:_.length)<((se=d==null?void 0:d.attributes)==null?void 0:se.minLength)?d.isValid=1:d.isValid=0:d.isValid=1}),me=Rt.addListener("OnInvalidFieldCatch",X=>{d.uuid===(X==null?void 0:X.fieldId)?M(1):M(0)}),V=Rt.addListener("OnGetFieldValue",X=>{var ue;const se=(ue=X==null?void 0:X.repeatableColumn)==null?void 0:ue.filter(Se=>(Se==null?void 0:Se.fieldUuid)===(d==null?void 0:d.uuid));se!=null&&se.length}),te=Rt.addListener("formFieldAdded",X=>{O===null&&F(X==null?void 0:X.uuid)});return()=>{Ne.remove(),me.remove(),V.remove(),Le.remove(),te.remove()}}),N.useEffect(()=>(O!==null&&setTimeout(()=>{F(null)},1e3),()=>{}),[O]);const ae=Le=>{C(Le)},Y=()=>{C(!1)},pe=Le=>{var V,te;T(Le.target.value);const Ne=a,me=Et.cloneDeep(e);if(Ne!==null){if((V=Le==null?void 0:Le.target)!=null&&V.value){if(me[d==null?void 0:d.uuid]=(te=Le==null?void 0:Le.target)==null?void 0:te.value,(Ne==null?void 0:Ne.length)>0)for(const X of Ne)X.fieldId===t.field.uuid&&(X.postData[0]={postValue:Le.target.value})}else if(delete me[d==null?void 0:d.uuid],(Ne==null?void 0:Ne.length)>0)for(const X of Ne)X.fieldId===t.field.uuid&&(X.postData[0]={postValue:""})}if(!(g!=null&&g.rowIsRepeatable)){n(me);const X=Object.keys(me).length;r(X)}},ie=(Le,Ne)=>{var me;if(a){const V=[...a],te=Et.findIndex(V,function(se){return se.rowId===(g==null?void 0:g.uuid)});let X=(me=a[te])==null?void 0:me.repeatableFields;X={...X,[Le==null?void 0:Le.uuid]:Ne},V[te]={...V[te],repeatableFields:X},i(V)}T(Ne),Ne!==""?Le.isValid=1:Le.isValid=0},J=o.jsxs("div",{onMouseOver:fe,onMouseOut:ne,children:[!x&&!S&&H&&o.jsx(Hr,{handleFieldSettingsSidebar:ae,...t}),o.jsxs("div",{className:`field ${S?" ":" builder-element-wrapper "} ${(d==null?void 0:d.isFluid)===!0?" p-fluid ":""} ${x?" ":" py-6 px-4 "} ${O===(d==null?void 0:d.uuid)?" new-field ":" card "} `,children:[o.jsx("div",{className:"grid",children:o.jsxs("div",{className:w?"col-6 ":"col-12 p-fluid",children:[(d==null?void 0:d.showHeaderText)&&o.jsx("h6",{children:(Q=d==null?void 0:d.headerText)==null?void 0:Q[c==null?void 0:c.type]}),(d==null?void 0:d.showLabel)&&o.jsxs("label",{htmlFor:d==null?void 0:d.uuid,className:"flex font-medium mb-3 text-700 text-2xl",children:[o.jsx(sa,{...t}),((oe=d==null?void 0:d.attributes)==null?void 0:oe.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",S?o.jsx(o.Fragment,{children:(ye=d==null?void 0:d.label)==null?void 0:ye[c==null?void 0:c.type]}):o.jsx(ea,{...t}),(d==null?void 0:d.showToolTip)&&o.jsx("span",{className:"ml-3",children:o.jsx(Vi,{message:(Te=d==null?void 0:d.toolTip)==null?void 0:Te[c==null?void 0:c.type],position:"right"})})]}),o.jsxs("div",{className:"mt-3",children:[o.jsxs("span",{className:"p-input-icon-"+(d==null?void 0:d.iconAlignment),children:[(d==null?void 0:d.showIcon)&&o.jsx("i",{className:"pi pi-"+((be=(Ae=d==null?void 0:d.icon)==null?void 0:Ae.properties)==null?void 0:be.name)}),o.jsx(gn,{id:d==null?void 0:d.uuid,placeholder:(we=d==null?void 0:d.placeholder)==null?void 0:we[c==null?void 0:c.type],minLength:(re=d==null?void 0:d.attributes)==null?void 0:re.minLength,maxLength:(U=d==null?void 0:d.attributes)==null?void 0:U.maxLength,value:_,onFocus:()=>M(1),onChange:Le=>{g!=null&&g.rowIsRepeatable?ie(d,Le.target.value):pe(Le)},className:B===1&&((Z=d==null?void 0:d.attributes)!=null&&Z.required)?_?"valid":"invalid":"valid'",readOnly:s===l})]}),o.jsx("div",{children:((K=d==null?void 0:d.attributes)==null?void 0:K.required)&&o.jsxs(o.Fragment,{children:[o.jsx("small",{className:"error",children:B===1&&!_?(he=d==null?void 0:d.validationMesssage)==null?void 0:he.english:""}),o.jsx("small",{className:"error",children:B===1&&_.length&&(_==null?void 0:_.length)<((_e=d==null?void 0:d.attributes)==null?void 0:_e.minLength)?`Mini length ${(ge=d==null?void 0:d.attributes)==null?void 0:ge.minLength}`:""})]})}),o.jsx("div",{children:(d==null?void 0:d.showHelperText)&&o.jsx("small",{children:(ve=d==null?void 0:d.helperText)==null?void 0:ve[c==null?void 0:c.type]})})]})]})}),w&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(Fi,{...t})]})]})]});return o.jsxs(o.Fragment,{children:[E===!0&&o.jsx(Ri,{visibilty:E,closeSettingFieldSidebar:Y,...t}),o.jsx(wi,{...t,fieldWrap:J})]})},V0e=t=>{var i,a;const{language:e,onHandleChange:n,fieldState:r}=t;return o.jsxs("form",{className:"p-fluid",children:[o.jsxs("div",{className:"field",children:[o.jsx("label",{children:"Href Text"}),o.jsx(gn,{value:(i=r==null?void 0:r.text)==null?void 0:i[e==null?void 0:e.type],onChange:s=>n("text",e,s.target.value)})]}),o.jsxs("div",{className:"field",children:[o.jsx("label",{children:"Hyper Link"}),o.jsx(gn,{value:(a=r==null?void 0:r.hrefLink)==null?void 0:a[e==null?void 0:e.type],onChange:s=>n("hrefLink",e,s.target.value)})]})]})},U0e=t=>{var r;const{onHandleChangeStyling:e,fieldState:n}=t;return o.jsxs("form",{className:"p-fluid",children:[o.jsxs("div",{className:"field",children:[o.jsx("label",{className:"mr-2",children:"Hyper Link Color"}),o.jsx(Zd,{value:n==null?void 0:n.color,onChange:i=>{e("color",i.value)}})]}),o.jsxs("div",{className:"field",children:[o.jsx("label",{children:"Font Size"}),o.jsx(gn,{type:"number",maxLength:2,placeholder:"eg 20px",value:(r=Number(n==null?void 0:n.fontSize))==null?void 0:r.toFixed(0),onChange:i=>{e("fontSize",i.target.value)}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Or,{checked:n==null?void 0:n.underLined,onChange:i=>{e("underLined",i.checked)}}),o.jsx("label",{children:"Underline link"})]})]})},q0e=t=>{const{visibilty:e,field:n,closeSettingFieldSidebar:r,pageIndex:i,sectionIndex:a,rowIndex:s,columnIndex:l,fieldIndex:c}=t,[u,d]=N.useState(n),{fieldSettingUpdate:f,formBuilderSchemaLanguages:h,formBuilderPublishedStatus:m}=ln(),{updateGlobalToast:g}=tn(),v=(x,S,E)=>{d(C=>({...C,[x]:{...C[x],[S==null?void 0:S.type]:E}}))},A=(x,S)=>{d(E=>({...E,[x]:S}))},w=()=>{f(i,a,s,l,c,u),g({showToast:!0,toastMessage:"Updated",toastDetail:"Html Updated",toastType:"success"})};return o.jsx(o.Fragment,{children:o.jsxs(Io,{visible:e,position:"left",className:"p-sidebar-lg",onHide:()=>r(),children:[o.jsxs("div",{className:"flex justify-content-between flex-wrap card-container ",children:[o.jsxs("div",{className:"flex align-items-center justify-content-center ",children:[" ",o.jsxs("h5",{className:"mb-0",children:[t==null?void 0:t.typeName," Settings "]})]}),!m&&o.jsx("div",{className:"flex align-items-center justify-content-center",children:o.jsx(kt,{className:"mt-3",label:"Update",onClick:()=>w(),"aria-label":"Update"})})]}),o.jsxs(Ka,{children:[o.jsx(hr,{header:"Text",children:o.jsx(ao,{activeIndex:0,children:h!=null&&h.length?h.map((x,S)=>o.jsx(io,{tabIndex:S,header:x==null?void 0:x.language,children:o.jsx(V0e,{language:x,fieldState:u,onHandleChange:v,...t})},S)):""})}),o.jsx(hr,{header:"Styling",children:o.jsx(U0e,{fieldState:u,onHandleChangeStyling:A,...t})})]})]})})},j0e=t=>{var m,g,v,A,w,x,S,E,C;const{field:e}=t,{userSelectedLanguage:n}=ln(),{isPreview:r}=tn(),[i,a]=N.useState(!1),[s,l]=N.useState(!1),c=()=>{l(!0)},u=()=>{l(!1)},d=_=>{a(_)},f=()=>{a(!1)};N.useEffect(()=>{},[e]);const h=o.jsxs("div",{className:r?"":"builder-element-wrapper",onMouseOver:c,onMouseOut:u,children:[!r&&s&&o.jsx(Hr,{handleFieldSettingsSidebar:d,...t}),o.jsxs("div",{className:r?" px-4":"field-form-builder px-4",children:[(e==null?void 0:e.showHeaderText)&&o.jsx("h6",{children:(m=e==null?void 0:e.headerText)==null?void 0:m[n==null?void 0:n.type]}),(e==null?void 0:e.showLabel)&&o.jsxs("label",{htmlFor:e.uuid,className:"flex font-medium mb-3 text-700 text-2xl",children:[((g=e==null?void 0:e.attributes)==null?void 0:g.required)&&o.jsx("span",{className:"must-required",children:"*"})," ",r?o.jsx(o.Fragment,{children:(v=e==null?void 0:e.label)==null?void 0:v[n==null?void 0:n.type]}):o.jsx(ea,{...t}),o.jsx("span",{className:"ml-3",children:(e==null?void 0:e.showToolTip)&&o.jsx(Vi,{message:(A=e==null?void 0:e.toolTip)==null?void 0:A[n==null?void 0:n.type],position:"right"})})]}),o.jsx("a",{style:{fontSize:parseInt(e==null?void 0:e.fontSize),color:`#${e==null?void 0:e.color}`,textDecoration:e!=null&&e.underLined?"underline":"none"},className:"atag-style",href:(w=e==null?void 0:e.hrefLink)==null?void 0:w[n==null?void 0:n.type],children:(x=e==null?void 0:e.text)==null?void 0:x[n==null?void 0:n.type]}),((S=e==null?void 0:e.attributes)==null?void 0:S.required)&&o.jsx("small",{className:"error",children:(E=e==null?void 0:e.validationMesssage)==null?void 0:E[n==null?void 0:n.type]}),(e==null?void 0:e.showHelperText)&&o.jsx("small",{children:(C=e==null?void 0:e.helperText)==null?void 0:C[n==null?void 0:n.type]})]})]});return o.jsxs(o.Fragment,{children:[o.jsx(q0e,{visibilty:i,closeSettingFieldSidebar:f,...t}),o.jsx(wi,{...t,fieldWrap:h})]})},$0e=t=>{var Q,oe,ye,Te,Ae,be,we,re,U,Z,K,he,_e,ge,ve,Le,Ne,me,V,te,X;const{field:e,fieldIndex:n,sectionIndex:r,pageIndex:i,row:a,rowIndex:s,columnIndex:l}=t,{isPreview:c,isRenderView:u,isAdmin:d}=tn(),{taskRegisterData:f,updateTaskRegisterData:h,updateTaskProgressValue:m,updateUserFormDataSubmit:g,userTaskSubmitFormData:v,TASK_PUBLISHED:A,task_status:w}=Pr(),{userSelectedLanguage:x,fieldSettingUpdate:S}=ln(),[E,C]=N.useState(null),[_,T]=N.useState(!1),[O,F]=N.useState(null),[B,M]=N.useState(0),[z,P]=N.useState(!1),[H,de]=N.useState(!1),fe=()=>{de(!0)},ne=()=>{de(!1)},W=()=>{var se,ue;if(a!=null&&a.rowIsRepeatable){if(a!=null&&a.repeatableFields){const Se=[...a.repeatableFields],De=Et.findIndex(Se,function(je){return je.uuid===(e==null?void 0:e.uuid)});De>=0&&Se[De].fieldData?F(Number(Se[De].fieldData)||null):F(null)}}else{const Se=v;if(Se!=null&&Se.length){for(const De of Se)if(De.fieldId===t.field.uuid&&((se=De==null?void 0:De.postData)!=null&&se.length)){F(Number((ue=De==null?void 0:De.postData[0])==null?void 0:ue.postValue)||null);break}}}P(!0)};N.useEffect(()=>{z||W();const se=Rt.addListener("clearRepeatableFields",ct=>{ct===(a==null?void 0:a.uuid)&&(F(null),M(0),e.isValid=0,S(i,r,s,l,n,e))}),ue=Rt.addListener("onSubmitUserForm",()=>{var ct;(ct=e==null?void 0:e.attributes)!=null&&ct.required?O?e.isValid=1:e.isValid=0:e.isValid=1}),Se=Rt.addListener("OnInvalidFieldCatch",ct=>{e.uuid===(ct==null?void 0:ct.fieldId)?M(1):M(0)}),De=Rt.addListener("OnGetFieldValue",ct=>{var nt;const Dt=(nt=ct==null?void 0:ct.repeatableColumn)==null?void 0:nt.filter(xt=>(xt==null?void 0:xt.fieldUuid)===(e==null?void 0:e.uuid));Dt!=null&&Dt.length}),je=Rt.addListener("formFieldAdded",ct=>{E===null&&C(ct.uuid)});return()=>{ue.remove(),Se.remove(),De.remove(),se.remove(),je.remove()}}),N.useEffect(()=>(E!==null&&setTimeout(()=>{C(null)},1e3),()=>{}),[E]);const ae=se=>{T(se)},Y=()=>{T(!1)},pe=se=>{const ue=v,Se=Et.cloneDeep(f);if(ue!==null){if(se){if(Se[e==null?void 0:e.uuid]=se,(ue==null?void 0:ue.length)>0)for(const De of ue)De.fieldId===t.field.uuid&&(De.postData[0]={postValue:se})}else if(delete Se[e==null?void 0:e.uuid],(ue==null?void 0:ue.length)>0)for(const De of ue)De.fieldId===t.field.uuid&&(De.postData[0]={postValue:""})}if(!(a!=null&&a.rowIsRepeatable)){h(Se);const De=Object.keys(Se).length;m(De)}},ie=(se,ue)=>{var Se;if(v!=null&&v.length){const De=[...v],je=Et.findIndex(De,function(Dt){return Dt.rowId===(a==null?void 0:a.uuid)});let ct=(Se=v[je])==null?void 0:Se.repeatableFields;ct={...ct,[se==null?void 0:se.uuid]:ue},De[je]={...De[je],repeatableFields:ct},g(De)}F(ue),ue!==""?se.isValid=1:se.isValid=0},J=o.jsxs("div",{onMouseOver:fe,onMouseOut:ne,children:[!u&&!c&&H&&o.jsx(Hr,{handleFieldSettingsSidebar:ae,...t}),o.jsxs("div",{className:`field ${c?" ":" builder-element-wrapper "}${(e==null?void 0:e.isFluid)===!0?" p-fluid py-6 px-4":" py-6 px-4"} ${E===(e==null?void 0:e.uuid)?" new-field ":" card "}`,children:[o.jsx("div",{className:"grid",children:o.jsxs("div",{className:d?"col-6 ":"col-12 p-fluid",children:[(e==null?void 0:e.showHeaderText)&&o.jsx("h6",{children:(Q=e==null?void 0:e.headerText)==null?void 0:Q[x==null?void 0:x.type]}),(e==null?void 0:e.showLabel)&&o.jsxs("label",{htmlFor:e.uuid,className:"flex font-medium mb-3 text-700 text-2xl",children:[o.jsx(sa,{...t}),((oe=e==null?void 0:e.attributes)==null?void 0:oe.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",c?o.jsx(o.Fragment,{children:(ye=e==null?void 0:e.label)==null?void 0:ye[x==null?void 0:x.type]}):o.jsx(ea,{...t}),o.jsx("span",{className:"ml-3",children:(e==null?void 0:e.showToolTip)&&o.jsx(Vi,{message:(Te=e==null?void 0:e.toolTip)==null?void 0:Te[x==null?void 0:x.type],position:"right"})})]}),o.jsxs("div",{className:"mt-3",children:[o.jsxs("span",{className:"p-input-icon-"+(e==null?void 0:e.iconAlignment),children:[(e==null?void 0:e.showIcon)&&o.jsx("i",{className:"pi pi-"+((be=(Ae=e==null?void 0:e.icon)==null?void 0:Ae.properties)==null?void 0:be.name)}),o.jsx(Na,{readOnly:w===A,id:e==null?void 0:e.uuid,placeholder:(we=e==null?void 0:e.placeholder)==null?void 0:we[x==null?void 0:x.type],value:O,min:(re=e==null?void 0:e.attributes)==null?void 0:re.min,max:e==null?void 0:e.attributes.max,suffix:e==null?void 0:e.attributes.suffix,prefix:(U=e==null?void 0:e.attributes)==null?void 0:U.prefix,showButtons:(Z=e==null?void 0:e.attributes)==null?void 0:Z.showButtons,pt:{incrementButton:{className:"bg-teal-500 border-teal-500"},decrementButton:{className:"bg-orange-500 border-orange-500"}},minFractionDigits:(K=e==null?void 0:e.attributes)==null?void 0:K.minFractionDigits,maxFractionDigits:(he=e==null?void 0:e.attributes)==null?void 0:he.maxFractionDigits,locale:(_e=e==null?void 0:e.attributes)==null?void 0:_e.locale,mode:(ge=e==null?void 0:e.attributes)==null?void 0:ge.mode,currency:(ve=e==null?void 0:e.attributes)==null?void 0:ve.currency,currencyDisplay:(Le=e==null?void 0:e.attributes)==null?void 0:Le.currencyDisplay,useGrouping:(Ne=e==null?void 0:e.attributes)==null?void 0:Ne.useGrouping,onFocus:()=>M(1),onChange:se=>{a!=null&&a.rowIsRepeatable?ie(e,se.value):pe(se.value)},className:B===1&&((me=e==null?void 0:e.attributes)!=null&&me.required)?O?"valid":"invalid":"valid'"})]}),o.jsx("div",{children:((V=e==null?void 0:e.attributes)==null?void 0:V.required)&&o.jsx("small",{className:"error",children:B===1&&!O?(te=e==null?void 0:e.validationMesssage)==null?void 0:te.english:""})}),o.jsx("div",{children:(e==null?void 0:e.showHelperText)&&o.jsx("small",{children:(X=e==null?void 0:e.helperText)==null?void 0:X[x==null?void 0:x.type]})})]})]})}),d&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(Fi,{...t})]})]})]});return o.jsxs(o.Fragment,{children:[_===!0&&o.jsx(Ri,{visibilty:_,closeSettingFieldSidebar:Y,...t}),o.jsx(wi,{...t,fieldWrap:J})]})},xb=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],o4=/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/,hu=/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+\$,\\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+\$,\\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%\/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/;function FF(t){try{JSON.parse(t)}catch{return!1}return!0}function kF(t){if(t<26)return xb[t];{const e=Math.floor(t/26)-1,n=t%26;return xb[e]+xb[n]}}const H0e=t=>{var pe,ie,J,Q,oe,ye,Te,Ae,be,we,re;const{field:e,fieldIndex:n,pageIndex:r,sectionIndex:i,row:a,update:s,value:l}=t,{isPreview:c,isAdmin:u,isRenderView:d}=tn(),{task_status:f,taskRegisterData:h,updateTaskRegisterData:m,updateTaskProgressValue:g,updateUserFormDataSubmit:v,userTaskSubmitFormData:A,TASK_PUBLISHED:w}=Pr(),{userSelectedLanguage:x}=ln(),[S,E]=N.useState(!1),[C,_]=N.useState(""),[T,O]=N.useState(0),[F,B]=N.useState(!1),M=()=>{B(!0)},z=()=>{B(!1)};N.useEffect(()=>{S||ne();const U=Rt.addListener("clearRepeatableFields",K=>{K===(a==null?void 0:a.uuid)&&(_(""),O(0),e.isValid=0)}),Z=Rt.addListener("onSubmitUserForm",()=>{var K;(K=e==null?void 0:e.attributes)!=null&&K.required?C!==""&&o4.test(C)===!0?e.isValid=1:e.isValid=0:e.isValid=1});return()=>{Z.remove(),U.remove()}});const[P,H]=N.useState(!1),de=U=>{H(U)},fe=()=>{H(!1)},ne=()=>{var U,Z,K;if(a!=null&&a.rowIsRepeatable){if(a!=null&&a.repeatableFields){const he=[...a.repeatableFields],_e=Et.findIndex(he,function(ge){return ge.uuid===(e==null?void 0:e.uuid)});_e>=0&&he[_e].fieldData?_(he[_e].fieldData):_("")}}else{const he=A;if(he!=null&&he.length){for(const _e of he)if(_e.fieldId===t.field.uuid&&((U=_e==null?void 0:_e.postData[0])==null?void 0:U.postValue)!==""&&((Z=_e==null?void 0:_e.postData[0])!=null&&Z.postValue)){_((K=_e==null?void 0:_e.postData[0])==null?void 0:K.postValue),E(!0);break}}}E(!0)},W=U=>{_(U);const Z=A,K=Et.cloneDeep(h);if(Z!==null){if(U!==""&&o4.test(U)===!0){if(K[e==null?void 0:e.uuid]=U,(Z==null?void 0:Z.length)>0)for(const he of Z)he.fieldId===t.field.uuid&&(he.postData[0]={postValue:U})}else if(delete K[e==null?void 0:e.uuid],(Z==null?void 0:Z.length)>0)for(const he of Z)he.fieldId===t.field.uuid&&(he.postData[0]={postValue:""})}if(!(a!=null&&a.rowIsRepeatable)){m(K);const he=Object.keys(K).length;g(he)}},ae=(U,Z,K,he)=>{var _e;if(_(he),A!==null){const ge=[...A],ve=Et.findIndex(ge,function(Ne){return Ne.rowId===(a==null?void 0:a.uuid)});let Le=(_e=A[ve])==null?void 0:_e.repeatableFields;Le={...Le,[K==null?void 0:K.uuid]:he},ge[ve]={...ge[ve],repeatableFields:Le},v(ge),he!==""&&o4.test(he)===!0?e.isValid=1:e.isValid=0}},Y=o.jsxs("div",{onMouseOver:M,onMouseOut:z,children:[!d&&!c&&F&&o.jsx(Hr,{handleFieldSettingsSidebar:de,...t}),o.jsxs("div",{className:`field ${c?" ":" builder-element-wrapper "}${(e==null?void 0:e.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[(e==null?void 0:e.showHeaderText)&&o.jsx("h6",{children:(pe=e==null?void 0:e.headerText)==null?void 0:pe[x==null?void 0:x.type]}),(e==null?void 0:e.showLabel)&&o.jsxs("label",{htmlFor:n,className:"flex font-medium mb-3 text-700 text-2xl",children:[o.jsx(sa,{...t,update:s,value:l}),((ie=e==null?void 0:e.attributes)==null?void 0:ie.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",c?o.jsx(o.Fragment,{children:(J=e==null?void 0:e.label)==null?void 0:J[x==null?void 0:x.type]}):o.jsx(ea,{...t}),o.jsx("span",{className:"ml-2",children:(e==null?void 0:e.showToolTip)&&o.jsx(o.Fragment,{children:o.jsx(Vi,{message:(Q=e==null?void 0:e.toolTip)==null?void 0:Q[x==null?void 0:x.type],position:"right"})})})]}),o.jsxs("span",{className:"p-input-icon-"+(e==null?void 0:e.iconAlignment),children:[(e==null?void 0:e.showIcon)&&o.jsx("i",{className:"pi pi-"+((ye=(oe=e==null?void 0:e.icon)==null?void 0:oe.properties)==null?void 0:ye.name)}),o.jsx(gn,{id:e==null?void 0:e.uuid,placeholder:(Te=e==null?void 0:e.placeholder)==null?void 0:Te[x==null?void 0:x.type],value:C,onFocus:()=>O(1),onChange:U=>{a!=null&&a.rowIsRepeatable?ae(r,i,{uuid:e.uuid},U.target.value):W(U.target.value)},className:T===1&&((Ae=e==null?void 0:e.attributes)!=null&&Ae.required)?C?"valid":"invalid":"valid'",readOnly:f===w})]}),((be=e==null?void 0:e.attributes)==null?void 0:be.required)&&o.jsx("div",{children:o.jsx("small",{className:"error",children:T===1&&!C?(we=e==null?void 0:e.validationMesssage)==null?void 0:we[x==null?void 0:x.language]:""})}),C!==""&&T===1&&o4.test(C)===!1&&o.jsx("small",{className:"error",children:"Please enter correct email"}),(e==null?void 0:e.showHelperText)&&o.jsx("div",{children:o.jsx("small",{children:(re=e==null?void 0:e.helperText)==null?void 0:re[x==null?void 0:x.type]})})]}),u&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(Fi,{...t})]})]});return o.jsxs(o.Fragment,{children:[P===!0&&o.jsx(Ri,{visibilty:P,closeSettingFieldSidebar:fe,...t},e==null?void 0:e.uuid),o.jsx(wi,{...t,fieldWrap:Y})]})},z0e=t=>{var Q,oe,ye,Te,Ae,be,we,re,U;const{field:e,fieldIndex:n,pageIndex:r,sectionIndex:i,rowIndex:a,columnIndex:s,row:l}=t,{isRenderView:c,isAdmin:u,isPreview:d}=tn(),{userSelectedLanguage:f,fieldSettingUpdate:h}=ln(),{task_status:m,taskRegisterData:g,updateTaskRegisterData:v,updateTaskProgressValue:A,updateUserFormDataSubmit:w,userTaskSubmitFormData:x,TASK_PUBLISHED:S}=Pr(),[E,C]=N.useState(!1),[_,T]=N.useState(""),[O,F]=N.useState(0),[B,M]=N.useState(!1),[z,P]=N.useState(!1),[H,de]=N.useState(!1),fe=()=>{P(!0)},ne=()=>{P(!1)},W=Z=>{C(Z)},ae=()=>{C(!1)},Y=()=>{var K,he,_e;const Z=x;if(l!=null&&l.rowIsRepeatable){if(l!=null&&l.repeatableFields){const ge=[...l.repeatableFields],ve=Et.findIndex(ge,function(Le){return Le.uuid===(e==null?void 0:e.uuid)});ve>=0&&ge[ve].fieldData?T(ge[ve].fieldData):(e.isValid=0,T(""))}}else if(Z!=null&&Z.length){for(const ge of Z)if(ge.fieldId===t.field.uuid&&((K=ge==null?void 0:ge.postData[0])!=null&&K.postValue)&&((he=ge==null?void 0:ge.postData[0])==null?void 0:he.postValue)!==""){T((_e=ge==null?void 0:ge.postData[0])==null?void 0:_e.postValue),M(!0);break}}M(!0)},pe=(Z,K,he,_e)=>{var ge;if(x!=null&&x.length){const ve=[...x],Le=Et.findIndex(ve,function(me){return me.rowId===(l==null?void 0:l.uuid)});let Ne=(ge=x[Le])==null?void 0:ge.repeatableFields;Ne={...Ne,[he==null?void 0:he.uuid]:_e},ve[Le]={...ve[Le],repeatableFields:Ne},w(ve)}T(_e),_e!==""?e.isValid=1:e.isValid=0,h(Z,K,a,s,n,e)};N.useEffect(()=>{B||Y();const Z=Rt.addListener("clearRepeatableFields",ve=>{ve===(l==null?void 0:l.uuid)&&(T(""),F(0),e.isValid=0)}),K=Rt.addListener("onSubmitUserForm",()=>{var ve;(ve=e==null?void 0:e.attributes)!=null&&ve.required?_?e.isValid=1:e.isValid=0:e.isValid=1}),he=Rt.addListener("OnInvalidFieldCatch",ve=>{e.uuid===(ve==null?void 0:ve.fieldId)?F(1):F(0)}),_e=Rt.addListener("OnGetFieldValue",ve=>{var Ne;const Le=(Ne=ve==null?void 0:ve.repeatableColumn)==null?void 0:Ne.filter(me=>(me==null?void 0:me.fieldUuid)===(e==null?void 0:e.uuid));Le!=null&&Le.length}),ge=Rt.addListener("onUpdateField",()=>{de(!H)});return()=>{ge.remove(),K.remove(),he.remove(),_e.remove(),Z.remove()}});const ie=Z=>{var _e,ge;T(Z.target.value);const K=x,he=Et.cloneDeep(g);if(K!==null){if((_e=Z==null?void 0:Z.target)!=null&&_e.value){if(he[e==null?void 0:e.uuid]=(ge=Z==null?void 0:Z.target)==null?void 0:ge.value,(K==null?void 0:K.length)>0)for(const ve of K)ve.fieldId===t.field.uuid&&(ve.postData[0]={postValue:Z.target.value})}else if(delete he[e==null?void 0:e.uuid],(K==null?void 0:K.length)>0)for(const ve of K)ve.fieldId===t.field.uuid&&(ve.postData[0]={postValue:""})}if(!(l!=null&&l.rowIsRepeatable)){v(he);const ve=Object.keys(he).length;A(ve)}},J=o.jsxs("div",{onMouseOver:fe,onMouseOut:ne,children:[!c&&!d&&z&&o.jsx(Hr,{handleFieldSettingsSidebar:W,...t}),o.jsxs("div",{className:`field ${d?" ":" builder-element-wrapper "}${(e==null?void 0:e.isFluid)===!0?"card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[o.jsx("div",{className:"grid",children:o.jsxs("div",{className:d?"col-12 ":"col-12 field-form-builder ",children:[(e==null?void 0:e.showHeaderText)&&o.jsx("h6",{children:(Q=e==null?void 0:e.headerText)==null?void 0:Q[f==null?void 0:f.type]}),(e==null?void 0:e.showLabel)&&o.jsxs("label",{htmlFor:n,className:"flex font-medium mb-3 text-700 text-2xl",children:[o.jsx(sa,{...t}),((oe=e==null?void 0:e.attributes)==null?void 0:oe.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",d?o.jsx(o.Fragment,{children:(ye=e==null?void 0:e.label)==null?void 0:ye[f==null?void 0:f.type]}):o.jsx(ea,{...t}),o.jsx("span",{className:"ml-3",children:(e==null?void 0:e.showToolTip)&&o.jsx(Vi,{message:(Te=e==null?void 0:e.toolTip)==null?void 0:Te[f==null?void 0:f.type],position:"right"})})]}),o.jsx(Ds,{rows:e==null?void 0:e.textareaRows,cols:e==null?void 0:e.textareaCols,autoResize:e==null?void 0:e.resizable,id:e==null?void 0:e.uuid,placeholder:(Ae=e==null?void 0:e.placeholder)==null?void 0:Ae[f==null?void 0:f.type],value:_,onFocus:()=>F(1),onChange:Z=>{l!=null&&l.rowIsRepeatable?pe(r,i,e,Z.target.value):ie(Z)},className:O===1&&((be=e==null?void 0:e.attributes)!=null&&be.required)?_?"valid":"invalid":"valid",readOnly:m===S}),o.jsx("div",{children:((we=e==null?void 0:e.attributes)==null?void 0:we.required)&&o.jsx("small",{className:"error",children:O===1&&!_?(re=e==null?void 0:e.validationMesssage)==null?void 0:re[f==null?void 0:f.type]:""})}),o.jsx("div",{children:(e==null?void 0:e.showHelperText)&&o.jsx("small",{children:(U=e==null?void 0:e.helperText)==null?void 0:U[f==null?void 0:f.type]})})]})}),u&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(Fi,{...t})]})]})]});return o.jsxs(o.Fragment,{children:[E===!0&&o.jsx(Ri,{visibilty:E,closeSettingFieldSidebar:ae,...t},e==null?void 0:e.uuid),o.jsx(wi,{...t,fieldWrap:J})]})},Y0e={},Cb=t=>{var T,O,F,B;const{isAdmin:e,isAdvanceView:n,isPreview:r}=tn(),{handleDrop:i}=ln(),{data:a,path:s,pageIndex:l,sectionIndex:c,rowIndex:u,columnIndex:d,conditionIndex:f,ruleIndex:h,condition:m,page:g,section:v,row:A,column:w}=t,x=N.useRef(null),[{isDragging:S},E]=Ji({type:qC,item:{type:qC,uuid:a.uuid,children:a.children,path:s},collect:M=>({isDragging:M.isDragging()})}),C=S?0:1;E(x);const _=(M,z,P,H,de,fe,ne)=>{const W=t!=null&&t.fieldContainer?t==null?void 0:t.fieldContainer:"inline-condition-container";return o.jsx(jc,{type:"inline-conditional",field:M,data:M,path:z,page:g,section:v,row:A,column:w,pageIndex:P,sectionIndex:H,rowIndex:de,columnIndex:fe,fieldIndex:ne,isAdmin:e,fieldContainer:W},M.uuid)};return o.jsxs("div",{ref:r===!1?x:null,style:{...Y0e,opacity:C},className:"draggable column",children:[m&&((T=m.children)==null?void 0:T.length)===0&&o.jsx("p",{className:"text-primary text-center",children:"Drag item here"}),m&&m.children&&((O=m.children)==null?void 0:O.length)>0&&m.children.map((M,z)=>{var P;return o.jsxs(N.Fragment,{children:[r===!1&&o.jsx(Cr,{isAdvanceView:n,data:{path:`${s}-${h}-${f}-${z}`,childrenCount:(P=m==null?void 0:m.children)==null?void 0:P.length,droppedField:m},onDrop:i}),_(M,`${s}-${h}-${f}-${z}`,l,c,u,d,z)]},M.uuid)}),r===!1&&o.jsx(Cr,{isAdvanceView:n,fieldDropArea:!0,data:{path:`${s}-${h}-${f}-${(F=m==null?void 0:m.children)==null?void 0:F.length}`,childrenCount:(B=m==null?void 0:m.children)==null?void 0:B.length,droppedField:m},onDrop:i,isLast:!0})]})},t0=t=>{const{inputValue:e,condition:n,ruleIndex:r,conditionIndex:i,field:a,section:s,page:l,row:c,pageIndex:u,sectionIndex:d,rowIndex:f,columnIndex:h,isConditionTrue:m}=t,{taskRegisterData:g,updateUserFormDataSubmit:v,userTaskSubmitFormData:A,updateProgressDataValuesHook:w}=Pr(),x=N.useCallback((S,E,C)=>{var T,O,F;const _=A;if(_!=null&&_.length){const B=g,M=(T=a==null?void 0:a.inlineConditionalRules)==null?void 0:T.rules[E].conditions[C].children;for(const[P,H]of M.entries()){(O=H==null?void 0:H.attributes)!=null&&O.required;const de=Et.findIndex(_,function(fe){return fe.fieldId===H.uuid});S?de===-1&&(_.push({postData:[],tabId:l.uuid,tabIndex:u,...a.inlineConditionalRules?{inlineConditionalRules:a.inlineConditionalRules}:{},...a.conditionalTabRules?{conditionalTabRules:a.conditionalTabRules}:{},...a.conditionalSectionRules?{conditionalSectionRules:a.conditionalSectionRules}:{},sectionId:s.uuid,sectionIndex:d,sectionHeading:s.heading,subHeadingText:s.subHeadingText,reviewerChecklist:a==null?void 0:a.reviewerChecklist,rowId:c.uuid,rowIndex:f,columnId:s.uuid,columnIndex:h,inlineConditionalField:!0,fieldIndex:P,fieldId:H.uuid,fieldInputType:a.componentType,fieldTitle:(F=a.label)==null?void 0:F.english,fieldDescription:a.description||null,fieldHelperText:a.helperText||null,fieldHeaderText:a.headerText||null,fieldFooterText:a.footerText||null,fieldTitleAbb:a.abbreviationLabel||a.label,question_abb_table:a.textForTable||null,language:"english",isHiddenfield:a.isHidden&&a.isHidden===1?1:0,isHiddenSection:s.isHidden&&s.isHidden===1?1:0}),B[H==null?void 0:H.uuid]&&delete B[H==null?void 0:H.uuid]):(B[H==null?void 0:H.uuid]&&delete B[H==null?void 0:H.uuid],de>=0&&_.splice(de,1))}const z=Object.keys(B).length;w({progressMaxValue:_==null?void 0:_.length,progressValue:z}),v(_)}},[h,a.abbreviationLabel,a.componentType,a.conditionalSectionRules,a.conditionalTabRules,a.description,a.footerText,a.headerText,a.helperText,a.inlineConditionalRules,a.isHidden,a.label,a==null?void 0:a.reviewerChecklist,a.textForTable,l.uuid,u,c.uuid,f,s.heading,s.isHidden,s.subHeadingText,s.uuid,d,g,w,v,A]);return N.useEffect(()=>(x(m,r,i),()=>{}),[i,e,m,r,x]),o.jsx("div",{children:m&&o.jsx("div",{className:"p-field p-pt-2",children:o.jsx(o.Fragment,{children:o.jsx(Cb,{...t,ruleIndex:r,conditionIndex:i,condition:n,data:a})})},i)})};function w2(t){"@babel/helpers - typeof";return w2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w2(t)}function K0e(t,e){if(w2(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(w2(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function X0e(t){var e=K0e(t,"string");return w2(e)==="symbol"?e:String(e)}function Tb(t,e,n){return e=X0e(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var R0e={value:"p-tag-value",icon:"p-tag-icon",root:function(e){var n=e.props;return pt("p-tag p-component",Tb(Tb({},"p-tag-".concat(n.severity),n.severity!==null),"p-tag-rounded",n.rounded))}},G0e=`
2389
+ `+Me),re&&n4([M,z,P],Qe=>{Me=b2(Me,Qe," ")}),S&&ve?S.createHTML(Me):Me},e.setConfig=function(){let Ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Cn(Ke),K=!0},e.clearConfig=function(){vn=null,K=!1},e.isValidAttribute=function(Ke,Oe,Je){vn||Cn({});const ot=yn(Ke),Lt=yn(Oe);return at(ot,Lt,Je)},e.addHook=function(Ke,Oe){typeof Oe=="function"&&(B[Ke]=B[Ke]||[],v2(B[Ke],Oe))},e.removeHook=function(Ke){if(B[Ke])return SF(B[Ke])},e.removeHooks=function(Ke){B[Ke]&&(B[Ke]=[])},e.removeAllHooks=function(){B={}},e}var s4=NF();const ea=t=>{var x;const{field:e,fieldIndex:n,pageIndex:r,sectionIndex:i,rowIndex:a,columnIndex:s,path:l}=t,[c,u]=N.useState(e);N.useEffect(()=>{var S;return A((S=e==null?void 0:e.label)==null?void 0:S[d==null?void 0:d.type]),()=>{}},[e]);const{userSelectedLanguage:d,fieldSettingUpdate:f,fieldSettingUpdateInlineConditional:h,gridComponentFieldSettingUpdate:m}=ln(),g=(S,E,C)=>{u(_=>({..._,[S]:{..._[S],[E==null?void 0:E.type]:C}}))},[v,A]=N.useState((x=e==null?void 0:e.label)==null?void 0:x[d==null?void 0:d.type]);N.useEffect(()=>(w(),()=>{}),[c]);const w=()=>{const S=l.split("-").map(Number);(t==null?void 0:t.fieldContainer)==="inline-condition-container"?h(S[la],S[ca],S[ha],S[pa],S[ga],S[Sa],S[$o],S[yo],c):(S==null?void 0:S.length)>Sa&&(S==null?void 0:S.length)===Vl+1&&(e!=null&&e.componentType)&&(t==null?void 0:t.fieldContainer)==="grid-container"?m(S[la],S[ca],S[ha],S[pa],S[ga],S[5],S[6],S[7],c):f(r,i,a,s,n,{...e,label:c==null?void 0:c.label})};return o.jsx(o.Fragment,{children:o.jsx(t4,{style:{display:"inline-block"},className:"builder-input-label-edit",html:v,disabled:!1,onChange:S=>{var E;A(s4.sanitize((E=S==null?void 0:S.target)==null?void 0:E.value))},onBlur:S=>{var C;const E=s4.sanitize((C=S==null?void 0:S.target)==null?void 0:C.innerText);console.log("DOMPurify.sanitize(e?.target?.innerText)",E),A(E),g("label",d,E)},tagName:"article"})})},i1=t=>{const{onLabel:e,offLabel:n,onIcon:r,offIcon:i,onHandleChangeSetttings:a,settingsKey:s,settingsKeyValue:l}=t;return o.jsx(o.Fragment,{children:o.jsx(a2,{checked:l,onLabel:e,onChange:c=>{a(s,c.value)},offLabel:n,onIcon:r,offIcon:i,className:"mr-1 px-1",style:{fontSize:"0.8rem"}})})},Hr=t=>{var de,fe,ne,W;const{field:e,fieldIndex:n,columnIndex:r,sectionIndex:i,rowIndex:a,pageIndex:s,type:l,path:c,handleFieldSettingsSidebar:u,showFieldIcons:d=!0,showSettingsIcon:f=!0}=t,{emitSocketData:h}=tn(),m=(ae,Y)=>{B(pe=>({...pe,[ae]:Y}))},{fieldSettingUpdate:g,fieldSettingUpdateInlineConditional:v,cloneField:A,gridComponentFieldSettingUpdate:w,fieldSettingDeleteInlineConditional:x,gridComponentFieldDelete:S,removeField:E}=ln(),{updateGlobalToast:C}=tn(),_=ae=>{const Y=c.split("-").map(Number);(t==null?void 0:t.fieldContainer)==="inline-condition-container"?v(Y[la],Y[ca],Y[ha],Y[pa],Y[ga],Y[Sa],Y[$o],Y[yo],ae):(Y==null?void 0:Y.length)>Sa&&(Y==null?void 0:Y.length)===Vl+1&&(ae!=null&&ae.componentType)&&(t==null?void 0:t.fieldContainer)==="grid-container"?w(Y[la],Y[ca],Y[ha],Y[pa],Y[ga],Y[5],Y[6],Y[7],ae):g(s,i,a,r,n,ae),C({showToast:!0,toastMessage:"Updated",toastDetail:"Field Updated",toastType:"success"})},[T,O]=N.useState(!1),[F,B]=N.useState({custom_component_title:"",custom_component_description:""}),M=()=>{B(ae=>({...ae,custom_component_schema:e})),O(!0)},z=()=>{const ae=c.split("-").map(Number);l==="inline-conditional"?x(ae[la],ae[ca],ae[ha],ae[pa],ae[ga],ae[Sa],ae[$o],ae[yo]):(ae==null?void 0:ae.length)>Sa&&(ae==null?void 0:ae.length)===Vl+1&&(e!=null&&e.componentType)&&l==="grid"?S(ae[la],ae[ca],ae[ha],ae[pa],ae[ga],ae[5],ae[6],ae[7]):E(s,i,a,r,n)},P=(ae,Y)=>{const pe={...e,attributes:{...e.attributes,[ae]:Y}};_(pe)},H=(ae,Y)=>{const pe={...e,[ae]:Y};_(pe)};return o.jsx(o.Fragment,{children:o.jsxs("div",{className:`${(e==null?void 0:e.componentType)!=="hidden-field"&&(e==null?void 0:e.componentType)!=="image"&&(e==null?void 0:e.componentType)!=="href"&&(e==null?void 0:e.componentType)!=="paragraph"&&(e==null?void 0:e.componentType)!=="heading"&&(e==null?void 0:e.componentType)!=="list"&&(e==null?void 0:e.componentType)!=="hr"&&(e==null?void 0:e.componentType)!=="image-gallery"&&(e==null?void 0:e.componentType)!=="video"&&(e==null?void 0:e.componentType)!=="question"?"builder-element-quick-options mb-2 w-9 justify-content-between":"builder-element-quick-options mb-2 w-4 justify-content-center"} flex quick-setting`,children:[o.jsx(o.Fragment,{children:(e==null?void 0:e.componentType)!=="hidden-field"&&(e==null?void 0:e.componentType)!=="image"&&(e==null?void 0:e.componentType)!=="href"&&(e==null?void 0:e.componentType)!=="paragraph"&&(e==null?void 0:e.componentType)!=="heading"&&(e==null?void 0:e.componentType)!=="list"&&(e==null?void 0:e.componentType)!=="hr"&&(e==null?void 0:e.componentType)!=="image-gallery"&&(e==null?void 0:e.componentType)!=="video"&&(e==null?void 0:e.componentType)!=="question"&&d===!0&&o.jsxs("div",{className:" ",children:[o.jsx(i1,{field:e,onHandleChangeSetttings:P,settingsKey:"required",settingsKeyValue:(de=e==null?void 0:e.attributes)==null?void 0:de.required,onLabel:"Required",offLabel:"Not Required",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:(fe=e==null?void 0:e.attributes)==null?void 0:fe.required}),o.jsx(i1,{field:e,onHandleChangeSetttings:H,settingsKey:"showToolTip",settingsKeyValue:e==null?void 0:e.showToolTip,onLabel:"Tooltip",offLabel:"Tooltip",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:e==null?void 0:e.showToolTip}),o.jsx(i1,{field:e,onHandleChangeSetttings:H,settingsKey:"showHelperText",settingsKeyValue:e==null?void 0:e.showHelperText,onLabel:"Helper text",offLabel:"Helper text",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:e==null?void 0:e.showHelperText}),o.jsx(i1,{field:e,onHandleChangeSetttings:H,settingsKey:"showHeaderText",settingsKeyValue:e==null?void 0:e.showHeaderText,onLabel:"Header text",offLabel:"Header text",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:e==null?void 0:e.showHeaderText}),o.jsx(i1,{field:e,onHandleChangeSetttings:H,settingsKey:"isFluid",settingsKeyValue:e==null?void 0:e.isFluid,onLabel:"Fluid",offLabel:"Fluid",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:e==null?void 0:e.isFluid}),(e==null?void 0:e.componentType)=="radio"&&o.jsxs(o.Fragment,{children:[o.jsx(i1,{field:e,onHandleChangeSetttings:H,settingsKey:"showAlphabetList",settingsKeyValue:e==null?void 0:e.showAlphabetList,onLabel:"Alpha",offLabel:"Alpha",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:e==null?void 0:e.showAlphabetList}),o.jsx(i1,{field:e,onHandleChangeSetttings:P,settingsKey:"style",settingsKeyValue:(ne=e==null?void 0:e.attributes)==null?void 0:ne.style,onLabel:"Style",offLabel:"Style",onIcon:"pi pi-eye",offIcon:"pi pi-eye-slash",defaultState:(W=e==null?void 0:e.attributes)==null?void 0:W.style})]})]})}),o.jsxs("div",{className:"quick-setting",children:[f===!0&&o.jsxs("span",{className:"p-buttonset",children:[(e==null?void 0:e.componentType)!=="hr"&&o.jsx(kt,{text:!0,size:"small",label:"Advance Settings",icon:"pi pi-cog",onClick:()=>{console.log("opening sidebar"),console.log("handleFieldSettingsSidebar",u),u(!0)},className:"mr-3"}),o.jsx(kt,{size:"small",text:!0,icon:"pi pi-clone",outlined:!0,onClick:()=>{A(e,s,i,a,r,n),h()}}),o.jsx(kt,{text:!0,size:"small",outlined:!0,icon:"pi pi-trash",onClick:()=>{z()}}),o.jsx(kt,{text:!0,size:"small",outlined:!0,icon:"pi pi-file",onClick:()=>{M()}})]}),o.jsxs(As,{maximizable:!0,header:"Custom component save",visible:T,style:{width:"20vw"},footer:()=>o.jsx(o.Fragment,{children:o.jsxs("div",{children:[o.jsx(kt,{size:"small",text:!0,label:"Close",icon:"pi pi-times",onClick:()=>O(!1),className:"p-button-text"}),(e==null?void 0:e.componentType)!=="hidden-field"&&o.jsx(kt,{text:!0,label:"Save",icon:"pi pi-check",onClick:()=>{O(!1)},autoFocus:!0})]})}),onHide:()=>O(!1),children:[o.jsxs("span",{className:"p-float-label",children:[o.jsx(gn,{id:"custom_component_title",name:"custom_component_title",className:"w-full",value:(F==null?void 0:F.custom_component_title)||"",onChange:ae=>{var Y;return m("custom_component_title",(Y=ae==null?void 0:ae.target)==null?void 0:Y.value)}}),o.jsx("label",{htmlFor:"username",children:"Custom component title"})]}),o.jsxs("span",{className:"p-float-label mt-5",children:[o.jsx(Ds,{id:"custom_component_description",name:"custom_component_description",className:"w-full",value:(F==null?void 0:F.custom_component_description)||"",onChange:ae=>{var Y;return m("custom_component_description",(Y=ae==null?void 0:ae.target)==null?void 0:Y.value)}}),o.jsx("label",{htmlFor:"username",children:"Custom component description"})]})]})]})]})})},L0e=t=>{var Q,oe,ye,Te,Ae,be,we,re;const{pageIndex:e,sectionIndex:n,field:r,fieldIndex:i,row:a,rowIndex:s,columnIndex:l}=t,{isAdmin:c,isRenderView:u,isPreview:d}=tn(),{userSelectedLanguage:f,fieldSettingUpdate:h}=ln(),{task_status:m,taskRegisterData:g,updateTaskRegisterData:v,updateTaskProgressValue:A,updateUserFormDataSubmit:w,userTaskSubmitFormData:x,TASK_PUBLISHED:S}=Pr(),[E,C]=N.useState(!1),[_,T]=N.useState(!1),[O,F]=N.useState(null),[B,M]=N.useState(0),[z,P]=N.useState(!1),H=()=>{P(!0)},de=()=>{P(!1)},fe=U=>{C(U)},ne=()=>{C(!1)},W=()=>{var U,Z,K;if(a!=null&&a.rowIsRepeatable){if(a!=null&&a.repeatableFields){const he=[...a.repeatableFields],_e=Et.findIndex(he,function(ge){return ge.uuid===(r==null?void 0:r.uuid)});_e>=0&&he[_e].fieldData?F(he[_e].fieldData):(r.isValid=0,F(null))}}else{const he=x,_e=Et.cloneDeep(g);if(he!=null&&he.length){for(const ge of he)if(ge.fieldId===t.field.uuid&&((U=ge==null?void 0:ge.postData)!=null&&U.length)){F((Z=ge==null?void 0:ge.postData[0])==null?void 0:Z.postValue),_e[r==null?void 0:r.uuid]=(K=ge==null?void 0:ge.postData[0])==null?void 0:K.postValue;const ve=Object.keys(_e).length;A(ve);break}}}T(!0)},ae=U=>{var _e;F(U.target.value);const Z=x,K=Et.cloneDeep(g);if((_e=U==null?void 0:U.target)!=null&&_e.value&&(Z==null?void 0:Z.length)>0)for(const ge of Z)ge.fieldId===t.field.uuid&&(K[r==null?void 0:r.uuid]=U==null?void 0:U.value,ge.postData[0]={postValue:U.value});else delete K[r==null?void 0:r.uuid];v(K);const he=Object.keys(K).length;A(he)};N.useEffect(()=>{_||W();const U=Rt.addListener("clearRepeatableFields",he=>{he===(a==null?void 0:a.uuid)&&(F(""),M(0),r.isValid=0,h(e,n,s,l,i,r))}),Z=Rt.addListener("onSubmitUserForm",()=>{var he;(he=r==null?void 0:r.attributes)!=null&&he.required?O?r.isValid=1:r.isValid=0:r.isValid=1}),K=Rt.addListener("OnInvalidFieldCatch",he=>{r.uuid===(he==null?void 0:he.fieldId)?M(1):M(0)});return()=>{Z.remove(),K.remove(),U.remove()}});const Y=(U,Z)=>{var K;if(x){const he=[...x],_e=Et.findIndex(he,function(ve){return ve.rowId===(a==null?void 0:a.uuid)});let ge=(K=x[_e])==null?void 0:K.repeatableFields;ge={...ge,[U==null?void 0:U.uuid]:Z},he[_e]={...he[_e],repeatableFields:ge},w(he)}F(Z),Z!==null?U.isValid=1:U.isValid=0},pe=(U,Z)=>U?o.jsxs("div",{className:"country-item flex",children:[o.jsx("img",{alt:U.name,src:U==null?void 0:U.image,onError:K=>K.target.src="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png",style:{width:"20px",marginRight:10}}),o.jsx("div",{children:U.name})]}):o.jsx("span",{children:Z.placeholder}),ie=U=>o.jsxs("div",{className:"country-item flex",children:[o.jsx("img",{alt:U.name,src:U==null?void 0:U.image,onError:Z=>Z.target.src="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png",style:{width:"20px",marginRight:10}}),o.jsx("div",{children:U.name})]}),J=o.jsxs("div",{onMouseOver:H,onMouseOut:de,children:[!u&&!d&&z&&o.jsx(Hr,{handleFieldSettingsSidebar:fe,...t}),o.jsxs("div",{className:`field ${d?" ":" builder-element-wrapper "}${(r==null?void 0:r.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[o.jsx("div",{className:"grid",children:o.jsxs("div",{className:d?"col-12 ":"field-form-builder col-12 ",children:[(r==null?void 0:r.showHeaderText)&&o.jsx("h6",{children:(Q=r==null?void 0:r.headerText)==null?void 0:Q[f==null?void 0:f.type]}),(r==null?void 0:r.showLabel)&&o.jsxs("label",{htmlFor:i,className:"flex font-medium mb-3 text-700 text-2xl",children:[o.jsx(sa,{...t}),((oe=r==null?void 0:r.attributes)==null?void 0:oe.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",d?o.jsx(o.Fragment,{children:(ye=r==null?void 0:r.label)==null?void 0:ye[f==null?void 0:f.type]}):o.jsx(ea,{...t}),o.jsx("span",{className:"ml-3",children:(r==null?void 0:r.showToolTip)&&o.jsx(Vi,{message:(Te=r==null?void 0:r.toolTip)==null?void 0:Te[f==null?void 0:f.type],position:"right"})})]}),o.jsx(xa,{className:"country-select-builder-component",onFocus:()=>M(1),onChange:U=>{a!=null&&a.rowIsRepeatable?Y(r,U.target.value):ae(U)},options:r==null?void 0:r.countries,optionLabel:"name",value:O,placeholder:(Ae=r==null?void 0:r.placeholder)==null?void 0:Ae[f==null?void 0:f.type],disabled:m===S,valueTemplate:pe,itemTemplate:ie,filter:!0,filterBy:"name",showClear:!0}),((be=r==null?void 0:r.attributes)==null?void 0:be.required)&&o.jsx("small",{className:"error",children:B===1&&!O?(we=r==null?void 0:r.validationMesssage)==null?void 0:we.language:""}),o.jsx("div",{children:(r==null?void 0:r.showHelperText)&&o.jsx("small",{children:(re=r==null?void 0:r.helperText)==null?void 0:re[f==null?void 0:f.type]})})]})}),c&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(Fi,{...t})]})]})]});return o.jsxs(o.Fragment,{children:[E===!0&&o.jsx(Ri,{visibilty:E,closeSettingFieldSidebar:ne,...t},r==null?void 0:r.uuid),o.jsx(wi,{...t,fieldWrap:J})]})},B0e=t=>{var Q,oe,ye,Te,Ae,be,we,re,U,Z,K,he,_e,ge,ve;const{taskRegisterData:e,updateTaskRegisterData:n,updateTaskProgressValue:r,updateUserFormDataSubmit:i,userTaskSubmitFormData:a,task_status:s,TASK_PUBLISHED:l}=Pr(),{userSelectedLanguage:c,fieldSettingUpdate:u}=ln(),{field:d,fieldIndex:f,sectionIndex:h,pageIndex:m,row:g,rowIndex:v,columnIndex:A}=t,{isAdmin:w,isRenderView:x,isPreview:S}=tn(),[E,C]=N.useState(!1),[_,T]=N.useState(""),[O,F]=N.useState(null),[B,M]=N.useState(0),[z,P]=N.useState(!1),[H,de]=N.useState(!1),fe=()=>{de(!0)},ne=()=>{de(!1)},W=()=>{var Le,Ne,me;if(g!=null&&g.rowIsRepeatable){if(g!=null&&g.repeatableFields){const V=[...g.repeatableFields],te=Et.findIndex(V,function(X){return X.uuid===(d==null?void 0:d.uuid)});te>=0&&V[te].fieldData?T(V[te].fieldData):T("")}}else{const V=a;if(V!=null&&V.length){for(const te of V)if(te.fieldId===t.field.uuid&&((Le=te==null?void 0:te.postData[0])==null?void 0:Le.postValue)!==""&&((Ne=te==null?void 0:te.postData[0])!=null&&Ne.postValue)){T((me=te==null?void 0:te.postData[0])==null?void 0:me.postValue);break}}}P(!0)};N.useEffect(()=>{z||W();const Le=Rt.addListener("clearRepeatableFields",X=>{X===(g==null?void 0:g.uuid)&&(T(""),M(0),d.isValid=0,u(m,h,v,A,f,d))}),Ne=Rt.addListener("onSubmitUserForm",()=>{var X,se;(X=d==null?void 0:d.attributes)!=null&&X.required?_&&_.length&&(_==null?void 0:_.length)<((se=d==null?void 0:d.attributes)==null?void 0:se.minLength)?d.isValid=1:d.isValid=0:d.isValid=1}),me=Rt.addListener("OnInvalidFieldCatch",X=>{d.uuid===(X==null?void 0:X.fieldId)?M(1):M(0)}),V=Rt.addListener("OnGetFieldValue",X=>{var ue;const se=(ue=X==null?void 0:X.repeatableColumn)==null?void 0:ue.filter(Se=>(Se==null?void 0:Se.fieldUuid)===(d==null?void 0:d.uuid));se!=null&&se.length}),te=Rt.addListener("formFieldAdded",X=>{O===null&&F(X==null?void 0:X.uuid)});return()=>{Ne.remove(),me.remove(),V.remove(),Le.remove(),te.remove()}}),N.useEffect(()=>(O!==null&&setTimeout(()=>{F(null)},1e3),()=>{}),[O]);const ae=Le=>{C(Le)},Y=()=>{C(!1)},pe=Le=>{var V,te;T(Le.target.value);const Ne=a,me=Et.cloneDeep(e);if(Ne!==null){if((V=Le==null?void 0:Le.target)!=null&&V.value){if(me[d==null?void 0:d.uuid]=(te=Le==null?void 0:Le.target)==null?void 0:te.value,(Ne==null?void 0:Ne.length)>0)for(const X of Ne)X.fieldId===t.field.uuid&&(X.postData[0]={postValue:Le.target.value})}else if(delete me[d==null?void 0:d.uuid],(Ne==null?void 0:Ne.length)>0)for(const X of Ne)X.fieldId===t.field.uuid&&(X.postData[0]={postValue:""})}if(!(g!=null&&g.rowIsRepeatable)){n(me);const X=Object.keys(me).length;r(X)}},ie=(Le,Ne)=>{var me;if(a){const V=[...a],te=Et.findIndex(V,function(se){return se.rowId===(g==null?void 0:g.uuid)});let X=(me=a[te])==null?void 0:me.repeatableFields;X={...X,[Le==null?void 0:Le.uuid]:Ne},V[te]={...V[te],repeatableFields:X},i(V)}T(Ne),Ne!==""?Le.isValid=1:Le.isValid=0},J=o.jsxs("div",{onMouseOver:fe,onMouseOut:ne,children:[!x&&!S&&H&&o.jsx(Hr,{handleFieldSettingsSidebar:ae,...t}),o.jsxs("div",{className:`field ${S?" ":" builder-element-wrapper "} ${(d==null?void 0:d.isFluid)===!0?" p-fluid ":""} ${x?" ":" py-6 px-4 "} ${O===(d==null?void 0:d.uuid)?" new-field ":" card "} `,children:[o.jsx("div",{className:"grid",children:o.jsxs("div",{className:w?"col-6 ":"col-12 p-fluid",children:[(d==null?void 0:d.showHeaderText)&&o.jsx("h6",{children:(Q=d==null?void 0:d.headerText)==null?void 0:Q[c==null?void 0:c.type]}),(d==null?void 0:d.showLabel)&&o.jsxs("label",{htmlFor:d==null?void 0:d.uuid,className:"flex font-medium mb-3 text-700 text-2xl",children:[o.jsx(sa,{...t}),((oe=d==null?void 0:d.attributes)==null?void 0:oe.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",S?o.jsx(o.Fragment,{children:(ye=d==null?void 0:d.label)==null?void 0:ye[c==null?void 0:c.type]}):o.jsx(ea,{...t}),(d==null?void 0:d.showToolTip)&&o.jsx("span",{className:"ml-3",children:o.jsx(Vi,{message:(Te=d==null?void 0:d.toolTip)==null?void 0:Te[c==null?void 0:c.type],position:"right"})})]}),o.jsxs("div",{className:"mt-3",children:[o.jsxs("span",{className:"p-input-icon-"+(d==null?void 0:d.iconAlignment),children:[(d==null?void 0:d.showIcon)&&o.jsx("i",{className:"pi pi-"+((be=(Ae=d==null?void 0:d.icon)==null?void 0:Ae.properties)==null?void 0:be.name)}),o.jsx(gn,{id:d==null?void 0:d.uuid,placeholder:(we=d==null?void 0:d.placeholder)==null?void 0:we[c==null?void 0:c.type],minLength:(re=d==null?void 0:d.attributes)==null?void 0:re.minLength,maxLength:(U=d==null?void 0:d.attributes)==null?void 0:U.maxLength,value:_,onFocus:()=>M(1),onChange:Le=>{g!=null&&g.rowIsRepeatable?ie(d,Le.target.value):pe(Le)},className:B===1&&((Z=d==null?void 0:d.attributes)!=null&&Z.required)?_?"valid":"invalid":"valid'",readOnly:s===l})]}),o.jsx("div",{children:((K=d==null?void 0:d.attributes)==null?void 0:K.required)&&o.jsxs(o.Fragment,{children:[o.jsx("small",{className:"error",children:B===1&&!_?(he=d==null?void 0:d.validationMesssage)==null?void 0:he.english:""}),o.jsx("small",{className:"error",children:B===1&&_.length&&(_==null?void 0:_.length)<((_e=d==null?void 0:d.attributes)==null?void 0:_e.minLength)?`Mini length ${(ge=d==null?void 0:d.attributes)==null?void 0:ge.minLength}`:""})]})}),o.jsx("div",{children:(d==null?void 0:d.showHelperText)&&o.jsx("small",{children:(ve=d==null?void 0:d.helperText)==null?void 0:ve[c==null?void 0:c.type]})})]})]})}),w&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(Fi,{...t})]})]})]});return o.jsxs(o.Fragment,{children:[E===!0&&o.jsx(Ri,{visibilty:E,closeSettingFieldSidebar:Y,...t}),o.jsx(wi,{...t,fieldWrap:J})]})},V0e=t=>{var i,a;const{language:e,onHandleChange:n,fieldState:r}=t;return o.jsxs("form",{className:"p-fluid",children:[o.jsxs("div",{className:"field",children:[o.jsx("label",{children:"Href Text"}),o.jsx(gn,{value:(i=r==null?void 0:r.text)==null?void 0:i[e==null?void 0:e.type],onChange:s=>n("text",e,s.target.value)})]}),o.jsxs("div",{className:"field",children:[o.jsx("label",{children:"Hyper Link"}),o.jsx(gn,{value:(a=r==null?void 0:r.hrefLink)==null?void 0:a[e==null?void 0:e.type],onChange:s=>n("hrefLink",e,s.target.value)})]})]})},U0e=t=>{var r;const{onHandleChangeStyling:e,fieldState:n}=t;return o.jsxs("form",{className:"p-fluid",children:[o.jsxs("div",{className:"field",children:[o.jsx("label",{className:"mr-2",children:"Hyper Link Color"}),o.jsx(Zd,{value:n==null?void 0:n.color,onChange:i=>{e("color",i.value)}})]}),o.jsxs("div",{className:"field",children:[o.jsx("label",{children:"Font Size"}),o.jsx(gn,{type:"number",maxLength:2,placeholder:"eg 20px",value:(r=Number(n==null?void 0:n.fontSize))==null?void 0:r.toFixed(0),onChange:i=>{e("fontSize",i.target.value)}})]}),o.jsxs("div",{className:"field-checkbox",children:[o.jsx(Or,{checked:n==null?void 0:n.underLined,onChange:i=>{e("underLined",i.checked)}}),o.jsx("label",{children:"Underline link"})]})]})},q0e=t=>{const{visibilty:e,field:n,closeSettingFieldSidebar:r,pageIndex:i,sectionIndex:a,rowIndex:s,columnIndex:l,fieldIndex:c}=t,[u,d]=N.useState(n),{fieldSettingUpdate:f,formBuilderSchemaLanguages:h,formBuilderPublishedStatus:m}=ln(),{updateGlobalToast:g}=tn(),v=(x,S,E)=>{d(C=>({...C,[x]:{...C[x],[S==null?void 0:S.type]:E}}))},A=(x,S)=>{d(E=>({...E,[x]:S}))},w=()=>{f(i,a,s,l,c,u),g({showToast:!0,toastMessage:"Updated",toastDetail:"Html Updated",toastType:"success"})};return o.jsx(o.Fragment,{children:o.jsxs(Io,{visible:e,position:"left",className:"p-sidebar-lg",onHide:()=>r(),children:[o.jsxs("div",{className:"flex justify-content-between flex-wrap card-container ",children:[o.jsxs("div",{className:"flex align-items-center justify-content-center ",children:[" ",o.jsxs("h5",{className:"mb-0",children:[t==null?void 0:t.typeName," Settings "]})]}),!m&&o.jsx("div",{className:"flex align-items-center justify-content-center",children:o.jsx(kt,{className:"mt-3",label:"Update",onClick:()=>w(),"aria-label":"Update"})})]}),o.jsxs(Ka,{children:[o.jsx(hr,{header:"Text",children:o.jsx(ao,{activeIndex:0,children:h!=null&&h.length?h.map((x,S)=>o.jsx(io,{tabIndex:S,header:x==null?void 0:x.language,children:o.jsx(V0e,{language:x,fieldState:u,onHandleChange:v,...t})},S)):""})}),o.jsx(hr,{header:"Styling",children:o.jsx(U0e,{fieldState:u,onHandleChangeStyling:A,...t})})]})]})})},j0e=t=>{var m,g,v,A,w,x,S,E,C;const{field:e}=t,{userSelectedLanguage:n}=ln(),{isPreview:r}=tn(),[i,a]=N.useState(!1),[s,l]=N.useState(!1),c=()=>{l(!0)},u=()=>{l(!1)},d=_=>{a(_)},f=()=>{a(!1)};N.useEffect(()=>{},[e]);const h=o.jsxs("div",{className:r?"":"builder-element-wrapper",onMouseOver:c,onMouseOut:u,children:[!r&&s&&o.jsx(Hr,{handleFieldSettingsSidebar:d,...t}),o.jsxs("div",{className:r?" px-4":"field-form-builder px-4",children:[(e==null?void 0:e.showHeaderText)&&o.jsx("h6",{children:(m=e==null?void 0:e.headerText)==null?void 0:m[n==null?void 0:n.type]}),(e==null?void 0:e.showLabel)&&o.jsxs("label",{htmlFor:e.uuid,className:"flex font-medium mb-3 text-700 text-2xl",children:[((g=e==null?void 0:e.attributes)==null?void 0:g.required)&&o.jsx("span",{className:"must-required",children:"*"})," ",r?o.jsx(o.Fragment,{children:(v=e==null?void 0:e.label)==null?void 0:v[n==null?void 0:n.type]}):o.jsx(ea,{...t}),o.jsx("span",{className:"ml-3",children:(e==null?void 0:e.showToolTip)&&o.jsx(Vi,{message:(A=e==null?void 0:e.toolTip)==null?void 0:A[n==null?void 0:n.type],position:"right"})})]}),o.jsx("a",{style:{fontSize:parseInt(e==null?void 0:e.fontSize),color:`#${e==null?void 0:e.color}`,textDecoration:e!=null&&e.underLined?"underline":"none"},className:"atag-style",href:(w=e==null?void 0:e.hrefLink)==null?void 0:w[n==null?void 0:n.type],children:(x=e==null?void 0:e.text)==null?void 0:x[n==null?void 0:n.type]}),((S=e==null?void 0:e.attributes)==null?void 0:S.required)&&o.jsx("small",{className:"error",children:(E=e==null?void 0:e.validationMesssage)==null?void 0:E[n==null?void 0:n.type]}),(e==null?void 0:e.showHelperText)&&o.jsx("small",{children:(C=e==null?void 0:e.helperText)==null?void 0:C[n==null?void 0:n.type]})]})]});return o.jsxs(o.Fragment,{children:[o.jsx(q0e,{visibilty:i,closeSettingFieldSidebar:f,...t}),o.jsx(wi,{...t,fieldWrap:h})]})},$0e=t=>{var Q,oe,ye,Te,Ae,be,we,re,U,Z,K,he,_e,ge,ve,Le,Ne,me,V,te,X;const{field:e,fieldIndex:n,sectionIndex:r,pageIndex:i,row:a,rowIndex:s,columnIndex:l}=t,{isPreview:c,isRenderView:u,isAdmin:d}=tn(),{taskRegisterData:f,updateTaskRegisterData:h,updateTaskProgressValue:m,updateUserFormDataSubmit:g,userTaskSubmitFormData:v,TASK_PUBLISHED:A,task_status:w}=Pr(),{userSelectedLanguage:x,fieldSettingUpdate:S}=ln(),[E,C]=N.useState(null),[_,T]=N.useState(!1),[O,F]=N.useState(null),[B,M]=N.useState(0),[z,P]=N.useState(!1),[H,de]=N.useState(!1),fe=()=>{de(!0)},ne=()=>{de(!1)},W=()=>{var se,ue;if(a!=null&&a.rowIsRepeatable){if(a!=null&&a.repeatableFields){const Se=[...a.repeatableFields],De=Et.findIndex(Se,function(je){return je.uuid===(e==null?void 0:e.uuid)});De>=0&&Se[De].fieldData?F(Number(Se[De].fieldData)||null):F(null)}}else{const Se=v;if(Se!=null&&Se.length){for(const De of Se)if(De.fieldId===t.field.uuid&&((se=De==null?void 0:De.postData)!=null&&se.length)){F(Number((ue=De==null?void 0:De.postData[0])==null?void 0:ue.postValue)||null);break}}}P(!0)};N.useEffect(()=>{z||W();const se=Rt.addListener("clearRepeatableFields",ct=>{ct===(a==null?void 0:a.uuid)&&(F(null),M(0),e.isValid=0,S(i,r,s,l,n,e))}),ue=Rt.addListener("onSubmitUserForm",()=>{var ct;(ct=e==null?void 0:e.attributes)!=null&&ct.required?O?e.isValid=1:e.isValid=0:e.isValid=1}),Se=Rt.addListener("OnInvalidFieldCatch",ct=>{e.uuid===(ct==null?void 0:ct.fieldId)?M(1):M(0)}),De=Rt.addListener("OnGetFieldValue",ct=>{var nt;const Dt=(nt=ct==null?void 0:ct.repeatableColumn)==null?void 0:nt.filter(xt=>(xt==null?void 0:xt.fieldUuid)===(e==null?void 0:e.uuid));Dt!=null&&Dt.length}),je=Rt.addListener("formFieldAdded",ct=>{E===null&&C(ct.uuid)});return()=>{ue.remove(),Se.remove(),De.remove(),se.remove(),je.remove()}}),N.useEffect(()=>(E!==null&&setTimeout(()=>{C(null)},1e3),()=>{}),[E]);const ae=se=>{T(se)},Y=()=>{T(!1)},pe=se=>{const ue=v,Se=Et.cloneDeep(f);if(ue!==null){if(se){if(Se[e==null?void 0:e.uuid]=se,(ue==null?void 0:ue.length)>0)for(const De of ue)De.fieldId===t.field.uuid&&(De.postData[0]={postValue:se})}else if(delete Se[e==null?void 0:e.uuid],(ue==null?void 0:ue.length)>0)for(const De of ue)De.fieldId===t.field.uuid&&(De.postData[0]={postValue:""})}if(!(a!=null&&a.rowIsRepeatable)){h(Se);const De=Object.keys(Se).length;m(De)}},ie=(se,ue)=>{var Se;if(v!=null&&v.length){const De=[...v],je=Et.findIndex(De,function(Dt){return Dt.rowId===(a==null?void 0:a.uuid)});let ct=(Se=v[je])==null?void 0:Se.repeatableFields;ct={...ct,[se==null?void 0:se.uuid]:ue},De[je]={...De[je],repeatableFields:ct},g(De)}F(ue),ue!==""?se.isValid=1:se.isValid=0},J=o.jsxs("div",{onMouseOver:fe,onMouseOut:ne,children:[!u&&!c&&H&&o.jsx(Hr,{handleFieldSettingsSidebar:ae,...t}),o.jsxs("div",{className:`field ${c?" ":" builder-element-wrapper "}${(e==null?void 0:e.isFluid)===!0?" p-fluid py-6 px-4":" py-6 px-4"} ${E===(e==null?void 0:e.uuid)?" new-field ":" card "}`,children:[o.jsx("div",{className:"grid",children:o.jsxs("div",{className:d?"col-6 ":"col-12 p-fluid",children:[(e==null?void 0:e.showHeaderText)&&o.jsx("h6",{children:(Q=e==null?void 0:e.headerText)==null?void 0:Q[x==null?void 0:x.type]}),(e==null?void 0:e.showLabel)&&o.jsxs("label",{htmlFor:e.uuid,className:"flex font-medium mb-3 text-700 text-2xl",children:[o.jsx(sa,{...t}),((oe=e==null?void 0:e.attributes)==null?void 0:oe.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",c?o.jsx(o.Fragment,{children:(ye=e==null?void 0:e.label)==null?void 0:ye[x==null?void 0:x.type]}):o.jsx(ea,{...t}),o.jsx("span",{className:"ml-3",children:(e==null?void 0:e.showToolTip)&&o.jsx(Vi,{message:(Te=e==null?void 0:e.toolTip)==null?void 0:Te[x==null?void 0:x.type],position:"right"})})]}),o.jsxs("div",{className:"mt-3",children:[o.jsxs("span",{className:"p-input-icon-"+(e==null?void 0:e.iconAlignment),children:[(e==null?void 0:e.showIcon)&&o.jsx("i",{className:"pi pi-"+((be=(Ae=e==null?void 0:e.icon)==null?void 0:Ae.properties)==null?void 0:be.name)}),o.jsx(Na,{readOnly:w===A,id:e==null?void 0:e.uuid,placeholder:(we=e==null?void 0:e.placeholder)==null?void 0:we[x==null?void 0:x.type],value:O,min:(re=e==null?void 0:e.attributes)==null?void 0:re.min,max:e==null?void 0:e.attributes.max,suffix:e==null?void 0:e.attributes.suffix,prefix:(U=e==null?void 0:e.attributes)==null?void 0:U.prefix,showButtons:(Z=e==null?void 0:e.attributes)==null?void 0:Z.showButtons,pt:{incrementButton:{className:"bg-teal-500 border-teal-500"},decrementButton:{className:"bg-orange-500 border-orange-500"}},minFractionDigits:(K=e==null?void 0:e.attributes)==null?void 0:K.minFractionDigits,maxFractionDigits:(he=e==null?void 0:e.attributes)==null?void 0:he.maxFractionDigits,locale:(_e=e==null?void 0:e.attributes)==null?void 0:_e.locale,mode:(ge=e==null?void 0:e.attributes)==null?void 0:ge.mode,currency:(ve=e==null?void 0:e.attributes)==null?void 0:ve.currency,currencyDisplay:(Le=e==null?void 0:e.attributes)==null?void 0:Le.currencyDisplay,useGrouping:(Ne=e==null?void 0:e.attributes)==null?void 0:Ne.useGrouping,onFocus:()=>M(1),onChange:se=>{a!=null&&a.rowIsRepeatable?ie(e,se.value):pe(se.value)},className:B===1&&((me=e==null?void 0:e.attributes)!=null&&me.required)?O?"valid":"invalid":"valid'"})]}),o.jsx("div",{children:((V=e==null?void 0:e.attributes)==null?void 0:V.required)&&o.jsx("small",{className:"error",children:B===1&&!O?(te=e==null?void 0:e.validationMesssage)==null?void 0:te.english:""})}),o.jsx("div",{children:(e==null?void 0:e.showHelperText)&&o.jsx("small",{children:(X=e==null?void 0:e.helperText)==null?void 0:X[x==null?void 0:x.type]})})]})]})}),d&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(Fi,{...t})]})]})]});return o.jsxs(o.Fragment,{children:[_===!0&&o.jsx(Ri,{visibilty:_,closeSettingFieldSidebar:Y,...t}),o.jsx(wi,{...t,fieldWrap:J})]})},xb=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],o4=/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/,hu=/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+\$,\\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+\$,\\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%\/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/;function FF(t){try{JSON.parse(t)}catch{return!1}return!0}function kF(t){if(t<26)return xb[t];{const e=Math.floor(t/26)-1,n=t%26;return xb[e]+xb[n]}}const H0e=t=>{var pe,ie,J,Q,oe,ye,Te,Ae,be,we,re;const{field:e,fieldIndex:n,pageIndex:r,sectionIndex:i,row:a,update:s,value:l}=t,{isPreview:c,isAdmin:u,isRenderView:d}=tn(),{task_status:f,taskRegisterData:h,updateTaskRegisterData:m,updateTaskProgressValue:g,updateUserFormDataSubmit:v,userTaskSubmitFormData:A,TASK_PUBLISHED:w}=Pr(),{userSelectedLanguage:x}=ln(),[S,E]=N.useState(!1),[C,_]=N.useState(""),[T,O]=N.useState(0),[F,B]=N.useState(!1),M=()=>{B(!0)},z=()=>{B(!1)};N.useEffect(()=>{S||ne();const U=Rt.addListener("clearRepeatableFields",K=>{K===(a==null?void 0:a.uuid)&&(_(""),O(0),e.isValid=0)}),Z=Rt.addListener("onSubmitUserForm",()=>{var K;(K=e==null?void 0:e.attributes)!=null&&K.required?C!==""&&o4.test(C)===!0?e.isValid=1:e.isValid=0:e.isValid=1});return()=>{Z.remove(),U.remove()}});const[P,H]=N.useState(!1),de=U=>{H(U)},fe=()=>{H(!1)},ne=()=>{var U,Z,K;if(a!=null&&a.rowIsRepeatable){if(a!=null&&a.repeatableFields){const he=[...a.repeatableFields],_e=Et.findIndex(he,function(ge){return ge.uuid===(e==null?void 0:e.uuid)});_e>=0&&he[_e].fieldData?_(he[_e].fieldData):_("")}}else{const he=A;if(he!=null&&he.length){for(const _e of he)if(_e.fieldId===t.field.uuid&&((U=_e==null?void 0:_e.postData[0])==null?void 0:U.postValue)!==""&&((Z=_e==null?void 0:_e.postData[0])!=null&&Z.postValue)){_((K=_e==null?void 0:_e.postData[0])==null?void 0:K.postValue),E(!0);break}}}E(!0)},W=U=>{_(U);const Z=A,K=Et.cloneDeep(h);if(Z!==null){if(U!==""&&o4.test(U)===!0){if(K[e==null?void 0:e.uuid]=U,(Z==null?void 0:Z.length)>0)for(const he of Z)he.fieldId===t.field.uuid&&(he.postData[0]={postValue:U})}else if(delete K[e==null?void 0:e.uuid],(Z==null?void 0:Z.length)>0)for(const he of Z)he.fieldId===t.field.uuid&&(he.postData[0]={postValue:""})}if(!(a!=null&&a.rowIsRepeatable)){m(K);const he=Object.keys(K).length;g(he)}},ae=(U,Z,K,he)=>{var _e;if(_(he),A!==null){const ge=[...A],ve=Et.findIndex(ge,function(Ne){return Ne.rowId===(a==null?void 0:a.uuid)});let Le=(_e=A[ve])==null?void 0:_e.repeatableFields;Le={...Le,[K==null?void 0:K.uuid]:he},ge[ve]={...ge[ve],repeatableFields:Le},v(ge),he!==""&&o4.test(he)===!0?e.isValid=1:e.isValid=0}},Y=o.jsxs("div",{onMouseOver:M,onMouseOut:z,children:[!d&&!c&&F&&o.jsx(Hr,{handleFieldSettingsSidebar:de,...t}),o.jsxs("div",{className:`field ${c?" ":" builder-element-wrapper "}${(e==null?void 0:e.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[(e==null?void 0:e.showHeaderText)&&o.jsx("h6",{children:(pe=e==null?void 0:e.headerText)==null?void 0:pe[x==null?void 0:x.type]}),(e==null?void 0:e.showLabel)&&o.jsxs("label",{htmlFor:n,className:"flex font-medium mb-3 text-700 text-2xl",children:[o.jsx(sa,{...t,update:s,value:l}),((ie=e==null?void 0:e.attributes)==null?void 0:ie.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",c?o.jsx(o.Fragment,{children:(J=e==null?void 0:e.label)==null?void 0:J[x==null?void 0:x.type]}):o.jsx(ea,{...t}),o.jsx("span",{className:"ml-2",children:(e==null?void 0:e.showToolTip)&&o.jsx(o.Fragment,{children:o.jsx(Vi,{message:(Q=e==null?void 0:e.toolTip)==null?void 0:Q[x==null?void 0:x.type],position:"right"})})})]}),o.jsxs("span",{className:"p-input-icon-"+(e==null?void 0:e.iconAlignment),children:[(e==null?void 0:e.showIcon)&&o.jsx("i",{className:"pi pi-"+((ye=(oe=e==null?void 0:e.icon)==null?void 0:oe.properties)==null?void 0:ye.name)}),o.jsx(gn,{id:e==null?void 0:e.uuid,placeholder:(Te=e==null?void 0:e.placeholder)==null?void 0:Te[x==null?void 0:x.type],value:C,onFocus:()=>O(1),onChange:U=>{a!=null&&a.rowIsRepeatable?ae(r,i,{uuid:e.uuid},U.target.value):W(U.target.value)},className:T===1&&((Ae=e==null?void 0:e.attributes)!=null&&Ae.required)?C?"valid":"invalid":"valid'",readOnly:f===w})]}),((be=e==null?void 0:e.attributes)==null?void 0:be.required)&&o.jsx("div",{children:o.jsx("small",{className:"error",children:T===1&&!C?(we=e==null?void 0:e.validationMesssage)==null?void 0:we[x==null?void 0:x.language]:""})}),C!==""&&T===1&&o4.test(C)===!1&&o.jsx("small",{className:"error",children:"Please enter correct email"}),(e==null?void 0:e.showHelperText)&&o.jsx("div",{children:o.jsx("small",{children:(re=e==null?void 0:e.helperText)==null?void 0:re[x==null?void 0:x.type]})})]}),u&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(Fi,{...t})]})]});return o.jsxs(o.Fragment,{children:[P===!0&&o.jsx(Ri,{visibilty:P,closeSettingFieldSidebar:fe,...t},e==null?void 0:e.uuid),o.jsx(wi,{...t,fieldWrap:Y})]})},z0e=t=>{var Q,oe,ye,Te,Ae,be,we,re,U;const{field:e,fieldIndex:n,pageIndex:r,sectionIndex:i,rowIndex:a,columnIndex:s,row:l}=t,{isRenderView:c,isAdmin:u,isPreview:d}=tn(),{userSelectedLanguage:f,fieldSettingUpdate:h}=ln(),{task_status:m,taskRegisterData:g,updateTaskRegisterData:v,updateTaskProgressValue:A,updateUserFormDataSubmit:w,userTaskSubmitFormData:x,TASK_PUBLISHED:S}=Pr(),[E,C]=N.useState(!1),[_,T]=N.useState(""),[O,F]=N.useState(0),[B,M]=N.useState(!1),[z,P]=N.useState(!1),[H,de]=N.useState(!1),fe=()=>{P(!0)},ne=()=>{P(!1)},W=Z=>{C(Z)},ae=()=>{C(!1)},Y=()=>{var K,he,_e;const Z=x;if(l!=null&&l.rowIsRepeatable){if(l!=null&&l.repeatableFields){const ge=[...l.repeatableFields],ve=Et.findIndex(ge,function(Le){return Le.uuid===(e==null?void 0:e.uuid)});ve>=0&&ge[ve].fieldData?T(ge[ve].fieldData):(e.isValid=0,T(""))}}else if(Z!=null&&Z.length){for(const ge of Z)if(ge.fieldId===t.field.uuid&&((K=ge==null?void 0:ge.postData[0])!=null&&K.postValue)&&((he=ge==null?void 0:ge.postData[0])==null?void 0:he.postValue)!==""){T((_e=ge==null?void 0:ge.postData[0])==null?void 0:_e.postValue),M(!0);break}}M(!0)},pe=(Z,K,he,_e)=>{var ge;if(x!=null&&x.length){const ve=[...x],Le=Et.findIndex(ve,function(me){return me.rowId===(l==null?void 0:l.uuid)});let Ne=(ge=x[Le])==null?void 0:ge.repeatableFields;Ne={...Ne,[he==null?void 0:he.uuid]:_e},ve[Le]={...ve[Le],repeatableFields:Ne},w(ve)}T(_e),_e!==""?e.isValid=1:e.isValid=0,h(Z,K,a,s,n,e)};N.useEffect(()=>{B||Y();const Z=Rt.addListener("clearRepeatableFields",ve=>{ve===(l==null?void 0:l.uuid)&&(T(""),F(0),e.isValid=0)}),K=Rt.addListener("onSubmitUserForm",()=>{var ve;(ve=e==null?void 0:e.attributes)!=null&&ve.required?_?e.isValid=1:e.isValid=0:e.isValid=1}),he=Rt.addListener("OnInvalidFieldCatch",ve=>{e.uuid===(ve==null?void 0:ve.fieldId)?F(1):F(0)}),_e=Rt.addListener("OnGetFieldValue",ve=>{var Ne;const Le=(Ne=ve==null?void 0:ve.repeatableColumn)==null?void 0:Ne.filter(me=>(me==null?void 0:me.fieldUuid)===(e==null?void 0:e.uuid));Le!=null&&Le.length}),ge=Rt.addListener("onUpdateField",()=>{de(!H)});return()=>{ge.remove(),K.remove(),he.remove(),_e.remove(),Z.remove()}});const ie=Z=>{var _e,ge;T(Z.target.value);const K=x,he=Et.cloneDeep(g);if(K!==null){if((_e=Z==null?void 0:Z.target)!=null&&_e.value){if(he[e==null?void 0:e.uuid]=(ge=Z==null?void 0:Z.target)==null?void 0:ge.value,(K==null?void 0:K.length)>0)for(const ve of K)ve.fieldId===t.field.uuid&&(ve.postData[0]={postValue:Z.target.value})}else if(delete he[e==null?void 0:e.uuid],(K==null?void 0:K.length)>0)for(const ve of K)ve.fieldId===t.field.uuid&&(ve.postData[0]={postValue:""})}if(!(l!=null&&l.rowIsRepeatable)){v(he);const ve=Object.keys(he).length;A(ve)}},J=o.jsxs("div",{onMouseOver:fe,onMouseOut:ne,children:[!c&&!d&&z&&o.jsx(Hr,{handleFieldSettingsSidebar:W,...t}),o.jsxs("div",{className:`field ${d?" ":" builder-element-wrapper "}${(e==null?void 0:e.isFluid)===!0?"card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[o.jsx("div",{className:"grid",children:o.jsxs("div",{className:d?"col-12 ":"col-12 field-form-builder ",children:[(e==null?void 0:e.showHeaderText)&&o.jsx("h6",{children:(Q=e==null?void 0:e.headerText)==null?void 0:Q[f==null?void 0:f.type]}),(e==null?void 0:e.showLabel)&&o.jsxs("label",{htmlFor:n,className:"flex font-medium mb-3 text-700 text-2xl",children:[o.jsx(sa,{...t}),((oe=e==null?void 0:e.attributes)==null?void 0:oe.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",d?o.jsx(o.Fragment,{children:(ye=e==null?void 0:e.label)==null?void 0:ye[f==null?void 0:f.type]}):o.jsx(ea,{...t}),o.jsx("span",{className:"ml-3",children:(e==null?void 0:e.showToolTip)&&o.jsx(Vi,{message:(Te=e==null?void 0:e.toolTip)==null?void 0:Te[f==null?void 0:f.type],position:"right"})})]}),o.jsx(Ds,{rows:e==null?void 0:e.textareaRows,cols:e==null?void 0:e.textareaCols,autoResize:e==null?void 0:e.resizable,id:e==null?void 0:e.uuid,placeholder:(Ae=e==null?void 0:e.placeholder)==null?void 0:Ae[f==null?void 0:f.type],value:_,onFocus:()=>F(1),onChange:Z=>{l!=null&&l.rowIsRepeatable?pe(r,i,e,Z.target.value):ie(Z)},className:O===1&&((be=e==null?void 0:e.attributes)!=null&&be.required)?_?"valid":"invalid":"valid",readOnly:m===S}),o.jsx("div",{children:((we=e==null?void 0:e.attributes)==null?void 0:we.required)&&o.jsx("small",{className:"error",children:O===1&&!_?(re=e==null?void 0:e.validationMesssage)==null?void 0:re[f==null?void 0:f.type]:""})}),o.jsx("div",{children:(e==null?void 0:e.showHelperText)&&o.jsx("small",{children:(U=e==null?void 0:e.helperText)==null?void 0:U[f==null?void 0:f.type]})})]})}),u&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(Fi,{...t})]})]})]});return o.jsxs(o.Fragment,{children:[E===!0&&o.jsx(Ri,{visibilty:E,closeSettingFieldSidebar:ae,...t},e==null?void 0:e.uuid),o.jsx(wi,{...t,fieldWrap:J})]})},Y0e={},Cb=t=>{var T,O,F,B;const{isAdmin:e,isAdvanceView:n,isPreview:r}=tn(),{handleDrop:i}=ln(),{data:a,path:s,pageIndex:l,sectionIndex:c,rowIndex:u,columnIndex:d,conditionIndex:f,ruleIndex:h,condition:m,page:g,section:v,row:A,column:w}=t,x=N.useRef(null),[{isDragging:S},E]=Ji({type:qC,item:{type:qC,uuid:a.uuid,children:a.children,path:s},collect:M=>({isDragging:M.isDragging()})}),C=S?0:1;E(x);const _=(M,z,P,H,de,fe,ne)=>{const W=t!=null&&t.fieldContainer?t==null?void 0:t.fieldContainer:"inline-condition-container";return o.jsx(jc,{type:"inline-conditional",field:M,data:M,path:z,page:g,section:v,row:A,column:w,pageIndex:P,sectionIndex:H,rowIndex:de,columnIndex:fe,fieldIndex:ne,isAdmin:e,fieldContainer:W},M.uuid)};return o.jsxs("div",{ref:r===!1?x:null,style:{...Y0e,opacity:C},className:"draggable column",children:[m&&((T=m.children)==null?void 0:T.length)===0&&o.jsx("p",{className:"text-primary text-center",children:"Drag item here"}),m&&m.children&&((O=m.children)==null?void 0:O.length)>0&&m.children.map((M,z)=>{var P;return o.jsxs(N.Fragment,{children:[r===!1&&o.jsx(Cr,{isAdvanceView:n,data:{path:`${s}-${h}-${f}-${z}`,childrenCount:(P=m==null?void 0:m.children)==null?void 0:P.length,droppedField:m},onDrop:i}),_(M,`${s}-${h}-${f}-${z}`,l,c,u,d,z)]},M.uuid)}),r===!1&&o.jsx(Cr,{isAdvanceView:n,fieldDropArea:!0,data:{path:`${s}-${h}-${f}-${(F=m==null?void 0:m.children)==null?void 0:F.length}`,childrenCount:(B=m==null?void 0:m.children)==null?void 0:B.length,droppedField:m},onDrop:i,isLast:!0})]})},t0=t=>{const{inputValue:e,condition:n,ruleIndex:r,conditionIndex:i,field:a,section:s,page:l,row:c,pageIndex:u,sectionIndex:d,rowIndex:f,columnIndex:h,isConditionTrue:m}=t,{taskRegisterData:g,updateUserFormDataSubmit:v,userTaskSubmitFormData:A,updateProgressDataValuesHook:w}=Pr(),x=N.useCallback((S,E,C)=>{var T,O,F;const _=A;if(_!=null&&_.length){const B=g,M=(T=a==null?void 0:a.inlineConditionalRules)==null?void 0:T.rules[E].conditions[C].children;for(const[P,H]of M.entries()){(O=H==null?void 0:H.attributes)!=null&&O.required;const de=Et.findIndex(_,function(fe){return fe.fieldId===H.uuid});S?de===-1&&(_.push({postData:[],tabId:l.uuid,tabIndex:u,...a.inlineConditionalRules?{inlineConditionalRules:a.inlineConditionalRules}:{},...a.conditionalTabRules?{conditionalTabRules:a.conditionalTabRules}:{},...a.conditionalSectionRules?{conditionalSectionRules:a.conditionalSectionRules}:{},sectionId:s.uuid,sectionIndex:d,sectionHeading:s.heading,subHeadingText:s.subHeadingText,reviewerChecklist:a==null?void 0:a.reviewerChecklist,rowId:c.uuid,rowIndex:f,columnId:s.uuid,columnIndex:h,inlineConditionalField:!0,fieldIndex:P,fieldId:H.uuid,fieldInputType:a.componentType,fieldTitle:(F=a.label)==null?void 0:F.english,fieldDescription:a.description||null,fieldHelperText:a.helperText||null,fieldHeaderText:a.headerText||null,fieldFooterText:a.footerText||null,fieldTitleAbb:a.abbreviationLabel||a.label,question_abb_table:a.textForTable||null,language:"english",isHiddenfield:a.isHidden&&a.isHidden===1?1:0,isHiddenSection:s.isHidden&&s.isHidden===1?1:0}),B[H==null?void 0:H.uuid]&&delete B[H==null?void 0:H.uuid]):(B[H==null?void 0:H.uuid]&&delete B[H==null?void 0:H.uuid],de>=0&&_.splice(de,1))}const z=Object.keys(B).length;w({progressMaxValue:_==null?void 0:_.length,progressValue:z}),v(_)}},[h,a.abbreviationLabel,a.componentType,a.conditionalSectionRules,a.conditionalTabRules,a.description,a.footerText,a.headerText,a.helperText,a.inlineConditionalRules,a.isHidden,a.label,a==null?void 0:a.reviewerChecklist,a.textForTable,l.uuid,u,c.uuid,f,s.heading,s.isHidden,s.subHeadingText,s.uuid,d,g,w,v,A]);return N.useEffect(()=>(x(m,r,i),()=>{}),[i,e,m,r,x]),o.jsx("div",{children:m&&o.jsx("div",{className:"p-field p-pt-2",children:o.jsx(o.Fragment,{children:o.jsx(Cb,{...t,ruleIndex:r,conditionIndex:i,condition:n,data:a})})},i)})};function w2(t){"@babel/helpers - typeof";return w2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w2(t)}function K0e(t,e){if(w2(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(w2(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function X0e(t){var e=K0e(t,"string");return w2(e)==="symbol"?e:String(e)}function Tb(t,e,n){return e=X0e(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var R0e={value:"p-tag-value",icon:"p-tag-icon",root:function(e){var n=e.props;return pt("p-tag p-component",Tb(Tb({},"p-tag-".concat(n.severity),n.severity!==null),"p-tag-rounded",n.rounded))}},G0e=`
2390
2390
  @layer primereact {
2391
2391
  .p-tag {
2392
2392
  display: inline-flex;
@@ -3705,7 +3705,7 @@ ${lh(e)}`),n.map&&!n.map.bytes&&(this.logger_("going to request init segment."),
3705
3705
  `.split("").map(t=>t.charCodeAt(0)));class Zme extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class e3e extends FA{constructor(e,n={}){super(e,n),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return lo();const e=this.subtitlesTrack_.cues,n=e[0].startTime,r=e[e.length-1].startTime;return lo([[n,r]])}initSegmentForMap(e,n=!1){if(!e)return null;const r=fv(e);let i=this.initSegments_[r];if(n&&!i&&e.bytes){const a=xB.byteLength+e.bytes.byteLength,s=new Uint8Array(a);s.set(e.bytes),s.set(xB,e.bytes.byteLength),this.initSegments_[r]=i={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:s}}return i||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,n){lg(e,n,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const n=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",n),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,n,r){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(n.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===Tu.TIMEOUT&&this.handleTimeout_(),e.code===Tu.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const i=this.pendingSegment_;this.saveBandwidthRelatedStats_(i.duration,n.stats),n.key&&this.segmentKey(n.key,!0),this.state="APPENDING",this.trigger("appending");const a=i.segment;if(a.map&&(a.map.bytes=n.map.bytes),i.bytes=n.bytes,typeof Ge.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,n,r),()=>this.stopForError({message:"Error loading vtt.js",metadata:{errorType:Nt.Error.VttLoadError}}));return}a.requested=!0;try{this.parseVTTCues_(i)}catch(s){this.stopForError({message:s.message,metadata:{errorType:Nt.Error.VttCueParsingError}});return}if(this.updateTimeMapping_(i,this.syncController_.timelines[i.timeline],this.playlist_),i.cues.length?i.timingInfo={start:i.cues[0].startTime,end:i.cues[i.cues.length-1].endTime}:i.timingInfo={start:i.startOfSegment,end:i.startOfSegment+i.duration},i.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}i.byteLength=i.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,i.cues.forEach(s=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new Ge.VTTCue(s.startTime,s.endTime,s.text):s)}),Vme(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let n,r=!1;if(typeof Ge.WebVTT!="function")throw new Zme;typeof Ge.TextDecoder=="function"?n=new Ge.TextDecoder("utf8"):(n=Ge.WebVTT.StringDecoder(),r=!0);const i=new Ge.WebVTT.Parser(Ge,Ge.vttjs,n);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},i.oncue=e.cues.push.bind(e.cues),i.ontimestampmap=s=>{e.timestampmap=s},i.onparsingerror=s=>{Nt.log.warn("Error encountered when parsing cues: "+s.message)},e.segment.map){let s=e.segment.map.bytes;r&&(s=SB(s)),i.parse(s)}let a=e.bytes;r&&(a=SB(a)),i.parse(a),i.flush()}updateTimeMapping_(e,n,r){const i=e.segment;if(!n)return;if(!e.cues.length){i.empty=!0;return}const{MPEGTS:a,LOCAL:s}=e.timestampmap,c=a/c1.ONE_SECOND_IN_TS-s+n.mapping;if(e.cues.forEach(u=>{const d=u.endTime-u.startTime,f=a===0?u.startTime+c:this.handleRollover_(u.startTime+c,n.time);u.startTime=Math.max(f,0),u.endTime=Math.max(f+d,0)}),!r.syncInfo){const u=e.cues[0].startTime,d=e.cues[e.cues.length-1].startTime;r.syncInfo={mediaSequence:r.mediaSequence+e.mediaIndex,time:Math.min(u,d-i.duration)}}}handleRollover_(e,n){if(n===null)return e;let r=e*c1.ONE_SECOND_IN_TS;const i=n*c1.ONE_SECOND_IN_TS;let a;for(i<r?a=-8589934592:a=8589934592;Math.abs(r-i)>4294967296;)r+=a;return r/c1.ONE_SECOND_IN_TS}}const t3e=function(t,e){const n=t.cues;for(let r=0;r<n.length;r++){const i=n[r];if(e>=i.adStartTime&&e<=i.adEndTime)return i}return null},n3e=function(t,e,n=0){if(!t.segments)return;let r=n,i;for(let a=0;a<t.segments.length;a++){const s=t.segments[a];if(i||(i=t3e(e,r+s.duration/2)),i){if("cueIn"in s){i.endTime=r,i.adEndTime=r,r+=s.duration,i=null;continue}if(r<i.endTime){r+=s.duration;continue}i.endTime+=s.duration}else if("cueOut"in s&&(i=new Ge.VTTCue(r,r+s.duration,s.cueOut),i.adStartTime=r,i.adEndTime=r+parseFloat(s.cueOut),e.addCue(i)),"cueOutCont"in s){const[l,c]=s.cueOutCont.split("/").map(parseFloat);i=new Ge.VTTCue(r,r+s.duration,""),i.adStartTime=r-l,i.adEndTime=i.adStartTime+c,e.addCue(i)}r+=s.duration}};class CB{constructor({start:e,end:n,segmentIndex:r,partIndex:i=null,appended:a=!1}){this.start_=e,this.end_=n,this.segmentIndex_=r,this.partIndex_=i,this.appended_=a}isInRange(e){return e>=this.start&&e<this.end}markAppended(){this.appended_=!0}resetAppendedStatus(){this.appended_=!1}get isAppended(){return this.appended_}get start(){return this.start_}get end(){return this.end_}get segmentIndex(){return this.segmentIndex_}get partIndex(){return this.partIndex_}}class r3e{constructor(e,n=[]){this.segmentSyncInfo_=e,this.partsSyncInfo_=n}get segmentSyncInfo(){return this.segmentSyncInfo_}get partsSyncInfo(){return this.partsSyncInfo_}get hasPartsSyncInfo(){return this.partsSyncInfo_.length>0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class PA{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,n){const{mediaSequence:r,segments:i}=e;if(this.isReliable_=this.isReliablePlaylist_(r,i),!!this.isReliable_)return this.updateStorage_(i,r,this.calculateBaseTime_(r,n))}getSyncInfoForTime(e){for(const{segmentSyncInfo:n,partsSyncInfo:r}of this.storage_.values())if(r.length){for(const i of r)if(i.isInRange(e))return i}else if(n.isInRange(e))return n;return null}updateStorage_(e,n,r){const i=new Map;let a=`
3706
3706
  `,s=r,l=n;this.start_=s,e.forEach((c,u)=>{const d=this.storage_.get(l),f=s,h=f+c.duration,m=!!(d&&d.segmentSyncInfo&&d.segmentSyncInfo.isAppended),g=new CB({start:f,end:h,appended:m,segmentIndex:u});c.syncInfo=g;let v=s;const A=(c.parts||[]).map((w,x)=>{const S=v,E=v+w.duration,C=!!(d&&d.partsSyncInfo&&d.partsSyncInfo[x]&&d.partsSyncInfo[x].isAppended),_=new CB({start:S,end:E,appended:C,segmentIndex:u,partIndex:x});return v=E,a+=`Media Sequence: ${l}.${x} | Range: ${S} --> ${E} | Appended: ${C}
3707
3707
  `,w.syncInfo=_,_});i.set(l,new r3e(g,A)),a+=`${dB(c.resolvedUri)} | Media Sequence: ${l} | Range: ${f} --> ${h} | Appended: ${m}
3708
- `,l++,s=h}),this.end_=s,this.storage_=i,this.diagnostics_=a}calculateBaseTime_(e,n){return this.storage_.size?this.storage_.has(e)?this.storage_.get(e).segmentSyncInfo.start:n:0}isReliablePlaylist_(e,n){return e!=null&&Array.isArray(n)&&n.length}}const i3e=86400,MA=[{name:"VOD",run:(t,e,n,r,i)=>n!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(t,e,n,r,i,a)=>{const s=t.getMediaSequenceSync(a);if(!s||!s.isReliable)return null;const l=s.getSyncInfoForTime(i);return l?{time:l.start,partIndex:l.partIndex,segmentIndex:l.segmentIndex}:null}},{name:"ProgramDateTime",run:(t,e,n,r,i)=>{if(!Object.keys(t.timelineToDatetimeMappings).length)return null;let a=null,s=null;const l=bA(e);i=i||0;for(let c=0;c<l.length;c++){const u=e.endList||i===0?c:l.length-(c+1),d=l[u],f=d.segment,h=t.timelineToDatetimeMappings[f.timeline];if(!h||!f.dateTimeObject)continue;let g=f.dateTimeObject.getTime()/1e3+h;if(f.parts&&typeof d.partIndex=="number")for(let A=0;A<d.partIndex;A++)g+=f.parts[A].duration;const v=Math.abs(i-g);if(s!==null&&(v===0||s<v))break;s=v,a={time:g,segmentIndex:d.segmentIndex,partIndex:d.partIndex}}return a}},{name:"Segment",run:(t,e,n,r,i)=>{let a=null,s=null;i=i||0;const l=bA(e);for(let c=0;c<l.length;c++){const u=e.endList||i===0?c:l.length-(c+1),d=l[u],f=d.segment,h=d.part&&d.part.start||f&&f.start;if(f.timeline===r&&typeof h<"u"){const m=Math.abs(i-h);if(s!==null&&s<m)break;(!a||s===null||s>=m)&&(s=m,a={time:h,segmentIndex:d.segmentIndex,partIndex:d.partIndex})}}return a}},{name:"Discontinuity",run:(t,e,n,r,i)=>{let a=null;if(i=i||0,e.discontinuityStarts&&e.discontinuityStarts.length){let s=null;for(let l=0;l<e.discontinuityStarts.length;l++){const c=e.discontinuityStarts[l],u=e.discontinuitySequence+l+1,d=t.discontinuities[u];if(d){const f=Math.abs(i-d.time);if(s!==null&&s<f)break;(!a||s===null||s>=f)&&(s=f,a={time:d.time,segmentIndex:c,partIndex:null})}}}return a}},{name:"Playlist",run:(t,e,n,r,i)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class a3e extends Nt.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={},this.mediaSequenceStorage_={main:new PA,audio:new PA,vtt:new PA},this.logger_=Ql("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,n,r,i,a){if(n!==1/0)return MA.find(({name:c})=>c==="VOD").run(this,e,n);const s=this.runStrategies_(e,n,r,i,a);if(!s.length)return null;for(const l of s){const{syncPoint:c,strategy:u}=l,{segmentIndex:d,time:f}=c;if(d<0)continue;const h=e.segments[d],m=f,g=m+h.duration;if(this.logger_(`Strategy: ${u}. Current time: ${i}. selected segment: ${d}. Time: [${m} -> ${g}]}`),i>=m&&i<g)return this.logger_("Found sync point with exact match: ",c),c}return this.selectSyncPoint_(s,{key:"time",value:i})}getExpiredTime(e,n){if(!e||!e.segments)return null;const r=this.runStrategies_(e,n,e.discontinuitySequence,0);if(!r.length)return null;const i=this.selectSyncPoint_(r,{key:"segmentIndex",value:0});return i.segmentIndex>0&&(i.time*=-1),Math.abs(i.time+ig({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:i.segmentIndex,endIndex:0}))}runStrategies_(e,n,r,i,a){const s=[];for(let l=0;l<MA.length;l++){const c=MA[l],u=c.run(this,e,n,r,i,a);u&&(u.strategy=c.name,s.push({strategy:c.name,syncPoint:u}))}return s}selectSyncPoint_(e,n){let r=e[0].syncPoint,i=Math.abs(e[0].syncPoint[n.key]-n.value),a=e[0].strategy;for(let s=1;s<e.length;s++){const l=Math.abs(e[s].syncPoint[n.key]-n.value);l<i&&(i=l,r=e[s].syncPoint,a=e[s].strategy)}return this.logger_(`syncPoint for [${n.key}: ${n.value}] chosen with strategy [${a}]: [time:${r.time}, segmentIndex:${r.segmentIndex}`+(typeof r.partIndex=="number"?`,partIndex:${r.partIndex}`:"")+"]"),r}saveExpiredSegmentInfo(e,n){const r=n.mediaSequence-e.mediaSequence;if(r>i3e){Nt.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let i=r-1;i>=0;i--){const a=e.segments[i];if(a&&typeof a.start<"u"){n.syncInfo={mediaSequence:e.mediaSequence+i,time:a.start},this.logger_(`playlist refresh sync: [time:${n.syncInfo.time}, mediaSequence: ${n.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const n=e.segments[0],r=n.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[n.timeline]=-r}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:n}){const r=this.calculateSegmentTimeMapping_(e,e.timingInfo,n),i=e.segment;r&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:i.start}));const a=i.dateTimeObject;i.discontinuity&&n&&a&&(this.timelineToDatetimeMappings[i.timeline]=-(a.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,n,r){const i=e.segment,a=e.part;let s=this.timelines[e.timeline],l,c;if(typeof e.timestampOffset=="number")s={time:e.startOfSegment,mapping:e.startOfSegment-n.start},r&&(this.timelines[e.timeline]=s,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${s.time}] [mapping: ${s.mapping}]`)),l=e.startOfSegment,c=n.end+s.mapping;else if(s)l=n.start+s.mapping,c=n.end+s.mapping;else return!1;return a&&(a.start=l,a.end=c),(!i.start||l<i.start)&&(i.start=l),i.end=c,!0}saveDiscontinuitySyncInfo_(e){const n=e.playlist,r=e.segment;if(r.discontinuity)this.discontinuities[r.timeline]={time:r.start,accuracy:0};else if(n.discontinuityStarts&&n.discontinuityStarts.length)for(let i=0;i<n.discontinuityStarts.length;i++){const a=n.discontinuityStarts[i],s=n.discontinuitySequence+i+1,l=a-e.mediaIndex,c=Math.abs(l);if(!this.discontinuities[s]||this.discontinuities[s].accuracy>c){let u;l<0?u=r.start-ig({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:e.mediaIndex,endIndex:a}):u=r.end+ig({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:e.mediaIndex+1,endIndex:a}),this.discontinuities[s]={time:u,accuracy:c}}}}dispose(){this.trigger("dispose"),this.off()}}class s3e extends Nt.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:n,to:r}){return typeof n=="number"&&typeof r=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:n,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:n,to:r}){return typeof n=="number"&&typeof r=="number"&&(this.lastTimelineChanges_[e]={type:e,from:n,to:r},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const o3e=GL(WL(function(){var t=function(){function v(){this.listeners={}}var A=v.prototype;return A.on=function(x,S){this.listeners[x]||(this.listeners[x]=[]),this.listeners[x].push(S)},A.off=function(x,S){if(!this.listeners[x])return!1;var E=this.listeners[x].indexOf(S);return this.listeners[x]=this.listeners[x].slice(0),this.listeners[x].splice(E,1),E>-1},A.trigger=function(x){var S=this.listeners[x];if(S)if(arguments.length===2)for(var E=S.length,C=0;C<E;++C)S[C].call(this,arguments[1]);else for(var _=Array.prototype.slice.call(arguments,1),T=S.length,O=0;O<T;++O)S[O].apply(this,_)},A.dispose=function(){this.listeners={}},A.pipe=function(x){this.on("data",function(S){x.push(S)})},v}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function e(v){return v.subarray(0,v.byteLength-v[v.byteLength-1])}/*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */const n=function(){const v=[[[],[],[],[],[]],[[],[],[],[],[]]],A=v[0],w=v[1],x=A[4],S=w[4];let E,C,_;const T=[],O=[];let F,B,M,z,P,H;for(E=0;E<256;E++)O[(T[E]=E<<1^(E>>7)*283)^E]=E;for(C=_=0;!x[C];C^=F||1,_=O[_]||1)for(z=_^_<<1^_<<2^_<<3^_<<4,z=z>>8^z&255^99,x[C]=z,S[z]=C,M=T[B=T[F=T[C]]],H=M*16843009^B*65537^F*257^C*16843008,P=T[z]*257^z*16843008,E=0;E<4;E++)A[E][C]=P=P<<24^P>>>8,w[E][z]=H=H<<24^H>>>8;for(E=0;E<5;E++)A[E]=A[E].slice(0),w[E]=w[E].slice(0);return v};let r=null;class i{constructor(A){r||(r=n()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];let w,x,S;const E=this._tables[0][4],C=this._tables[1],_=A.length;let T=1;if(_!==4&&_!==6&&_!==8)throw new Error("Invalid aes key size");const O=A.slice(0),F=[];for(this._key=[O,F],w=_;w<4*_+28;w++)S=O[w-1],(w%_===0||_===8&&w%_===4)&&(S=E[S>>>24]<<24^E[S>>16&255]<<16^E[S>>8&255]<<8^E[S&255],w%_===0&&(S=S<<8^S>>>24^T<<24,T=T<<1^(T>>7)*283)),O[w]=O[w-_]^S;for(x=0;w;x++,w--)S=O[x&3?w:w-4],w<=4||x<4?F[x]=S:F[x]=C[0][E[S>>>24]]^C[1][E[S>>16&255]]^C[2][E[S>>8&255]]^C[3][E[S&255]]}decrypt(A,w,x,S,E,C){const _=this._key[1];let T=A^_[0],O=S^_[1],F=x^_[2],B=w^_[3],M,z,P;const H=_.length/4-2;let de,fe=4;const ne=this._tables[1],W=ne[0],ae=ne[1],Y=ne[2],pe=ne[3],ie=ne[4];for(de=0;de<H;de++)M=W[T>>>24]^ae[O>>16&255]^Y[F>>8&255]^pe[B&255]^_[fe],z=W[O>>>24]^ae[F>>16&255]^Y[B>>8&255]^pe[T&255]^_[fe+1],P=W[F>>>24]^ae[B>>16&255]^Y[T>>8&255]^pe[O&255]^_[fe+2],B=W[B>>>24]^ae[T>>16&255]^Y[O>>8&255]^pe[F&255]^_[fe+3],fe+=4,T=M,O=z,F=P;for(de=0;de<4;de++)E[(3&-de)+C]=ie[T>>>24]<<24^ie[O>>16&255]<<16^ie[F>>8&255]<<8^ie[B&255]^_[fe++],M=T,T=O,O=F,F=B,B=M}}class a extends t{constructor(){super(t),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(A){this.jobs.push(A),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const s=function(v){return v<<24|(v&65280)<<8|(v&16711680)>>8|v>>>24},l=function(v,A,w){const x=new Int32Array(v.buffer,v.byteOffset,v.byteLength>>2),S=new i(Array.prototype.slice.call(A)),E=new Uint8Array(v.byteLength),C=new Int32Array(E.buffer);let _,T,O,F,B,M,z,P,H;for(_=w[0],T=w[1],O=w[2],F=w[3],H=0;H<x.length;H+=4)B=s(x[H]),M=s(x[H+1]),z=s(x[H+2]),P=s(x[H+3]),S.decrypt(B,M,z,P,C,H),C[H]=s(C[H]^_),C[H+1]=s(C[H+1]^T),C[H+2]=s(C[H+2]^O),C[H+3]=s(C[H+3]^F),_=B,T=M,O=z,F=P;return E};class c{constructor(A,w,x,S){const E=c.STEP,C=new Int32Array(A.buffer),_=new Uint8Array(A.byteLength);let T=0;for(this.asyncStream_=new a,this.asyncStream_.push(this.decryptChunk_(C.subarray(T,T+E),w,x,_)),T=E;T<C.length;T+=E)x=new Uint32Array([s(C[T-4]),s(C[T-3]),s(C[T-2]),s(C[T-1])]),this.asyncStream_.push(this.decryptChunk_(C.subarray(T,T+E),w,x,_));this.asyncStream_.push(function(){S(null,e(_))})}static get STEP(){return 32e3}decryptChunk_(A,w,x,S){return function(){const E=l(A,w,x);S.set(E,A.byteOffset)}}}var u=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},d;typeof window<"u"?d=window:typeof u<"u"?d=u:typeof self<"u"?d=self:d={};var f=d,h=function(A){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(A):A&&A.buffer instanceof ArrayBuffer},m=f.BigInt||Number;m("0x1"),m("0x100"),m("0x10000"),m("0x1000000"),m("0x100000000"),m("0x10000000000"),m("0x1000000000000"),m("0x100000000000000"),m("0x10000000000000000"),function(){var v=new Uint16Array([65484]),A=new Uint8Array(v.buffer,v.byteOffset,v.byteLength);return A[0]===255?"big":A[0]===204?"little":"unknown"}();const g=function(v){const A={};return Object.keys(v).forEach(w=>{const x=v[w];h(x)?A[w]={bytes:x.buffer,byteOffset:x.byteOffset,byteLength:x.byteLength}:A[w]=x}),A};self.onmessage=function(v){const A=v.data,w=new Uint8Array(A.encrypted.bytes,A.encrypted.byteOffset,A.encrypted.byteLength),x=new Uint32Array(A.key.bytes,A.key.byteOffset,A.key.byteLength/4),S=new Uint32Array(A.iv.bytes,A.iv.byteOffset,A.iv.byteLength/4);new c(w,x,S,function(E,C){self.postMessage(g({source:A.source,decrypted:C}),[C.buffer])})}}));var l3e=RL(o3e);const c3e=t=>{let e=t.default?"main":"alternative";return t.characteristics&&t.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},TB=(t,e)=>{t.abort(),t.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},LA=(t,e)=>{e.activePlaylistLoader=t,t.load()},u3e=(t,e)=>()=>{const{segmentLoaders:{[t]:n,main:r},mediaTypes:{[t]:i}}=e,a=i.activeTrack(),s=i.getActiveGroup(),l=i.activePlaylistLoader,c=i.lastGroup_;if(!(s&&c&&s.id===c.id)&&(i.lastGroup_=s,i.lastTrack_=a,TB(n,i),!(!s||s.isMainPlaylist))){if(!s.playlistLoader){l&&r.resetEverything();return}n.resyncLoader(),LA(s.playlistLoader,i)}},d3e=(t,e)=>()=>{const{segmentLoaders:{[t]:n},mediaTypes:{[t]:r}}=e;r.lastGroup_=null,n.abort(),n.pause()},f3e=(t,e)=>()=>{const{mainPlaylistLoader:n,segmentLoaders:{[t]:r,main:i},mediaTypes:{[t]:a}}=e,s=a.activeTrack(),l=a.getActiveGroup(),c=a.activePlaylistLoader,u=a.lastTrack_;if(!(u&&s&&u.id===s.id)&&(a.lastGroup_=l,a.lastTrack_=s,TB(r,a),!!l)){if(l.isMainPlaylist){if(!s||!u||s.id===u.id)return;const d=e.vhs.playlistController_,f=d.selectPlaylist();if(d.media()===f)return;a.logger_(`track change. Switching main audio from ${u.id} to ${s.id}`),n.pause(),i.resetEverything(),d.fastQualityChange_(f);return}if(t==="AUDIO"){if(!l.playlistLoader){i.setAudio(!0),i.resetEverything();return}r.setAudio(!0),i.setAudio(!1)}if(c===l.playlistLoader){LA(l.playlistLoader,a);return}r.track&&r.track(s),r.resetEverything(),LA(l.playlistLoader,a)}},vv={AUDIO:(t,e)=>()=>{const{mediaTypes:{[t]:n},excludePlaylist:r}=e,i=n.activeTrack(),a=n.activeGroup(),s=(a.filter(c=>c.default)[0]||a[0]).id,l=n.tracks[s];if(i===l){r({error:{message:"Problem encountered loading the default audio track."}});return}Nt.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const c in n.tracks)n.tracks[c].enabled=n.tracks[c]===l;n.onTrackChanged()},SUBTITLES:(t,e)=>()=>{const{mediaTypes:{[t]:n}}=e;Nt.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}},EB={AUDIO:(t,e,n)=>{if(!e)return;const{tech:r,requestOptions:i,segmentLoaders:{[t]:a}}=n;e.on("loadedmetadata",()=>{const s=e.media();a.playlist(s,i),(!r.paused()||s.endList&&r.preload()!=="none")&&a.load()}),e.on("loadedplaylist",()=>{a.playlist(e.media(),i),r.paused()||a.load()}),e.on("error",vv[t](t,n))},SUBTITLES:(t,e,n)=>{const{tech:r,requestOptions:i,segmentLoaders:{[t]:a},mediaTypes:{[t]:s}}=n;e.on("loadedmetadata",()=>{const l=e.media();a.playlist(l,i),a.track(s.activeTrack()),(!r.paused()||l.endList&&r.preload()!=="none")&&a.load()}),e.on("loadedplaylist",()=>{a.playlist(e.media(),i),r.paused()||a.load()}),e.on("error",vv[t](t,n))}},h3e={AUDIO:(t,e)=>{const{vhs:n,sourceType:r,segmentLoaders:{[t]:i},requestOptions:a,main:{mediaGroups:s},mediaTypes:{[t]:{groups:l,tracks:c,logger_:u}},mainPlaylistLoader:d}=e,f=ag(d.main);(!s[t]||Object.keys(s[t]).length===0)&&(s[t]={main:{default:{default:!0}}},f&&(s[t].main.default.playlists=d.main.playlists));for(const h in s[t]){l[h]||(l[h]=[]);for(const m in s[t][h]){let g=s[t][h][m],v;if(f?(u(`AUDIO group '${h}' label '${m}' is a main playlist`),g.isMainPlaylist=!0,v=null):r==="vhs-json"&&g.playlists?v=new sh(g.playlists[0],n,a):g.resolvedUri?v=new sh(g.resolvedUri,n,a):g.playlists&&r==="dash"?v=new IA(g.playlists[0],n,a,d):v=null,g=Gi({id:m,playlistLoader:v},g),EB[t](t,g.playlistLoader,e),l[h].push(g),typeof c[m]>"u"){const A=new Nt.AudioTrack({id:m,kind:c3e(g),enabled:!1,language:g.language,default:g.default,label:m});c[m]=A}}}i.on("error",vv[t](t,e))},SUBTITLES:(t,e)=>{const{tech:n,vhs:r,sourceType:i,segmentLoaders:{[t]:a},requestOptions:s,main:{mediaGroups:l},mediaTypes:{[t]:{groups:c,tracks:u}},mainPlaylistLoader:d}=e;for(const f in l[t]){c[f]||(c[f]=[]);for(const h in l[t][f]){if(!r.options_.useForcedSubtitles&&l[t][f][h].forced)continue;let m=l[t][f][h],g;if(i==="hls")g=new sh(m.resolvedUri,r,s);else if(i==="dash"){if(!m.playlists.filter(A=>A.excludeUntil!==1/0).length)return;g=new IA(m.playlists[0],r,s,d)}else i==="vhs-json"&&(g=new sh(m.playlists?m.playlists[0]:m.resolvedUri,r,s));if(m=Gi({id:h,playlistLoader:g},m),EB[t](t,m.playlistLoader,e),c[f].push(m),typeof u[h]>"u"){const v=n.addRemoteTextTrack({id:h,kind:"subtitles",default:m.default&&m.autoselect,language:m.language,label:h},!1).track;u[h]=v}}}a.on("error",vv[t](t,e))},"CLOSED-CAPTIONS":(t,e)=>{const{tech:n,main:{mediaGroups:r},mediaTypes:{[t]:{groups:i,tracks:a}}}=e;for(const s in r[t]){i[s]||(i[s]=[]);for(const l in r[t][s]){const c=r[t][s][l];if(!/^(?:CC|SERVICE)/.test(c.instreamId))continue;const u=n.options_.vhs&&n.options_.vhs.captionServices||{};let d={label:l,language:c.language,instreamId:c.instreamId,default:c.default&&c.autoselect};if(u[d.instreamId]&&(d=Gi(d,u[d.instreamId])),d.default===void 0&&delete d.default,i[s].push(Gi({id:l},c)),typeof a[l]>"u"){const f=n.addRemoteTextTrack({id:d.instreamId,kind:"captions",default:d.default,language:d.language,label:d.label},!1).track;a[l]=f}}}}},IB=(t,e)=>{for(let n=0;n<t.length;n++)if(wA(e,t[n])||t[n].playlists&&IB(t[n].playlists,e))return!0;return!1},p3e=(t,e)=>n=>{const{mainPlaylistLoader:r,mediaTypes:{[t]:{groups:i}}}=e,a=r.media();if(!a)return null;let s=null;a.attributes[t]&&(s=i[a.attributes[t]]);const l=Object.keys(i);if(!s)if(t==="AUDIO"&&l.length>1&&ag(e.main))for(let c=0;c<l.length;c++){const u=i[l[c]];if(IB(u,a)){s=u;break}}else i.main?s=i.main:l.length===1&&(s=i[l[0]]);return typeof n>"u"?s:n===null||!s?null:s.filter(c=>c.id===n.id)[0]||null},g3e={AUDIO:(t,e)=>()=>{const{mediaTypes:{[t]:{tracks:n}}}=e;for(const r in n)if(n[r].enabled)return n[r];return null},SUBTITLES:(t,e)=>()=>{const{mediaTypes:{[t]:{tracks:n}}}=e;for(const r in n)if(n[r].mode==="showing"||n[r].mode==="hidden")return n[r];return null}},m3e=(t,{mediaTypes:e})=>()=>{const n=e[t].activeTrack();return n?e[t].activeGroup(n):null},v3e=t=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(u=>{h3e[u](u,t)});const{mediaTypes:e,mainPlaylistLoader:n,tech:r,vhs:i,segmentLoaders:{["AUDIO"]:a,main:s}}=t;["AUDIO","SUBTITLES"].forEach(u=>{e[u].activeGroup=p3e(u,t),e[u].activeTrack=g3e[u](u,t),e[u].onGroupChanged=u3e(u,t),e[u].onGroupChanging=d3e(u,t),e[u].onTrackChanged=f3e(u,t),e[u].getActiveGroup=m3e(u,t)});const l=e.AUDIO.activeGroup();if(l){const u=(l.filter(f=>f.default)[0]||l[0]).id;e.AUDIO.tracks[u].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(s.setAudio(!1),a.setAudio(!0)):s.setAudio(!0)}n.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(u=>e[u].onGroupChanged())}),n.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(u=>e[u].onGroupChanging())});const c=()=>{e.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};r.audioTracks().addEventListener("change",c),r.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),i.on("dispose",()=>{r.audioTracks().removeEventListener("change",c),r.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const u in e.AUDIO.tracks)r.audioTracks().addTrack(e.AUDIO.tracks[u])},b3e=()=>{const t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{t[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:yd,activeTrack:yd,getActiveGroup:yd,onGroupChanged:yd,onTrackChanged:yd,lastTrack_:null,logger_:Ql(`MediaGroups[${e}]`)}}),t};class _B{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=Jo(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(n=>[n.ID,n])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class y3e extends Nt.EventTarget{constructor(e,n){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new _B,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Ql("Content Steering"),this.xhr_=e,this.getBandwidth_=n}assignTagProperties(e,n){this.manifestType_=n.serverUri?"HLS":"DASH";const r=n.serverUri||n.serverURL;if(!r){this.logger_(`steering manifest URL is ${r}, cannot request steering manifest.`),this.trigger("error");return}if(r.startsWith("data:")){this.decodeDataUriManifest_(r.substring(r.indexOf(",")+1));return}this.steeringManifest.reloadUri=Jo(e,r),this.defaultPathway=n.pathwayId||n.defaultServiceLocation,this.queryBeforeStart=n.queryBeforeStart,this.proxyServerUrl_=n.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const n=this.steeringManifest.reloadUri;if(!n)return;const r=e?n:this.getRequestURI(n);if(!r){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(i,a)=>{if(i){if(a.status===410){this.logger_(`manifest request 410 ${i}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),this.excludedSteeringManifestURLs.add(r);return}if(a.status===429){const l=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${i}.`),this.logger_(`content steering will retry in ${l} seconds.`),this.startTTLTimeout_(parseInt(l,10));return}this.logger_(`manifest failed to load ${i}.`),this.startTTLTimeout_();return}const s=JSON.parse(this.request_.responseText);this.assignSteeringProperties_(s),this.startTTLTimeout_()})}setProxyServerUrl_(e){const n=new Ge.URL(e),r=new Ge.URL(this.proxyServerUrl_);return r.searchParams.set("url",encodeURI(n.toString())),this.setSteeringParams_(r.toString())}decodeDataUriManifest_(e){const n=JSON.parse(Ge.atob(e));this.assignSteeringProperties_(n)}setSteeringParams_(e){const n=new Ge.URL(e),r=this.getPathway(),i=this.getBandwidth_();if(r){const a=`_${this.manifestType_}_pathway`;n.searchParams.set(a,r)}if(i){const a=`_${this.manifestType_}_throughput`;n.searchParams.set(a,i)}return n.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const r=(i=>{for(const a of i)if(this.availablePathways_.has(a))return a;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==r&&(this.currentPathway=r,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const n=i=>this.excludedSteeringManifestURLs.has(i);if(this.proxyServerUrl_){const i=this.setProxyServerUrl_(e);if(!n(i))return i}const r=this.setSteeringParams_(e);return n(r)?null:r}startTTLTimeout_(e=this.steeringManifest.ttl){const n=e*1e3;this.ttlTimeout_=Ge.setTimeout(()=>{this.requestSteeringManifest()},n)}clearTTLTimeout_(){Ge.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new _B}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,n){return!n&&this.steeringManifest.reloadUri||n&&(Jo(e,n.serverURL)!==this.steeringManifest.reloadUri||n.defaultServiceLocation!==this.defaultPathway||n.queryBeforeStart!==this.queryBeforeStart||n.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const A3e=10;let Ad;const w3e=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],S3e=function(t){return this.audioSegmentLoader_[t]+this.mainSegmentLoader_[t]},x3e=function({currentPlaylist:t,buffered:e,currentTime:n,nextPlaylist:r,bufferLowWaterLine:i,bufferHighWaterLine:a,duration:s,bufferBasedABR:l,log:c}){if(!r)return Nt.log.warn("We received no playlist to switch to. Please check your stream."),!1;const u=`allowing switch ${t&&t.id||"null"} -> ${r.id}`;if(!t)return c(`${u} as current playlist is not set`),!0;if(r.id===t.id)return!1;const d=!!rh(e,n).length;if(!t.endList)return!d&&typeof t.partTargetDuration=="number"?(c(`not ${u} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(c(`${u} as current playlist is live`),!0);const f=mA(e,n),h=l?ks.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:ks.MAX_BUFFER_LOW_WATER_LINE;if(s<h)return c(`${u} as duration < max low water line (${s} < ${h})`),!0;const m=r.attributes.BANDWIDTH,g=t.attributes.BANDWIDTH;if(m<g&&(!l||f<a)){let v=`${u} as next bandwidth < current bandwidth (${m} < ${g})`;return l&&(v+=` and forwardBuffer < bufferHighWaterLine (${f} < ${a})`),c(v),!0}if((!l||m>g)&&f>=i){let v=`${u} as forwardBuffer >= bufferLowWaterLine (${f} >= ${i})`;return l&&(v+=` and next bandwidth > current bandwidth (${m} > ${g})`),c(v),!0}return c(`not ${u} as no switching criteria met`),!1};class C3e extends Nt.EventTarget{constructor(e){super();const{src:n,withCredentials:r,tech:i,bandwidth:a,externVhs:s,useCueTags:l,playlistExclusionDuration:c,enableLowInitialPlaylist:u,sourceType:d,cacheEncryptionKeys:f,bufferBasedABR:h,leastPixelDiffSelector:m,captionServices:g}=e;if(!n)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:v}=e;(v===null||typeof v>"u")&&(v=1/0),Ad=s,this.bufferBasedABR=!!h,this.leastPixelDiffSelector=!!m,this.withCredentials=r,this.tech_=i,this.vhs_=i.vhs,this.sourceType_=d,this.useCueTags_=l,this.playlistExclusionDuration=c,this.maxPlaylistRetries=v,this.enableLowInitialPlaylist=u,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:v,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=b3e(),this.mediaSource=new Ge.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=lo(),this.hasPlayed_=!1,this.syncController_=new a3e(e),this.segmentMetadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new l3e,this.sourceUpdater_=new wB(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new s3e,this.keyStatusMap_=new Map;const A={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:g,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:a,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:f,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new IA(n,this.vhs_,Gi(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new sh(n,this.vhs_,Gi(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new FA(Gi(A,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new FA(Gi(A,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new e3e(Gi(A,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((S,E)=>{function C(){i.off("vttjserror",_),S()}function _(){i.off("vttjsloaded",C),E()}i.one("vttjsloaded",C),i.one("vttjserror",_),i.addWebVttScript_()})}),e);const w=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new y3e(this.vhs_.xhr,w),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),w3e.forEach(S=>{this[S+"_"]=S3e.bind(this,S)}),this.logger_=Ql("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const x=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(x,()=>{const S=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-S,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),n=this.audioAppendsToLoadedData_();return e===-1||n===-1?-1:e+n}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const n=this.selectPlaylist();n&&this.shouldSwitchToMedia_(n)&&this.switchMedia_(n,e)}switchMedia_(e,n,r){const i=this.media(),a=i&&(i.id||i.uri),s=e&&(e.id||e.uri);a&&a!==s&&(this.logger_(`switch media ${a} -> ${s} from ${n}`),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${n}`})),this.mainPlaylistLoader_.media(e,r)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const n=this.mediaTypes_[e],r=n?n.activeGroup():null,i=this.contentSteeringController_.getPathway();if(r&&i){const s=(r.length?r[0].playlists:r.playlists).filter(l=>l.attributes.serviceLocation===i);s.length&&this.mediaTypes_[e].activePlaylistLoader.media(s[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=Ge.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(Ge.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),n=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return n;const r=e.mediaGroups.AUDIO,i=Object.keys(r);let a;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)a=this.mediaTypes_.AUDIO.activeTrack();else{const l=r.main||i.length&&r[i[0]];for(const c in l)if(l[c].default){a={label:c};break}}if(!a)return n;const s=[];for(const l in r)if(r[l][a.label]){const c=r[l][a.label];if(c.playlists&&c.playlists.length)s.push.apply(s,c.playlists);else if(c.uri)s.push(c);else if(e.playlists.length)for(let u=0;u<e.playlists.length;u++){const d=e.playlists[u];d.attributes&&d.attributes.AUDIO&&d.attributes.AUDIO===l&&s.push(d)}}return s.length?s:n}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const e=this.mainPlaylistLoader_.media(),n=e.targetDuration*1.5*1e3;AA(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=n,e.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),v3e({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let n;if(this.enableLowInitialPlaylist&&(n=this.selectInitialPlaylist()),n||(n=this.selectPlaylist()),!n||!this.shouldSwitchToMedia_(n)||(this.initialMedia_=n,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const e=this.mainPlaylistLoader_.media(),n=e.targetDuration*1.5*1e3;AA(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=n,this.sourceType_==="dash"&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const e=this.mainPlaylistLoader_.media();if(e.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,n){const r=e.mediaGroups||{};let i=!0;const a=Object.keys(r.AUDIO);for(const s in r.AUDIO)for(const l in r.AUDIO[s])r.AUDIO[s][l].uri||(i=!1);i&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Ad.Playlist.isAes(n)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),a.length&&Object.keys(r.AUDIO[a[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const n=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,r=this.tech_.currentTime(),i=this.bufferLowWaterLine(),a=this.bufferHighWaterLine(),s=this.tech_.buffered();return x3e({buffered:s,currentTime:r,currentPlaylist:n,nextPlaylist:e,bufferLowWaterLine:i,bufferHighWaterLine:a,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const n=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:n.playlist,error:n})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",n=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:A3e}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const n=this.getCodecsOrExclude_();n&&this.sourceUpdater_.addOrChangeSourceBuffers(n)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(()=>{this.tech_.setCurrentTime(this.tech_.currentTime())})}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const n=this.seekable();if(!n.length)return!1;const r=n.end(0);let i=r;if(e.start){const a=e.start.timeOffset;a<0?i=Math.max(r+a,n.start(0)):i=Math.min(r,a)}this.trigger("firstplay"),this.tech_.setCurrentTime(i)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,n=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const n=this.duration();e[e.length-1].endTime=isNaN(n)||Math.abs(n)===1/0?Number.MAX_VALUE:n}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const n=this.mainSegmentLoader_.getCurrentMediaInfo_();!n||n.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const r=this.syncController_.getExpiredTime(e,this.duration());if(r===null)return!1;const i=Ad.Playlist.playlistEnd(e,r),a=this.tech_.currentTime(),s=this.tech_.buffered();if(!s.length)return i-a<=Cu;const l=s.end(s.length-1);return l-a<=Cu&&i-l<=Cu}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:n={},playlistExclusionDuration:r}){if(e=e||this.mainPlaylistLoader_.media(),r=r||n.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=n,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const i=this.mainPlaylistLoader_.main.playlists,a=i.filter(dv),s=a.length===1&&a[0]===e;if(i.length===1&&r!==1/0)return Nt.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(s);if(s){if(this.main().contentSteering){const g=this.pathwayAttribute_(e),v=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(g),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(g)},v);return}let m=!1;i.forEach(g=>{if(g===e)return;const v=g.excludeUntil;typeof v<"u"&&v!==1/0&&(m=!0,delete g.excludeUntil)}),m&&(Nt.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let l;e.playlistErrors_>this.maxPlaylistRetries?l=1/0:l=Date.now()+r*1e3,e.excludeUntil=l,n.reason&&(e.lastExcludeReason_=n.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const c=this.selectPlaylist();if(!c){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const u=n.internal?this.logger_:Nt.log.warn,d=n.message?" "+n.message:"";u(`${n.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${d} Switching to playlist ${c.id}.`),c.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),c.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const f=c.targetDuration/2*1e3||5*1e3,h=typeof c.lastRequest=="number"&&Date.now()-c.lastRequest<=f;return this.switchMedia_(c,"exclude",s||h)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,n){const r=[],i=e==="all";(i||e==="main")&&r.push(this.mainPlaylistLoader_);const a=[];(i||e==="audio")&&a.push("AUDIO"),(i||e==="subtitle")&&(a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES")),a.forEach(s=>{const l=this.mediaTypes_[s]&&this.mediaTypes_[s].activePlaylistLoader;l&&r.push(l)}),["main","audio","subtitle"].forEach(s=>{const l=this[`${s}SegmentLoader_`];l&&(e===s||e==="all")&&r.push(l)}),r.forEach(s=>n.forEach(l=>{typeof s[l]=="function"&&s[l]()}))}setCurrentTime(e){const n=rh(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(n&&n.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Ad.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let n=this.mainPlaylistLoader_.media();if(!n)return;let r=this.syncController_.getExpiredTime(n,this.duration());if(r===null)return;const i=this.mainPlaylistLoader_.main,a=Ad.Playlist.seekable(n,r,Ad.Playlist.liveEdgeDelay(i,n));if(a.length===0||this.mediaTypes_.AUDIO.activePlaylistLoader&&(n=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),r=this.syncController_.getExpiredTime(n,this.duration()),r===null||(e=Ad.Playlist.seekable(n,r,Ad.Playlist.liveEdgeDelay(i,n)),e.length===0)))return;let s,l;this.seekable_&&this.seekable_.length&&(s=this.seekable_.end(0),l=this.seekable_.start(0)),e?e.start(0)>a.end(0)||a.start(0)>e.end(0)?this.seekable_=a:this.seekable_=lo([[e.start(0)>a.start(0)?e.start(0):a.start(0),e.end(0)<a.end(0)?e.end(0):a.end(0)]]):this.seekable_=a,!(this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===s&&this.seekable_.start(0)===l)&&(this.logger_(`seekable updated [${wL(this.seekable_)}]`),this.tech_.trigger("seekablechanged"))}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const i=this.seekable();if(!i.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<i.end(i.length-1))&&this.sourceUpdater_.setDuration(i.end(i.length-1));return}const n=this.tech_.buffered();let r=Ad.Playlist.duration(this.mainPlaylistLoader_.media());n.length>0&&(r=Math.max(r,n.end(n.length-1))),this.mediaSource.duration!==r&&this.sourceUpdater_.setDuration(r)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const n=this.mediaTypes_[e].groups;for(const r in n)n[r].forEach(i=>{i.playlistLoader&&i.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,n=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),r=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!n||!r)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},n=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const r=og(this.main(),n),i={},a=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(i.video=r.video||e.main.videoCodec||Jfe),e.main.isMuxed&&(i.video+=`,${r.audio||e.main.audioCodec||bk}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||a)&&(i.audio=r.audio||e.main.audioCodec||e.audio.audioCodec||bk,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!i.audio&&!i.video){this.excludePlaylist({playlistToExclude:n,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const s=(u,d)=>u?v4(d):Hb(d),l={};let c;if(["video","audio"].forEach(function(u){if(i.hasOwnProperty(u)&&!s(e[u].isFmp4,i[u])){const d=e[u].isFmp4?"browser":"muxer";l[d]=l[d]||[],l[d].push(i[u]),u==="audio"&&(c=d)}}),a&&c&&n.attributes.AUDIO){const u=n.attributes.AUDIO;this.main().playlists.forEach(d=>{(d.attributes&&d.attributes.AUDIO)===u&&d!==n&&(d.excludeUntil=1/0)}),this.logger_(`excluding audio group ${u} as ${c} does not support codec(s): "${i.audio}"`)}if(Object.keys(l).length){const u=Object.keys(l).reduce((d,f)=>(d&&(d+=", "),d+=`${f} does not support codec(s): "${l[f].join(",")}"`,d),"")+".";this.excludePlaylist({playlistToExclude:n,error:{internal:!0,message:u},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const u=[];if(["video","audio"].forEach(d=>{const f=(gu(this.sourceUpdater_.codecs[d]||"")[0]||{}).type,h=(gu(i[d]||"")[0]||{}).type;f&&h&&f.toLowerCase()!==h.toLowerCase()&&u.push(`"${this.sourceUpdater_.codecs[d]}" -> "${i[d]}"`)}),u.length){this.excludePlaylist({playlistToExclude:n,error:{message:`Codec switching not supported: ${u.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return i}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const n=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(n)}excludeUnsupportedVariants_(){const e=this.main().playlists,n=[];Object.keys(e).forEach(r=>{const i=e[r];if(n.indexOf(i.id)!==-1)return;n.push(i.id);const a=og(this.main,i),s=[];a.audio&&!Hb(a.audio)&&!v4(a.audio)&&s.push(`audio codec ${a.audio}`),a.video&&!Hb(a.video)&&!v4(a.video)&&s.push(`video codec ${a.video}`),a.text&&a.text==="stpp.ttml.im1t"&&s.push(`text codec ${a.text}`),s.length&&(i.excludeUntil=1/0,this.logger_(`excluding ${i.id} for unsupported: ${s.join(", ")}`))})}excludeIncompatibleVariants_(e){const n=[],r=this.main().playlists,i=hv(gu(e)),a=oB(i),s=i.video&&gu(i.video)[0]||null,l=i.audio&&gu(i.audio)[0]||null;Object.keys(r).forEach(c=>{const u=r[c];if(n.indexOf(u.id)!==-1||u.excludeUntil===1/0)return;n.push(u.id);const d=[],f=og(this.mainPlaylistLoader_.main,u),h=oB(f);if(!(!f.audio&&!f.video)){if(h!==a&&d.push(`codec count "${h}" !== "${a}"`),!this.sourceUpdater_.canChangeType()){const m=f.video&&gu(f.video)[0]||null,g=f.audio&&gu(f.audio)[0]||null;m&&s&&m.type.toLowerCase()!==s.type.toLowerCase()&&d.push(`video codec "${m.type}" !== "${s.type}"`),g&&l&&g.type.toLowerCase()!==l.type.toLowerCase()&&d.push(`audio codec "${g.type}" !== "${l.type}"`)}d.length&&(u.excludeUntil=1/0,this.logger_(`excluding ${u.id}: ${d.join(" && ")}`))}})}updateAdCues_(e){let n=0;const r=this.seekable();r.length&&(n=r.start(0)),n3e(e,this.cueTagsTrack_,n)}goalBufferLength(){const e=this.tech_.currentTime(),n=ks.GOAL_BUFFER_LENGTH,r=ks.GOAL_BUFFER_LENGTH_RATE,i=Math.max(n,ks.MAX_GOAL_BUFFER_LENGTH);return Math.min(n+e*r,i)}bufferLowWaterLine(){const e=this.tech_.currentTime(),n=ks.BUFFER_LOW_WATER_LINE,r=ks.BUFFER_LOW_WATER_LINE_RATE,i=Math.max(n,ks.MAX_BUFFER_LOW_WATER_LINE),a=Math.max(n,ks.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(n+e*r,this.bufferBasedABR?a:i)}bufferHighWaterLine(){return ks.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){fB(this.inbandTextTracks_,"com.apple.streaming",this.tech_),Bme({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,n,r){const i=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();fB(this.inbandTextTracks_,e,this.tech_),Pme({inbandTextTracks:this.inbandTextTracks_,metadataArray:n,timestampOffset:i,videoDuration:r})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const n of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(n));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{const i=this.contentSteeringController_.getAvailablePathways(),a=[];for(const s of e.playlists){const l=s.attributes.serviceLocation;if(l&&(a.push(l),!i.has(l)))return!0}return!!(!a.length&&i.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const r=this.main().playlists,i=new Set;let a=!1;Object.keys(r).forEach(s=>{const l=r[s],c=this.pathwayAttribute_(l),u=c&&e!==c;l.excludeUntil===1/0&&l.lastExcludeReason_==="content-steering"&&!u&&(delete l.excludeUntil,delete l.lastExcludeReason_,a=!0);const f=!l.excludeUntil&&l.excludeUntil!==1/0;!i.has(l.id)&&u&&f&&(i.add(l.id),l.excludeUntil=1/0,l.lastExcludeReason_="content-steering",this.logger_(`excluding ${l.id} for ${l.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(s=>{const l=this.mediaTypes_[s];if(l.activePlaylistLoader){const c=l.activePlaylistLoader.media_;c&&c.attributes.serviceLocation!==e&&(a=!0)}}),a&&this.changeSegmentPathway_()}handlePathwayClones_(){const n=this.main().playlists,r=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(r&&r.size||i&&i.size){for(const[s,l]of r.entries())i.get(s)||(this.mainPlaylistLoader_.updateOrDeleteClone(l),this.contentSteeringController_.excludePathway(s));for(const[s,l]of i.entries()){const c=r.get(s);if(!c){n.filter(d=>d.attributes["PATHWAY-ID"]===l["BASE-ID"]).forEach(d=>{this.mainPlaylistLoader_.addClonePathway(l,d)}),this.contentSteeringController_.addAvailablePathway(s);continue}this.equalPathwayClones_(c,l)||(this.mainPlaylistLoader_.updateOrDeleteClone(l,!0),this.contentSteeringController_.addAvailablePathway(s))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...i])))}}equalPathwayClones_(e,n){if(e["BASE-ID"]!==n["BASE-ID"]||e.ID!==n.ID||e["URI-REPLACEMENT"].HOST!==n["URI-REPLACEMENT"].HOST)return!1;const r=e["URI-REPLACEMENT"].PARAMS,i=n["URI-REPLACEMENT"].PARAMS;for(const a in r)if(r[a]!==i[a])return!1;for(const a in i)if(r[a]!==i[a])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const n="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(r=>{const i=this.mainPlaylistLoader_.getKeyIdSet(r);!i||!i.size||i.forEach(a=>{const s="usable",l=this.keyStatusMap_.has(a)&&this.keyStatusMap_.get(a)===s,c=r.lastExcludeReason_===n&&r.excludeUntil===1/0;l?l&&c&&(delete r.excludeUntil,delete r.lastExcludeReason_,this.logger_(`enabling playlist ${r.id} because key ID ${a} is ${s}`)):(r.excludeUntil!==1/0&&r.lastExcludeReason_!==n&&(r.excludeUntil=1/0,r.lastExcludeReason_=n,this.logger_(`excluding playlist ${r.id} because the key ID ${a} doesn't exist in the keyStatusMap or is not ${s}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(r=>{const i=r&&r.attributes&&r.attributes.RESOLUTION&&r.attributes.RESOLUTION.height<720,a=r.excludeUntil===1/0&&r.lastExcludeReason_===n;i&&a&&(delete r.excludeUntil,Nt.log.warn(`enabling non-HD playlist ${r.id} because all playlists were excluded due to ${n} key IDs`))})}addKeyStatus_(e,n){const a=(typeof e=="string"?e:Jme(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${n}' with key ID ${a} added to the keyStatusMap`),this.keyStatusMap_.set(a,n)}updatePlaylistByKeyStatus(e,n){this.addKeyStatus_(e,n),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const T3e=(t,e,n)=>r=>{const i=t.main.playlists[e],a=yA(i),s=dv(i);return typeof r>"u"?s:(r?delete i.disabled:i.disabled=!0,r!==s&&!a&&(n(i),r?t.trigger("renditionenabled"):t.trigger("renditiondisabled")),r)};class E3e{constructor(e,n,r){const{playlistController_:i}=e,a=i.fastQualityChange_.bind(i);if(n.attributes){const s=n.attributes.RESOLUTION;this.width=s&&s.width,this.height=s&&s.height,this.bandwidth=n.attributes.BANDWIDTH,this.frameRate=n.attributes["FRAME-RATE"]}this.codecs=og(i.main(),n),this.playlist=n,this.id=r,this.enabled=T3e(e.playlists,n.id,a)}}const I3e=function(t){t.representations=()=>{const e=t.playlistController_.main(),n=ag(e)?t.playlistController_.getAudioTrackPlaylists_():e.playlists;return n?n.filter(r=>!yA(r)).map((r,i)=>new E3e(t,r,r.id)):[]}},DB=["seeking","seeked","pause","playing","error"];class _3e{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Ql("PlaybackWatcher"),this.logger_("initialize");const n=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),i=()=>this.techWaiting_(),a=()=>this.resetTimeUpdate_(),s=this.playlistController_,l=["main","subtitle","audio"],c={};l.forEach(d=>{c[d]={reset:()=>this.resetSegmentDownloads_(d),updateend:()=>this.checkSegmentDownloads_(d)},s[`${d}SegmentLoader_`].on("appendsdone",c[d].updateend),s[`${d}SegmentLoader_`].on("playlistupdate",c[d].reset),this.tech_.on(["seeked","seeking"],c[d].reset)});const u=d=>{["main","audio"].forEach(f=>{s[`${f}SegmentLoader_`][d]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),u("off"))},this.clearSeekingAppendCheck_=()=>u("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),u("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",i),this.tech_.on(DB,a),this.tech_.on("canplay",r),this.tech_.one("play",n),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",i),this.tech_.off(DB,a),this.tech_.off("canplay",r),this.tech_.off("play",n),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),l.forEach(d=>{s[`${d}SegmentLoader_`].off("appendsdone",c[d].updateend),s[`${d}SegmentLoader_`].off("playlistupdate",c[d].reset),this.tech_.off(["seeked","seeking"],c[d].reset)}),this.checkCurrentTimeTimeout_&&Ge.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&Ge.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=Ge.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const n=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=n.buffered_()}checkSegmentDownloads_(e){const n=this.playlistController_,r=n[`${e}SegmentLoader_`],i=r.buffered_(),a=Age(this[`${e}Buffered_`],i);if(this[`${e}Buffered_`]=i,a){this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:r.playlist_&&r.playlist_.id,buffered:m1(i)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&n.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),n=this.tech_.buffered();if(this.lastRecordedTime===e&&(!n.length||e+Cu>=n.end(n.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const n=this.seekable(),r=this.tech_.currentTime(),i=this.afterSeekableWindow_(n,r,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let a;if(i&&(a=n.end(n.length-1)),this.beforeSeekableWindow_(n,r)){const g=n.start(0);a=g+(g===n.end(0)?0:Cu)}if(typeof a<"u")return this.logger_(`Trying to seek outside of seekable at time ${r} with seekable range ${wL(n)}. Seeking to ${a}.`),this.tech_.setCurrentTime(a),!0;const s=this.playlistController_.sourceUpdater_,l=this.tech_.buffered(),c=s.audioBuffer?s.audioBuffered():null,u=s.videoBuffer?s.videoBuffered():null,d=this.media(),f=d.partTargetDuration?d.partTargetDuration:(d.targetDuration-xu)*2,h=[c,u];for(let g=0;g<h.length;g++){if(!h[g])continue;if(mA(h[g],r)<f)return!1}const m=uv(l,r);return m.length===0?!1:(a=m.start(0)+Cu,this.logger_(`Buffered region starts (${m.start(0)}) just beyond seek point (${r}). Seeking to ${a}.`),this.tech_.setCurrentTime(a),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),n=this.tech_.buffered(),r=rh(n,e);if(r.length&&e+3<=r.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${r.start(0)} -> ${r.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),n=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,n)){const l=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${n}. Seeking to live point (seekable end) ${l}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(l),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,i=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:r.audioBuffered(),videoBuffered:r.videoBuffered(),currentTime:n}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(n),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const s=uv(i,n);return s.length>0?(this.logger_(`Stopped at ${n} and seeking to ${s.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(n),!0):!1}afterSeekableWindow_(e,n,r,i=!1){if(!e.length)return!1;let a=e.end(e.length-1)+Cu;const s=!r.endList,l=typeof r.partTargetDuration=="number";return s&&(l||i)&&(a=e.end(e.length-1)+r.targetDuration*3),n>a}beforeSeekableWindow_(e,n){return!!(e.length&&e.start(0)>0&&n<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:n,currentTime:r}){if(!e)return;let i;if(e.length&&n.length){const a=rh(e,r-3),s=rh(e,r),l=rh(n,r);l.length&&!s.length&&a.length&&(i={start:a.end(0),end:l.end(0)})}else uv(e,r).length||(i=this.gapFromVideoUnderflow_(e,r));return i?(this.logger_(`Encountered a gap in video from ${i.start} to ${i.end}. Seeking to current time ${r}`),!0):!1}skipTheGap_(e){const n=this.tech_.buffered(),r=this.tech_.currentTime(),i=uv(n,r);this.resetTimeUpdate_(),!(i.length===0||r!==e)&&(this.logger_("skipTheGap_:","currentTime:",r,"scheduled currentTime:",e,"nextRange start:",i.start(0)),this.tech_.setCurrentTime(i.start(0)+xu),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}))}gapFromVideoUnderflow_(e,n){const r=vge(e);for(let i=0;i<r.length;i++){const a=r.start(i),s=r.end(i);if(n-a<4&&n-a>2)return{start:a,end:s}}return null}}const D3e={errorInterval:30,getSource(t){const n=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return t(n)}},OB=function(t,e){let n=0,r=0;const i=Gi(D3e,e);t.ready(()=>{t.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const a=function(){r&&t.currentTime(r)},s=function(d){d!=null&&(r=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",a),t.src(d),t.trigger({type:"usage",name:"vhs-error-reload"}),t.play())},l=function(){if(Date.now()-n<i.errorInterval*1e3){t.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!i.getSource||typeof i.getSource!="function"){Nt.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return n=Date.now(),i.getSource.call(t,s)},c=function(){t.off("loadedmetadata",a),t.off("error",l),t.off("dispose",c)},u=function(d){c(),OB(t,d)};t.on("error",l),t.on("dispose",c),t.reloadSourceOnError=u},O3e=function(t){OB(this,t)};var NB="3.12.1",N3e="7.0.3",F3e="1.3.0",k3e="7.1.0",P3e="4.0.1";const Va={PlaylistLoader:sh,Playlist:Zo,utils:$ge,STANDARD_PLAYLIST_SELECTOR:uB,INITIAL_PLAYLIST_SELECTOR:Dme,lastBandwidthSelector:uB,movingAverageBandwidthSelector:Ime,comparePlaylistBandwidth:NA,comparePlaylistResolution:Eme,xhr:UL()};Object.keys(ks).forEach(t=>{Object.defineProperty(Va,t,{get(){return Nt.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),ks[t]},set(e){if(Nt.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){Nt.log.warn(`value of Vhs.${t} must be greater than or equal to 0`);return}ks[t]=e}})});const FB="videojs-vhs",kB=function(t,e){const n=e.media();let r=-1;for(let i=0;i<t.length;i++)if(t[i].id===n.id){r=i;break}t.selectedIndex_=r,t.trigger({selectedIndex:r,type:"change"})},M3e=function(t,e){e.representations().forEach(n=>{t.addQualityLevel(n)}),kB(t,e.playlists)};Va.canPlaySource=function(){return Nt.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const L3e=(t,e,n)=>{if(!t)return t;let r={};e&&e.attributes&&e.attributes.CODECS&&(r=hv(gu(e.attributes.CODECS))),n&&n.attributes&&n.attributes.CODECS&&(r.audio=n.attributes.CODECS);const i=O2(r.video),a=O2(r.audio),s={};for(const l in t)s[l]={},a&&(s[l].audioContentType=a),i&&(s[l].videoContentType=i),e.contentProtection&&e.contentProtection[l]&&e.contentProtection[l].pssh&&(s[l].pssh=e.contentProtection[l].pssh),typeof t[l]=="string"&&(s[l].url=t[l]);return Gi(t,s)},B3e=(t,e)=>t.reduce((n,r)=>{if(!r.contentProtection)return n;const i=e.reduce((a,s)=>{const l=r.contentProtection[s];return l&&l.pssh&&(a[s]={pssh:l.pssh}),a},{});return Object.keys(i).length&&n.push(i),n},[]),V3e=({player:t,sourceKeySystems:e,audioMedia:n,mainPlaylists:r})=>{if(!t.eme.initializeMediaKeys)return Promise.resolve();const i=n?r.concat([n]):r,a=B3e(i,Object.keys(e)),s=[],l=[];return a.forEach(c=>{l.push(new Promise((u,d)=>{t.tech_.one("keysessioncreated",u)})),s.push(new Promise((u,d)=>{t.eme.initializeMediaKeys({keySystems:c},f=>{if(f){d(f);return}u()})}))}),Promise.race([Promise.all(s),Promise.race(l)])},U3e=({player:t,sourceKeySystems:e,media:n,audioMedia:r})=>{const i=L3e(e,n,r);return i?(t.currentSource().keySystems=i,i&&!t.eme?(Nt.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},PB=()=>{if(!Ge.localStorage)return null;const t=Ge.localStorage.getItem(FB);if(!t)return null;try{return JSON.parse(t)}catch{return null}},q3e=t=>{if(!Ge.localStorage)return!1;let e=PB();e=e?Gi(e,t):t;try{Ge.localStorage.setItem(FB,JSON.stringify(e))}catch{return!1}return e},j3e=t=>t.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(t.substring(t.indexOf(",")+1)):t,MB=(t,e)=>{t._requestCallbackSet||(t._requestCallbackSet=new Set),t._requestCallbackSet.add(e)},LB=(t,e)=>{t._responseCallbackSet||(t._responseCallbackSet=new Set),t._responseCallbackSet.add(e)},BB=(t,e)=>{t._requestCallbackSet&&(t._requestCallbackSet.delete(e),t._requestCallbackSet.size||delete t._requestCallbackSet)},VB=(t,e)=>{t._responseCallbackSet&&(t._responseCallbackSet.delete(e),t._responseCallbackSet.size||delete t._responseCallbackSet)};Va.supportsNativeHls=function(){if(!Sn||!Sn.createElement)return!1;const t=Sn.createElement("video");return Nt.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(n){return/maybe|probably/i.test(t.canPlayType(n))}):!1}(),Va.supportsNativeDash=function(){return!Sn||!Sn.createElement||!Nt.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(Sn.createElement("video").canPlayType("application/dash+xml"))}(),Va.supportsTypeNatively=t=>t==="hls"?Va.supportsNativeHls:t==="dash"?Va.supportsNativeDash:!1,Va.isSupported=function(){return Nt.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},Va.xhr.onRequest=function(t){MB(Va.xhr,t)},Va.xhr.onResponse=function(t){LB(Va.xhr,t)},Va.xhr.offRequest=function(t){BB(Va.xhr,t)},Va.xhr.offResponse=function(t){VB(Va.xhr,t)};const $3e=Nt.getComponent("Component");class UB extends $3e{constructor(e,n,r){if(super(n,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=Ql("VhsHandler"),n.options_&&n.options_.playerId){const i=Nt.getPlayer(n.options_.playerId);this.player_=i}if(this.tech_=n,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&n.overrideNativeAudioTracks&&n.overrideNativeVideoTracks)n.overrideNativeAudioTracks(!0),n.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(n.featuresNativeVideoTracks||n.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(Sn,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],i=>{const a=Sn.fullscreenElement||Sn.webkitFullscreenElement||Sn.mozFullScreenElement||Sn.msFullscreenElement;a&&a.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=Gi(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const r=PB();r&&r.bandwidth&&(this.options_.bandwidth=r.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),r&&r.throughput&&(this.options_.throughput=r.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=ks.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===ks.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(r=>{typeof this.source_[r]<"u"&&(this.options_[r]=this.source_[r])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;const n=this.options_.customPixelRatio;typeof n=="number"&&n>=0&&(this.customPixelRatio=n)}setOptions(e={}){this.setOptions_(e)}src(e,n){if(!e)return;this.setOptions_(),this.options_.src=j3e(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Va,this.options_.sourceType=yk(n),this.options_.seekTo=a=>{this.tech_.setCurrentTime(a)},this.playlistController_=new C3e(this.options_);const r=Gi({liveRangeSafeTimeDelta:Cu},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new _3e(r),this.playlistController_.on("error",()=>{const a=Nt.players[this.tech_.options_.playerId];let s=this.playlistController_.error;typeof s=="object"&&!s.code?s.code=3:typeof s=="string"&&(s={message:s,code:3}),a.error(s)});const i=this.options_.bufferBasedABR?Va.movingAverageBandwidthSelector(.55):Va.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):i.bind(this),this.playlistController_.selectInitialPlaylist=Va.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(a){this.playlistController_.selectPlaylist=a.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(a){this.playlistController_.mainSegmentLoader_.throughput.rate=a,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let a=this.playlistController_.mainSegmentLoader_.bandwidth;const s=Ge.navigator.connection||Ge.navigator.mozConnection||Ge.navigator.webkitConnection,l=1e7;if(this.options_.useNetworkInformationApi&&s){const c=s.downlink*1e3*1e3;c>=l&&a>=l?a=Math.max(a,c):a=c}return a},set(a){this.playlistController_.mainSegmentLoader_.bandwidth=a,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const a=1/(this.bandwidth||1);let s;return this.throughput>0?s=1/this.throughput:s=0,Math.floor(1/(a+s))},set(){Nt.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>m1(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>m1(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&q3e({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{I3e(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=Ge.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),V3e({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(n=>{this.logger_("error while creating EME key session",n),this.player_.error({message:"Failed to initialize media keys for EME",code:3,metadata:{errorType:Nt.Error.EMEKeySessionCreationError}})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,n=U3e({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",r=>{this.playlistController_.updatePlaylistByKeyStatus(r.keyId,r.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!n){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=Nt.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{M3e(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{kB(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":NB,"mux.js":N3e,"mpd-parser":F3e,"m3u8-parser":k3e,"aes-decrypter":P3e}}version(){return this.constructor.version()}canChangeType(){return wB.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&Ge.URL.revokeObjectURL&&(Ge.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,n){return Gge({playlist:this.playlistController_.media(),time:e,callback:n})}seekToProgramTime(e,n,r=!0,i=2){return zL({programTime:e,playlist:this.playlistController_.media(),retryCount:i,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:n})}setupXhrHooks_(){this.xhr.onRequest=e=>{MB(this.xhr,e)},this.xhr.onResponse=e=>{LB(this.xhr,e)},this.xhr.offRequest=e=>{BB(this.xhr,e)},this.xhr.offResponse=e=>{VB(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const bv={name:"videojs-http-streaming",VERSION:NB,canHandleSource(t,e={}){const n=Gi(Nt.options,e);return bv.canPlayType(t.type,n)},handleSource(t,e,n={}){const r=Gi(Nt.options,n);return e.vhs=new UB(t,e,r),e.vhs.xhr=UL(),e.vhs.setupXhrHooks_(),e.vhs.src(t.src,t.type),e.vhs},canPlayType(t,e){const n=yk(t);if(!n)return"";const r=bv.getOverrideNative(e);return!Va.supportsTypeNatively(n)||r?"maybe":""},getOverrideNative(t={}){const{vhs:e={}}=t,n=!(Nt.browser.IS_ANY_SAFARI||Nt.browser.IS_IOS),{overrideNative:r=n}=e;return r}};v4("avc1.4d400d,mp4a.40.2")&&Nt.getTech("Html5").registerSourceHandler(bv,0),Nt.VhsHandler=UB,Nt.VhsSourceHandler=bv,Nt.Vhs=Va,Nt.use||Nt.registerComponent("Vhs",Va),Nt.options.vhs=Nt.options.vhs||{},(!Nt.getPlugin||!Nt.getPlugin("reloadSourceOnError"))&&Nt.registerPlugin("reloadSourceOnError",O3e);const H3e=t=>{const{userTrainingSaveData:e,updateUserTraining:n}=Pr(),r=N.useRef(null),i=N.useRef(null),{options:a,onReady:s,currentItem:l}=t,[c,u]=N.useState(!1),d=m=>{if(e!==null){const g=e==null?void 0:e.findIndex(v=>(v==null?void 0:v.fieldId)===(l==null?void 0:l.uuid));if(g>=0){const v=m.target;e[g].seenTime=v.currentTime}}},f=m=>{const g=[...e],v=g==null?void 0:g.findIndex(A=>(A==null?void 0:A.fieldId)===(m==null?void 0:m.uuid));v>=0&&(g[v]={...e[v],isSeen:!0},n(g),h("Ended"))};N.useEffect(()=>{if(i.current){const m=i.current;m.autoplay(a.autoplay),m.src(a.sources)}else{const m=r.current;if(!m)return;const g=i.current=Nt(m,a,()=>{Nt.log("player is ready"),s&&s(g)})}},[a,r]);const h=m=>{const g=i.current,v=e!==null?e.findIndex(A=>(A==null?void 0:A.fieldId)===(l==null?void 0:l.uuid)):-1;v>=0&&e[v].logs.push({action:m,videoTime:e[v].seenTime,totalTime:g.duration(),timeState:new Date}),n(e)};return N.useEffect(()=>{if(!c&&e!==null){const m=e.findIndex(g=>(g==null?void 0:g.fieldId)===(l==null?void 0:l.uuid));m>=0&&(u(!0),i.current.currentTime(e[m].seenTime))}},[e]),N.useEffect(()=>{const m=i.current;return()=>{m&&(m.dispose(),i.current=null)}},[i]),o.jsx("div",{"data-vjs-player":!0,children:o.jsx("video",{onPause:()=>{h("Pause")},onPlay:()=>{h("Play")},onEnded:()=>{f(l)},onTimeUpdate:d,ref:r,className:"video-js vjs-big-play-centered"})})},z3e=t=>{var x,S,E;const{field:e}=t,n=N.useRef(null),{userSelectedLanguage:r}=ln(),{isPreview:i}=tn(),a=C=>{n.current=C,C.on("waiting",()=>{Nt.log("player is waiting")}),C.on("dispose",()=>{Nt.log("player will dispose")})},[s,l]=N.useState(!1),[c,u]=N.useState(!1),d=()=>{u(!0)},f=()=>{u(!1)},h=C=>{l(C)},m=()=>{l(!1)},g=N.useCallback(C=>o.jsx(H3e,{options:{autoplay:!1,controls:!0,responsive:!0,fluid:!0,sources:[{src:C}]},currentItem:e,onReady:a,onUpdate:()=>{}}),[e==null?void 0:e.media_file_id]),v=C=>{N.useEffect(()=>{T()},[]);const[_]=N.useState(""),T=()=>{};return o.jsxs(o.Fragment,{children:[" ",o.jsx("video",{src:_,width:"100%",controls:!0})]})},A=N.useCallback(C=>o.jsx(v,{mediaId:C}),[e==null?void 0:e.media_file_id]),w=o.jsxs("div",{onMouseOver:d,onMouseOut:f,children:[!i&&c&&o.jsx(Hr,{handleFieldSettingsSidebar:h,...t}),o.jsx("div",{className:i?"py-4 px-2":"field-form-builder py-4 px-2",children:o.jsx("div",{className:"field",children:o.jsx("div",{className:"grid",children:o.jsx("div",{className:"col-12",children:o.jsxs("div",{className:"mt-3",children:[o.jsxs("label",{className:"flex font-medium mb-3 text-700 text-2xl",children:[" ",(x=e==null?void 0:e.title)==null?void 0:x[r==null?void 0:r.type]," -"," ",e==null?void 0:e.videoDuration]}),(e==null?void 0:e.isExternalSource)===!0&&o.jsx(o.Fragment,{children:(e==null?void 0:e.media_url)&&g((S=e==null?void 0:e.media_url)==null?void 0:S[r==null?void 0:r.type])}),(e==null?void 0:e.isExternalSource)===!1?(e==null?void 0:e.media_file_id)!==void 0&&(e==null?void 0:e.media_file_id)!==null?o.jsx(o.Fragment,{children:A(e==null?void 0:e.media_file_id)}):o.jsx(o.Fragment,{children:(e==null?void 0:e.media_url)&&g((E=e==null?void 0:e.media_url)==null?void 0:E[r==null?void 0:r.type])}):o.jsx(o.Fragment,{})]})})})})})]});return o.jsxs(o.Fragment,{children:[o.jsx(K1e,{visibilty:s,closeSettingFieldSidebar:m,...t}),o.jsx(wi,{...t,fieldWrap:w})]})},Y3e=t=>{const{isPreview:e}=tn(),[n,r]=N.useState(!1),i=()=>{r(!0)},a=()=>{r(!1)},s=o.jsxs("div",{onMouseOver:i,onMouseOut:a,children:[!e&&n&&o.jsx(Hr,{handleFieldSettingsSidebar:()=>{},...t}),o.jsx("div",{className:e?"":"field-form-builder",children:o.jsx("div",{className:"grid",children:o.jsx("div",{className:"col-12",children:o.jsx("div",{className:"hr-divider"})})})})]});return o.jsx(o.Fragment,{children:o.jsx(wi,{...t,fieldWrap:s})})},K3e=t=>{var Y,pe,ie,J,Q,oe,ye,Te,Ae,be,we;const{isPreview:e,isAdmin:n,isRenderView:r}=tn(),{field:i,fieldIndex:a,row:s}=t,{task_status:l,taskRegisterData:c,updateTaskRegisterData:u,updateTaskProgressValue:d,userTaskSubmitFormData:f,updateUserFormDataSubmit:h,TASK_PUBLISHED:m}=Pr(),{userSelectedLanguage:g}=ln(),[v,A]=N.useState(!1),[w,x]=N.useState(""),[S,E]=N.useState(0),[C,_]=N.useState(!1),[T,O]=N.useState(!1),F=()=>{O(!0)},B=()=>{O(!1)},M=re=>new Date(re),z=()=>{var re,U,Z;if(s!=null&&s.rowIsRepeatable){if(s!=null&&s.repeatableFields){const K=[...s.repeatableFields],he=Et.findIndex(K,function(_e){return _e.uuid===(i==null?void 0:i.uuid)});he>=0&&K[he].fieldData?x(K[he].fieldData):x("")}}else{const K=f;if(K!=null&&K.length){for(const he of K)if(he.fieldId===t.field.uuid&&((re=he==null?void 0:he.postData[0])==null?void 0:re.postValue)!==""&&((U=he==null?void 0:he.postData[0])!=null&&U.postValue)){x(M((Z=he==null?void 0:he.postData[0])==null?void 0:Z.postValue));break}}}_(!0)};N.useEffect(()=>{C||z();const re=Rt.addListener("clearRepeatableFields",he=>{he===(s==null?void 0:s.uuid)&&(x(""),E(0),i.isValid=0)}),U=Rt.addListener("onSubmitUserForm",()=>{var he;(he=i==null?void 0:i.attributes)!=null&&he.required?w?i.isValid=1:i.isValid=0:i.isValid=1}),Z=Rt.addListener("OnInvalidFieldCatch",he=>{i.uuid===(he==null?void 0:he.fieldId)?E(1):E(0)}),K=Rt.addListener("OnGetFieldValue",he=>{var ge;const _e=(ge=he==null?void 0:he.repeatableColumn)==null?void 0:ge.filter(ve=>(ve==null?void 0:ve.fieldUuid)===(i==null?void 0:i.uuid));_e!=null&&_e.length});return()=>{U.remove(),Z.remove(),re.remove(),K.remove()}});const P=re=>{A(re)},H=()=>{A(!1)},de=re=>{var K,he;x(re.target.value);const U=f,Z=Et.cloneDeep(c);if(U!==null){if((K=re==null?void 0:re.target)!=null&&K.value){if(Z[i==null?void 0:i.uuid]=(he=re==null?void 0:re.target)==null?void 0:he.value,(U==null?void 0:U.length)>0)for(const _e of U)_e.fieldId===t.field.uuid&&(_e.postData[0]={postValue:re.target.value})}else if(delete Z[i==null?void 0:i.uuid],(U==null?void 0:U.length)>0)for(const _e of U)_e.fieldId===t.field.uuid&&(_e.postData[0]={postValue:""})}if(!(s!=null&&s.rowIsRepeatable)){u(Z);const _e=Object.keys(Z).length;d(_e)}},fe=(re,U)=>{var Z;if(x(U),(f==null?void 0:f.length)>0){const K=[...f],he=Et.findIndex(K,function(ge){return ge.rowId===(s==null?void 0:s.uuid)});let _e=(Z=f[he])==null?void 0:Z.repeatableFields;_e={..._e,[re.uuid]:U},K[he]={...K[he],repeatableFields:_e},h(K),U!==""?re.isValid=1:re.isValid=0}},ne=new Date(i==null?void 0:i.minDate),W=new Date(i==null?void 0:i.maxDate),ae=o.jsxs("div",{onMouseOver:F,onMouseOut:B,children:[!r&&!e&&T&&o.jsx(Hr,{type:"",handleFieldSettingsSidebar:P,...t}),o.jsxs("div",{className:`field ${e?" ":" builder-element-wrapper "}${(i==null?void 0:i.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[o.jsx("div",{className:"grid",children:o.jsxs("div",{className:"col-12 ",children:[(i==null?void 0:i.showHeaderText)&&o.jsx("h6",{children:(Y=i==null?void 0:i.headerText)==null?void 0:Y[g==null?void 0:g.type]}),(i==null?void 0:i.showLabel)&&o.jsxs("label",{htmlFor:a,className:"flex font-medium mb-3 text-700 text-2xl",children:[o.jsx(sa,{update:function(){throw new Error("Function not implemented.")},value:{fieldId:void 0,uuid:void 0},...t}),((pe=i==null?void 0:i.attributes)==null?void 0:pe.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",e?o.jsx(o.Fragment,{children:(ie=i==null?void 0:i.label)==null?void 0:ie[g==null?void 0:g.type]}):o.jsx(ea,{...t}),(i==null?void 0:i.showToolTip)&&o.jsx("span",{className:"ml-3",children:(i==null?void 0:i.showToolTip)&&o.jsx(Vi,{message:(J=i==null?void 0:i.toolTip)==null?void 0:J[g==null?void 0:g.type],position:"right"})})]}),o.jsxs("div",{className:"mt-3",children:[o.jsxs("span",{className:"p-input-icon-"+(i==null?void 0:i.iconAlignment),children:[(i==null?void 0:i.showIcon)&&o.jsx("i",{className:"pi pi-"+((oe=(Q=i==null?void 0:i.icon)==null?void 0:Q.properties)==null?void 0:oe.name)}),o.jsx(W1,{readOnlyInput:!0,numberOfMonths:i==null?void 0:i.noOfMonths,selectionMode:(i==null?void 0:i.dateRange)||"single",view:(i==null?void 0:i.calenderView)||!1,showButtonBar:(i==null?void 0:i.isTodayBtn)||!1,showIcon:(i==null?void 0:i.isIcon)||!1,id:i==null?void 0:i.uuid,dateFormat:i==null?void 0:i.dateFormat,placeholder:(ye=i==null?void 0:i.placeholder)==null?void 0:ye[g==null?void 0:g.type],value:w,onFocus:()=>E(1),onChange:re=>{s!=null&&s.rowIsRepeatable?fe(i,re.target.value):de(re)},minDate:ne,maxDate:W,className:S===1&&((Te=i==null?void 0:i.attributes)!=null&&Te.required)?w?"valid":"invalid":"valid'",disabled:l===m})]}),o.jsx("div",{children:((Ae=i==null?void 0:i.attributes)==null?void 0:Ae.required)&&o.jsx("small",{className:"error",children:S===1&&!w?(be=i==null?void 0:i.validationMesssage)==null?void 0:be.english:""})}),o.jsx("div",{children:(i==null?void 0:i.showHelperText)&&o.jsx("small",{children:(we=i==null?void 0:i.helperText)==null?void 0:we[g==null?void 0:g.type]})})]})]})}),n&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(Fi,{...t})]})]})]});return o.jsxs(o.Fragment,{children:[v===!0&&o.jsx(Ri,{visibilty:v,closeSettingFieldSidebar:H,...t},i==null?void 0:i.uuid),o.jsx(wi,{...t,fieldWrap:ae})]})},X3e=t=>{var ye,Te,Ae,be,we,re,U,Z;const e=N.useRef(null),{task_status:n,taskRegisterData:r,updateTaskRegisterData:i,updateTaskProgressValue:a,updateUserFormDataSubmit:s,userTaskSubmitFormData:l,onSetValuetoPostDataHook:c,TASK_PUBLISHED:u}=Pr(),{userSelectedLanguage:d,fieldSettingUpdate:f}=ln(),{field:h,fieldIndex:m,columnIndex:g,sectionIndex:v,rowIndex:A,pageIndex:w,row:x}=t,{isAdmin:S,isPreview:E,isRenderView:C}=tn(),[_,T]=N.useState(!1),[O,F]=N.useState(0),[B,M]=N.useState(!1),[z,P]=N.useState(null),[H,de]=N.useState(!1),fe=()=>{de(!0)},ne=()=>{de(!1)},W=()=>{var K;(K=e==null?void 0:e.current)==null||K.clear(),h.isValid=0,f(w,v,A,g,m,h),P(null),c(t,h,"")},ae=()=>{var he,_e,ge;const K=l;if((K==null?void 0:K.length)>0)for(const ve of K)ve.fieldId===t.field.uuid&&((he=ve==null?void 0:ve.postData[0])!=null&&he.postValue&&((_e=ve==null?void 0:ve.postData[0])==null?void 0:_e.postValue)!==""&&(P((ge=ve==null?void 0:ve.postData[0])==null?void 0:ge.postValue),M(!0)),h.isValid=1);M(!0)},Y=()=>{var K,he,_e,ge;if(l!=null&&l.length){const ve=[...l],Le=Et.findIndex(ve,function(me){return me.rowId===(x==null?void 0:x.uuid)});let Ne=(K=l[Le])==null?void 0:K.repeatableFields;Ne={...Ne,[h==null?void 0:h.uuid]:`<img src="${(he=e.current)==null?void 0:he.toDataURL()}" >`},ve[Le]={...ve[Le],repeatableFields:Ne},s(ve)}P(((_e=e.current)==null?void 0:_e.toDataURL())||""),((ge=e.current)==null?void 0:ge.toDataURL())!==""?h.isValid=1:h.isValid=0};N.useEffect(()=>{B||ae();const K=Rt.addListener("clearRepeatableFields",ve=>{ve===(x==null?void 0:x.uuid)&&(P(null),W(),F(0),h.isValid=0,f(w,v,A,g,m,h))}),he=Rt.addListener("onSubmitUserForm",()=>{var ve;(ve=h==null?void 0:h.attributes)!=null&&ve.required?(z!==null?h.isValid=1:h.isValid=0,f(w,v,A,g,m,h)):h.isValid=1}),_e=Rt.addListener("OnInvalidFieldCatch",ve=>{h.uuid===(ve==null?void 0:ve.fieldId)?F(1):F(0)}),ge=Rt.addListener("OnSignatureSettingChange",()=>{W()});return()=>{he.remove(),_e.remove(),ge.remove(),K.remove()}});const pe=K=>{T(K)},ie=()=>{T(!1)},J=()=>{var he,_e,ge,ve;const K=l;if(l!=null&&l.length){const Le=Et.cloneDeep(r);if(Le[h==null?void 0:h.uuid]=(he=e.current)==null?void 0:he.toDataURL(),(K==null?void 0:K.length)>0){for(const Ne of K)if(Ne.fieldId===t.field.uuid){Ne.postData[0]={postValue:(_e=e.current)==null?void 0:_e.toDataURL()},P(((ge=e.current)==null?void 0:ge.toDataURL())||null);break}}if(!(x!=null&&x.rowIsRepeatable)){i(Le);const Ne=(ve=Object.keys(Le))==null?void 0:ve.length;a(Ne)}}},Q=()=>{var K,he,_e;return`rgba(${(K=h==null?void 0:h.backgroundColor)==null?void 0:K.r}, ${(he=h==null?void 0:h.backgroundColor)==null?void 0:he.g}, ${(_e=h==null?void 0:h.backgroundColor)==null?void 0:_e.b}, 0.8)`},oe=o.jsxs("div",{onMouseOver:fe,onMouseOut:ne,children:[!C&&!E&&H&&o.jsx(Hr,{handleFieldSettingsSidebar:pe,...t}),o.jsx("div",{className:`field ${E?" ":" builder-element-wrapper "}${(h==null?void 0:h.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:o.jsxs("div",{className:"grid",children:[o.jsxs("div",{className:E?"col-12":"col-11",children:[(h==null?void 0:h.showHeaderText)&&o.jsx("h6",{children:(ye=h==null?void 0:h.headerText)==null?void 0:ye[d==null?void 0:d.type]}),(h==null?void 0:h.showLabel)&&o.jsxs("label",{htmlFor:h.uuid,className:"flex font-medium mb-3 text-700 text-2xl",children:[o.jsx(sa,{...t}),((Te=h==null?void 0:h.attributes)==null?void 0:Te.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",E?o.jsx(o.Fragment,{children:(Ae=h==null?void 0:h.label)==null?void 0:Ae[d==null?void 0:d.type]}):o.jsx(ea,{...t}),o.jsx("span",{className:"ml-3",children:(h==null?void 0:h.showToolTip)&&o.jsx(Vi,{message:(be=h==null?void 0:h.toolTip)==null?void 0:be[d==null?void 0:d.type],position:"right"})})]}),o.jsxs("div",{className:"mt-3",children:[n!==u&&z===null&&o.jsx(fE,{backgroundColor:Q(),penColor:`#${h==null?void 0:h.penColor}`,canvasProps:{width:`${h==null?void 0:h.canvasWidth}`,height:h==null?void 0:h.canvasHeight,className:"sigCanvas"},ref:e,onEnd:()=>{x!=null&&x.rowIsRepeatable?Y():J()}},h==null?void 0:h.uuid),n===u&&z!==null&&o.jsx("img",{alt:"",src:z,style:{width:350,height:200}}),n!==6&&z!==null&&o.jsx("img",{alt:"",src:z,style:{width:350,height:200}}),o.jsx("div",{children:((we=h==null?void 0:h.attributes)==null?void 0:we.required)&&o.jsx("small",{className:"error",children:O===1&&!z?(re=h==null?void 0:h.validationMesssage)==null?void 0:re.english:""})}),o.jsx("div",{className:"mt-3",children:(h==null?void 0:h.showHelperText)&&o.jsx("small",{children:(U=h==null?void 0:h.helperText)==null?void 0:U[d==null?void 0:d.type]})}),n!==u&&o.jsx(kt,{text:!0,label:(Z=h==null?void 0:h.clearSignatureButtonLabel)==null?void 0:Z[d==null?void 0:d.type],onClick:()=>W(),className:"p-button-raised p-button-text mt-3"})]})]}),S&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(Fi,{...t})]})]})})]});return o.jsxs(o.Fragment,{children:[_===!0&&o.jsx(Ri,{visibilty:_,closeSettingFieldSidebar:ie,...t}),o.jsx(wi,{...t,fieldWrap:oe})]})};function ug(){return ug=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ug.apply(this,arguments)}function dg(t){"@babel/helpers - typeof";return dg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dg(t)}function R3e(t,e){if(dg(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(dg(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function G3e(t){var e=R3e(t,"string");return dg(e)==="symbol"?e:String(e)}function BA(t,e,n){return e=G3e(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function W3e(t){if(Array.isArray(t))return t}function Q3e(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,s,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return l}}function VA(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function qB(t,e){if(t){if(typeof t=="string")return VA(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return VA(t,e)}}function J3e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3708
+ `,l++,s=h}),this.end_=s,this.storage_=i,this.diagnostics_=a}calculateBaseTime_(e,n){return this.storage_.size?this.storage_.has(e)?this.storage_.get(e).segmentSyncInfo.start:n:0}isReliablePlaylist_(e,n){return e!=null&&Array.isArray(n)&&n.length}}const i3e=86400,MA=[{name:"VOD",run:(t,e,n,r,i)=>n!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(t,e,n,r,i,a)=>{const s=t.getMediaSequenceSync(a);if(!s||!s.isReliable)return null;const l=s.getSyncInfoForTime(i);return l?{time:l.start,partIndex:l.partIndex,segmentIndex:l.segmentIndex}:null}},{name:"ProgramDateTime",run:(t,e,n,r,i)=>{if(!Object.keys(t.timelineToDatetimeMappings).length)return null;let a=null,s=null;const l=bA(e);i=i||0;for(let c=0;c<l.length;c++){const u=e.endList||i===0?c:l.length-(c+1),d=l[u],f=d.segment,h=t.timelineToDatetimeMappings[f.timeline];if(!h||!f.dateTimeObject)continue;let g=f.dateTimeObject.getTime()/1e3+h;if(f.parts&&typeof d.partIndex=="number")for(let A=0;A<d.partIndex;A++)g+=f.parts[A].duration;const v=Math.abs(i-g);if(s!==null&&(v===0||s<v))break;s=v,a={time:g,segmentIndex:d.segmentIndex,partIndex:d.partIndex}}return a}},{name:"Segment",run:(t,e,n,r,i)=>{let a=null,s=null;i=i||0;const l=bA(e);for(let c=0;c<l.length;c++){const u=e.endList||i===0?c:l.length-(c+1),d=l[u],f=d.segment,h=d.part&&d.part.start||f&&f.start;if(f.timeline===r&&typeof h<"u"){const m=Math.abs(i-h);if(s!==null&&s<m)break;(!a||s===null||s>=m)&&(s=m,a={time:h,segmentIndex:d.segmentIndex,partIndex:d.partIndex})}}return a}},{name:"Discontinuity",run:(t,e,n,r,i)=>{let a=null;if(i=i||0,e.discontinuityStarts&&e.discontinuityStarts.length){let s=null;for(let l=0;l<e.discontinuityStarts.length;l++){const c=e.discontinuityStarts[l],u=e.discontinuitySequence+l+1,d=t.discontinuities[u];if(d){const f=Math.abs(i-d.time);if(s!==null&&s<f)break;(!a||s===null||s>=f)&&(s=f,a={time:d.time,segmentIndex:c,partIndex:null})}}}return a}},{name:"Playlist",run:(t,e,n,r,i)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class a3e extends Nt.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={},this.mediaSequenceStorage_={main:new PA,audio:new PA,vtt:new PA},this.logger_=Ql("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,n,r,i,a){if(n!==1/0)return MA.find(({name:c})=>c==="VOD").run(this,e,n);const s=this.runStrategies_(e,n,r,i,a);if(!s.length)return null;for(const l of s){const{syncPoint:c,strategy:u}=l,{segmentIndex:d,time:f}=c;if(d<0)continue;const h=e.segments[d],m=f,g=m+h.duration;if(this.logger_(`Strategy: ${u}. Current time: ${i}. selected segment: ${d}. Time: [${m} -> ${g}]}`),i>=m&&i<g)return this.logger_("Found sync point with exact match: ",c),c}return this.selectSyncPoint_(s,{key:"time",value:i})}getExpiredTime(e,n){if(!e||!e.segments)return null;const r=this.runStrategies_(e,n,e.discontinuitySequence,0);if(!r.length)return null;const i=this.selectSyncPoint_(r,{key:"segmentIndex",value:0});return i.segmentIndex>0&&(i.time*=-1),Math.abs(i.time+ig({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:i.segmentIndex,endIndex:0}))}runStrategies_(e,n,r,i,a){const s=[];for(let l=0;l<MA.length;l++){const c=MA[l],u=c.run(this,e,n,r,i,a);u&&(u.strategy=c.name,s.push({strategy:c.name,syncPoint:u}))}return s}selectSyncPoint_(e,n){let r=e[0].syncPoint,i=Math.abs(e[0].syncPoint[n.key]-n.value),a=e[0].strategy;for(let s=1;s<e.length;s++){const l=Math.abs(e[s].syncPoint[n.key]-n.value);l<i&&(i=l,r=e[s].syncPoint,a=e[s].strategy)}return this.logger_(`syncPoint for [${n.key}: ${n.value}] chosen with strategy [${a}]: [time:${r.time}, segmentIndex:${r.segmentIndex}`+(typeof r.partIndex=="number"?`,partIndex:${r.partIndex}`:"")+"]"),r}saveExpiredSegmentInfo(e,n){const r=n.mediaSequence-e.mediaSequence;if(r>i3e){Nt.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let i=r-1;i>=0;i--){const a=e.segments[i];if(a&&typeof a.start<"u"){n.syncInfo={mediaSequence:e.mediaSequence+i,time:a.start},this.logger_(`playlist refresh sync: [time:${n.syncInfo.time}, mediaSequence: ${n.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const n=e.segments[0],r=n.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[n.timeline]=-r}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:n}){const r=this.calculateSegmentTimeMapping_(e,e.timingInfo,n),i=e.segment;r&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:i.start}));const a=i.dateTimeObject;i.discontinuity&&n&&a&&(this.timelineToDatetimeMappings[i.timeline]=-(a.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,n,r){const i=e.segment,a=e.part;let s=this.timelines[e.timeline],l,c;if(typeof e.timestampOffset=="number")s={time:e.startOfSegment,mapping:e.startOfSegment-n.start},r&&(this.timelines[e.timeline]=s,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${s.time}] [mapping: ${s.mapping}]`)),l=e.startOfSegment,c=n.end+s.mapping;else if(s)l=n.start+s.mapping,c=n.end+s.mapping;else return!1;return a&&(a.start=l,a.end=c),(!i.start||l<i.start)&&(i.start=l),i.end=c,!0}saveDiscontinuitySyncInfo_(e){const n=e.playlist,r=e.segment;if(r.discontinuity)this.discontinuities[r.timeline]={time:r.start,accuracy:0};else if(n.discontinuityStarts&&n.discontinuityStarts.length)for(let i=0;i<n.discontinuityStarts.length;i++){const a=n.discontinuityStarts[i],s=n.discontinuitySequence+i+1,l=a-e.mediaIndex,c=Math.abs(l);if(!this.discontinuities[s]||this.discontinuities[s].accuracy>c){let u;l<0?u=r.start-ig({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:e.mediaIndex,endIndex:a}):u=r.end+ig({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:e.mediaIndex+1,endIndex:a}),this.discontinuities[s]={time:u,accuracy:c}}}}dispose(){this.trigger("dispose"),this.off()}}class s3e extends Nt.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:n,to:r}){return typeof n=="number"&&typeof r=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:n,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:n,to:r}){return typeof n=="number"&&typeof r=="number"&&(this.lastTimelineChanges_[e]={type:e,from:n,to:r},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const o3e=GL(WL(function(){var t=function(){function v(){this.listeners={}}var A=v.prototype;return A.on=function(x,S){this.listeners[x]||(this.listeners[x]=[]),this.listeners[x].push(S)},A.off=function(x,S){if(!this.listeners[x])return!1;var E=this.listeners[x].indexOf(S);return this.listeners[x]=this.listeners[x].slice(0),this.listeners[x].splice(E,1),E>-1},A.trigger=function(x){var S=this.listeners[x];if(S)if(arguments.length===2)for(var E=S.length,C=0;C<E;++C)S[C].call(this,arguments[1]);else for(var _=Array.prototype.slice.call(arguments,1),T=S.length,O=0;O<T;++O)S[O].apply(this,_)},A.dispose=function(){this.listeners={}},A.pipe=function(x){this.on("data",function(S){x.push(S)})},v}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function e(v){return v.subarray(0,v.byteLength-v[v.byteLength-1])}/*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */const n=function(){const v=[[[],[],[],[],[]],[[],[],[],[],[]]],A=v[0],w=v[1],x=A[4],S=w[4];let E,C,_;const T=[],O=[];let F,B,M,z,P,H;for(E=0;E<256;E++)O[(T[E]=E<<1^(E>>7)*283)^E]=E;for(C=_=0;!x[C];C^=F||1,_=O[_]||1)for(z=_^_<<1^_<<2^_<<3^_<<4,z=z>>8^z&255^99,x[C]=z,S[z]=C,M=T[B=T[F=T[C]]],H=M*16843009^B*65537^F*257^C*16843008,P=T[z]*257^z*16843008,E=0;E<4;E++)A[E][C]=P=P<<24^P>>>8,w[E][z]=H=H<<24^H>>>8;for(E=0;E<5;E++)A[E]=A[E].slice(0),w[E]=w[E].slice(0);return v};let r=null;class i{constructor(A){r||(r=n()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];let w,x,S;const E=this._tables[0][4],C=this._tables[1],_=A.length;let T=1;if(_!==4&&_!==6&&_!==8)throw new Error("Invalid aes key size");const O=A.slice(0),F=[];for(this._key=[O,F],w=_;w<4*_+28;w++)S=O[w-1],(w%_===0||_===8&&w%_===4)&&(S=E[S>>>24]<<24^E[S>>16&255]<<16^E[S>>8&255]<<8^E[S&255],w%_===0&&(S=S<<8^S>>>24^T<<24,T=T<<1^(T>>7)*283)),O[w]=O[w-_]^S;for(x=0;w;x++,w--)S=O[x&3?w:w-4],w<=4||x<4?F[x]=S:F[x]=C[0][E[S>>>24]]^C[1][E[S>>16&255]]^C[2][E[S>>8&255]]^C[3][E[S&255]]}decrypt(A,w,x,S,E,C){const _=this._key[1];let T=A^_[0],O=S^_[1],F=x^_[2],B=w^_[3],M,z,P;const H=_.length/4-2;let de,fe=4;const ne=this._tables[1],W=ne[0],ae=ne[1],Y=ne[2],pe=ne[3],ie=ne[4];for(de=0;de<H;de++)M=W[T>>>24]^ae[O>>16&255]^Y[F>>8&255]^pe[B&255]^_[fe],z=W[O>>>24]^ae[F>>16&255]^Y[B>>8&255]^pe[T&255]^_[fe+1],P=W[F>>>24]^ae[B>>16&255]^Y[T>>8&255]^pe[O&255]^_[fe+2],B=W[B>>>24]^ae[T>>16&255]^Y[O>>8&255]^pe[F&255]^_[fe+3],fe+=4,T=M,O=z,F=P;for(de=0;de<4;de++)E[(3&-de)+C]=ie[T>>>24]<<24^ie[O>>16&255]<<16^ie[F>>8&255]<<8^ie[B&255]^_[fe++],M=T,T=O,O=F,F=B,B=M}}class a extends t{constructor(){super(t),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(A){this.jobs.push(A),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const s=function(v){return v<<24|(v&65280)<<8|(v&16711680)>>8|v>>>24},l=function(v,A,w){const x=new Int32Array(v.buffer,v.byteOffset,v.byteLength>>2),S=new i(Array.prototype.slice.call(A)),E=new Uint8Array(v.byteLength),C=new Int32Array(E.buffer);let _,T,O,F,B,M,z,P,H;for(_=w[0],T=w[1],O=w[2],F=w[3],H=0;H<x.length;H+=4)B=s(x[H]),M=s(x[H+1]),z=s(x[H+2]),P=s(x[H+3]),S.decrypt(B,M,z,P,C,H),C[H]=s(C[H]^_),C[H+1]=s(C[H+1]^T),C[H+2]=s(C[H+2]^O),C[H+3]=s(C[H+3]^F),_=B,T=M,O=z,F=P;return E};class c{constructor(A,w,x,S){const E=c.STEP,C=new Int32Array(A.buffer),_=new Uint8Array(A.byteLength);let T=0;for(this.asyncStream_=new a,this.asyncStream_.push(this.decryptChunk_(C.subarray(T,T+E),w,x,_)),T=E;T<C.length;T+=E)x=new Uint32Array([s(C[T-4]),s(C[T-3]),s(C[T-2]),s(C[T-1])]),this.asyncStream_.push(this.decryptChunk_(C.subarray(T,T+E),w,x,_));this.asyncStream_.push(function(){S(null,e(_))})}static get STEP(){return 32e3}decryptChunk_(A,w,x,S){return function(){const E=l(A,w,x);S.set(E,A.byteOffset)}}}var u=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},d;typeof window<"u"?d=window:typeof u<"u"?d=u:typeof self<"u"?d=self:d={};var f=d,h=function(A){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(A):A&&A.buffer instanceof ArrayBuffer},m=f.BigInt||Number;m("0x1"),m("0x100"),m("0x10000"),m("0x1000000"),m("0x100000000"),m("0x10000000000"),m("0x1000000000000"),m("0x100000000000000"),m("0x10000000000000000"),function(){var v=new Uint16Array([65484]),A=new Uint8Array(v.buffer,v.byteOffset,v.byteLength);return A[0]===255?"big":A[0]===204?"little":"unknown"}();const g=function(v){const A={};return Object.keys(v).forEach(w=>{const x=v[w];h(x)?A[w]={bytes:x.buffer,byteOffset:x.byteOffset,byteLength:x.byteLength}:A[w]=x}),A};self.onmessage=function(v){const A=v.data,w=new Uint8Array(A.encrypted.bytes,A.encrypted.byteOffset,A.encrypted.byteLength),x=new Uint32Array(A.key.bytes,A.key.byteOffset,A.key.byteLength/4),S=new Uint32Array(A.iv.bytes,A.iv.byteOffset,A.iv.byteLength/4);new c(w,x,S,function(E,C){self.postMessage(g({source:A.source,decrypted:C}),[C.buffer])})}}));var l3e=RL(o3e);const c3e=t=>{let e=t.default?"main":"alternative";return t.characteristics&&t.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},TB=(t,e)=>{t.abort(),t.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},LA=(t,e)=>{e.activePlaylistLoader=t,t.load()},u3e=(t,e)=>()=>{const{segmentLoaders:{[t]:n,main:r},mediaTypes:{[t]:i}}=e,a=i.activeTrack(),s=i.getActiveGroup(),l=i.activePlaylistLoader,c=i.lastGroup_;if(!(s&&c&&s.id===c.id)&&(i.lastGroup_=s,i.lastTrack_=a,TB(n,i),!(!s||s.isMainPlaylist))){if(!s.playlistLoader){l&&r.resetEverything();return}n.resyncLoader(),LA(s.playlistLoader,i)}},d3e=(t,e)=>()=>{const{segmentLoaders:{[t]:n},mediaTypes:{[t]:r}}=e;r.lastGroup_=null,n.abort(),n.pause()},f3e=(t,e)=>()=>{const{mainPlaylistLoader:n,segmentLoaders:{[t]:r,main:i},mediaTypes:{[t]:a}}=e,s=a.activeTrack(),l=a.getActiveGroup(),c=a.activePlaylistLoader,u=a.lastTrack_;if(!(u&&s&&u.id===s.id)&&(a.lastGroup_=l,a.lastTrack_=s,TB(r,a),!!l)){if(l.isMainPlaylist){if(!s||!u||s.id===u.id)return;const d=e.vhs.playlistController_,f=d.selectPlaylist();if(d.media()===f)return;a.logger_(`track change. Switching main audio from ${u.id} to ${s.id}`),n.pause(),i.resetEverything(),d.fastQualityChange_(f);return}if(t==="AUDIO"){if(!l.playlistLoader){i.setAudio(!0),i.resetEverything();return}r.setAudio(!0),i.setAudio(!1)}if(c===l.playlistLoader){LA(l.playlistLoader,a);return}r.track&&r.track(s),r.resetEverything(),LA(l.playlistLoader,a)}},vv={AUDIO:(t,e)=>()=>{const{mediaTypes:{[t]:n},excludePlaylist:r}=e,i=n.activeTrack(),a=n.activeGroup(),s=(a.filter(c=>c.default)[0]||a[0]).id,l=n.tracks[s];if(i===l){r({error:{message:"Problem encountered loading the default audio track."}});return}Nt.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const c in n.tracks)n.tracks[c].enabled=n.tracks[c]===l;n.onTrackChanged()},SUBTITLES:(t,e)=>()=>{const{mediaTypes:{[t]:n}}=e;Nt.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}},EB={AUDIO:(t,e,n)=>{if(!e)return;const{tech:r,requestOptions:i,segmentLoaders:{[t]:a}}=n;e.on("loadedmetadata",()=>{const s=e.media();a.playlist(s,i),(!r.paused()||s.endList&&r.preload()!=="none")&&a.load()}),e.on("loadedplaylist",()=>{a.playlist(e.media(),i),r.paused()||a.load()}),e.on("error",vv[t](t,n))},SUBTITLES:(t,e,n)=>{const{tech:r,requestOptions:i,segmentLoaders:{[t]:a},mediaTypes:{[t]:s}}=n;e.on("loadedmetadata",()=>{const l=e.media();a.playlist(l,i),a.track(s.activeTrack()),(!r.paused()||l.endList&&r.preload()!=="none")&&a.load()}),e.on("loadedplaylist",()=>{a.playlist(e.media(),i),r.paused()||a.load()}),e.on("error",vv[t](t,n))}},h3e={AUDIO:(t,e)=>{const{vhs:n,sourceType:r,segmentLoaders:{[t]:i},requestOptions:a,main:{mediaGroups:s},mediaTypes:{[t]:{groups:l,tracks:c,logger_:u}},mainPlaylistLoader:d}=e,f=ag(d.main);(!s[t]||Object.keys(s[t]).length===0)&&(s[t]={main:{default:{default:!0}}},f&&(s[t].main.default.playlists=d.main.playlists));for(const h in s[t]){l[h]||(l[h]=[]);for(const m in s[t][h]){let g=s[t][h][m],v;if(f?(u(`AUDIO group '${h}' label '${m}' is a main playlist`),g.isMainPlaylist=!0,v=null):r==="vhs-json"&&g.playlists?v=new sh(g.playlists[0],n,a):g.resolvedUri?v=new sh(g.resolvedUri,n,a):g.playlists&&r==="dash"?v=new IA(g.playlists[0],n,a,d):v=null,g=Gi({id:m,playlistLoader:v},g),EB[t](t,g.playlistLoader,e),l[h].push(g),typeof c[m]>"u"){const A=new Nt.AudioTrack({id:m,kind:c3e(g),enabled:!1,language:g.language,default:g.default,label:m});c[m]=A}}}i.on("error",vv[t](t,e))},SUBTITLES:(t,e)=>{const{tech:n,vhs:r,sourceType:i,segmentLoaders:{[t]:a},requestOptions:s,main:{mediaGroups:l},mediaTypes:{[t]:{groups:c,tracks:u}},mainPlaylistLoader:d}=e;for(const f in l[t]){c[f]||(c[f]=[]);for(const h in l[t][f]){if(!r.options_.useForcedSubtitles&&l[t][f][h].forced)continue;let m=l[t][f][h],g;if(i==="hls")g=new sh(m.resolvedUri,r,s);else if(i==="dash"){if(!m.playlists.filter(A=>A.excludeUntil!==1/0).length)return;g=new IA(m.playlists[0],r,s,d)}else i==="vhs-json"&&(g=new sh(m.playlists?m.playlists[0]:m.resolvedUri,r,s));if(m=Gi({id:h,playlistLoader:g},m),EB[t](t,m.playlistLoader,e),c[f].push(m),typeof u[h]>"u"){const v=n.addRemoteTextTrack({id:h,kind:"subtitles",default:m.default&&m.autoselect,language:m.language,label:h},!1).track;u[h]=v}}}a.on("error",vv[t](t,e))},"CLOSED-CAPTIONS":(t,e)=>{const{tech:n,main:{mediaGroups:r},mediaTypes:{[t]:{groups:i,tracks:a}}}=e;for(const s in r[t]){i[s]||(i[s]=[]);for(const l in r[t][s]){const c=r[t][s][l];if(!/^(?:CC|SERVICE)/.test(c.instreamId))continue;const u=n.options_.vhs&&n.options_.vhs.captionServices||{};let d={label:l,language:c.language,instreamId:c.instreamId,default:c.default&&c.autoselect};if(u[d.instreamId]&&(d=Gi(d,u[d.instreamId])),d.default===void 0&&delete d.default,i[s].push(Gi({id:l},c)),typeof a[l]>"u"){const f=n.addRemoteTextTrack({id:d.instreamId,kind:"captions",default:d.default,language:d.language,label:d.label},!1).track;a[l]=f}}}}},IB=(t,e)=>{for(let n=0;n<t.length;n++)if(wA(e,t[n])||t[n].playlists&&IB(t[n].playlists,e))return!0;return!1},p3e=(t,e)=>n=>{const{mainPlaylistLoader:r,mediaTypes:{[t]:{groups:i}}}=e,a=r.media();if(!a)return null;let s=null;a.attributes[t]&&(s=i[a.attributes[t]]);const l=Object.keys(i);if(!s)if(t==="AUDIO"&&l.length>1&&ag(e.main))for(let c=0;c<l.length;c++){const u=i[l[c]];if(IB(u,a)){s=u;break}}else i.main?s=i.main:l.length===1&&(s=i[l[0]]);return typeof n>"u"?s:n===null||!s?null:s.filter(c=>c.id===n.id)[0]||null},g3e={AUDIO:(t,e)=>()=>{const{mediaTypes:{[t]:{tracks:n}}}=e;for(const r in n)if(n[r].enabled)return n[r];return null},SUBTITLES:(t,e)=>()=>{const{mediaTypes:{[t]:{tracks:n}}}=e;for(const r in n)if(n[r].mode==="showing"||n[r].mode==="hidden")return n[r];return null}},m3e=(t,{mediaTypes:e})=>()=>{const n=e[t].activeTrack();return n?e[t].activeGroup(n):null},v3e=t=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(u=>{h3e[u](u,t)});const{mediaTypes:e,mainPlaylistLoader:n,tech:r,vhs:i,segmentLoaders:{["AUDIO"]:a,main:s}}=t;["AUDIO","SUBTITLES"].forEach(u=>{e[u].activeGroup=p3e(u,t),e[u].activeTrack=g3e[u](u,t),e[u].onGroupChanged=u3e(u,t),e[u].onGroupChanging=d3e(u,t),e[u].onTrackChanged=f3e(u,t),e[u].getActiveGroup=m3e(u,t)});const l=e.AUDIO.activeGroup();if(l){const u=(l.filter(f=>f.default)[0]||l[0]).id;e.AUDIO.tracks[u].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(s.setAudio(!1),a.setAudio(!0)):s.setAudio(!0)}n.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(u=>e[u].onGroupChanged())}),n.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(u=>e[u].onGroupChanging())});const c=()=>{e.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};r.audioTracks().addEventListener("change",c),r.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),i.on("dispose",()=>{r.audioTracks().removeEventListener("change",c),r.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const u in e.AUDIO.tracks)r.audioTracks().addTrack(e.AUDIO.tracks[u])},b3e=()=>{const t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{t[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:yd,activeTrack:yd,getActiveGroup:yd,onGroupChanged:yd,onTrackChanged:yd,lastTrack_:null,logger_:Ql(`MediaGroups[${e}]`)}}),t};class _B{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=Jo(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(n=>[n.ID,n])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class y3e extends Nt.EventTarget{constructor(e,n){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new _B,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Ql("Content Steering"),this.xhr_=e,this.getBandwidth_=n}assignTagProperties(e,n){this.manifestType_=n.serverUri?"HLS":"DASH";const r=n.serverUri||n.serverURL;if(!r){this.logger_(`steering manifest URL is ${r}, cannot request steering manifest.`),this.trigger("error");return}if(r.startsWith("data:")){this.decodeDataUriManifest_(r.substring(r.indexOf(",")+1));return}this.steeringManifest.reloadUri=Jo(e,r),this.defaultPathway=n.pathwayId||n.defaultServiceLocation,this.queryBeforeStart=n.queryBeforeStart,this.proxyServerUrl_=n.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const n=this.steeringManifest.reloadUri;if(!n)return;const r=e?n:this.getRequestURI(n);if(!r){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(i,a)=>{if(i){if(a.status===410){this.logger_(`manifest request 410 ${i}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),this.excludedSteeringManifestURLs.add(r);return}if(a.status===429){const l=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${i}.`),this.logger_(`content steering will retry in ${l} seconds.`),this.startTTLTimeout_(parseInt(l,10));return}this.logger_(`manifest failed to load ${i}.`),this.startTTLTimeout_();return}const s=JSON.parse(this.request_.responseText);this.assignSteeringProperties_(s),this.startTTLTimeout_()})}setProxyServerUrl_(e){const n=new Ge.URL(e),r=new Ge.URL(this.proxyServerUrl_);return r.searchParams.set("url",encodeURI(n.toString())),this.setSteeringParams_(r.toString())}decodeDataUriManifest_(e){const n=JSON.parse(Ge.atob(e));this.assignSteeringProperties_(n)}setSteeringParams_(e){const n=new Ge.URL(e),r=this.getPathway(),i=this.getBandwidth_();if(r){const a=`_${this.manifestType_}_pathway`;n.searchParams.set(a,r)}if(i){const a=`_${this.manifestType_}_throughput`;n.searchParams.set(a,i)}return n.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const r=(i=>{for(const a of i)if(this.availablePathways_.has(a))return a;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==r&&(this.currentPathway=r,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const n=i=>this.excludedSteeringManifestURLs.has(i);if(this.proxyServerUrl_){const i=this.setProxyServerUrl_(e);if(!n(i))return i}const r=this.setSteeringParams_(e);return n(r)?null:r}startTTLTimeout_(e=this.steeringManifest.ttl){const n=e*1e3;this.ttlTimeout_=Ge.setTimeout(()=>{this.requestSteeringManifest()},n)}clearTTLTimeout_(){Ge.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new _B}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,n){return!n&&this.steeringManifest.reloadUri||n&&(Jo(e,n.serverURL)!==this.steeringManifest.reloadUri||n.defaultServiceLocation!==this.defaultPathway||n.queryBeforeStart!==this.queryBeforeStart||n.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const A3e=10;let Ad;const w3e=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],S3e=function(t){return this.audioSegmentLoader_[t]+this.mainSegmentLoader_[t]},x3e=function({currentPlaylist:t,buffered:e,currentTime:n,nextPlaylist:r,bufferLowWaterLine:i,bufferHighWaterLine:a,duration:s,bufferBasedABR:l,log:c}){if(!r)return Nt.log.warn("We received no playlist to switch to. Please check your stream."),!1;const u=`allowing switch ${t&&t.id||"null"} -> ${r.id}`;if(!t)return c(`${u} as current playlist is not set`),!0;if(r.id===t.id)return!1;const d=!!rh(e,n).length;if(!t.endList)return!d&&typeof t.partTargetDuration=="number"?(c(`not ${u} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(c(`${u} as current playlist is live`),!0);const f=mA(e,n),h=l?ks.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:ks.MAX_BUFFER_LOW_WATER_LINE;if(s<h)return c(`${u} as duration < max low water line (${s} < ${h})`),!0;const m=r.attributes.BANDWIDTH,g=t.attributes.BANDWIDTH;if(m<g&&(!l||f<a)){let v=`${u} as next bandwidth < current bandwidth (${m} < ${g})`;return l&&(v+=` and forwardBuffer < bufferHighWaterLine (${f} < ${a})`),c(v),!0}if((!l||m>g)&&f>=i){let v=`${u} as forwardBuffer >= bufferLowWaterLine (${f} >= ${i})`;return l&&(v+=` and next bandwidth > current bandwidth (${m} > ${g})`),c(v),!0}return c(`not ${u} as no switching criteria met`),!1};class C3e extends Nt.EventTarget{constructor(e){super();const{src:n,withCredentials:r,tech:i,bandwidth:a,externVhs:s,useCueTags:l,playlistExclusionDuration:c,enableLowInitialPlaylist:u,sourceType:d,cacheEncryptionKeys:f,bufferBasedABR:h,leastPixelDiffSelector:m,captionServices:g}=e;if(!n)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:v}=e;(v===null||typeof v>"u")&&(v=1/0),Ad=s,this.bufferBasedABR=!!h,this.leastPixelDiffSelector=!!m,this.withCredentials=r,this.tech_=i,this.vhs_=i.vhs,this.sourceType_=d,this.useCueTags_=l,this.playlistExclusionDuration=c,this.maxPlaylistRetries=v,this.enableLowInitialPlaylist=u,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:v,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=b3e(),this.mediaSource=new Ge.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=lo(),this.hasPlayed_=!1,this.syncController_=new a3e(e),this.segmentMetadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new l3e,this.sourceUpdater_=new wB(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new s3e,this.keyStatusMap_=new Map;const A={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:g,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:a,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:f,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new IA(n,this.vhs_,Gi(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new sh(n,this.vhs_,Gi(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new FA(Gi(A,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new FA(Gi(A,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new e3e(Gi(A,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((S,E)=>{function C(){i.off("vttjserror",_),S()}function _(){i.off("vttjsloaded",C),E()}i.one("vttjsloaded",C),i.one("vttjserror",_),i.addWebVttScript_()})}),e);const w=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new y3e(this.vhs_.xhr,w),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),w3e.forEach(S=>{this[S+"_"]=S3e.bind(this,S)}),this.logger_=Ql("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const x=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(x,()=>{const S=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-S,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),n=this.audioAppendsToLoadedData_();return e===-1||n===-1?-1:e+n}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const n=this.selectPlaylist();n&&this.shouldSwitchToMedia_(n)&&this.switchMedia_(n,e)}switchMedia_(e,n,r){const i=this.media(),a=i&&(i.id||i.uri),s=e&&(e.id||e.uri);a&&a!==s&&(this.logger_(`switch media ${a} -> ${s} from ${n}`),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${n}`})),this.mainPlaylistLoader_.media(e,r)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const n=this.mediaTypes_[e],r=n?n.activeGroup():null,i=this.contentSteeringController_.getPathway();if(r&&i){const s=(r.length?r[0].playlists:r.playlists).filter(l=>l.attributes.serviceLocation===i);s.length&&this.mediaTypes_[e].activePlaylistLoader.media(s[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=Ge.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(Ge.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),n=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return n;const r=e.mediaGroups.AUDIO,i=Object.keys(r);let a;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)a=this.mediaTypes_.AUDIO.activeTrack();else{const l=r.main||i.length&&r[i[0]];for(const c in l)if(l[c].default){a={label:c};break}}if(!a)return n;const s=[];for(const l in r)if(r[l][a.label]){const c=r[l][a.label];if(c.playlists&&c.playlists.length)s.push.apply(s,c.playlists);else if(c.uri)s.push(c);else if(e.playlists.length)for(let u=0;u<e.playlists.length;u++){const d=e.playlists[u];d.attributes&&d.attributes.AUDIO&&d.attributes.AUDIO===l&&s.push(d)}}return s.length?s:n}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const e=this.mainPlaylistLoader_.media(),n=e.targetDuration*1.5*1e3;AA(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=n,e.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),v3e({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let n;if(this.enableLowInitialPlaylist&&(n=this.selectInitialPlaylist()),n||(n=this.selectPlaylist()),!n||!this.shouldSwitchToMedia_(n)||(this.initialMedia_=n,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const e=this.mainPlaylistLoader_.media(),n=e.targetDuration*1.5*1e3;AA(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=n,this.sourceType_==="dash"&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const e=this.mainPlaylistLoader_.media();if(e.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,n){const r=e.mediaGroups||{};let i=!0;const a=Object.keys(r.AUDIO);for(const s in r.AUDIO)for(const l in r.AUDIO[s])r.AUDIO[s][l].uri||(i=!1);i&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Ad.Playlist.isAes(n)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),a.length&&Object.keys(r.AUDIO[a[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const n=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,r=this.tech_.currentTime(),i=this.bufferLowWaterLine(),a=this.bufferHighWaterLine(),s=this.tech_.buffered();return x3e({buffered:s,currentTime:r,currentPlaylist:n,nextPlaylist:e,bufferLowWaterLine:i,bufferHighWaterLine:a,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const n=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:n.playlist,error:n})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",n=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:A3e}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const n=this.getCodecsOrExclude_();n&&this.sourceUpdater_.addOrChangeSourceBuffers(n)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(()=>{this.tech_.setCurrentTime(this.tech_.currentTime())})}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const n=this.seekable();if(!n.length)return!1;const r=n.end(0);let i=r;if(e.start){const a=e.start.timeOffset;a<0?i=Math.max(r+a,n.start(0)):i=Math.min(r,a)}this.trigger("firstplay"),this.tech_.setCurrentTime(i)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,n=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const n=this.duration();e[e.length-1].endTime=isNaN(n)||Math.abs(n)===1/0?Number.MAX_VALUE:n}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const n=this.mainSegmentLoader_.getCurrentMediaInfo_();!n||n.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const r=this.syncController_.getExpiredTime(e,this.duration());if(r===null)return!1;const i=Ad.Playlist.playlistEnd(e,r),a=this.tech_.currentTime(),s=this.tech_.buffered();if(!s.length)return i-a<=Cu;const l=s.end(s.length-1);return l-a<=Cu&&i-l<=Cu}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:n={},playlistExclusionDuration:r}){if(e=e||this.mainPlaylistLoader_.media(),r=r||n.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=n,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const i=this.mainPlaylistLoader_.main.playlists,a=i.filter(dv),s=a.length===1&&a[0]===e;if(i.length===1&&r!==1/0)return Nt.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(s);if(s){if(this.main().contentSteering){const g=this.pathwayAttribute_(e),v=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(g),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(g)},v);return}let m=!1;i.forEach(g=>{if(g===e)return;const v=g.excludeUntil;typeof v<"u"&&v!==1/0&&(m=!0,delete g.excludeUntil)}),m&&(Nt.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let l;e.playlistErrors_>this.maxPlaylistRetries?l=1/0:l=Date.now()+r*1e3,e.excludeUntil=l,n.reason&&(e.lastExcludeReason_=n.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const c=this.selectPlaylist();if(!c){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const u=n.internal?this.logger_:Nt.log.warn,d=n.message?" "+n.message:"";u(`${n.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${d} Switching to playlist ${c.id}.`),c.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),c.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const f=c.targetDuration/2*1e3||5*1e3,h=typeof c.lastRequest=="number"&&Date.now()-c.lastRequest<=f;return this.switchMedia_(c,"exclude",s||h)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,n){const r=[],i=e==="all";(i||e==="main")&&r.push(this.mainPlaylistLoader_);const a=[];(i||e==="audio")&&a.push("AUDIO"),(i||e==="subtitle")&&(a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES")),a.forEach(s=>{const l=this.mediaTypes_[s]&&this.mediaTypes_[s].activePlaylistLoader;l&&r.push(l)}),["main","audio","subtitle"].forEach(s=>{const l=this[`${s}SegmentLoader_`];l&&(e===s||e==="all")&&r.push(l)}),r.forEach(s=>n.forEach(l=>{typeof s[l]=="function"&&s[l]()}))}setCurrentTime(e){const n=rh(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(n&&n.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Ad.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let n=this.mainPlaylistLoader_.media();if(!n)return;let r=this.syncController_.getExpiredTime(n,this.duration());if(r===null)return;const i=this.mainPlaylistLoader_.main,a=Ad.Playlist.seekable(n,r,Ad.Playlist.liveEdgeDelay(i,n));if(a.length===0||this.mediaTypes_.AUDIO.activePlaylistLoader&&(n=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),r=this.syncController_.getExpiredTime(n,this.duration()),r===null||(e=Ad.Playlist.seekable(n,r,Ad.Playlist.liveEdgeDelay(i,n)),e.length===0)))return;let s,l;this.seekable_&&this.seekable_.length&&(s=this.seekable_.end(0),l=this.seekable_.start(0)),e?e.start(0)>a.end(0)||a.start(0)>e.end(0)?this.seekable_=a:this.seekable_=lo([[e.start(0)>a.start(0)?e.start(0):a.start(0),e.end(0)<a.end(0)?e.end(0):a.end(0)]]):this.seekable_=a,!(this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===s&&this.seekable_.start(0)===l)&&(this.logger_(`seekable updated [${wL(this.seekable_)}]`),this.tech_.trigger("seekablechanged"))}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const i=this.seekable();if(!i.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<i.end(i.length-1))&&this.sourceUpdater_.setDuration(i.end(i.length-1));return}const n=this.tech_.buffered();let r=Ad.Playlist.duration(this.mainPlaylistLoader_.media());n.length>0&&(r=Math.max(r,n.end(n.length-1))),this.mediaSource.duration!==r&&this.sourceUpdater_.setDuration(r)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const n=this.mediaTypes_[e].groups;for(const r in n)n[r].forEach(i=>{i.playlistLoader&&i.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,n=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),r=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!n||!r)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},n=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const r=og(this.main(),n),i={},a=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(i.video=r.video||e.main.videoCodec||Jfe),e.main.isMuxed&&(i.video+=`,${r.audio||e.main.audioCodec||bk}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||a)&&(i.audio=r.audio||e.main.audioCodec||e.audio.audioCodec||bk,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!i.audio&&!i.video){this.excludePlaylist({playlistToExclude:n,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const s=(u,d)=>u?v4(d):Hb(d),l={};let c;if(["video","audio"].forEach(function(u){if(i.hasOwnProperty(u)&&!s(e[u].isFmp4,i[u])){const d=e[u].isFmp4?"browser":"muxer";l[d]=l[d]||[],l[d].push(i[u]),u==="audio"&&(c=d)}}),a&&c&&n.attributes.AUDIO){const u=n.attributes.AUDIO;this.main().playlists.forEach(d=>{(d.attributes&&d.attributes.AUDIO)===u&&d!==n&&(d.excludeUntil=1/0)}),this.logger_(`excluding audio group ${u} as ${c} does not support codec(s): "${i.audio}"`)}if(Object.keys(l).length){const u=Object.keys(l).reduce((d,f)=>(d&&(d+=", "),d+=`${f} does not support codec(s): "${l[f].join(",")}"`,d),"")+".";this.excludePlaylist({playlistToExclude:n,error:{internal:!0,message:u},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const u=[];if(["video","audio"].forEach(d=>{const f=(gu(this.sourceUpdater_.codecs[d]||"")[0]||{}).type,h=(gu(i[d]||"")[0]||{}).type;f&&h&&f.toLowerCase()!==h.toLowerCase()&&u.push(`"${this.sourceUpdater_.codecs[d]}" -> "${i[d]}"`)}),u.length){this.excludePlaylist({playlistToExclude:n,error:{message:`Codec switching not supported: ${u.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return i}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const n=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(n)}excludeUnsupportedVariants_(){const e=this.main().playlists,n=[];Object.keys(e).forEach(r=>{const i=e[r];if(n.indexOf(i.id)!==-1)return;n.push(i.id);const a=og(this.main,i),s=[];a.audio&&!Hb(a.audio)&&!v4(a.audio)&&s.push(`audio codec ${a.audio}`),a.video&&!Hb(a.video)&&!v4(a.video)&&s.push(`video codec ${a.video}`),a.text&&a.text==="stpp.ttml.im1t"&&s.push(`text codec ${a.text}`),s.length&&(i.excludeUntil=1/0,this.logger_(`excluding ${i.id} for unsupported: ${s.join(", ")}`))})}excludeIncompatibleVariants_(e){const n=[],r=this.main().playlists,i=hv(gu(e)),a=oB(i),s=i.video&&gu(i.video)[0]||null,l=i.audio&&gu(i.audio)[0]||null;Object.keys(r).forEach(c=>{const u=r[c];if(n.indexOf(u.id)!==-1||u.excludeUntil===1/0)return;n.push(u.id);const d=[],f=og(this.mainPlaylistLoader_.main,u),h=oB(f);if(!(!f.audio&&!f.video)){if(h!==a&&d.push(`codec count "${h}" !== "${a}"`),!this.sourceUpdater_.canChangeType()){const m=f.video&&gu(f.video)[0]||null,g=f.audio&&gu(f.audio)[0]||null;m&&s&&m.type.toLowerCase()!==s.type.toLowerCase()&&d.push(`video codec "${m.type}" !== "${s.type}"`),g&&l&&g.type.toLowerCase()!==l.type.toLowerCase()&&d.push(`audio codec "${g.type}" !== "${l.type}"`)}d.length&&(u.excludeUntil=1/0,this.logger_(`excluding ${u.id}: ${d.join(" && ")}`))}})}updateAdCues_(e){let n=0;const r=this.seekable();r.length&&(n=r.start(0)),n3e(e,this.cueTagsTrack_,n)}goalBufferLength(){const e=this.tech_.currentTime(),n=ks.GOAL_BUFFER_LENGTH,r=ks.GOAL_BUFFER_LENGTH_RATE,i=Math.max(n,ks.MAX_GOAL_BUFFER_LENGTH);return Math.min(n+e*r,i)}bufferLowWaterLine(){const e=this.tech_.currentTime(),n=ks.BUFFER_LOW_WATER_LINE,r=ks.BUFFER_LOW_WATER_LINE_RATE,i=Math.max(n,ks.MAX_BUFFER_LOW_WATER_LINE),a=Math.max(n,ks.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(n+e*r,this.bufferBasedABR?a:i)}bufferHighWaterLine(){return ks.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){fB(this.inbandTextTracks_,"com.apple.streaming",this.tech_),Bme({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,n,r){const i=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();fB(this.inbandTextTracks_,e,this.tech_),Pme({inbandTextTracks:this.inbandTextTracks_,metadataArray:n,timestampOffset:i,videoDuration:r})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const n of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(n));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{const i=this.contentSteeringController_.getAvailablePathways(),a=[];for(const s of e.playlists){const l=s.attributes.serviceLocation;if(l&&(a.push(l),!i.has(l)))return!0}return!!(!a.length&&i.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const r=this.main().playlists,i=new Set;let a=!1;Object.keys(r).forEach(s=>{const l=r[s],c=this.pathwayAttribute_(l),u=c&&e!==c;l.excludeUntil===1/0&&l.lastExcludeReason_==="content-steering"&&!u&&(delete l.excludeUntil,delete l.lastExcludeReason_,a=!0);const f=!l.excludeUntil&&l.excludeUntil!==1/0;!i.has(l.id)&&u&&f&&(i.add(l.id),l.excludeUntil=1/0,l.lastExcludeReason_="content-steering",this.logger_(`excluding ${l.id} for ${l.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(s=>{const l=this.mediaTypes_[s];if(l.activePlaylistLoader){const c=l.activePlaylistLoader.media_;c&&c.attributes.serviceLocation!==e&&(a=!0)}}),a&&this.changeSegmentPathway_()}handlePathwayClones_(){const n=this.main().playlists,r=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(r&&r.size||i&&i.size){for(const[s,l]of r.entries())i.get(s)||(this.mainPlaylistLoader_.updateOrDeleteClone(l),this.contentSteeringController_.excludePathway(s));for(const[s,l]of i.entries()){const c=r.get(s);if(!c){n.filter(d=>d.attributes["PATHWAY-ID"]===l["BASE-ID"]).forEach(d=>{this.mainPlaylistLoader_.addClonePathway(l,d)}),this.contentSteeringController_.addAvailablePathway(s);continue}this.equalPathwayClones_(c,l)||(this.mainPlaylistLoader_.updateOrDeleteClone(l,!0),this.contentSteeringController_.addAvailablePathway(s))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...i])))}}equalPathwayClones_(e,n){if(e["BASE-ID"]!==n["BASE-ID"]||e.ID!==n.ID||e["URI-REPLACEMENT"].HOST!==n["URI-REPLACEMENT"].HOST)return!1;const r=e["URI-REPLACEMENT"].PARAMS,i=n["URI-REPLACEMENT"].PARAMS;for(const a in r)if(r[a]!==i[a])return!1;for(const a in i)if(r[a]!==i[a])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const n="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(r=>{const i=this.mainPlaylistLoader_.getKeyIdSet(r);!i||!i.size||i.forEach(a=>{const s="usable",l=this.keyStatusMap_.has(a)&&this.keyStatusMap_.get(a)===s,c=r.lastExcludeReason_===n&&r.excludeUntil===1/0;l?l&&c&&(delete r.excludeUntil,delete r.lastExcludeReason_,this.logger_(`enabling playlist ${r.id} because key ID ${a} is ${s}`)):(r.excludeUntil!==1/0&&r.lastExcludeReason_!==n&&(r.excludeUntil=1/0,r.lastExcludeReason_=n,this.logger_(`excluding playlist ${r.id} because the key ID ${a} doesn't exist in the keyStatusMap or is not ${s}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(r=>{const i=r&&r.attributes&&r.attributes.RESOLUTION&&r.attributes.RESOLUTION.height<720,a=r.excludeUntil===1/0&&r.lastExcludeReason_===n;i&&a&&(delete r.excludeUntil,Nt.log.warn(`enabling non-HD playlist ${r.id} because all playlists were excluded due to ${n} key IDs`))})}addKeyStatus_(e,n){const a=(typeof e=="string"?e:Jme(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${n}' with key ID ${a} added to the keyStatusMap`),this.keyStatusMap_.set(a,n)}updatePlaylistByKeyStatus(e,n){this.addKeyStatus_(e,n),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const T3e=(t,e,n)=>r=>{const i=t.main.playlists[e],a=yA(i),s=dv(i);return typeof r>"u"?s:(r?delete i.disabled:i.disabled=!0,r!==s&&!a&&(n(i),r?t.trigger("renditionenabled"):t.trigger("renditiondisabled")),r)};class E3e{constructor(e,n,r){const{playlistController_:i}=e,a=i.fastQualityChange_.bind(i);if(n.attributes){const s=n.attributes.RESOLUTION;this.width=s&&s.width,this.height=s&&s.height,this.bandwidth=n.attributes.BANDWIDTH,this.frameRate=n.attributes["FRAME-RATE"]}this.codecs=og(i.main(),n),this.playlist=n,this.id=r,this.enabled=T3e(e.playlists,n.id,a)}}const I3e=function(t){t.representations=()=>{const e=t.playlistController_.main(),n=ag(e)?t.playlistController_.getAudioTrackPlaylists_():e.playlists;return n?n.filter(r=>!yA(r)).map((r,i)=>new E3e(t,r,r.id)):[]}},DB=["seeking","seeked","pause","playing","error"];class _3e{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Ql("PlaybackWatcher"),this.logger_("initialize");const n=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),i=()=>this.techWaiting_(),a=()=>this.resetTimeUpdate_(),s=this.playlistController_,l=["main","subtitle","audio"],c={};l.forEach(d=>{c[d]={reset:()=>this.resetSegmentDownloads_(d),updateend:()=>this.checkSegmentDownloads_(d)},s[`${d}SegmentLoader_`].on("appendsdone",c[d].updateend),s[`${d}SegmentLoader_`].on("playlistupdate",c[d].reset),this.tech_.on(["seeked","seeking"],c[d].reset)});const u=d=>{["main","audio"].forEach(f=>{s[`${f}SegmentLoader_`][d]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),u("off"))},this.clearSeekingAppendCheck_=()=>u("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),u("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",i),this.tech_.on(DB,a),this.tech_.on("canplay",r),this.tech_.one("play",n),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",i),this.tech_.off(DB,a),this.tech_.off("canplay",r),this.tech_.off("play",n),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),l.forEach(d=>{s[`${d}SegmentLoader_`].off("appendsdone",c[d].updateend),s[`${d}SegmentLoader_`].off("playlistupdate",c[d].reset),this.tech_.off(["seeked","seeking"],c[d].reset)}),this.checkCurrentTimeTimeout_&&Ge.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&Ge.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=Ge.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const n=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=n.buffered_()}checkSegmentDownloads_(e){const n=this.playlistController_,r=n[`${e}SegmentLoader_`],i=r.buffered_(),a=Age(this[`${e}Buffered_`],i);if(this[`${e}Buffered_`]=i,a){this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:r.playlist_&&r.playlist_.id,buffered:m1(i)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&n.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),n=this.tech_.buffered();if(this.lastRecordedTime===e&&(!n.length||e+Cu>=n.end(n.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const n=this.seekable(),r=this.tech_.currentTime(),i=this.afterSeekableWindow_(n,r,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let a;if(i&&(a=n.end(n.length-1)),this.beforeSeekableWindow_(n,r)){const g=n.start(0);a=g+(g===n.end(0)?0:Cu)}if(typeof a<"u")return this.logger_(`Trying to seek outside of seekable at time ${r} with seekable range ${wL(n)}. Seeking to ${a}.`),this.tech_.setCurrentTime(a),!0;const s=this.playlistController_.sourceUpdater_,l=this.tech_.buffered(),c=s.audioBuffer?s.audioBuffered():null,u=s.videoBuffer?s.videoBuffered():null,d=this.media(),f=d.partTargetDuration?d.partTargetDuration:(d.targetDuration-xu)*2,h=[c,u];for(let g=0;g<h.length;g++){if(!h[g])continue;if(mA(h[g],r)<f)return!1}const m=uv(l,r);return m.length===0?!1:(a=m.start(0)+Cu,this.logger_(`Buffered region starts (${m.start(0)}) just beyond seek point (${r}). Seeking to ${a}.`),this.tech_.setCurrentTime(a),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),n=this.tech_.buffered(),r=rh(n,e);if(r.length&&e+3<=r.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${r.start(0)} -> ${r.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),n=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,n)){const l=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${n}. Seeking to live point (seekable end) ${l}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(l),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,i=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:r.audioBuffered(),videoBuffered:r.videoBuffered(),currentTime:n}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(n),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const s=uv(i,n);return s.length>0?(this.logger_(`Stopped at ${n} and seeking to ${s.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(n),!0):!1}afterSeekableWindow_(e,n,r,i=!1){if(!e.length)return!1;let a=e.end(e.length-1)+Cu;const s=!r.endList,l=typeof r.partTargetDuration=="number";return s&&(l||i)&&(a=e.end(e.length-1)+r.targetDuration*3),n>a}beforeSeekableWindow_(e,n){return!!(e.length&&e.start(0)>0&&n<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:n,currentTime:r}){if(!e)return;let i;if(e.length&&n.length){const a=rh(e,r-3),s=rh(e,r),l=rh(n,r);l.length&&!s.length&&a.length&&(i={start:a.end(0),end:l.end(0)})}else uv(e,r).length||(i=this.gapFromVideoUnderflow_(e,r));return i?(this.logger_(`Encountered a gap in video from ${i.start} to ${i.end}. Seeking to current time ${r}`),!0):!1}skipTheGap_(e){const n=this.tech_.buffered(),r=this.tech_.currentTime(),i=uv(n,r);this.resetTimeUpdate_(),!(i.length===0||r!==e)&&(this.logger_("skipTheGap_:","currentTime:",r,"scheduled currentTime:",e,"nextRange start:",i.start(0)),this.tech_.setCurrentTime(i.start(0)+xu),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}))}gapFromVideoUnderflow_(e,n){const r=vge(e);for(let i=0;i<r.length;i++){const a=r.start(i),s=r.end(i);if(n-a<4&&n-a>2)return{start:a,end:s}}return null}}const D3e={errorInterval:30,getSource(t){const n=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return t(n)}},OB=function(t,e){let n=0,r=0;const i=Gi(D3e,e);t.ready(()=>{t.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const a=function(){r&&t.currentTime(r)},s=function(d){d!=null&&(r=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",a),t.src(d),t.trigger({type:"usage",name:"vhs-error-reload"}),t.play())},l=function(){if(Date.now()-n<i.errorInterval*1e3){t.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!i.getSource||typeof i.getSource!="function"){Nt.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return n=Date.now(),i.getSource.call(t,s)},c=function(){t.off("loadedmetadata",a),t.off("error",l),t.off("dispose",c)},u=function(d){c(),OB(t,d)};t.on("error",l),t.on("dispose",c),t.reloadSourceOnError=u},O3e=function(t){OB(this,t)};var NB="3.12.1",N3e="7.0.3",F3e="1.3.0",k3e="7.1.0",P3e="4.0.1";const Va={PlaylistLoader:sh,Playlist:Zo,utils:$ge,STANDARD_PLAYLIST_SELECTOR:uB,INITIAL_PLAYLIST_SELECTOR:Dme,lastBandwidthSelector:uB,movingAverageBandwidthSelector:Ime,comparePlaylistBandwidth:NA,comparePlaylistResolution:Eme,xhr:UL()};Object.keys(ks).forEach(t=>{Object.defineProperty(Va,t,{get(){return Nt.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),ks[t]},set(e){if(Nt.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){Nt.log.warn(`value of Vhs.${t} must be greater than or equal to 0`);return}ks[t]=e}})});const FB="videojs-vhs",kB=function(t,e){const n=e.media();let r=-1;for(let i=0;i<t.length;i++)if(t[i].id===n.id){r=i;break}t.selectedIndex_=r,t.trigger({selectedIndex:r,type:"change"})},M3e=function(t,e){e.representations().forEach(n=>{t.addQualityLevel(n)}),kB(t,e.playlists)};Va.canPlaySource=function(){return Nt.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const L3e=(t,e,n)=>{if(!t)return t;let r={};e&&e.attributes&&e.attributes.CODECS&&(r=hv(gu(e.attributes.CODECS))),n&&n.attributes&&n.attributes.CODECS&&(r.audio=n.attributes.CODECS);const i=O2(r.video),a=O2(r.audio),s={};for(const l in t)s[l]={},a&&(s[l].audioContentType=a),i&&(s[l].videoContentType=i),e.contentProtection&&e.contentProtection[l]&&e.contentProtection[l].pssh&&(s[l].pssh=e.contentProtection[l].pssh),typeof t[l]=="string"&&(s[l].url=t[l]);return Gi(t,s)},B3e=(t,e)=>t.reduce((n,r)=>{if(!r.contentProtection)return n;const i=e.reduce((a,s)=>{const l=r.contentProtection[s];return l&&l.pssh&&(a[s]={pssh:l.pssh}),a},{});return Object.keys(i).length&&n.push(i),n},[]),V3e=({player:t,sourceKeySystems:e,audioMedia:n,mainPlaylists:r})=>{if(!t.eme.initializeMediaKeys)return Promise.resolve();const i=n?r.concat([n]):r,a=B3e(i,Object.keys(e)),s=[],l=[];return a.forEach(c=>{l.push(new Promise((u,d)=>{t.tech_.one("keysessioncreated",u)})),s.push(new Promise((u,d)=>{t.eme.initializeMediaKeys({keySystems:c},f=>{if(f){d(f);return}u()})}))}),Promise.race([Promise.all(s),Promise.race(l)])},U3e=({player:t,sourceKeySystems:e,media:n,audioMedia:r})=>{const i=L3e(e,n,r);return i?(t.currentSource().keySystems=i,i&&!t.eme?(Nt.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},PB=()=>{if(!Ge.localStorage)return null;const t=Ge.localStorage.getItem(FB);if(!t)return null;try{return JSON.parse(t)}catch{return null}},q3e=t=>{if(!Ge.localStorage)return!1;let e=PB();e=e?Gi(e,t):t;try{Ge.localStorage.setItem(FB,JSON.stringify(e))}catch{return!1}return e},j3e=t=>t.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(t.substring(t.indexOf(",")+1)):t,MB=(t,e)=>{t._requestCallbackSet||(t._requestCallbackSet=new Set),t._requestCallbackSet.add(e)},LB=(t,e)=>{t._responseCallbackSet||(t._responseCallbackSet=new Set),t._responseCallbackSet.add(e)},BB=(t,e)=>{t._requestCallbackSet&&(t._requestCallbackSet.delete(e),t._requestCallbackSet.size||delete t._requestCallbackSet)},VB=(t,e)=>{t._responseCallbackSet&&(t._responseCallbackSet.delete(e),t._responseCallbackSet.size||delete t._responseCallbackSet)};Va.supportsNativeHls=function(){if(!Sn||!Sn.createElement)return!1;const t=Sn.createElement("video");return Nt.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(n){return/maybe|probably/i.test(t.canPlayType(n))}):!1}(),Va.supportsNativeDash=function(){return!Sn||!Sn.createElement||!Nt.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(Sn.createElement("video").canPlayType("application/dash+xml"))}(),Va.supportsTypeNatively=t=>t==="hls"?Va.supportsNativeHls:t==="dash"?Va.supportsNativeDash:!1,Va.isSupported=function(){return Nt.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},Va.xhr.onRequest=function(t){MB(Va.xhr,t)},Va.xhr.onResponse=function(t){LB(Va.xhr,t)},Va.xhr.offRequest=function(t){BB(Va.xhr,t)},Va.xhr.offResponse=function(t){VB(Va.xhr,t)};const $3e=Nt.getComponent("Component");class UB extends $3e{constructor(e,n,r){if(super(n,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=Ql("VhsHandler"),n.options_&&n.options_.playerId){const i=Nt.getPlayer(n.options_.playerId);this.player_=i}if(this.tech_=n,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&n.overrideNativeAudioTracks&&n.overrideNativeVideoTracks)n.overrideNativeAudioTracks(!0),n.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(n.featuresNativeVideoTracks||n.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(Sn,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],i=>{const a=Sn.fullscreenElement||Sn.webkitFullscreenElement||Sn.mozFullScreenElement||Sn.msFullscreenElement;a&&a.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=Gi(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const r=PB();r&&r.bandwidth&&(this.options_.bandwidth=r.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),r&&r.throughput&&(this.options_.throughput=r.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=ks.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===ks.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(r=>{typeof this.source_[r]<"u"&&(this.options_[r]=this.source_[r])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;const n=this.options_.customPixelRatio;typeof n=="number"&&n>=0&&(this.customPixelRatio=n)}setOptions(e={}){this.setOptions_(e)}src(e,n){if(!e)return;this.setOptions_(),this.options_.src=j3e(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Va,this.options_.sourceType=yk(n),this.options_.seekTo=a=>{this.tech_.setCurrentTime(a)},this.playlistController_=new C3e(this.options_);const r=Gi({liveRangeSafeTimeDelta:Cu},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new _3e(r),this.playlistController_.on("error",()=>{const a=Nt.players[this.tech_.options_.playerId];let s=this.playlistController_.error;typeof s=="object"&&!s.code?s.code=3:typeof s=="string"&&(s={message:s,code:3}),a.error(s)});const i=this.options_.bufferBasedABR?Va.movingAverageBandwidthSelector(.55):Va.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):i.bind(this),this.playlistController_.selectInitialPlaylist=Va.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(a){this.playlistController_.selectPlaylist=a.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(a){this.playlistController_.mainSegmentLoader_.throughput.rate=a,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let a=this.playlistController_.mainSegmentLoader_.bandwidth;const s=Ge.navigator.connection||Ge.navigator.mozConnection||Ge.navigator.webkitConnection,l=1e7;if(this.options_.useNetworkInformationApi&&s){const c=s.downlink*1e3*1e3;c>=l&&a>=l?a=Math.max(a,c):a=c}return a},set(a){this.playlistController_.mainSegmentLoader_.bandwidth=a,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const a=1/(this.bandwidth||1);let s;return this.throughput>0?s=1/this.throughput:s=0,Math.floor(1/(a+s))},set(){Nt.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>m1(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>m1(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&q3e({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{I3e(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=Ge.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),V3e({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(n=>{this.logger_("error while creating EME key session",n),this.player_.error({message:"Failed to initialize media keys for EME",code:3,metadata:{errorType:Nt.Error.EMEKeySessionCreationError}})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,n=U3e({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",r=>{this.playlistController_.updatePlaylistByKeyStatus(r.keyId,r.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!n){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=Nt.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{M3e(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{kB(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":NB,"mux.js":N3e,"mpd-parser":F3e,"m3u8-parser":k3e,"aes-decrypter":P3e}}version(){return this.constructor.version()}canChangeType(){return wB.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&Ge.URL.revokeObjectURL&&(Ge.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,n){return Gge({playlist:this.playlistController_.media(),time:e,callback:n})}seekToProgramTime(e,n,r=!0,i=2){return zL({programTime:e,playlist:this.playlistController_.media(),retryCount:i,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:n})}setupXhrHooks_(){this.xhr.onRequest=e=>{MB(this.xhr,e)},this.xhr.onResponse=e=>{LB(this.xhr,e)},this.xhr.offRequest=e=>{BB(this.xhr,e)},this.xhr.offResponse=e=>{VB(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const bv={name:"videojs-http-streaming",VERSION:NB,canHandleSource(t,e={}){const n=Gi(Nt.options,e);return bv.canPlayType(t.type,n)},handleSource(t,e,n={}){const r=Gi(Nt.options,n);return e.vhs=new UB(t,e,r),e.vhs.xhr=UL(),e.vhs.setupXhrHooks_(),e.vhs.src(t.src,t.type),e.vhs},canPlayType(t,e){const n=yk(t);if(!n)return"";const r=bv.getOverrideNative(e);return!Va.supportsTypeNatively(n)||r?"maybe":""},getOverrideNative(t={}){const{vhs:e={}}=t,n=!(Nt.browser.IS_ANY_SAFARI||Nt.browser.IS_IOS),{overrideNative:r=n}=e;return r}};v4("avc1.4d400d,mp4a.40.2")&&Nt.getTech("Html5").registerSourceHandler(bv,0),Nt.VhsHandler=UB,Nt.VhsSourceHandler=bv,Nt.Vhs=Va,Nt.use||Nt.registerComponent("Vhs",Va),Nt.options.vhs=Nt.options.vhs||{},(!Nt.getPlugin||!Nt.getPlugin("reloadSourceOnError"))&&Nt.registerPlugin("reloadSourceOnError",O3e);const H3e=t=>{const{userTrainingSaveData:e,updateUserTraining:n}=Pr(),r=N.useRef(null),i=N.useRef(null),{options:a,onReady:s,currentItem:l}=t,[c,u]=N.useState(!1),d=m=>{if(e!==null){const g=e==null?void 0:e.findIndex(v=>(v==null?void 0:v.fieldId)===(l==null?void 0:l.uuid));if(g>=0){const v=m.target;e[g].seenTime=v.currentTime}}},f=m=>{const g=[...e],v=g==null?void 0:g.findIndex(A=>(A==null?void 0:A.fieldId)===(m==null?void 0:m.uuid));v>=0&&(g[v]={...e[v],isSeen:!0},n(g),h("Ended"))};N.useEffect(()=>{if(i.current){const m=i.current;m.autoplay(a.autoplay),m.src(a.sources)}else{const m=r.current;if(!m)return;const g=i.current=Nt(m,a,()=>{Nt.log("player is ready"),s&&s(g)})}},[a,r]);const h=m=>{const g=i.current,v=e!==null?e.findIndex(A=>(A==null?void 0:A.fieldId)===(l==null?void 0:l.uuid)):-1;v>=0&&e[v].logs.push({action:m,videoTime:e[v].seenTime,totalTime:g.duration(),timeState:new Date}),n(e)};return N.useEffect(()=>{if(!c&&e!==null){const m=e.findIndex(g=>(g==null?void 0:g.fieldId)===(l==null?void 0:l.uuid));m>=0&&(u(!0),i.current.currentTime(e[m].seenTime))}},[e]),N.useEffect(()=>{const m=i.current;return()=>{m&&(m.dispose(),i.current=null)}},[i]),o.jsx("div",{"data-vjs-player":!0,children:o.jsx("video",{onPause:()=>{h("Pause")},onPlay:()=>{h("Play")},onEnded:()=>{f(l)},onTimeUpdate:d,ref:r,className:"video-js vjs-big-play-centered"})})},z3e=t=>{var x,S,E;const{field:e}=t,n=N.useRef(null),{userSelectedLanguage:r}=ln(),{isPreview:i}=tn(),a=C=>{n.current=C,C.on("waiting",()=>{Nt.log("player is waiting")}),C.on("dispose",()=>{Nt.log("player will dispose")})},[s,l]=N.useState(!1),[c,u]=N.useState(!1),d=()=>{u(!0)},f=()=>{u(!1)},h=C=>{l(C)},m=()=>{l(!1)},g=N.useCallback(C=>o.jsx(H3e,{options:{autoplay:!1,controls:!0,responsive:!0,fluid:!0,sources:[{src:C}]},currentItem:e,onReady:a,onUpdate:()=>{}}),[e==null?void 0:e.media_file_id]),v=C=>{N.useEffect(()=>{T()},[]);const[_]=N.useState(""),T=()=>{};return o.jsxs(o.Fragment,{children:[" ",o.jsx("video",{src:_,width:"100%",controls:!0})]})},A=N.useCallback(C=>o.jsx(v,{mediaId:C}),[e==null?void 0:e.media_file_id]),w=o.jsxs("div",{onMouseOver:d,onMouseOut:f,children:[!i&&c&&o.jsx(Hr,{handleFieldSettingsSidebar:h,...t}),o.jsx("div",{className:i?"py-4 px-2":"field-form-builder py-4 px-2",children:o.jsx("div",{className:"field",children:o.jsx("div",{className:"grid",children:o.jsx("div",{className:"col-12",children:o.jsxs("div",{className:"mt-3",children:[o.jsxs("label",{className:"flex font-medium mb-3 text-700 text-2xl",children:[" ",(x=e==null?void 0:e.title)==null?void 0:x[r==null?void 0:r.type]," -"," ",e==null?void 0:e.videoDuration]}),(e==null?void 0:e.isExternalSource)===!0&&o.jsx(o.Fragment,{children:(e==null?void 0:e.media_url)&&g((S=e==null?void 0:e.media_url)==null?void 0:S[r==null?void 0:r.type])}),(e==null?void 0:e.isExternalSource)===!1?(e==null?void 0:e.media_file_id)!==void 0&&(e==null?void 0:e.media_file_id)!==null?o.jsx(o.Fragment,{children:A(e==null?void 0:e.media_file_id)}):o.jsx(o.Fragment,{children:(e==null?void 0:e.media_url)&&g((E=e==null?void 0:e.media_url)==null?void 0:E[r==null?void 0:r.type])}):o.jsx(o.Fragment,{})]})})})})})]});return console.log("fieldSettingsSidebar ",s),o.jsxs(o.Fragment,{children:[o.jsx(K1e,{visibilty:s,closeSettingFieldSidebar:m,...t}),o.jsx(wi,{...t,fieldWrap:w})]})},Y3e=t=>{const{isPreview:e}=tn(),[n,r]=N.useState(!1),i=()=>{r(!0)},a=()=>{r(!1)},s=o.jsxs("div",{onMouseOver:i,onMouseOut:a,children:[!e&&n&&o.jsx(Hr,{handleFieldSettingsSidebar:()=>{},...t}),o.jsx("div",{className:e?"":"field-form-builder",children:o.jsx("div",{className:"grid",children:o.jsx("div",{className:"col-12",children:o.jsx("div",{className:"hr-divider"})})})})]});return o.jsx(o.Fragment,{children:o.jsx(wi,{...t,fieldWrap:s})})},K3e=t=>{var Y,pe,ie,J,Q,oe,ye,Te,Ae,be,we;const{isPreview:e,isAdmin:n,isRenderView:r}=tn(),{field:i,fieldIndex:a,row:s}=t,{task_status:l,taskRegisterData:c,updateTaskRegisterData:u,updateTaskProgressValue:d,userTaskSubmitFormData:f,updateUserFormDataSubmit:h,TASK_PUBLISHED:m}=Pr(),{userSelectedLanguage:g}=ln(),[v,A]=N.useState(!1),[w,x]=N.useState(""),[S,E]=N.useState(0),[C,_]=N.useState(!1),[T,O]=N.useState(!1),F=()=>{O(!0)},B=()=>{O(!1)},M=re=>new Date(re),z=()=>{var re,U,Z;if(s!=null&&s.rowIsRepeatable){if(s!=null&&s.repeatableFields){const K=[...s.repeatableFields],he=Et.findIndex(K,function(_e){return _e.uuid===(i==null?void 0:i.uuid)});he>=0&&K[he].fieldData?x(K[he].fieldData):x("")}}else{const K=f;if(K!=null&&K.length){for(const he of K)if(he.fieldId===t.field.uuid&&((re=he==null?void 0:he.postData[0])==null?void 0:re.postValue)!==""&&((U=he==null?void 0:he.postData[0])!=null&&U.postValue)){x(M((Z=he==null?void 0:he.postData[0])==null?void 0:Z.postValue));break}}}_(!0)};N.useEffect(()=>{C||z();const re=Rt.addListener("clearRepeatableFields",he=>{he===(s==null?void 0:s.uuid)&&(x(""),E(0),i.isValid=0)}),U=Rt.addListener("onSubmitUserForm",()=>{var he;(he=i==null?void 0:i.attributes)!=null&&he.required?w?i.isValid=1:i.isValid=0:i.isValid=1}),Z=Rt.addListener("OnInvalidFieldCatch",he=>{i.uuid===(he==null?void 0:he.fieldId)?E(1):E(0)}),K=Rt.addListener("OnGetFieldValue",he=>{var ge;const _e=(ge=he==null?void 0:he.repeatableColumn)==null?void 0:ge.filter(ve=>(ve==null?void 0:ve.fieldUuid)===(i==null?void 0:i.uuid));_e!=null&&_e.length});return()=>{U.remove(),Z.remove(),re.remove(),K.remove()}});const P=re=>{A(re)},H=()=>{A(!1)},de=re=>{var K,he;x(re.target.value);const U=f,Z=Et.cloneDeep(c);if(U!==null){if((K=re==null?void 0:re.target)!=null&&K.value){if(Z[i==null?void 0:i.uuid]=(he=re==null?void 0:re.target)==null?void 0:he.value,(U==null?void 0:U.length)>0)for(const _e of U)_e.fieldId===t.field.uuid&&(_e.postData[0]={postValue:re.target.value})}else if(delete Z[i==null?void 0:i.uuid],(U==null?void 0:U.length)>0)for(const _e of U)_e.fieldId===t.field.uuid&&(_e.postData[0]={postValue:""})}if(!(s!=null&&s.rowIsRepeatable)){u(Z);const _e=Object.keys(Z).length;d(_e)}},fe=(re,U)=>{var Z;if(x(U),(f==null?void 0:f.length)>0){const K=[...f],he=Et.findIndex(K,function(ge){return ge.rowId===(s==null?void 0:s.uuid)});let _e=(Z=f[he])==null?void 0:Z.repeatableFields;_e={..._e,[re.uuid]:U},K[he]={...K[he],repeatableFields:_e},h(K),U!==""?re.isValid=1:re.isValid=0}},ne=new Date(i==null?void 0:i.minDate),W=new Date(i==null?void 0:i.maxDate),ae=o.jsxs("div",{onMouseOver:F,onMouseOut:B,children:[!r&&!e&&T&&o.jsx(Hr,{type:"",handleFieldSettingsSidebar:P,...t}),o.jsxs("div",{className:`field ${e?" ":" builder-element-wrapper "}${(i==null?void 0:i.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:[o.jsx("div",{className:"grid",children:o.jsxs("div",{className:"col-12 ",children:[(i==null?void 0:i.showHeaderText)&&o.jsx("h6",{children:(Y=i==null?void 0:i.headerText)==null?void 0:Y[g==null?void 0:g.type]}),(i==null?void 0:i.showLabel)&&o.jsxs("label",{htmlFor:a,className:"flex font-medium mb-3 text-700 text-2xl",children:[o.jsx(sa,{update:function(){throw new Error("Function not implemented.")},value:{fieldId:void 0,uuid:void 0},...t}),((pe=i==null?void 0:i.attributes)==null?void 0:pe.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",e?o.jsx(o.Fragment,{children:(ie=i==null?void 0:i.label)==null?void 0:ie[g==null?void 0:g.type]}):o.jsx(ea,{...t}),(i==null?void 0:i.showToolTip)&&o.jsx("span",{className:"ml-3",children:(i==null?void 0:i.showToolTip)&&o.jsx(Vi,{message:(J=i==null?void 0:i.toolTip)==null?void 0:J[g==null?void 0:g.type],position:"right"})})]}),o.jsxs("div",{className:"mt-3",children:[o.jsxs("span",{className:"p-input-icon-"+(i==null?void 0:i.iconAlignment),children:[(i==null?void 0:i.showIcon)&&o.jsx("i",{className:"pi pi-"+((oe=(Q=i==null?void 0:i.icon)==null?void 0:Q.properties)==null?void 0:oe.name)}),o.jsx(W1,{readOnlyInput:!0,numberOfMonths:i==null?void 0:i.noOfMonths,selectionMode:(i==null?void 0:i.dateRange)||"single",view:(i==null?void 0:i.calenderView)||!1,showButtonBar:(i==null?void 0:i.isTodayBtn)||!1,showIcon:(i==null?void 0:i.isIcon)||!1,id:i==null?void 0:i.uuid,dateFormat:i==null?void 0:i.dateFormat,placeholder:(ye=i==null?void 0:i.placeholder)==null?void 0:ye[g==null?void 0:g.type],value:w,onFocus:()=>E(1),onChange:re=>{s!=null&&s.rowIsRepeatable?fe(i,re.target.value):de(re)},minDate:ne,maxDate:W,className:S===1&&((Te=i==null?void 0:i.attributes)!=null&&Te.required)?w?"valid":"invalid":"valid'",disabled:l===m})]}),o.jsx("div",{children:((Ae=i==null?void 0:i.attributes)==null?void 0:Ae.required)&&o.jsx("small",{className:"error",children:S===1&&!w?(be=i==null?void 0:i.validationMesssage)==null?void 0:be.english:""})}),o.jsx("div",{children:(i==null?void 0:i.showHelperText)&&o.jsx("small",{children:(we=i==null?void 0:i.helperText)==null?void 0:we[g==null?void 0:g.type]})})]})]})}),n&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(Fi,{...t})]})]})]});return o.jsxs(o.Fragment,{children:[v===!0&&o.jsx(Ri,{visibilty:v,closeSettingFieldSidebar:H,...t},i==null?void 0:i.uuid),o.jsx(wi,{...t,fieldWrap:ae})]})},X3e=t=>{var ye,Te,Ae,be,we,re,U,Z;const e=N.useRef(null),{task_status:n,taskRegisterData:r,updateTaskRegisterData:i,updateTaskProgressValue:a,updateUserFormDataSubmit:s,userTaskSubmitFormData:l,onSetValuetoPostDataHook:c,TASK_PUBLISHED:u}=Pr(),{userSelectedLanguage:d,fieldSettingUpdate:f}=ln(),{field:h,fieldIndex:m,columnIndex:g,sectionIndex:v,rowIndex:A,pageIndex:w,row:x}=t,{isAdmin:S,isPreview:E,isRenderView:C}=tn(),[_,T]=N.useState(!1),[O,F]=N.useState(0),[B,M]=N.useState(!1),[z,P]=N.useState(null),[H,de]=N.useState(!1),fe=()=>{de(!0)},ne=()=>{de(!1)},W=()=>{var K;(K=e==null?void 0:e.current)==null||K.clear(),h.isValid=0,f(w,v,A,g,m,h),P(null),c(t,h,"")},ae=()=>{var he,_e,ge;const K=l;if((K==null?void 0:K.length)>0)for(const ve of K)ve.fieldId===t.field.uuid&&((he=ve==null?void 0:ve.postData[0])!=null&&he.postValue&&((_e=ve==null?void 0:ve.postData[0])==null?void 0:_e.postValue)!==""&&(P((ge=ve==null?void 0:ve.postData[0])==null?void 0:ge.postValue),M(!0)),h.isValid=1);M(!0)},Y=()=>{var K,he,_e,ge;if(l!=null&&l.length){const ve=[...l],Le=Et.findIndex(ve,function(me){return me.rowId===(x==null?void 0:x.uuid)});let Ne=(K=l[Le])==null?void 0:K.repeatableFields;Ne={...Ne,[h==null?void 0:h.uuid]:`<img src="${(he=e.current)==null?void 0:he.toDataURL()}" >`},ve[Le]={...ve[Le],repeatableFields:Ne},s(ve)}P(((_e=e.current)==null?void 0:_e.toDataURL())||""),((ge=e.current)==null?void 0:ge.toDataURL())!==""?h.isValid=1:h.isValid=0};N.useEffect(()=>{B||ae();const K=Rt.addListener("clearRepeatableFields",ve=>{ve===(x==null?void 0:x.uuid)&&(P(null),W(),F(0),h.isValid=0,f(w,v,A,g,m,h))}),he=Rt.addListener("onSubmitUserForm",()=>{var ve;(ve=h==null?void 0:h.attributes)!=null&&ve.required?(z!==null?h.isValid=1:h.isValid=0,f(w,v,A,g,m,h)):h.isValid=1}),_e=Rt.addListener("OnInvalidFieldCatch",ve=>{h.uuid===(ve==null?void 0:ve.fieldId)?F(1):F(0)}),ge=Rt.addListener("OnSignatureSettingChange",()=>{W()});return()=>{he.remove(),_e.remove(),ge.remove(),K.remove()}});const pe=K=>{T(K)},ie=()=>{T(!1)},J=()=>{var he,_e,ge,ve;const K=l;if(l!=null&&l.length){const Le=Et.cloneDeep(r);if(Le[h==null?void 0:h.uuid]=(he=e.current)==null?void 0:he.toDataURL(),(K==null?void 0:K.length)>0){for(const Ne of K)if(Ne.fieldId===t.field.uuid){Ne.postData[0]={postValue:(_e=e.current)==null?void 0:_e.toDataURL()},P(((ge=e.current)==null?void 0:ge.toDataURL())||null);break}}if(!(x!=null&&x.rowIsRepeatable)){i(Le);const Ne=(ve=Object.keys(Le))==null?void 0:ve.length;a(Ne)}}},Q=()=>{var K,he,_e;return`rgba(${(K=h==null?void 0:h.backgroundColor)==null?void 0:K.r}, ${(he=h==null?void 0:h.backgroundColor)==null?void 0:he.g}, ${(_e=h==null?void 0:h.backgroundColor)==null?void 0:_e.b}, 0.8)`},oe=o.jsxs("div",{onMouseOver:fe,onMouseOut:ne,children:[!C&&!E&&H&&o.jsx(Hr,{handleFieldSettingsSidebar:pe,...t}),o.jsx("div",{className:`field ${E?" ":" builder-element-wrapper "}${(h==null?void 0:h.isFluid)===!0?" card py-3 px-4 p-fluid":"card py-3 px-4"}`,children:o.jsxs("div",{className:"grid",children:[o.jsxs("div",{className:E?"col-12":"col-11",children:[(h==null?void 0:h.showHeaderText)&&o.jsx("h6",{children:(ye=h==null?void 0:h.headerText)==null?void 0:ye[d==null?void 0:d.type]}),(h==null?void 0:h.showLabel)&&o.jsxs("label",{htmlFor:h.uuid,className:"flex font-medium mb-3 text-700 text-2xl",children:[o.jsx(sa,{...t}),((Te=h==null?void 0:h.attributes)==null?void 0:Te.required)&&o.jsx("span",{className:"must-required mr-1",children:"*"})," ",E?o.jsx(o.Fragment,{children:(Ae=h==null?void 0:h.label)==null?void 0:Ae[d==null?void 0:d.type]}):o.jsx(ea,{...t}),o.jsx("span",{className:"ml-3",children:(h==null?void 0:h.showToolTip)&&o.jsx(Vi,{message:(be=h==null?void 0:h.toolTip)==null?void 0:be[d==null?void 0:d.type],position:"right"})})]}),o.jsxs("div",{className:"mt-3",children:[n!==u&&z===null&&o.jsx(fE,{backgroundColor:Q(),penColor:`#${h==null?void 0:h.penColor}`,canvasProps:{width:`${h==null?void 0:h.canvasWidth}`,height:h==null?void 0:h.canvasHeight,className:"sigCanvas"},ref:e,onEnd:()=>{x!=null&&x.rowIsRepeatable?Y():J()}},h==null?void 0:h.uuid),n===u&&z!==null&&o.jsx("img",{alt:"",src:z,style:{width:350,height:200}}),n!==6&&z!==null&&o.jsx("img",{alt:"",src:z,style:{width:350,height:200}}),o.jsx("div",{children:((we=h==null?void 0:h.attributes)==null?void 0:we.required)&&o.jsx("small",{className:"error",children:O===1&&!z?(re=h==null?void 0:h.validationMesssage)==null?void 0:re.english:""})}),o.jsx("div",{className:"mt-3",children:(h==null?void 0:h.showHelperText)&&o.jsx("small",{children:(U=h==null?void 0:h.helperText)==null?void 0:U[d==null?void 0:d.type]})}),n!==u&&o.jsx(kt,{text:!0,label:(Z=h==null?void 0:h.clearSignatureButtonLabel)==null?void 0:Z[d==null?void 0:d.type],onClick:()=>W(),className:"p-button-raised p-button-text mt-3"})]})]}),S&&o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),o.jsx(Fi,{...t})]})]})})]});return o.jsxs(o.Fragment,{children:[_===!0&&o.jsx(Ri,{visibilty:_,closeSettingFieldSidebar:ie,...t}),o.jsx(wi,{...t,fieldWrap:oe})]})};function ug(){return ug=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ug.apply(this,arguments)}function dg(t){"@babel/helpers - typeof";return dg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dg(t)}function R3e(t,e){if(dg(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(dg(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function G3e(t){var e=R3e(t,"string");return dg(e)==="symbol"?e:String(e)}function BA(t,e,n){return e=G3e(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function W3e(t){if(Array.isArray(t))return t}function Q3e(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,s,l=[],c=!0,u=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return l}}function VA(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function qB(t,e){if(t){if(typeof t=="string")return VA(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return VA(t,e)}}function J3e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3709
3709
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v1(t,e){return W3e(t)||Q3e(t,e)||qB(t,e)||J3e()}var Z3e={header:"p-galleria-header",footer:"p-galleria-footer",closeIcon:"p-galleria-close-icon",closeButton:"p-galleria-close p-link",root:function(e){var n=e.props,r=e.context,i=e.thumbnailsPosClassName,a=e.indicatorPosClassName;return pt("p-galleria p-component",{"p-galleria-fullscreen":n.fullScreen,"p-galleria-indicator-onitem":n.showIndicatorsOnItem,"p-galleria-item-nav-onhover":n.showItemNavigatorsOnHover&&!n.fullScreen,"p-input-filled":r&&r.inputStyle==="filled"||qn.inputStyle==="filled","p-ripple-disabled":r&&r.ripple===!1||qn.ripple===!1},i,a)},content:"p-galleria-content",mask:function(e){var n=e.visibleState;return pt("p-galleria-mask",{"p-galleria-visible":n})},thumbnailItem:function(e){var n=e.subProps;return pt("p-galleria-thumbnail-item",{"p-galleria-thumbnail-item-current":n.current,"p-galleria-thumbnail-item-active":n.active,"p-galleria-thumbnail-item-start":n.start,"p-galleria-thumbnail-item-end":n.end})},thumbnailItemContent:"p-galleria-thumbnail-item-content",previousThumbnailIcon:"p-galleria-thumbnail-prev-icon",previousThumbnailButton:function(e){var n=e.isDisabled;return pt("p-galleria-thumbnail-prev p-link",{"p-disabled":n})},nextThumbnailIcon:"p-galleria-thumbnail-next-icon",nextThumbnailButton:function(e){var n=e.isDisabled;return pt("p-galleria-thumbnail-next p-link",{"p-disabled":n})},thumbnailContainer:"p-galleria-thumbnail-container",thumbnailItemsContainer:"p-galleria-thumbnail-items-container",thumbnailItems:"p-galleria-thumbnail-items",thumbnailWrapper:"p-galleria-thumbnail-wrapper",previousItemIcon:"p-galleria-item-prev-icon",previousItemButton:function(e){var n=e.isDisabled;return pt("p-galleria-item-prev p-galleria-item-nav p-link",{"p-disabled":n})},nextItemIcon:"p-galleria-item-next-icon",nextItemButton:function(e){var n=e.isDisabled;return pt("p-galleria-item-next p-galleria-item-nav p-link",{"p-disabled":n})},caption:"p-galleria-caption",indicator:function(e){var n=e.isActive;return pt("p-galleria-indicator",{"p-highlight":n})},indicators:"p-galleria-indicators p-reset",itemWrapper:"p-galleria-item-wrapper",itemContainer:"p-galleria-item-container",item:"p-galleria-item",transition:"p-galleria"},e4e=`
3710
3710
  @layer primereact {
3711
3711
  .p-galleria-content {
@@ -58728,7 +58728,7 @@ const Li = (t) => {
58728
58728
  label: "Advance Settings",
58729
58729
  icon: "pi pi-cog",
58730
58730
  onClick: () => {
58731
- u(!0);
58731
+ console.log("opening sidebar"), console.log("handleFieldSettingsSidebar", u), u(!0);
58732
58732
  },
58733
58733
  className: "mr-3"
58734
58734
  }
@@ -61931,7 +61931,7 @@ var che = function() {
61931
61931
  theme: i.theme,
61932
61932
  formats: i.formats
61933
61933
  };
61934
- che ? C(new Quill(d.current, M)) : import("./quill-CV81oHmt.js").then(function(z) {
61934
+ che ? C(new Quill(d.current, M)) : import("./quill-DT4n1x1U.js").then(function(z) {
61935
61935
  if (z && Te.isExist(d.current)) {
61936
61936
  var k;
61937
61937
  z.default ? k = new z.default(d.current, M) : k = new z(d.current, M), C(k);
@@ -100916,7 +100916,7 @@ const Z5e = (t) => {
100916
100916
  }
100917
100917
  )
100918
100918
  ] });
100919
- return /* @__PURE__ */ I(Ie, { children: [
100919
+ return console.log("fieldSettingsSidebar ", s), /* @__PURE__ */ I(Ie, { children: [
100920
100920
  /* @__PURE__ */ c(
100921
100921
  Khe,
100922
100922
  {
@@ -1,7 +1,7 @@
1
1
  var Ml = Object.defineProperty;
2
2
  var Dl = (n, t, e) => t in n ? Ml(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
3
  var T = (n, t, e) => (Dl(n, typeof t != "symbol" ? t + "" : t, e), e);
4
- import { d as ti, i as Rr, a as Hi, b as Ul, e as Br, M as Pl, S as ei, U as si, g as ni, c as ri, f as fr, h as zs, j as $i, k as Vs, l as dr, m as jl, n as Hl, o as Fi, p as $l, q as Fl, r as zl, s as Kl, t as ii, u as Gl, v as Vl, w as Ft, x as zi, y as xe } from "./main-DezaxtIM.js";
4
+ import { d as ti, i as Rr, a as Hi, b as Ul, e as Br, M as Pl, S as ei, U as si, g as ni, c as ri, f as fr, h as zs, j as $i, k as Vs, l as dr, m as jl, n as Hl, o as Fi, p as $l, q as Fl, r as zl, s as Kl, t as ii, u as Gl, v as Vl, w as Ft, x as zi, y as xe } from "./main-yFHfZGS2.js";
5
5
  function Ki(n) {
6
6
  return n;
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cft-builder",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"