@project-sunbird/collection-editor-react 0.1.27 → 0.1.28
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.
- package/dist/api/channel.d.ts +2 -0
- package/dist/collection-editor.umd.js +44 -44
- package/dist/index.cjs +50 -50
- package/dist/index.js +3514 -3526
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Cp=Object.defineProperty;var jl=e=>{throw TypeError(e)};var Sp=(e,t,r)=>t in e?Cp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ns=(e,t,r)=>Sp(e,typeof t!="symbol"?t+"":t,r),ma=(e,t,r)=>t.has(e)||jl("Cannot "+r);var T=(e,t,r)=>(ma(e,t,"read from private field"),r?r.call(e):t.get(e)),ae=(e,t,r)=>t.has(e)?jl("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Y=(e,t,r,n)=>(ma(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ce=(e,t,r)=>(ma(e,t,"access private method"),r);var Ys=(e,t,r,n)=>({set _(s){Y(e,t,s,r)},get _(){return T(e,t,n)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react"),Br=require("react-dom"),c=require("react/jsx-runtime");function xp(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Ae=xp(m);var Ps=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Zr,Rr,In,sd,_p=(sd=class extends Ps{constructor(){super();ae(this,Zr);ae(this,Rr);ae(this,In);Y(this,In,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){T(this,Rr)||this.setEventListener(T(this,In))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,Rr))==null||t.call(this),Y(this,Rr,void 0))}setEventListener(t){var r;Y(this,In,t),(r=T(this,Rr))==null||r.call(this),Y(this,Rr,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){T(this,Zr)!==t&&(Y(this,Zr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof T(this,Zr)=="boolean"?T(this,Zr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Zr=new WeakMap,Rr=new WeakMap,In=new WeakMap,sd),Ho=new _p,Tp={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},cr,Xr,id,Ep=(id=class{constructor(){ae(this,cr,Tp);ae(this,Xr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&T(this,Xr)&&e!==T(this,cr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:T(this,cr),provider:e}),Y(this,cr,e),process.env.NODE_ENV!=="production"&&Y(this,Xr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Xr,!0),T(this,cr).setTimeout(e,t)}clearTimeout(e){T(this,cr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Xr,!0),T(this,cr).setInterval(e,t)}clearInterval(e){T(this,cr).clearInterval(e)}},cr=new WeakMap,Xr=new WeakMap,id),Wr=new Ep;function Ip(e){setTimeout(e,0)}var Op=typeof window>"u"||"Deno"in globalThis;function Dt(){}function Ap(e,t){return typeof e=="function"?e(t):e}function Ka(e){return typeof e=="number"&&e>=0&&e!==1/0}function pd(e,t){return Math.max(e+(t||0)-Date.now(),0)}function $r(e,t){return typeof e=="function"?e(t):e}function Pt(e,t){return typeof e=="function"?e(t):e}function kl(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:a,stale:o}=e;if(a){if(n){if(t.queryHash!==Qo(a,t.options))return!1}else if(!xs(t.queryKey,a))return!1}if(r!=="all"){const l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||s&&s!==t.state.fetchStatus||i&&!i(t))}function Ll(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(Ss(t.options.mutationKey)!==Ss(i))return!1}else if(!xs(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Qo(e,t){return((t==null?void 0:t.queryKeyHashFn)||Ss)(e)}function Ss(e){return JSON.stringify(e,(t,r)=>Xa(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function xs(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>xs(e[r],t[r])):!1}var Dp=Object.prototype.hasOwnProperty;function Ya(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=Pl(e)&&Pl(t);if(!n&&!(Xa(e)&&Xa(t)))return t;const i=(n?e:Object.keys(e)).length,a=n?t:Object.keys(t),o=a.length,l=n?new Array(o):{};let u=0;for(let f=0;f<o;f++){const d=n?f:a[f],g=e[d],p=t[d];if(g===p){l[d]=g,(n?f<i:Dp.call(e,d))&&u++;continue}if(g===null||p===null||typeof g!="object"||typeof p!="object"){l[d]=p;continue}const w=Ya(g,p,r+1);l[d]=w,w===g&&u++}return i===o&&u===i?e:l}function Za(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Pl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Xa(e){if(!Fl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Fl(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Fl(e){return Object.prototype.toString.call(e)==="[object Object]"}function Np(e){return new Promise(t=>{Wr.setTimeout(t,e)})}function Ja(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Ya(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return Ya(e,t)}return t}function Rp(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function jp(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Ii=Symbol();function md(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ii&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ii?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function gd(e,t){return typeof e=="function"?e(...t):!!e}function kp(e,t,r){let n=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),n||(n=!0,s.aborted?r():s.addEventListener("abort",r,{once:!0})),s)}),e}var _s=(()=>{let e=()=>Op;return{isServer(){return e()},setIsServer(t){e=t}}})();function eo(){let e,t;const r=new Promise((s,i)=>{e=s,t=i});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var Lp=Ip;function Pp(){let e=[],t=0,r=o=>{o()},n=o=>{o()},s=Lp;const i=o=>{t?e.push(o):s(()=>{r(o)})},a=()=>{const o=e;e=[],o.length&&s(()=>{n(()=>{o.forEach(l=>{r(l)})})})};return{batch:o=>{let l;t++;try{l=o()}finally{t--,t||a()}return l},batchCalls:o=>(...l)=>{i(()=>{o(...l)})},schedule:i,setNotifyFunction:o=>{r=o},setBatchNotifyFunction:o=>{n=o},setScheduler:o=>{s=o}}}var dt=Pp(),On,jr,An,ad,Fp=(ad=class extends Ps{constructor(){super();ae(this,On,!0);ae(this,jr);ae(this,An);Y(this,An,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){T(this,jr)||this.setEventListener(T(this,An))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,jr))==null||t.call(this),Y(this,jr,void 0))}setEventListener(t){var r;Y(this,An,t),(r=T(this,jr))==null||r.call(this),Y(this,jr,t(this.setOnline.bind(this)))}setOnline(t){T(this,On)!==t&&(Y(this,On,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return T(this,On)}},On=new WeakMap,jr=new WeakMap,An=new WeakMap,ad),Oi=new Fp;function Mp(e){return Math.min(1e3*2**e,3e4)}function yd(e){return(e??"online")==="online"?Oi.isOnline():!0}var to=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function vd(e){let t=!1,r=0,n;const s=eo(),i=()=>s.status!=="pending",a=h=>{var y;if(!i()){const v=new to(h);g(v),(y=e.onCancel)==null||y.call(e,v)}},o=()=>{t=!0},l=()=>{t=!1},u=()=>Ho.isFocused()&&(e.networkMode==="always"||Oi.isOnline())&&e.canRun(),f=()=>yd(e.networkMode)&&e.canRun(),d=h=>{i()||(n==null||n(),s.resolve(h))},g=h=>{i()||(n==null||n(),s.reject(h))},p=()=>new Promise(h=>{var y;n=v=>{(i()||u())&&h(v)},(y=e.onPause)==null||y.call(e)}).then(()=>{var h;n=void 0,i()||(h=e.onContinue)==null||h.call(e)}),w=()=>{if(i())return;let h;const y=r===0?e.initialPromise:void 0;try{h=y??e.fn()}catch(v){h=Promise.reject(v)}Promise.resolve(h).then(d).catch(v=>{var E;if(i())return;const b=e.retry??(_s.isServer()?0:3),C=e.retryDelay??Mp,S=typeof C=="function"?C(r,v):C,_=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,v);if(t||!_){g(v);return}r++,(E=e.onFail)==null||E.call(e,r,v),Np(S).then(()=>u()?void 0:p()).then(()=>{t?g(v):w()})})};return{promise:s,status:()=>s.status,cancel:a,continue:()=>(n==null||n(),s),cancelRetry:o,continueRetry:l,canStart:f,start:()=>(f()?w():p().then(w),s)}}var Jr,od,bd=(od=class{constructor(){ae(this,Jr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ka(this.gcTime)&&Y(this,Jr,Wr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(_s.isServer()?1/0:5*60*1e3))}clearGcTimeout(){T(this,Jr)!==void 0&&(Wr.clearTimeout(T(this,Jr)),Y(this,Jr,void 0))}},Jr=new WeakMap,od);function Bp(e){return{onFetch:(t,r)=>{var f,d,g,p,w;const n=t.options,s=(g=(d=(f=t.fetchOptions)==null?void 0:f.meta)==null?void 0:d.fetchMore)==null?void 0:g.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],a=((w=t.state.data)==null?void 0:w.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const u=async()=>{let h=!1;const y=C=>{kp(C,()=>t.signal,()=>h=!0)},v=md(t.options,t.fetchOptions),b=async(C,S,_)=>{if(h)return Promise.reject(t.signal.reason);if(S==null&&C.pages.length)return Promise.resolve(C);const N=(()=>{const D={client:t.client,queryKey:t.queryKey,pageParam:S,direction:_?"backward":"forward",meta:t.options.meta};return y(D),D})(),R=await v(N),{maxPages:P}=t.options,B=_?jp:Rp;return{pages:B(C.pages,R,P),pageParams:B(C.pageParams,S,P)}};if(s&&i.length){const C=s==="backward",S=C?$p:Ml,_={pages:i,pageParams:a},E=S(n,_);o=await b(_,E,C)}else{const C=e??i.length;do{const S=l===0?a[0]??n.initialPageParam:Ml(n,o);if(l>0&&S==null)break;o=await b(o,S),l++}while(l<C)}return o};t.options.persister?t.fetchFn=()=>{var h,y;return(y=(h=t.options).persister)==null?void 0:y.call(h,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function Ml(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function $p(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var Dn,en,Nn,Ht,tn,st,Ns,rn,Lt,wd,yr,ld,qp=(ld=class extends bd{constructor(t){super();ae(this,Lt);ae(this,Dn);ae(this,en);ae(this,Nn);ae(this,Ht);ae(this,tn);ae(this,st);ae(this,Ns);ae(this,rn);Y(this,rn,!1),Y(this,Ns,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,tn,t.client),Y(this,Ht,T(this,tn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(this,en,$l(this.options)),this.state=t.state??T(this,en),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return T(this,Dn)}get promise(){var t;return(t=T(this,st))==null?void 0:t.promise}setOptions(t){if(this.options={...T(this,Ns),...t},t!=null&&t._type&&Y(this,Dn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=$l(this.options);r.data!==void 0&&(this.setState(Bl(r.data,r.dataUpdatedAt)),Y(this,en,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&T(this,Ht).remove(this)}setData(t,r){const n=Ja(this.state.data,t,this.options);return Ce(this,Lt,yr).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){Ce(this,Lt,yr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=T(this,st))==null?void 0:n.promise;return(s=T(this,st))==null||s.cancel(t),r?r.then(Dt).catch(Dt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return T(this,en)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Pt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ii||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>$r(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!pd(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=T(this,st))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=T(this,st))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),T(this,Ht).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(T(this,st)&&(T(this,rn)||Ce(this,Lt,wd).call(this)?T(this,st).cancel({revert:!0}):T(this,st).cancelRetry()),this.scheduleGc()),T(this,Ht).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ce(this,Lt,yr).call(this,{type:"invalidate"})}async fetch(t,r){var u,f,d,g,p,w,h,y,v,b,C;if(this.state.fetchStatus!=="idle"&&((u=T(this,st))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(T(this,st))return T(this,st).continueRetry(),T(this,st).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(_=>_.options.queryFn);S&&this.setOptions(S.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(Y(this,rn,!0),n.signal)})},i=()=>{const S=md(this.options,r),E=(()=>{const N={client:T(this,tn),queryKey:this.queryKey,meta:this.meta};return s(N),N})();return Y(this,rn,!1),this.options.persister?this.options.persister(S,E,this):S(E)},o=(()=>{const S={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:T(this,tn),state:this.state,fetchFn:i};return s(S),S})(),l=T(this,Dn)==="infinite"?Bp(this.options.pages):this.options.behavior;l==null||l.onFetch(o,this),Y(this,Nn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=o.fetchOptions)==null?void 0:f.meta))&&Ce(this,Lt,yr).call(this,{type:"fetch",meta:(d=o.fetchOptions)==null?void 0:d.meta}),Y(this,st,vd({initialPromise:r==null?void 0:r.initialPromise,fn:o.fetchFn,onCancel:S=>{S instanceof to&&S.revert&&this.setState({...T(this,Nn),fetchStatus:"idle"}),n.abort()},onFail:(S,_)=>{Ce(this,Lt,yr).call(this,{type:"failed",failureCount:S,error:_})},onPause:()=>{Ce(this,Lt,yr).call(this,{type:"pause"})},onContinue:()=>{Ce(this,Lt,yr).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const S=await T(this,st).start();if(S===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(S),(p=(g=T(this,Ht).config).onSuccess)==null||p.call(g,S,this),(h=(w=T(this,Ht).config).onSettled)==null||h.call(w,S,this.state.error,this),S}catch(S){if(S instanceof to){if(S.silent)return T(this,st).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw Ce(this,Lt,yr).call(this,{type:"error",error:S}),(v=(y=T(this,Ht).config).onError)==null||v.call(y,S,this),(C=(b=T(this,Ht).config).onSettled)==null||C.call(b,this.state.data,S,this),S}finally{this.scheduleGc()}}},Dn=new WeakMap,en=new WeakMap,Nn=new WeakMap,Ht=new WeakMap,tn=new WeakMap,st=new WeakMap,Ns=new WeakMap,rn=new WeakMap,Lt=new WeakSet,wd=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},yr=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Cd(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Bl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Y(this,Nn,t.manual?s:void 0),s;case"error":const i=t.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),dt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),T(this,Ht).notify({query:this,type:"updated",action:t})})},ld);function Cd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:yd(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Bl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function $l(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var At,Se,Rs,_t,nn,Rn,vr,kr,js,jn,kn,sn,an,Lr,Ln,De,hs,ro,no,so,io,ao,oo,lo,Sd,cd,Up=(cd=class extends Ps{constructor(t,r){super();ae(this,De);ae(this,At);ae(this,Se);ae(this,Rs);ae(this,_t);ae(this,nn);ae(this,Rn);ae(this,vr);ae(this,kr);ae(this,js);ae(this,jn);ae(this,kn);ae(this,sn);ae(this,an);ae(this,Lr);ae(this,Ln,new Set);this.options=r,Y(this,At,t),Y(this,kr,null),Y(this,vr,eo()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(T(this,Se).addObserver(this),ql(T(this,Se),this.options)?Ce(this,De,hs).call(this):this.updateResult(),Ce(this,De,io).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return co(T(this,Se),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return co(T(this,Se),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ce(this,De,ao).call(this),Ce(this,De,oo).call(this),T(this,Se).removeObserver(this)}setOptions(t){const r=this.options,n=T(this,Se);if(this.options=T(this,At).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Pt(this.options.enabled,T(this,Se))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ce(this,De,lo).call(this),T(this,Se).setOptions(this.options),r._defaulted&&!Za(this.options,r)&&T(this,At).getQueryCache().notify({type:"observerOptionsUpdated",query:T(this,Se),observer:this});const s=this.hasListeners();s&&Ul(T(this,Se),n,this.options,r)&&Ce(this,De,hs).call(this),this.updateResult(),s&&(T(this,Se)!==n||Pt(this.options.enabled,T(this,Se))!==Pt(r.enabled,T(this,Se))||$r(this.options.staleTime,T(this,Se))!==$r(r.staleTime,T(this,Se)))&&Ce(this,De,ro).call(this);const i=Ce(this,De,no).call(this);s&&(T(this,Se)!==n||Pt(this.options.enabled,T(this,Se))!==Pt(r.enabled,T(this,Se))||i!==T(this,Lr))&&Ce(this,De,so).call(this,i)}getOptimisticResult(t){const r=T(this,At).getQueryCache().build(T(this,At),t),n=this.createResult(r,t);return Vp(this,n)&&(Y(this,_t,n),Y(this,Rn,this.options),Y(this,nn,T(this,Se).state)),n}getCurrentResult(){return T(this,_t)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&T(this,vr).status==="pending"&&T(this,vr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){T(this,Ln).add(t)}getCurrentQuery(){return T(this,Se)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=T(this,At).defaultQueryOptions(t),n=T(this,At).getQueryCache().build(T(this,At),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return Ce(this,De,hs).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),T(this,_t)))}createResult(t,r){var P;const n=T(this,Se),s=this.options,i=T(this,_t),a=T(this,nn),o=T(this,Rn),u=t!==n?t.state:T(this,Rs),{state:f}=t;let d={...f},g=!1,p;if(r._optimisticResults){const B=this.hasListeners(),D=!B&&ql(t,r),j=B&&Ul(t,n,r,s);(D||j)&&(d={...d,...Cd(f.data,t.options)}),r._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:w,errorUpdatedAt:h,status:y}=d;p=d.data;let v=!1;if(r.placeholderData!==void 0&&p===void 0&&y==="pending"){let B;i!=null&&i.isPlaceholderData&&r.placeholderData===(o==null?void 0:o.placeholderData)?(B=i.data,v=!0):B=typeof r.placeholderData=="function"?r.placeholderData((P=T(this,kn))==null?void 0:P.state.data,T(this,kn)):r.placeholderData,B!==void 0&&(y="success",p=Ja(i==null?void 0:i.data,B,r),g=!0)}if(r.select&&p!==void 0&&!v)if(i&&p===(a==null?void 0:a.data)&&r.select===T(this,js))p=T(this,jn);else try{Y(this,js,r.select),p=r.select(p),p=Ja(i==null?void 0:i.data,p,r),Y(this,jn,p),Y(this,kr,null)}catch(B){Y(this,kr,B)}T(this,kr)&&(w=T(this,kr),p=T(this,jn),h=Date.now(),y="error");const b=d.fetchStatus==="fetching",C=y==="pending",S=y==="error",_=C&&b,E=p!==void 0,R={status:y,fetchStatus:d.fetchStatus,isPending:C,isSuccess:y==="success",isError:S,isInitialLoading:_,isLoading:_,data:p,dataUpdatedAt:d.dataUpdatedAt,error:w,errorUpdatedAt:h,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:d.dataUpdateCount>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:b,isRefetching:b&&!C,isLoadingError:S&&!E,isPaused:d.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:S&&E,isStale:Go(t,r),refetch:this.refetch,promise:T(this,vr),isEnabled:Pt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const B=R.data!==void 0,D=R.status==="error"&&!B,j=L=>{D?L.reject(R.error):B&&L.resolve(R.data)},M=()=>{const L=Y(this,vr,R.promise=eo());j(L)},k=T(this,vr);switch(k.status){case"pending":t.queryHash===n.queryHash&&j(k);break;case"fulfilled":(D||R.data!==k.value)&&M();break;case"rejected":(!D||R.error!==k.reason)&&M();break}}return R}updateResult(){const t=T(this,_t),r=this.createResult(T(this,Se),this.options);if(Y(this,nn,T(this,Se).state),Y(this,Rn,this.options),T(this,nn).data!==void 0&&Y(this,kn,T(this,Se)),Za(r,t))return;Y(this,_t,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!T(this,Ln).size)return!0;const a=new Set(i??T(this,Ln));return this.options.throwOnError&&a.add("error"),Object.keys(T(this,_t)).some(o=>{const l=o;return T(this,_t)[l]!==t[l]&&a.has(l)})};Ce(this,De,Sd).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ce(this,De,io).call(this)}},At=new WeakMap,Se=new WeakMap,Rs=new WeakMap,_t=new WeakMap,nn=new WeakMap,Rn=new WeakMap,vr=new WeakMap,kr=new WeakMap,js=new WeakMap,jn=new WeakMap,kn=new WeakMap,sn=new WeakMap,an=new WeakMap,Lr=new WeakMap,Ln=new WeakMap,De=new WeakSet,hs=function(t){Ce(this,De,lo).call(this);let r=T(this,Se).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Dt)),r},ro=function(){Ce(this,De,ao).call(this);const t=$r(this.options.staleTime,T(this,Se));if(_s.isServer()||T(this,_t).isStale||!Ka(t))return;const n=pd(T(this,_t).dataUpdatedAt,t)+1;Y(this,sn,Wr.setTimeout(()=>{T(this,_t).isStale||this.updateResult()},n))},no=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(T(this,Se)):this.options.refetchInterval)??!1},so=function(t){Ce(this,De,oo).call(this),Y(this,Lr,t),!(_s.isServer()||Pt(this.options.enabled,T(this,Se))===!1||!Ka(T(this,Lr))||T(this,Lr)===0)&&Y(this,an,Wr.setInterval(()=>{(this.options.refetchIntervalInBackground||Ho.isFocused())&&Ce(this,De,hs).call(this)},T(this,Lr)))},io=function(){Ce(this,De,ro).call(this),Ce(this,De,so).call(this,Ce(this,De,no).call(this))},ao=function(){T(this,sn)!==void 0&&(Wr.clearTimeout(T(this,sn)),Y(this,sn,void 0))},oo=function(){T(this,an)!==void 0&&(Wr.clearInterval(T(this,an)),Y(this,an,void 0))},lo=function(){const t=T(this,At).getQueryCache().build(T(this,At),this.options);if(t===T(this,Se))return;const r=T(this,Se);Y(this,Se,t),Y(this,Rs,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},Sd=function(t){dt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(T(this,_t))}),T(this,At).getQueryCache().notify({query:T(this,Se),type:"observerResultsUpdated"})})},cd);function zp(e,t){return Pt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Pt(t.retryOnMount,e)===!1)}function ql(e,t){return zp(e,t)||e.state.data!==void 0&&co(e,t,t.refetchOnMount)}function co(e,t,r){if(Pt(t.enabled,e)!==!1&&$r(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Go(e,t)}return!1}function Ul(e,t,r,n){return(e!==t||Pt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Go(e,r)}function Go(e,t){return Pt(t.enabled,e)!==!1&&e.isStaleByTime($r(t.staleTime,e))}function Vp(e,t){return!Za(e.getCurrentResult(),t)}var ks,ur,vt,on,dr,Ir,ud,Hp=(ud=class extends bd{constructor(t){super();ae(this,dr);ae(this,ks);ae(this,ur);ae(this,vt);ae(this,on);Y(this,ks,t.client),this.mutationId=t.mutationId,Y(this,vt,t.mutationCache),Y(this,ur,[]),this.state=t.state||Qp(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){T(this,ur).includes(t)||(T(this,ur).push(t),this.clearGcTimeout(),T(this,vt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Y(this,ur,T(this,ur).filter(r=>r!==t)),this.scheduleGc(),T(this,vt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){T(this,ur).length||(this.state.status==="pending"?this.scheduleGc():T(this,vt).remove(this))}continue(){var t;return((t=T(this,on))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var a,o,l,u,f,d,g,p,w,h,y,v,b,C,S,_,E,N;const r=()=>{Ce(this,dr,Ir).call(this,{type:"continue"})},n={client:T(this,ks),meta:this.options.meta,mutationKey:this.options.mutationKey};Y(this,on,vd({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(R,P)=>{Ce(this,dr,Ir).call(this,{type:"failed",failureCount:R,error:P})},onPause:()=>{Ce(this,dr,Ir).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>T(this,vt).canRun(this)}));const s=this.state.status==="pending",i=!T(this,on).canStart();try{if(s)r();else{Ce(this,dr,Ir).call(this,{type:"pending",variables:t,isPaused:i}),T(this,vt).config.onMutate&&await T(this,vt).config.onMutate(t,this,n);const P=await((o=(a=this.options).onMutate)==null?void 0:o.call(a,t,n));P!==this.state.context&&Ce(this,dr,Ir).call(this,{type:"pending",context:P,variables:t,isPaused:i})}const R=await T(this,on).start();return await((u=(l=T(this,vt).config).onSuccess)==null?void 0:u.call(l,R,t,this.state.context,this,n)),await((d=(f=this.options).onSuccess)==null?void 0:d.call(f,R,t,this.state.context,n)),await((p=(g=T(this,vt).config).onSettled)==null?void 0:p.call(g,R,null,this.state.variables,this.state.context,this,n)),await((h=(w=this.options).onSettled)==null?void 0:h.call(w,R,null,t,this.state.context,n)),Ce(this,dr,Ir).call(this,{type:"success",data:R}),R}catch(R){try{await((v=(y=T(this,vt).config).onError)==null?void 0:v.call(y,R,t,this.state.context,this,n))}catch(P){Promise.reject(P)}try{await((C=(b=this.options).onError)==null?void 0:C.call(b,R,t,this.state.context,n))}catch(P){Promise.reject(P)}try{await((_=(S=T(this,vt).config).onSettled)==null?void 0:_.call(S,void 0,R,this.state.variables,this.state.context,this,n))}catch(P){Promise.reject(P)}try{await((N=(E=this.options).onSettled)==null?void 0:N.call(E,void 0,R,t,this.state.context,n))}catch(P){Promise.reject(P)}throw Ce(this,dr,Ir).call(this,{type:"error",error:R}),R}finally{T(this,vt).runNext(this)}}},ks=new WeakMap,ur=new WeakMap,vt=new WeakMap,on=new WeakMap,dr=new WeakSet,Ir=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),dt.batch(()=>{T(this,ur).forEach(n=>{n.onMutationUpdate(t)}),T(this,vt).notify({mutation:this,type:"updated",action:t})})},ud);function Qp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var br,Zt,Ls,dd,Gp=(dd=class extends Ps{constructor(t={}){super();ae(this,br);ae(this,Zt);ae(this,Ls);this.config=t,Y(this,br,new Set),Y(this,Zt,new Map),Y(this,Ls,0)}build(t,r,n){const s=new Hp({client:t,mutationCache:this,mutationId:++Ys(this,Ls)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){T(this,br).add(t);const r=Zs(t);if(typeof r=="string"){const n=T(this,Zt).get(r);n?n.push(t):T(this,Zt).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(T(this,br).delete(t)){const r=Zs(t);if(typeof r=="string"){const n=T(this,Zt).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&T(this,Zt).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Zs(t);if(typeof r=="string"){const n=T(this,Zt).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=Zs(t);if(typeof r=="string"){const s=(n=T(this,Zt).get(r))==null?void 0:n.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){dt.batch(()=>{T(this,br).forEach(t=>{this.notify({type:"removed",mutation:t})}),T(this,br).clear(),T(this,Zt).clear()})}getAll(){return Array.from(T(this,br))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Ll(r,n))}findAll(t={}){return this.getAll().filter(r=>Ll(t,r))}notify(t){dt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return dt.batch(()=>Promise.all(t.map(r=>r.continue().catch(Dt))))}},br=new WeakMap,Zt=new WeakMap,Ls=new WeakMap,dd);function Zs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var fr,fd,Wp=(fd=class extends Ps{constructor(t={}){super();ae(this,fr);this.config=t,Y(this,fr,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??Qo(s,r);let a=this.get(i);return a||(a=new qp({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(a)),a}add(t){T(this,fr).has(t.queryHash)||(T(this,fr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=T(this,fr).get(t.queryHash);r&&(t.destroy(),r===t&&T(this,fr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){dt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return T(this,fr).get(t)}getAll(){return[...T(this,fr).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>kl(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>kl(t,n)):r}notify(t){dt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){dt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){dt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},fr=new WeakMap,fd),Ye,Pr,Fr,Pn,Fn,Mr,Mn,Bn,hd,Kp=(hd=class{constructor(e={}){ae(this,Ye);ae(this,Pr);ae(this,Fr);ae(this,Pn);ae(this,Fn);ae(this,Mr);ae(this,Mn);ae(this,Bn);Y(this,Ye,e.queryCache||new Wp),Y(this,Pr,e.mutationCache||new Gp),Y(this,Fr,e.defaultOptions||{}),Y(this,Pn,new Map),Y(this,Fn,new Map),Y(this,Mr,0)}mount(){Ys(this,Mr)._++,T(this,Mr)===1&&(Y(this,Mn,Ho.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,Ye).onFocus())})),Y(this,Bn,Oi.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,Ye).onOnline())})))}unmount(){var e,t;Ys(this,Mr)._--,T(this,Mr)===0&&((e=T(this,Mn))==null||e.call(this),Y(this,Mn,void 0),(t=T(this,Bn))==null||t.call(this),Y(this,Bn,void 0))}isFetching(e){return T(this,Ye).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return T(this,Pr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=T(this,Ye).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=T(this,Ye).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime($r(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return T(this,Ye).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=T(this,Ye).get(n.queryHash),i=s==null?void 0:s.state.data,a=Ap(t,i);if(a!==void 0)return T(this,Ye).build(this,n).setData(a,{...r,manual:!0})}setQueriesData(e,t,r){return dt.batch(()=>T(this,Ye).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=T(this,Ye).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=T(this,Ye);dt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=T(this,Ye);return dt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=dt.batch(()=>T(this,Ye).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Dt).catch(Dt)}invalidateQueries(e,t={}){return dt.batch(()=>(T(this,Ye).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=dt.batch(()=>T(this,Ye).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(Dt)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Dt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=T(this,Ye).build(this,t);return r.isStaleByTime($r(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Dt).catch(Dt)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Dt).catch(Dt)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Oi.isOnline()?T(this,Pr).resumePausedMutations():Promise.resolve()}getQueryCache(){return T(this,Ye)}getMutationCache(){return T(this,Pr)}getDefaultOptions(){return T(this,Fr)}setDefaultOptions(e){Y(this,Fr,e)}setQueryDefaults(e,t){T(this,Pn).set(Ss(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...T(this,Pn).values()],r={};return t.forEach(n=>{xs(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){T(this,Fn).set(Ss(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...T(this,Fn).values()],r={};return t.forEach(n=>{xs(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...T(this,Fr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Qo(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Ii&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...T(this,Fr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){T(this,Ye).clear(),T(this,Pr).clear()}},Ye=new WeakMap,Pr=new WeakMap,Fr=new WeakMap,Pn=new WeakMap,Fn=new WeakMap,Mr=new WeakMap,Mn=new WeakMap,Bn=new WeakMap,hd),xd=Ae.createContext(void 0),Yp=e=>{const t=Ae.useContext(xd);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Zp=({client:e,children:t})=>(Ae.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(xd.Provider,{value:e,children:t})),_d=Ae.createContext(!1),Xp=()=>Ae.useContext(_d);_d.Provider;function Jp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var em=Ae.createContext(Jp()),tm=()=>Ae.useContext(em),rm=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?gd(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},nm=e=>{Ae.useEffect(()=>{e.clearReset()},[e])},sm=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||gd(r,[e.error,n])),im=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},am=(e,t)=>e.isLoading&&e.isFetching&&!t,om=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,zl=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function lm(e,t,r){var p,w,h,y;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=Xp(),s=tm(),i=Yp(),a=i.defaultQueryOptions(e);(w=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||w.call(p,a);const o=i.getQueryCache().get(a.queryHash);process.env.NODE_ENV!=="production"&&(a.queryFn||console.error(`[${a.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const l=e.subscribed!==!1;a._optimisticResults=n?"isRestoring":l?"optimistic":void 0,im(a),rm(a,s,o),nm(s);const u=!i.getQueryCache().get(a.queryHash),[f]=Ae.useState(()=>new t(i,a)),d=f.getOptimisticResult(a),g=!n&&l;if(Ae.useSyncExternalStore(Ae.useCallback(v=>{const b=g?f.subscribe(dt.batchCalls(v)):Dt;return f.updateResult(),b},[f,g]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),Ae.useEffect(()=>{f.setOptions(a)},[a,f]),om(a,d))throw zl(a,f,s);if(sm({result:d,errorResetBoundary:s,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw d.error;if((y=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,a,d),a.experimental_prefetchInRender&&!_s.isServer()&&am(d,n)){const v=u?zl(a,f,s):o==null?void 0:o.promise;v==null||v.catch(Dt).finally(()=>{f.updateResult()})}return a.notifyOnChangeProps?d:f.trackResult(d)}function $n(e,t){return lm(e,Up)}let cm={data:""},um=e=>{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||cm},dm=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,fm=/\/\*[^]*?\*\/| +/g,Vl=/\n+/g,Nr=(e,t)=>{let r="",n="",s="";for(let i in e){let a=e[i];i[0]=="@"?i[1]=="i"?r=i+" "+a+";":n+=i[1]=="f"?Nr(a,i):i+"{"+Nr(a,i[1]=="k"?"":t)+"}":typeof a=="object"?n+=Nr(a,t?t.replace(/([^,])+/g,o=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,o):o?o+" "+l:l)):i):a!=null&&(i=i[1]=="-"?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=Nr.p?Nr.p(i,a):i+":"+a+";")}return r+(t&&s?t+"{"+s+"}":s)+n},_r={},Td=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+Td(e[r]);return t}return e},hm=(e,t,r,n,s)=>{let i=Td(e),a=_r[i]||(_r[i]=(l=>{let u=0,f=11;for(;u<l.length;)f=101*f+l.charCodeAt(u++)>>>0;return"go"+f})(i));if(!_r[a]){let l=i!==e?e:(u=>{let f,d,g=[{}];for(;f=dm.exec(u.replace(fm,""));)f[4]?g.shift():f[3]?(d=f[3].replace(Vl," ").trim(),g.unshift(g[0][d]=g[0][d]||{})):g[0][f[1]]=f[2].replace(Vl," ").trim();return g[0]})(e);_r[a]=Nr(s?{["@keyframes "+a]:l}:l,r?"":"."+a)}let o=r&&_r.g;return r&&(_r.g=_r[a]),((l,u,f,d)=>{d?u.data=u.data.replace(d,l):u.data.indexOf(l)===-1&&(u.data=f?l+u.data:u.data+l)})(_r[a],t,n,o),a},pm=(e,t,r)=>e.reduce((n,s,i)=>{let a=t[i];if(a&&a.call){let o=a(r),l=o&&o.props&&o.props.className||/^go/.test(o)&&o;a=l?"."+l:o&&typeof o=="object"?o.props?"":Nr(o,""):o===!1?"":o}return n+s+(a??"")},"");function Qi(e){let t=this||{},r=e.call?e(t.p):e;return hm(r.unshift?r.raw?pm(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,um(t.target),t.g,t.o,t.k)}let Ed,uo,fo;Qi.bind({g:1});let wr=Qi.bind({k:1});function mm(e,t,r,n){Nr.p=t,Ed=e,uo=r,fo=n}function Ur(e,t){let r=this||{};return function(){let n=arguments;function s(i,a){let o=Object.assign({},i),l=o.className||s.className;r.p=Object.assign({theme:uo&&uo()},o),r.o=/go\d/.test(l),o.className=Qi.apply(r,n)+(l?" "+l:"");let u=e;return e[0]&&(u=o.as||e,delete o.as),fo&&u[0]&&fo(o),Ed(u,o)}return s}}var gm=e=>typeof e=="function",Ai=(e,t)=>gm(e)?e(t):e,ym=(()=>{let e=0;return()=>(++e).toString()})(),Id=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),vm=20,Wo="default",Od=(e,t)=>{let{toastLimit:r}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,r)};case 1:return{...e,toasts:e.toasts.map(a=>a.id===t.toast.id?{...a,...t.toast}:a)};case 2:let{toast:n}=t;return Od(e,{type:e.toasts.find(a=>a.id===n.id)?1:0,toast:n});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(a=>a.id===s||s===void 0?{...a,dismissed:!0,visible:!1}:a)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(a=>a.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(a=>({...a,pauseDuration:a.pauseDuration+i}))}}},di=[],Ad={toasts:[],pausedAt:void 0,settings:{toastLimit:vm}},hr={},Dd=(e,t=Wo)=>{hr[t]=Od(hr[t]||Ad,e),di.forEach(([r,n])=>{r===t&&n(hr[t])})},Nd=e=>Object.keys(hr).forEach(t=>Dd(e,t)),bm=e=>Object.keys(hr).find(t=>hr[t].toasts.some(r=>r.id===e)),Gi=(e=Wo)=>t=>{Dd(t,e)},wm={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Cm=(e={},t=Wo)=>{let[r,n]=m.useState(hr[t]||Ad),s=m.useRef(hr[t]);m.useEffect(()=>(s.current!==hr[t]&&n(hr[t]),di.push([t,n]),()=>{let a=di.findIndex(([o])=>o===t);a>-1&&di.splice(a,1)}),[t]);let i=r.toasts.map(a=>{var o,l,u;return{...e,...e[a.type],...a,removeDelay:a.removeDelay||((o=e[a.type])==null?void 0:o.removeDelay)||(e==null?void 0:e.removeDelay),duration:a.duration||((l=e[a.type])==null?void 0:l.duration)||(e==null?void 0:e.duration)||wm[a.type],style:{...e.style,...(u=e[a.type])==null?void 0:u.style,...a.style}}});return{...r,toasts:i}},Sm=(e,t="blank",r)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...r,id:(r==null?void 0:r.id)||ym()}),Fs=e=>(t,r)=>{let n=Sm(t,e,r);return Gi(n.toasterId||bm(n.id))({type:2,toast:n}),n.id},tt=(e,t)=>Fs("blank")(e,t);tt.error=Fs("error");tt.success=Fs("success");tt.loading=Fs("loading");tt.custom=Fs("custom");tt.dismiss=(e,t)=>{let r={type:3,toastId:e};t?Gi(t)(r):Nd(r)};tt.dismissAll=e=>tt.dismiss(void 0,e);tt.remove=(e,t)=>{let r={type:4,toastId:e};t?Gi(t)(r):Nd(r)};tt.removeAll=e=>tt.remove(void 0,e);tt.promise=(e,t,r)=>{let n=tt.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?Ai(t.success,s):void 0;return i?tt.success(i,{id:n,...r,...r==null?void 0:r.success}):tt.dismiss(n),s}).catch(s=>{let i=t.error?Ai(t.error,s):void 0;i?tt.error(i,{id:n,...r,...r==null?void 0:r.error}):tt.dismiss(n)}),e};var xm=1e3,_m=(e,t="default")=>{let{toasts:r,pausedAt:n}=Cm(e,t),s=m.useRef(new Map).current,i=m.useCallback((d,g=xm)=>{if(s.has(d))return;let p=setTimeout(()=>{s.delete(d),a({type:4,toastId:d})},g);s.set(d,p)},[]);m.useEffect(()=>{if(n)return;let d=Date.now(),g=r.map(p=>{if(p.duration===1/0)return;let w=(p.duration||0)+p.pauseDuration-(d-p.createdAt);if(w<0){p.visible&&tt.dismiss(p.id);return}return setTimeout(()=>tt.dismiss(p.id,t),w)});return()=>{g.forEach(p=>p&&clearTimeout(p))}},[r,n,t]);let a=m.useCallback(Gi(t),[t]),o=m.useCallback(()=>{a({type:5,time:Date.now()})},[a]),l=m.useCallback((d,g)=>{a({type:1,toast:{id:d,height:g}})},[a]),u=m.useCallback(()=>{n&&a({type:6,time:Date.now()})},[n,a]),f=m.useCallback((d,g)=>{let{reverseOrder:p=!1,gutter:w=8,defaultPosition:h}=g||{},y=r.filter(C=>(C.position||h)===(d.position||h)&&C.height),v=y.findIndex(C=>C.id===d.id),b=y.filter((C,S)=>S<v&&C.visible).length;return y.filter(C=>C.visible).slice(...p?[b+1]:[0,b]).reduce((C,S)=>C+(S.height||0)+w,0)},[r]);return m.useEffect(()=>{r.forEach(d=>{if(d.dismissed)i(d.id,d.removeDelay);else{let g=s.get(d.id);g&&(clearTimeout(g),s.delete(d.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:l,startPause:o,endPause:u,calculateOffset:f}}},Tm=wr`
|
|
1
|
+
"use strict";var Cp=Object.defineProperty;var Nl=e=>{throw TypeError(e)};var Sp=(e,t,r)=>t in e?Cp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ns=(e,t,r)=>Sp(e,typeof t!="symbol"?t+"":t,r),pa=(e,t,r)=>t.has(e)||Nl("Cannot "+r);var T=(e,t,r)=>(pa(e,t,"read from private field"),r?r.call(e):t.get(e)),ae=(e,t,r)=>t.has(e)?Nl("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Y=(e,t,r,n)=>(pa(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ce=(e,t,r)=>(pa(e,t,"access private method"),r);var Ys=(e,t,r,n)=>({set _(s){Y(e,t,s,r)},get _(){return T(e,t,n)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react"),Br=require("react-dom"),c=require("react/jsx-runtime");function xp(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Ae=xp(m);var Ps=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Zr,Rr,In,rd,_p=(rd=class extends Ps{constructor(){super();ae(this,Zr);ae(this,Rr);ae(this,In);Y(this,In,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){T(this,Rr)||this.setEventListener(T(this,In))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,Rr))==null||t.call(this),Y(this,Rr,void 0))}setEventListener(t){var r;Y(this,In,t),(r=T(this,Rr))==null||r.call(this),Y(this,Rr,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){T(this,Zr)!==t&&(Y(this,Zr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof T(this,Zr)=="boolean"?T(this,Zr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Zr=new WeakMap,Rr=new WeakMap,In=new WeakMap,rd),zo=new _p,Tp={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},cr,Xr,nd,Ep=(nd=class{constructor(){ae(this,cr,Tp);ae(this,Xr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&T(this,Xr)&&e!==T(this,cr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:T(this,cr),provider:e}),Y(this,cr,e),process.env.NODE_ENV!=="production"&&Y(this,Xr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Xr,!0),T(this,cr).setTimeout(e,t)}clearTimeout(e){T(this,cr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Xr,!0),T(this,cr).setInterval(e,t)}clearInterval(e){T(this,cr).clearInterval(e)}},cr=new WeakMap,Xr=new WeakMap,nd),Wr=new Ep;function Ip(e){setTimeout(e,0)}var Op=typeof window>"u"||"Deno"in globalThis;function Dt(){}function Ap(e,t){return typeof e=="function"?e(t):e}function Ga(e){return typeof e=="number"&&e>=0&&e!==1/0}function fd(e,t){return Math.max(e+(t||0)-Date.now(),0)}function $r(e,t){return typeof e=="function"?e(t):e}function Pt(e,t){return typeof e=="function"?e(t):e}function Rl(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:a,stale:o}=e;if(a){if(n){if(t.queryHash!==Vo(a,t.options))return!1}else if(!xs(t.queryKey,a))return!1}if(r!=="all"){const l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||s&&s!==t.state.fetchStatus||i&&!i(t))}function kl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(Ss(t.options.mutationKey)!==Ss(i))return!1}else if(!xs(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Vo(e,t){return((t==null?void 0:t.queryKeyHashFn)||Ss)(e)}function Ss(e){return JSON.stringify(e,(t,r)=>Ya(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function xs(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>xs(e[r],t[r])):!1}var Dp=Object.prototype.hasOwnProperty;function Wa(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=jl(e)&&jl(t);if(!n&&!(Ya(e)&&Ya(t)))return t;const i=(n?e:Object.keys(e)).length,a=n?t:Object.keys(t),o=a.length,l=n?new Array(o):{};let u=0;for(let f=0;f<o;f++){const d=n?f:a[f],g=e[d],p=t[d];if(g===p){l[d]=g,(n?f<i:Dp.call(e,d))&&u++;continue}if(g===null||p===null||typeof g!="object"||typeof p!="object"){l[d]=p;continue}const w=Wa(g,p,r+1);l[d]=w,w===g&&u++}return i===o&&u===i?e:l}function Ka(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function jl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ya(e){if(!Ll(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Ll(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ll(e){return Object.prototype.toString.call(e)==="[object Object]"}function Np(e){return new Promise(t=>{Wr.setTimeout(t,e)})}function Za(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Wa(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return Wa(e,t)}return t}function Rp(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function kp(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Ii=Symbol();function hd(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ii&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ii?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function pd(e,t){return typeof e=="function"?e(...t):!!e}function jp(e,t,r){let n=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),n||(n=!0,s.aborted?r():s.addEventListener("abort",r,{once:!0})),s)}),e}var _s=(()=>{let e=()=>Op;return{isServer(){return e()},setIsServer(t){e=t}}})();function Xa(){let e,t;const r=new Promise((s,i)=>{e=s,t=i});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var Lp=Ip;function Pp(){let e=[],t=0,r=o=>{o()},n=o=>{o()},s=Lp;const i=o=>{t?e.push(o):s(()=>{r(o)})},a=()=>{const o=e;e=[],o.length&&s(()=>{n(()=>{o.forEach(l=>{r(l)})})})};return{batch:o=>{let l;t++;try{l=o()}finally{t--,t||a()}return l},batchCalls:o=>(...l)=>{i(()=>{o(...l)})},schedule:i,setNotifyFunction:o=>{r=o},setBatchNotifyFunction:o=>{n=o},setScheduler:o=>{s=o}}}var dt=Pp(),On,kr,An,sd,Fp=(sd=class extends Ps{constructor(){super();ae(this,On,!0);ae(this,kr);ae(this,An);Y(this,An,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){T(this,kr)||this.setEventListener(T(this,An))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,kr))==null||t.call(this),Y(this,kr,void 0))}setEventListener(t){var r;Y(this,An,t),(r=T(this,kr))==null||r.call(this),Y(this,kr,t(this.setOnline.bind(this)))}setOnline(t){T(this,On)!==t&&(Y(this,On,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return T(this,On)}},On=new WeakMap,kr=new WeakMap,An=new WeakMap,sd),Oi=new Fp;function Mp(e){return Math.min(1e3*2**e,3e4)}function md(e){return(e??"online")==="online"?Oi.isOnline():!0}var Ja=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function gd(e){let t=!1,r=0,n;const s=Xa(),i=()=>s.status!=="pending",a=h=>{var y;if(!i()){const v=new Ja(h);g(v),(y=e.onCancel)==null||y.call(e,v)}},o=()=>{t=!0},l=()=>{t=!1},u=()=>zo.isFocused()&&(e.networkMode==="always"||Oi.isOnline())&&e.canRun(),f=()=>md(e.networkMode)&&e.canRun(),d=h=>{i()||(n==null||n(),s.resolve(h))},g=h=>{i()||(n==null||n(),s.reject(h))},p=()=>new Promise(h=>{var y;n=v=>{(i()||u())&&h(v)},(y=e.onPause)==null||y.call(e)}).then(()=>{var h;n=void 0,i()||(h=e.onContinue)==null||h.call(e)}),w=()=>{if(i())return;let h;const y=r===0?e.initialPromise:void 0;try{h=y??e.fn()}catch(v){h=Promise.reject(v)}Promise.resolve(h).then(d).catch(v=>{var E;if(i())return;const b=e.retry??(_s.isServer()?0:3),C=e.retryDelay??Mp,S=typeof C=="function"?C(r,v):C,_=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,v);if(t||!_){g(v);return}r++,(E=e.onFail)==null||E.call(e,r,v),Np(S).then(()=>u()?void 0:p()).then(()=>{t?g(v):w()})})};return{promise:s,status:()=>s.status,cancel:a,continue:()=>(n==null||n(),s),cancelRetry:o,continueRetry:l,canStart:f,start:()=>(f()?w():p().then(w),s)}}var Jr,id,yd=(id=class{constructor(){ae(this,Jr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ga(this.gcTime)&&Y(this,Jr,Wr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(_s.isServer()?1/0:5*60*1e3))}clearGcTimeout(){T(this,Jr)!==void 0&&(Wr.clearTimeout(T(this,Jr)),Y(this,Jr,void 0))}},Jr=new WeakMap,id);function Bp(e){return{onFetch:(t,r)=>{var f,d,g,p,w;const n=t.options,s=(g=(d=(f=t.fetchOptions)==null?void 0:f.meta)==null?void 0:d.fetchMore)==null?void 0:g.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],a=((w=t.state.data)==null?void 0:w.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const u=async()=>{let h=!1;const y=C=>{jp(C,()=>t.signal,()=>h=!0)},v=hd(t.options,t.fetchOptions),b=async(C,S,_)=>{if(h)return Promise.reject(t.signal.reason);if(S==null&&C.pages.length)return Promise.resolve(C);const N=(()=>{const D={client:t.client,queryKey:t.queryKey,pageParam:S,direction:_?"backward":"forward",meta:t.options.meta};return y(D),D})(),R=await v(N),{maxPages:M}=t.options,$=_?kp:Rp;return{pages:$(C.pages,R,M),pageParams:$(C.pageParams,S,M)}};if(s&&i.length){const C=s==="backward",S=C?$p:Pl,_={pages:i,pageParams:a},E=S(n,_);o=await b(_,E,C)}else{const C=e??i.length;do{const S=l===0?a[0]??n.initialPageParam:Pl(n,o);if(l>0&&S==null)break;o=await b(o,S),l++}while(l<C)}return o};t.options.persister?t.fetchFn=()=>{var h,y;return(y=(h=t.options).persister)==null?void 0:y.call(h,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function Pl(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function $p(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var Dn,en,Nn,Ht,tn,st,Ns,rn,Lt,vd,yr,ad,qp=(ad=class extends yd{constructor(t){super();ae(this,Lt);ae(this,Dn);ae(this,en);ae(this,Nn);ae(this,Ht);ae(this,tn);ae(this,st);ae(this,Ns);ae(this,rn);Y(this,rn,!1),Y(this,Ns,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,tn,t.client),Y(this,Ht,T(this,tn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(this,en,Ml(this.options)),this.state=t.state??T(this,en),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return T(this,Dn)}get promise(){var t;return(t=T(this,st))==null?void 0:t.promise}setOptions(t){if(this.options={...T(this,Ns),...t},t!=null&&t._type&&Y(this,Dn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Ml(this.options);r.data!==void 0&&(this.setState(Fl(r.data,r.dataUpdatedAt)),Y(this,en,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&T(this,Ht).remove(this)}setData(t,r){const n=Za(this.state.data,t,this.options);return Ce(this,Lt,yr).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){Ce(this,Lt,yr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=T(this,st))==null?void 0:n.promise;return(s=T(this,st))==null||s.cancel(t),r?r.then(Dt).catch(Dt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return T(this,en)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Pt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ii||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>$r(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!fd(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=T(this,st))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=T(this,st))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),T(this,Ht).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(T(this,st)&&(T(this,rn)||Ce(this,Lt,vd).call(this)?T(this,st).cancel({revert:!0}):T(this,st).cancelRetry()),this.scheduleGc()),T(this,Ht).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ce(this,Lt,yr).call(this,{type:"invalidate"})}async fetch(t,r){var u,f,d,g,p,w,h,y,v,b,C;if(this.state.fetchStatus!=="idle"&&((u=T(this,st))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(T(this,st))return T(this,st).continueRetry(),T(this,st).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(_=>_.options.queryFn);S&&this.setOptions(S.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(Y(this,rn,!0),n.signal)})},i=()=>{const S=hd(this.options,r),E=(()=>{const N={client:T(this,tn),queryKey:this.queryKey,meta:this.meta};return s(N),N})();return Y(this,rn,!1),this.options.persister?this.options.persister(S,E,this):S(E)},o=(()=>{const S={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:T(this,tn),state:this.state,fetchFn:i};return s(S),S})(),l=T(this,Dn)==="infinite"?Bp(this.options.pages):this.options.behavior;l==null||l.onFetch(o,this),Y(this,Nn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=o.fetchOptions)==null?void 0:f.meta))&&Ce(this,Lt,yr).call(this,{type:"fetch",meta:(d=o.fetchOptions)==null?void 0:d.meta}),Y(this,st,gd({initialPromise:r==null?void 0:r.initialPromise,fn:o.fetchFn,onCancel:S=>{S instanceof Ja&&S.revert&&this.setState({...T(this,Nn),fetchStatus:"idle"}),n.abort()},onFail:(S,_)=>{Ce(this,Lt,yr).call(this,{type:"failed",failureCount:S,error:_})},onPause:()=>{Ce(this,Lt,yr).call(this,{type:"pause"})},onContinue:()=>{Ce(this,Lt,yr).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const S=await T(this,st).start();if(S===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(S),(p=(g=T(this,Ht).config).onSuccess)==null||p.call(g,S,this),(h=(w=T(this,Ht).config).onSettled)==null||h.call(w,S,this.state.error,this),S}catch(S){if(S instanceof Ja){if(S.silent)return T(this,st).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw Ce(this,Lt,yr).call(this,{type:"error",error:S}),(v=(y=T(this,Ht).config).onError)==null||v.call(y,S,this),(C=(b=T(this,Ht).config).onSettled)==null||C.call(b,this.state.data,S,this),S}finally{this.scheduleGc()}}},Dn=new WeakMap,en=new WeakMap,Nn=new WeakMap,Ht=new WeakMap,tn=new WeakMap,st=new WeakMap,Ns=new WeakMap,rn=new WeakMap,Lt=new WeakSet,vd=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},yr=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...bd(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Fl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Y(this,Nn,t.manual?s:void 0),s;case"error":const i=t.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),dt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),T(this,Ht).notify({query:this,type:"updated",action:t})})},ad);function bd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:md(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Fl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ml(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var At,Se,Rs,_t,nn,Rn,vr,jr,ks,kn,jn,sn,an,Lr,Ln,De,hs,eo,to,ro,no,so,io,ao,wd,od,Up=(od=class extends Ps{constructor(t,r){super();ae(this,De);ae(this,At);ae(this,Se);ae(this,Rs);ae(this,_t);ae(this,nn);ae(this,Rn);ae(this,vr);ae(this,jr);ae(this,ks);ae(this,kn);ae(this,jn);ae(this,sn);ae(this,an);ae(this,Lr);ae(this,Ln,new Set);this.options=r,Y(this,At,t),Y(this,jr,null),Y(this,vr,Xa()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(T(this,Se).addObserver(this),Bl(T(this,Se),this.options)?Ce(this,De,hs).call(this):this.updateResult(),Ce(this,De,no).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return oo(T(this,Se),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return oo(T(this,Se),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ce(this,De,so).call(this),Ce(this,De,io).call(this),T(this,Se).removeObserver(this)}setOptions(t){const r=this.options,n=T(this,Se);if(this.options=T(this,At).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Pt(this.options.enabled,T(this,Se))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ce(this,De,ao).call(this),T(this,Se).setOptions(this.options),r._defaulted&&!Ka(this.options,r)&&T(this,At).getQueryCache().notify({type:"observerOptionsUpdated",query:T(this,Se),observer:this});const s=this.hasListeners();s&&$l(T(this,Se),n,this.options,r)&&Ce(this,De,hs).call(this),this.updateResult(),s&&(T(this,Se)!==n||Pt(this.options.enabled,T(this,Se))!==Pt(r.enabled,T(this,Se))||$r(this.options.staleTime,T(this,Se))!==$r(r.staleTime,T(this,Se)))&&Ce(this,De,eo).call(this);const i=Ce(this,De,to).call(this);s&&(T(this,Se)!==n||Pt(this.options.enabled,T(this,Se))!==Pt(r.enabled,T(this,Se))||i!==T(this,Lr))&&Ce(this,De,ro).call(this,i)}getOptimisticResult(t){const r=T(this,At).getQueryCache().build(T(this,At),t),n=this.createResult(r,t);return Vp(this,n)&&(Y(this,_t,n),Y(this,Rn,this.options),Y(this,nn,T(this,Se).state)),n}getCurrentResult(){return T(this,_t)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&T(this,vr).status==="pending"&&T(this,vr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){T(this,Ln).add(t)}getCurrentQuery(){return T(this,Se)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=T(this,At).defaultQueryOptions(t),n=T(this,At).getQueryCache().build(T(this,At),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return Ce(this,De,hs).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),T(this,_t)))}createResult(t,r){var M;const n=T(this,Se),s=this.options,i=T(this,_t),a=T(this,nn),o=T(this,Rn),u=t!==n?t.state:T(this,Rs),{state:f}=t;let d={...f},g=!1,p;if(r._optimisticResults){const $=this.hasListeners(),D=!$&&Bl(t,r),j=$&&$l(t,n,r,s);(D||j)&&(d={...d,...bd(f.data,t.options)}),r._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:w,errorUpdatedAt:h,status:y}=d;p=d.data;let v=!1;if(r.placeholderData!==void 0&&p===void 0&&y==="pending"){let $;i!=null&&i.isPlaceholderData&&r.placeholderData===(o==null?void 0:o.placeholderData)?($=i.data,v=!0):$=typeof r.placeholderData=="function"?r.placeholderData((M=T(this,jn))==null?void 0:M.state.data,T(this,jn)):r.placeholderData,$!==void 0&&(y="success",p=Za(i==null?void 0:i.data,$,r),g=!0)}if(r.select&&p!==void 0&&!v)if(i&&p===(a==null?void 0:a.data)&&r.select===T(this,ks))p=T(this,kn);else try{Y(this,ks,r.select),p=r.select(p),p=Za(i==null?void 0:i.data,p,r),Y(this,kn,p),Y(this,jr,null)}catch($){Y(this,jr,$)}T(this,jr)&&(w=T(this,jr),p=T(this,kn),h=Date.now(),y="error");const b=d.fetchStatus==="fetching",C=y==="pending",S=y==="error",_=C&&b,E=p!==void 0,R={status:y,fetchStatus:d.fetchStatus,isPending:C,isSuccess:y==="success",isError:S,isInitialLoading:_,isLoading:_,data:p,dataUpdatedAt:d.dataUpdatedAt,error:w,errorUpdatedAt:h,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:d.dataUpdateCount>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:b,isRefetching:b&&!C,isLoadingError:S&&!E,isPaused:d.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:S&&E,isStale:Ho(t,r),refetch:this.refetch,promise:T(this,vr),isEnabled:Pt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const $=R.data!==void 0,D=R.status==="error"&&!$,j=L=>{D?L.reject(R.error):$&&L.resolve(R.data)},P=()=>{const L=Y(this,vr,R.promise=Xa());j(L)},k=T(this,vr);switch(k.status){case"pending":t.queryHash===n.queryHash&&j(k);break;case"fulfilled":(D||R.data!==k.value)&&P();break;case"rejected":(!D||R.error!==k.reason)&&P();break}}return R}updateResult(){const t=T(this,_t),r=this.createResult(T(this,Se),this.options);if(Y(this,nn,T(this,Se).state),Y(this,Rn,this.options),T(this,nn).data!==void 0&&Y(this,jn,T(this,Se)),Ka(r,t))return;Y(this,_t,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!T(this,Ln).size)return!0;const a=new Set(i??T(this,Ln));return this.options.throwOnError&&a.add("error"),Object.keys(T(this,_t)).some(o=>{const l=o;return T(this,_t)[l]!==t[l]&&a.has(l)})};Ce(this,De,wd).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ce(this,De,no).call(this)}},At=new WeakMap,Se=new WeakMap,Rs=new WeakMap,_t=new WeakMap,nn=new WeakMap,Rn=new WeakMap,vr=new WeakMap,jr=new WeakMap,ks=new WeakMap,kn=new WeakMap,jn=new WeakMap,sn=new WeakMap,an=new WeakMap,Lr=new WeakMap,Ln=new WeakMap,De=new WeakSet,hs=function(t){Ce(this,De,ao).call(this);let r=T(this,Se).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Dt)),r},eo=function(){Ce(this,De,so).call(this);const t=$r(this.options.staleTime,T(this,Se));if(_s.isServer()||T(this,_t).isStale||!Ga(t))return;const n=fd(T(this,_t).dataUpdatedAt,t)+1;Y(this,sn,Wr.setTimeout(()=>{T(this,_t).isStale||this.updateResult()},n))},to=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(T(this,Se)):this.options.refetchInterval)??!1},ro=function(t){Ce(this,De,io).call(this),Y(this,Lr,t),!(_s.isServer()||Pt(this.options.enabled,T(this,Se))===!1||!Ga(T(this,Lr))||T(this,Lr)===0)&&Y(this,an,Wr.setInterval(()=>{(this.options.refetchIntervalInBackground||zo.isFocused())&&Ce(this,De,hs).call(this)},T(this,Lr)))},no=function(){Ce(this,De,eo).call(this),Ce(this,De,ro).call(this,Ce(this,De,to).call(this))},so=function(){T(this,sn)!==void 0&&(Wr.clearTimeout(T(this,sn)),Y(this,sn,void 0))},io=function(){T(this,an)!==void 0&&(Wr.clearInterval(T(this,an)),Y(this,an,void 0))},ao=function(){const t=T(this,At).getQueryCache().build(T(this,At),this.options);if(t===T(this,Se))return;const r=T(this,Se);Y(this,Se,t),Y(this,Rs,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},wd=function(t){dt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(T(this,_t))}),T(this,At).getQueryCache().notify({query:T(this,Se),type:"observerResultsUpdated"})})},od);function zp(e,t){return Pt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Pt(t.retryOnMount,e)===!1)}function Bl(e,t){return zp(e,t)||e.state.data!==void 0&&oo(e,t,t.refetchOnMount)}function oo(e,t,r){if(Pt(t.enabled,e)!==!1&&$r(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Ho(e,t)}return!1}function $l(e,t,r,n){return(e!==t||Pt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Ho(e,r)}function Ho(e,t){return Pt(t.enabled,e)!==!1&&e.isStaleByTime($r(t.staleTime,e))}function Vp(e,t){return!Ka(e.getCurrentResult(),t)}var js,ur,vt,on,dr,Ir,ld,Hp=(ld=class extends yd{constructor(t){super();ae(this,dr);ae(this,js);ae(this,ur);ae(this,vt);ae(this,on);Y(this,js,t.client),this.mutationId=t.mutationId,Y(this,vt,t.mutationCache),Y(this,ur,[]),this.state=t.state||Qp(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){T(this,ur).includes(t)||(T(this,ur).push(t),this.clearGcTimeout(),T(this,vt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Y(this,ur,T(this,ur).filter(r=>r!==t)),this.scheduleGc(),T(this,vt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){T(this,ur).length||(this.state.status==="pending"?this.scheduleGc():T(this,vt).remove(this))}continue(){var t;return((t=T(this,on))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var a,o,l,u,f,d,g,p,w,h,y,v,b,C,S,_,E,N;const r=()=>{Ce(this,dr,Ir).call(this,{type:"continue"})},n={client:T(this,js),meta:this.options.meta,mutationKey:this.options.mutationKey};Y(this,on,gd({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(R,M)=>{Ce(this,dr,Ir).call(this,{type:"failed",failureCount:R,error:M})},onPause:()=>{Ce(this,dr,Ir).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>T(this,vt).canRun(this)}));const s=this.state.status==="pending",i=!T(this,on).canStart();try{if(s)r();else{Ce(this,dr,Ir).call(this,{type:"pending",variables:t,isPaused:i}),T(this,vt).config.onMutate&&await T(this,vt).config.onMutate(t,this,n);const M=await((o=(a=this.options).onMutate)==null?void 0:o.call(a,t,n));M!==this.state.context&&Ce(this,dr,Ir).call(this,{type:"pending",context:M,variables:t,isPaused:i})}const R=await T(this,on).start();return await((u=(l=T(this,vt).config).onSuccess)==null?void 0:u.call(l,R,t,this.state.context,this,n)),await((d=(f=this.options).onSuccess)==null?void 0:d.call(f,R,t,this.state.context,n)),await((p=(g=T(this,vt).config).onSettled)==null?void 0:p.call(g,R,null,this.state.variables,this.state.context,this,n)),await((h=(w=this.options).onSettled)==null?void 0:h.call(w,R,null,t,this.state.context,n)),Ce(this,dr,Ir).call(this,{type:"success",data:R}),R}catch(R){try{await((v=(y=T(this,vt).config).onError)==null?void 0:v.call(y,R,t,this.state.context,this,n))}catch(M){Promise.reject(M)}try{await((C=(b=this.options).onError)==null?void 0:C.call(b,R,t,this.state.context,n))}catch(M){Promise.reject(M)}try{await((_=(S=T(this,vt).config).onSettled)==null?void 0:_.call(S,void 0,R,this.state.variables,this.state.context,this,n))}catch(M){Promise.reject(M)}try{await((N=(E=this.options).onSettled)==null?void 0:N.call(E,void 0,R,t,this.state.context,n))}catch(M){Promise.reject(M)}throw Ce(this,dr,Ir).call(this,{type:"error",error:R}),R}finally{T(this,vt).runNext(this)}}},js=new WeakMap,ur=new WeakMap,vt=new WeakMap,on=new WeakMap,dr=new WeakSet,Ir=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),dt.batch(()=>{T(this,ur).forEach(n=>{n.onMutationUpdate(t)}),T(this,vt).notify({mutation:this,type:"updated",action:t})})},ld);function Qp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var br,Zt,Ls,cd,Gp=(cd=class extends Ps{constructor(t={}){super();ae(this,br);ae(this,Zt);ae(this,Ls);this.config=t,Y(this,br,new Set),Y(this,Zt,new Map),Y(this,Ls,0)}build(t,r,n){const s=new Hp({client:t,mutationCache:this,mutationId:++Ys(this,Ls)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){T(this,br).add(t);const r=Zs(t);if(typeof r=="string"){const n=T(this,Zt).get(r);n?n.push(t):T(this,Zt).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(T(this,br).delete(t)){const r=Zs(t);if(typeof r=="string"){const n=T(this,Zt).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&T(this,Zt).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Zs(t);if(typeof r=="string"){const n=T(this,Zt).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=Zs(t);if(typeof r=="string"){const s=(n=T(this,Zt).get(r))==null?void 0:n.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){dt.batch(()=>{T(this,br).forEach(t=>{this.notify({type:"removed",mutation:t})}),T(this,br).clear(),T(this,Zt).clear()})}getAll(){return Array.from(T(this,br))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>kl(r,n))}findAll(t={}){return this.getAll().filter(r=>kl(t,r))}notify(t){dt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return dt.batch(()=>Promise.all(t.map(r=>r.continue().catch(Dt))))}},br=new WeakMap,Zt=new WeakMap,Ls=new WeakMap,cd);function Zs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var fr,ud,Wp=(ud=class extends Ps{constructor(t={}){super();ae(this,fr);this.config=t,Y(this,fr,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??Vo(s,r);let a=this.get(i);return a||(a=new qp({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(a)),a}add(t){T(this,fr).has(t.queryHash)||(T(this,fr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=T(this,fr).get(t.queryHash);r&&(t.destroy(),r===t&&T(this,fr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){dt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return T(this,fr).get(t)}getAll(){return[...T(this,fr).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Rl(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>Rl(t,n)):r}notify(t){dt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){dt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){dt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},fr=new WeakMap,ud),Ye,Pr,Fr,Pn,Fn,Mr,Mn,Bn,dd,Kp=(dd=class{constructor(e={}){ae(this,Ye);ae(this,Pr);ae(this,Fr);ae(this,Pn);ae(this,Fn);ae(this,Mr);ae(this,Mn);ae(this,Bn);Y(this,Ye,e.queryCache||new Wp),Y(this,Pr,e.mutationCache||new Gp),Y(this,Fr,e.defaultOptions||{}),Y(this,Pn,new Map),Y(this,Fn,new Map),Y(this,Mr,0)}mount(){Ys(this,Mr)._++,T(this,Mr)===1&&(Y(this,Mn,zo.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,Ye).onFocus())})),Y(this,Bn,Oi.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,Ye).onOnline())})))}unmount(){var e,t;Ys(this,Mr)._--,T(this,Mr)===0&&((e=T(this,Mn))==null||e.call(this),Y(this,Mn,void 0),(t=T(this,Bn))==null||t.call(this),Y(this,Bn,void 0))}isFetching(e){return T(this,Ye).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return T(this,Pr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=T(this,Ye).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=T(this,Ye).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime($r(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return T(this,Ye).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=T(this,Ye).get(n.queryHash),i=s==null?void 0:s.state.data,a=Ap(t,i);if(a!==void 0)return T(this,Ye).build(this,n).setData(a,{...r,manual:!0})}setQueriesData(e,t,r){return dt.batch(()=>T(this,Ye).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=T(this,Ye).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=T(this,Ye);dt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=T(this,Ye);return dt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=dt.batch(()=>T(this,Ye).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Dt).catch(Dt)}invalidateQueries(e,t={}){return dt.batch(()=>(T(this,Ye).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=dt.batch(()=>T(this,Ye).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(Dt)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Dt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=T(this,Ye).build(this,t);return r.isStaleByTime($r(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Dt).catch(Dt)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Dt).catch(Dt)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Oi.isOnline()?T(this,Pr).resumePausedMutations():Promise.resolve()}getQueryCache(){return T(this,Ye)}getMutationCache(){return T(this,Pr)}getDefaultOptions(){return T(this,Fr)}setDefaultOptions(e){Y(this,Fr,e)}setQueryDefaults(e,t){T(this,Pn).set(Ss(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...T(this,Pn).values()],r={};return t.forEach(n=>{xs(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){T(this,Fn).set(Ss(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...T(this,Fn).values()],r={};return t.forEach(n=>{xs(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...T(this,Fr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Vo(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Ii&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...T(this,Fr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){T(this,Ye).clear(),T(this,Pr).clear()}},Ye=new WeakMap,Pr=new WeakMap,Fr=new WeakMap,Pn=new WeakMap,Fn=new WeakMap,Mr=new WeakMap,Mn=new WeakMap,Bn=new WeakMap,dd),Cd=Ae.createContext(void 0),Yp=e=>{const t=Ae.useContext(Cd);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Zp=({client:e,children:t})=>(Ae.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(Cd.Provider,{value:e,children:t})),Sd=Ae.createContext(!1),Xp=()=>Ae.useContext(Sd);Sd.Provider;function Jp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var em=Ae.createContext(Jp()),tm=()=>Ae.useContext(em),rm=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?pd(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},nm=e=>{Ae.useEffect(()=>{e.clearReset()},[e])},sm=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||pd(r,[e.error,n])),im=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},am=(e,t)=>e.isLoading&&e.isFetching&&!t,om=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,ql=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function lm(e,t,r){var p,w,h,y;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=Xp(),s=tm(),i=Yp(),a=i.defaultQueryOptions(e);(w=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||w.call(p,a);const o=i.getQueryCache().get(a.queryHash);process.env.NODE_ENV!=="production"&&(a.queryFn||console.error(`[${a.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const l=e.subscribed!==!1;a._optimisticResults=n?"isRestoring":l?"optimistic":void 0,im(a),rm(a,s,o),nm(s);const u=!i.getQueryCache().get(a.queryHash),[f]=Ae.useState(()=>new t(i,a)),d=f.getOptimisticResult(a),g=!n&&l;if(Ae.useSyncExternalStore(Ae.useCallback(v=>{const b=g?f.subscribe(dt.batchCalls(v)):Dt;return f.updateResult(),b},[f,g]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),Ae.useEffect(()=>{f.setOptions(a)},[a,f]),om(a,d))throw ql(a,f,s);if(sm({result:d,errorResetBoundary:s,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw d.error;if((y=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,a,d),a.experimental_prefetchInRender&&!_s.isServer()&&am(d,n)){const v=u?ql(a,f,s):o==null?void 0:o.promise;v==null||v.catch(Dt).finally(()=>{f.updateResult()})}return a.notifyOnChangeProps?d:f.trackResult(d)}function $n(e,t){return lm(e,Up)}let cm={data:""},um=e=>{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||cm},dm=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,fm=/\/\*[^]*?\*\/| +/g,Ul=/\n+/g,Nr=(e,t)=>{let r="",n="",s="";for(let i in e){let a=e[i];i[0]=="@"?i[1]=="i"?r=i+" "+a+";":n+=i[1]=="f"?Nr(a,i):i+"{"+Nr(a,i[1]=="k"?"":t)+"}":typeof a=="object"?n+=Nr(a,t?t.replace(/([^,])+/g,o=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,o):o?o+" "+l:l)):i):a!=null&&(i=i[1]=="-"?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=Nr.p?Nr.p(i,a):i+":"+a+";")}return r+(t&&s?t+"{"+s+"}":s)+n},_r={},xd=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+xd(e[r]);return t}return e},hm=(e,t,r,n,s)=>{let i=xd(e),a=_r[i]||(_r[i]=(l=>{let u=0,f=11;for(;u<l.length;)f=101*f+l.charCodeAt(u++)>>>0;return"go"+f})(i));if(!_r[a]){let l=i!==e?e:(u=>{let f,d,g=[{}];for(;f=dm.exec(u.replace(fm,""));)f[4]?g.shift():f[3]?(d=f[3].replace(Ul," ").trim(),g.unshift(g[0][d]=g[0][d]||{})):g[0][f[1]]=f[2].replace(Ul," ").trim();return g[0]})(e);_r[a]=Nr(s?{["@keyframes "+a]:l}:l,r?"":"."+a)}let o=r&&_r.g;return r&&(_r.g=_r[a]),((l,u,f,d)=>{d?u.data=u.data.replace(d,l):u.data.indexOf(l)===-1&&(u.data=f?l+u.data:u.data+l)})(_r[a],t,n,o),a},pm=(e,t,r)=>e.reduce((n,s,i)=>{let a=t[i];if(a&&a.call){let o=a(r),l=o&&o.props&&o.props.className||/^go/.test(o)&&o;a=l?"."+l:o&&typeof o=="object"?o.props?"":Nr(o,""):o===!1?"":o}return n+s+(a??"")},"");function Hi(e){let t=this||{},r=e.call?e(t.p):e;return hm(r.unshift?r.raw?pm(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,um(t.target),t.g,t.o,t.k)}let _d,lo,co;Hi.bind({g:1});let wr=Hi.bind({k:1});function mm(e,t,r,n){Nr.p=t,_d=e,lo=r,co=n}function Ur(e,t){let r=this||{};return function(){let n=arguments;function s(i,a){let o=Object.assign({},i),l=o.className||s.className;r.p=Object.assign({theme:lo&&lo()},o),r.o=/go\d/.test(l),o.className=Hi.apply(r,n)+(l?" "+l:"");let u=e;return e[0]&&(u=o.as||e,delete o.as),co&&u[0]&&co(o),_d(u,o)}return s}}var gm=e=>typeof e=="function",Ai=(e,t)=>gm(e)?e(t):e,ym=(()=>{let e=0;return()=>(++e).toString()})(),Td=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),vm=20,Qo="default",Ed=(e,t)=>{let{toastLimit:r}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,r)};case 1:return{...e,toasts:e.toasts.map(a=>a.id===t.toast.id?{...a,...t.toast}:a)};case 2:let{toast:n}=t;return Ed(e,{type:e.toasts.find(a=>a.id===n.id)?1:0,toast:n});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(a=>a.id===s||s===void 0?{...a,dismissed:!0,visible:!1}:a)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(a=>a.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(a=>({...a,pauseDuration:a.pauseDuration+i}))}}},di=[],Id={toasts:[],pausedAt:void 0,settings:{toastLimit:vm}},hr={},Od=(e,t=Qo)=>{hr[t]=Ed(hr[t]||Id,e),di.forEach(([r,n])=>{r===t&&n(hr[t])})},Ad=e=>Object.keys(hr).forEach(t=>Od(e,t)),bm=e=>Object.keys(hr).find(t=>hr[t].toasts.some(r=>r.id===e)),Qi=(e=Qo)=>t=>{Od(t,e)},wm={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Cm=(e={},t=Qo)=>{let[r,n]=m.useState(hr[t]||Id),s=m.useRef(hr[t]);m.useEffect(()=>(s.current!==hr[t]&&n(hr[t]),di.push([t,n]),()=>{let a=di.findIndex(([o])=>o===t);a>-1&&di.splice(a,1)}),[t]);let i=r.toasts.map(a=>{var o,l,u;return{...e,...e[a.type],...a,removeDelay:a.removeDelay||((o=e[a.type])==null?void 0:o.removeDelay)||(e==null?void 0:e.removeDelay),duration:a.duration||((l=e[a.type])==null?void 0:l.duration)||(e==null?void 0:e.duration)||wm[a.type],style:{...e.style,...(u=e[a.type])==null?void 0:u.style,...a.style}}});return{...r,toasts:i}},Sm=(e,t="blank",r)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...r,id:(r==null?void 0:r.id)||ym()}),Fs=e=>(t,r)=>{let n=Sm(t,e,r);return Qi(n.toasterId||bm(n.id))({type:2,toast:n}),n.id},tt=(e,t)=>Fs("blank")(e,t);tt.error=Fs("error");tt.success=Fs("success");tt.loading=Fs("loading");tt.custom=Fs("custom");tt.dismiss=(e,t)=>{let r={type:3,toastId:e};t?Qi(t)(r):Ad(r)};tt.dismissAll=e=>tt.dismiss(void 0,e);tt.remove=(e,t)=>{let r={type:4,toastId:e};t?Qi(t)(r):Ad(r)};tt.removeAll=e=>tt.remove(void 0,e);tt.promise=(e,t,r)=>{let n=tt.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?Ai(t.success,s):void 0;return i?tt.success(i,{id:n,...r,...r==null?void 0:r.success}):tt.dismiss(n),s}).catch(s=>{let i=t.error?Ai(t.error,s):void 0;i?tt.error(i,{id:n,...r,...r==null?void 0:r.error}):tt.dismiss(n)}),e};var xm=1e3,_m=(e,t="default")=>{let{toasts:r,pausedAt:n}=Cm(e,t),s=m.useRef(new Map).current,i=m.useCallback((d,g=xm)=>{if(s.has(d))return;let p=setTimeout(()=>{s.delete(d),a({type:4,toastId:d})},g);s.set(d,p)},[]);m.useEffect(()=>{if(n)return;let d=Date.now(),g=r.map(p=>{if(p.duration===1/0)return;let w=(p.duration||0)+p.pauseDuration-(d-p.createdAt);if(w<0){p.visible&&tt.dismiss(p.id);return}return setTimeout(()=>tt.dismiss(p.id,t),w)});return()=>{g.forEach(p=>p&&clearTimeout(p))}},[r,n,t]);let a=m.useCallback(Qi(t),[t]),o=m.useCallback(()=>{a({type:5,time:Date.now()})},[a]),l=m.useCallback((d,g)=>{a({type:1,toast:{id:d,height:g}})},[a]),u=m.useCallback(()=>{n&&a({type:6,time:Date.now()})},[n,a]),f=m.useCallback((d,g)=>{let{reverseOrder:p=!1,gutter:w=8,defaultPosition:h}=g||{},y=r.filter(C=>(C.position||h)===(d.position||h)&&C.height),v=y.findIndex(C=>C.id===d.id),b=y.filter((C,S)=>S<v&&C.visible).length;return y.filter(C=>C.visible).slice(...p?[b+1]:[0,b]).reduce((C,S)=>C+(S.height||0)+w,0)},[r]);return m.useEffect(()=>{r.forEach(d=>{if(d.dismissed)i(d.id,d.removeDelay);else{let g=s.get(d.id);g&&(clearTimeout(g),s.delete(d.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:l,startPause:o,endPause:u,calculateOffset:f}}},Tm=wr`
|
|
2
2
|
from {
|
|
3
3
|
transform: scale(0) rotate(45deg);
|
|
4
4
|
opacity: 0;
|
|
@@ -93,7 +93,7 @@ to {
|
|
|
93
93
|
100% {
|
|
94
94
|
opacity: 1;
|
|
95
95
|
height: 10px;
|
|
96
|
-
}`,
|
|
96
|
+
}`,km=Ur("div")`
|
|
97
97
|
width: 20px;
|
|
98
98
|
opacity: 0;
|
|
99
99
|
height: 20px;
|
|
@@ -120,7 +120,7 @@ to {
|
|
|
120
120
|
height: 10px;
|
|
121
121
|
width: 6px;
|
|
122
122
|
}
|
|
123
|
-
`,
|
|
123
|
+
`,jm=Ur("div")`
|
|
124
124
|
position: absolute;
|
|
125
125
|
`,Lm=Ur("div")`
|
|
126
126
|
position: relative;
|
|
@@ -144,7 +144,7 @@ to {
|
|
|
144
144
|
min-width: 20px;
|
|
145
145
|
animation: ${Pm} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
146
146
|
forwards;
|
|
147
|
-
`,Mm=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?Ae.createElement(Fm,null,t):t:r==="blank"?null:Ae.createElement(Lm,null,Ae.createElement(Dm,{...n}),r!=="loading"&&Ae.createElement(
|
|
147
|
+
`,Mm=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?Ae.createElement(Fm,null,t):t:r==="blank"?null:Ae.createElement(Lm,null,Ae.createElement(Dm,{...n}),r!=="loading"&&Ae.createElement(jm,null,r==="error"?Ae.createElement(Om,{...n}):Ae.createElement(km,{...n})))},Bm=e=>`
|
|
148
148
|
0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;}
|
|
149
149
|
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
|
|
150
150
|
`,$m=e=>`
|
|
@@ -169,21 +169,21 @@ to {
|
|
|
169
169
|
color: inherit;
|
|
170
170
|
flex: 1 1 auto;
|
|
171
171
|
white-space: pre-line;
|
|
172
|
-
`,Hm=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=
|
|
172
|
+
`,Hm=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=Td()?[qm,Um]:[Bm(r),$m(r)];return{animation:t?`${wr(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${wr(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},Qm=Ae.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?Hm(e.position||t||"top-center",e.visible):{opacity:0},i=Ae.createElement(Mm,{toast:e}),a=Ae.createElement(Vm,{...e.ariaProps},Ai(e.message,e));return Ae.createElement(zm,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:a}):Ae.createElement(Ae.Fragment,null,i,a))});mm(Ae.createElement);var Gm=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=Ae.useCallback(a=>{if(a){let o=()=>{let l=a.getBoundingClientRect().height;n(e,l)};o(),new MutationObserver(o).observe(a,{subtree:!0,childList:!0,characterData:!0})}},[e,n]);return Ae.createElement("div",{ref:i,className:t,style:r},s)},Wm=(e,t)=>{let r=e.includes("top"),n=r?{top:0}:{bottom:0},s=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:Td()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},Km=Hi`
|
|
173
173
|
z-index: 9999;
|
|
174
174
|
> * {
|
|
175
175
|
pointer-events: auto;
|
|
176
176
|
}
|
|
177
|
-
`,Xs=16,Ym=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:a,containerClassName:o})=>{let{toasts:l,handlers:u}=_m(r,i);return Ae.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Xs,left:Xs,right:Xs,bottom:Xs,pointerEvents:"none",...a},className:o,onMouseEnter:u.startPause,onMouseLeave:u.endPause},l.map(f=>{let d=f.position||t,g=u.calculateOffset(f,{reverseOrder:e,gutter:n,defaultPosition:t}),p=Wm(d,g);return Ae.createElement(Gm,{id:f.id,key:f.id,onHeightUpdate:u.updateHeight,className:f.visible?Km:"",style:p},f.type==="custom"?Ai(f.message,f):s?s(f):Ae.createElement(Qm,{toast:f,position:d}))}))},Ee=tt;function Zm(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return m.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const
|
|
177
|
+
`,Xs=16,Ym=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:a,containerClassName:o})=>{let{toasts:l,handlers:u}=_m(r,i);return Ae.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Xs,left:Xs,right:Xs,bottom:Xs,pointerEvents:"none",...a},className:o,onMouseEnter:u.startPause,onMouseLeave:u.endPause},l.map(f=>{let d=f.position||t,g=u.calculateOffset(f,{reverseOrder:e,gutter:n,defaultPosition:t}),p=Wm(d,g);return Ae.createElement(Gm,{id:f.id,key:f.id,onHeightUpdate:u.updateHeight,className:f.visible?Km:"",style:p},f.type==="custom"?Ai(f.message,f):s?s(f):Ae.createElement(Qm,{toast:f,position:d}))}))},Ee=tt;function Zm(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return m.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const Gi=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Hn(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Go(e){return"nodeType"in e}function Tt(e){var t,r;return e?Hn(e)?e:Go(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Wo(e){const{Document:t}=Tt(e);return e instanceof t}function Ms(e){return Hn(e)?!1:e instanceof Tt(e).HTMLElement}function Dd(e){return e instanceof Tt(e).SVGElement}function Qn(e){return e?Hn(e)?e.document:Go(e)?Wo(e)?e:Ms(e)||Dd(e)?e.ownerDocument:document:document:document}const Jt=Gi?m.useLayoutEffect:m.useEffect;function Wi(e){const t=m.useRef(e);return Jt(()=>{t.current=e}),m.useCallback(function(){for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return t.current==null?void 0:t.current(...n)},[])}function Xm(){const e=m.useRef(null),t=m.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=m.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Ts(e,t){t===void 0&&(t=[e]);const r=m.useRef(e);return Jt(()=>{r.current!==e&&(r.current=e)},t),r}function Bs(e,t){const r=m.useRef();return m.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function Di(e){const t=Wi(e),r=m.useRef(null),n=m.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function Ni(e){const t=m.useRef();return m.useEffect(()=>{t.current=e},[e]),t.current}let ma={};function $s(e,t){return m.useMemo(()=>{if(t)return t;const r=ma[e]==null?0:ma[e]+1;return ma[e]=r,e+"-"+r},[e,t])}function Nd(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return n.reduce((i,a)=>{const o=Object.entries(a);for(const[l,u]of o){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const En=Nd(1),Es=Nd(-1);function Jm(e){return"clientX"in e&&"clientY"in e}function Ki(e){if(!e)return!1;const{KeyboardEvent:t}=Tt(e.target);return t&&e instanceof t}function eg(e){if(!e)return!1;const{TouchEvent:t}=Tt(e.target);return t&&e instanceof t}function Ri(e){if(eg(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Jm(e)?{x:e.clientX,y:e.clientY}:null}const qr=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[qr.Translate.toString(e),qr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),zl="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function tg(e){return e.matches(zl)?e:e.querySelector(zl)}const rg={display:"none"};function ng(e){let{id:t,value:r}=e;return m.createElement("div",{id:t,style:rg},r)}function sg(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return m.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function ig(){const[e,t]=m.useState("");return{announce:m.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Rd=m.createContext(null);function ag(e){const t=m.useContext(Rd);m.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function og(){const[e]=m.useState(()=>new Set),t=m.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[m.useCallback(n=>{let{type:s,event:i}=n;e.forEach(a=>{var o;return(o=a[s])==null?void 0:o.call(a,i)})},[e]),t]}const lg={draggable:`
|
|
178
178
|
To pick up a draggable item, press the space bar.
|
|
179
179
|
While dragging, use the arrow keys to move the item.
|
|
180
180
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
181
|
-
`},cg={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function ug(e){let{announcements:t=cg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=lg}=e;const{announce:i,announcement:a}=ig(),o=$s("DndLiveRegion"),[l,u]=m.useState(!1);if(m.useEffect(()=>{u(!0)},[]),ag(m.useMemo(()=>({onDragStart(d){let{active:g}=d;i(t.onDragStart({active:g}))},onDragMove(d){let{active:g,over:p}=d;t.onDragMove&&i(t.onDragMove({active:g,over:p}))},onDragOver(d){let{active:g,over:p}=d;i(t.onDragOver({active:g,over:p}))},onDragEnd(d){let{active:g,over:p}=d;i(t.onDragEnd({active:g,over:p}))},onDragCancel(d){let{active:g,over:p}=d;i(t.onDragCancel({active:g,over:p}))}}),[i,t])),!l)return null;const f=m.createElement(m.Fragment,null,m.createElement(ng,{id:n,value:s.draggable}),m.createElement(sg,{id:o,announcement:a}));return r?Br.createPortal(f,r):f}var et;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(et||(et={}));function ji(){}function ho(e,t){return m.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Ld(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return m.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const er=Object.freeze({x:0,y:0});function Pd(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function dg(e,t){const r=Ri(e);if(!r)return"0 0";const n={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return n.x+"% "+n.y+"%"}function Fd(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function fg(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Ql(e){let{left:t,top:r,height:n,width:s}=e;return[{x:t,y:r},{x:t+s,y:r},{x:t,y:r+n},{x:t+s,y:r+n}]}function Md(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function Gl(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const hg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Gl(t,t.left,t.top),i=[];for(const a of n){const{id:o}=a,l=r.get(o);if(l){const u=Pd(Gl(l),s);i.push({id:o,data:{droppableContainer:a,value:u}})}}return i.sort(Fd)},pg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Ql(t),i=[];for(const a of n){const{id:o}=a,l=r.get(o);if(l){const u=Ql(l),f=s.reduce((g,p,w)=>g+Pd(u[w],p),0),d=Number((f/4).toFixed(4));i.push({id:o,data:{droppableContainer:a,value:d}})}}return i.sort(Fd)};function mg(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=s-n,o=i-r;if(n<s&&r<i){const l=t.width*t.height,u=e.width*e.height,f=a*o,d=f/(l+u-f);return Number(d.toFixed(4))}return 0}const gg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const i of n){const{id:a}=i,o=r.get(a);if(o){const l=mg(o,t);l>0&&s.push({id:a,data:{droppableContainer:i,value:l}})}}return s.sort(fg)};function yg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Bd(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:er}function vg(e){return function(r){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return s.reduce((a,o)=>({...a,top:a.top+e*o.y,bottom:a.bottom+e*o.y,left:a.left+e*o.x,right:a.right+e*o.x}),{...r})}}const bg=vg(1);function $d(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function wg(e,t,r){const n=$d(t);if(!n)return e;const{scaleX:s,scaleY:i,x:a,y:o}=n,l=e.left-a-(1-s)*parseFloat(r),u=e.top-o-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),f=s?e.width/s:e.width,d=i?e.height/i:e.height;return{width:f,height:d,top:u,right:l+f,bottom:u+d,left:l}}const Cg={ignoreTransform:!1};function Gn(e,t){t===void 0&&(t=Cg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=Tt(e).getComputedStyle(e);u&&(r=wg(r,u,f))}const{top:n,left:s,width:i,height:a,bottom:o,right:l}=r;return{top:n,left:s,width:i,height:a,bottom:o,right:l}}function Wl(e){return Gn(e,{ignoreTransform:!0})}function Sg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function xg(e,t){return t===void 0&&(t=Tt(e).getComputedStyle(e)),t.position==="fixed"}function _g(e,t){t===void 0&&(t=Tt(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?r.test(i):!1})}function Zi(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Yo(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!Ms(s)||Rd(s)||r.includes(s))return r;const i=Tt(e).getComputedStyle(s);return s!==e&&_g(s,i)&&r.push(s),xg(s,i)?r:n(s.parentNode)}return e?n(e):r}function qd(e){const[t]=Zi(e,1);return t??null}function ya(e){return!Wi||!e?null:Hn(e)?e:Ko(e)?Yo(e)||e===Qn(e).scrollingElement?window:Ms(e)?e:null:null}function Ud(e){return Hn(e)?e.scrollX:e.scrollLeft}function zd(e){return Hn(e)?e.scrollY:e.scrollTop}function po(e){return{x:Ud(e),y:zd(e)}}var ot;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ot||(ot={}));function Vd(e){return!Wi||!e?!1:e===document.scrollingElement}function Hd(e){const t={x:0,y:0},r=Vd(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=n.y,o=e.scrollLeft>=n.x;return{isTop:s,isLeft:i,isBottom:a,isRight:o,maxScroll:n,minScroll:t}}const Tg={x:.2,y:.2};function Eg(e,t,r,n,s){let{top:i,left:a,right:o,bottom:l}=r;n===void 0&&(n=10),s===void 0&&(s=Tg);const{isTop:u,isBottom:f,isLeft:d,isRight:g}=Hd(e),p={x:0,y:0},w={x:0,y:0},h={height:t.height*s.y,width:t.width*s.x};return!u&&i<=t.top+h.height?(p.y=ot.Backward,w.y=n*Math.abs((t.top+h.height-i)/h.height)):!f&&l>=t.bottom-h.height&&(p.y=ot.Forward,w.y=n*Math.abs((t.bottom-h.height-l)/h.height)),!g&&o>=t.right-h.width?(p.x=ot.Forward,w.x=n*Math.abs((t.right-h.width-o)/h.width)):!d&&a<=t.left+h.width&&(p.x=ot.Backward,w.x=n*Math.abs((t.left+h.width-a)/h.width)),{direction:p,speed:w}}function Ig(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:t,left:r,right:n,bottom:s}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:s,width:e.clientWidth,height:e.clientHeight}}function Qd(e){return e.reduce((t,r)=>En(t,po(r)),er)}function Og(e){return e.reduce((t,r)=>t+Ud(r),0)}function Ag(e){return e.reduce((t,r)=>t+zd(r),0)}function Gd(e,t){if(t===void 0&&(t=Gn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);qd(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Dg=[["x",["left","right"],Og],["y",["top","bottom"],Ag]];class Zo{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Zi(r),s=Qd(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,o]of Dg)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=o(n),f=s[i]-u;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ys{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var s;(s=this.target)==null||s.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function Ng(e){const{EventTarget:t}=Tt(e);return e instanceof t?e:Qn(e)}function va(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var Qt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Qt||(Qt={}));function Kl(e){e.preventDefault()}function Rg(e){e.stopPropagation()}var xe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(xe||(xe={}));const Wd={start:[xe.Space,xe.Enter],cancel:[xe.Esc],end:[xe.Space,xe.Enter,xe.Tab]},jg=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case xe.Right:return{...r,x:r.x+25};case xe.Left:return{...r,x:r.x-25};case xe.Down:return{...r,y:r.y+25};case xe.Up:return{...r,y:r.y-25}}};class Xo{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new ys(Qn(r)),this.windowListeners=new ys(Tt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Qt.Resize,this.handleCancel),this.windowListeners.add(Qt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Qt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Gd(n),r(er)}handleKeyDown(t){if(Yi(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=Wd,coordinateGetter:a=jg,scrollBehavior:o="smooth"}=s,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=n.current,f=u?{x:u.left,y:u.top}:er;this.referenceCoordinates||(this.referenceCoordinates=f);const d=a(t,{active:r,context:n.current,currentCoordinates:f});if(d){const g=Es(d,f),p={x:0,y:0},{scrollableAncestors:w}=n.current;for(const h of w){const y=t.code,{isTop:v,isRight:b,isLeft:C,isBottom:S,maxScroll:_,minScroll:E}=Hd(h),N=Ig(h),R={x:Math.min(y===xe.Right?N.right-N.width/2:N.right,Math.max(y===xe.Right?N.left:N.left+N.width/2,d.x)),y:Math.min(y===xe.Down?N.bottom-N.height/2:N.bottom,Math.max(y===xe.Down?N.top:N.top+N.height/2,d.y))},P=y===xe.Right&&!b||y===xe.Left&&!C,B=y===xe.Down&&!S||y===xe.Up&&!v;if(P&&R.x!==d.x){const D=h.scrollLeft+g.x,j=y===xe.Right&&D<=_.x||y===xe.Left&&D>=E.x;if(j&&!g.y){h.scrollTo({left:D,behavior:o});return}j?p.x=h.scrollLeft-D:p.x=y===xe.Right?h.scrollLeft-_.x:h.scrollLeft-E.x,p.x&&h.scrollBy({left:-p.x,behavior:o});break}else if(B&&R.y!==d.y){const D=h.scrollTop+g.y,j=y===xe.Down&&D<=_.y||y===xe.Up&&D>=E.y;if(j&&!g.x){h.scrollTo({top:D,behavior:o});return}j?p.y=h.scrollTop-D:p.y=y===xe.Down?h.scrollTop-_.y:h.scrollTop-E.y,p.y&&h.scrollBy({top:-p.y,behavior:o});break}}this.handleMove(t,En(Es(d,this.referenceCoordinates),p))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Xo.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Wd,onActivation:s}=t,{active:i}=r;const{code:a}=e.nativeEvent;if(n.start.includes(a)){const o=i.activatorNode.current;return o&&e.target!==o?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function Yl(e){return!!(e&&"distance"in e)}function Zl(e){return!!(e&&"delay"in e)}class Jo{constructor(t,r,n){var s;n===void 0&&(n=Ng(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:i}=t,{target:a}=i;this.props=t,this.events=r,this.document=Qn(a),this.documentListeners=new ys(this.document),this.listeners=new ys(n),this.windowListeners=new ys(Tt(a)),this.initialCoordinates=(s=Ri(i))!=null?s:er,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Qt.Resize,this.handleCancel),this.windowListeners.add(Qt.DragStart,Kl),this.windowListeners.add(Qt.VisibilityChange,this.handleCancel),this.windowListeners.add(Qt.ContextMenu,Kl),this.documentListeners.add(Qt.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Zl(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Yl(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:s}=this.props;s(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Qt.Click,Rg,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Qt.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:i}=this,{onMove:a,options:{activationConstraint:o}}=i;if(!s)return;const l=(r=Ri(t))!=null?r:er,u=Es(s,l);if(!n&&o){if(Yl(o)){if(o.tolerance!=null&&va(u,o.tolerance))return this.handleCancel();if(va(u,o.distance))return this.handleStart()}if(Zl(o)&&va(u,o.tolerance))return this.handleCancel();this.handlePending(o,u);return}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===xe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const kg={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Xi extends Jo{constructor(t){const{event:r}=t,n=Qn(r.target);super(t,kg,n)}}Xi.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const Lg={move:{name:"mousemove"},end:{name:"mouseup"}};var mo;(function(e){e[e.RightClick=2]="RightClick"})(mo||(mo={}));class Pg extends Jo{constructor(t){super(t,Lg,Qn(t.event.target))}}Pg.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===mo.RightClick?!1:(n==null||n({event:r}),!0)}}];const ba={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Fg extends Jo{constructor(t){super(t,ba)}static setup(){return window.addEventListener(ba.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ba.move.name,t)};function t(){}}}Fg.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n==null||n({event:r}),!0)}}];var vs;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(vs||(vs={}));var ki;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ki||(ki={}));function Mg(e){let{acceleration:t,activator:r=vs.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:a=5,order:o=ki.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:f,delta:d,threshold:g}=e;const p=$g({delta:d,disabled:!i}),[w,h]=Xm(),y=m.useRef({x:0,y:0}),v=m.useRef({x:0,y:0}),b=m.useMemo(()=>{switch(r){case vs.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case vs.DraggableRect:return s}},[r,s,l]),C=m.useRef(null),S=m.useCallback(()=>{const E=C.current;if(!E)return;const N=y.current.x*v.current.x,R=y.current.y*v.current.y;E.scrollBy(N,R)},[]),_=m.useMemo(()=>o===ki.TreeOrder?[...u].reverse():u,[o,u]);m.useEffect(()=>{if(!i||!u.length||!b){h();return}for(const E of _){if((n==null?void 0:n(E))===!1)continue;const N=u.indexOf(E),R=f[N];if(!R)continue;const{direction:P,speed:B}=Eg(E,R,b,t,g);for(const D of["x","y"])p[D][P[D]]||(B[D]=0,P[D]=0);if(B.x>0||B.y>0){h(),C.current=E,w(S,a),y.current=B,v.current=P;return}}y.current={x:0,y:0},v.current={x:0,y:0},h()},[t,S,n,h,i,a,JSON.stringify(b),JSON.stringify(p),w,u,_,f,JSON.stringify(g)])}const Bg={x:{[ot.Backward]:!1,[ot.Forward]:!1},y:{[ot.Backward]:!1,[ot.Forward]:!1}};function $g(e){let{delta:t,disabled:r}=e;const n=Ni(t);return Bs(s=>{if(r||!n||!s)return Bg;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[ot.Backward]:s.x[ot.Backward]||i.x===-1,[ot.Forward]:s.x[ot.Forward]||i.x===1},y:{[ot.Backward]:s.y[ot.Backward]||i.y===-1,[ot.Forward]:s.y[ot.Forward]||i.y===1}}},[r,t,n])}function qg(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Bs(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function Ug(e,t){return m.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,i=s.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,n)}));return[...r,...i]},[]),[e,t])}var Is;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Is||(Is={}));var go;(function(e){e.Optimized="optimized"})(go||(go={}));const Xl=new Map;function zg(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,a]=m.useState(null),{frequency:o,measure:l,strategy:u}=s,f=m.useRef(e),d=y(),g=Ts(d),p=m.useCallback(function(v){v===void 0&&(v=[]),!g.current&&a(b=>b===null?v:b.concat(v.filter(C=>!b.includes(C))))},[g]),w=m.useRef(null),h=Bs(v=>{if(d&&!r)return Xl;if(!v||v===Xl||f.current!==e||i!=null){const b=new Map;for(let C of e){if(!C)continue;if(i&&i.length>0&&!i.includes(C.id)&&C.rect.current){b.set(C.id,C.rect.current);continue}const S=C.node.current,_=S?new Zo(l(S),S):null;C.rect.current=_,_&&b.set(C.id,_)}return b}return v},[e,i,r,d,l]);return m.useEffect(()=>{f.current=e},[e]),m.useEffect(()=>{d||p()},[r,d]),m.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),m.useEffect(()=>{d||typeof o!="number"||w.current!==null||(w.current=setTimeout(()=>{p(),w.current=null},o))},[o,d,p,...n]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:i!=null};function y(){switch(u){case Is.Always:return!1;case Is.BeforeDragging:return r;default:return!r}}}function el(e,t){return Bs(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function Vg(e,t){return el(e,t)}function Hg(e){let{callback:t,disabled:r}=e;const n=Ki(t),s=m.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return m.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Ji(e){let{callback:t,disabled:r}=e;const n=Ki(t),s=m.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return m.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Qg(e){return new Zo(Gn(e),e)}function Jl(e,t,r){t===void 0&&(t=Qg);const[n,s]=m.useState(null);function i(){s(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??r)!=null?u:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const a=Hg({callback(l){if(e)for(const u of l){const{type:f,target:d}=u;if(f==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),o=Ji({callback:i});return Jt(()=>{i(),e?(o==null||o.observe(e),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(o==null||o.disconnect(),a==null||a.disconnect())},[e]),n}function Gg(e){const t=el(e);return Bd(e,t)}const ec=[];function Wg(e){const t=m.useRef(e),r=Bs(n=>e?n&&n!==ec&&e&&t.current&&e.parentNode===t.current.parentNode?n:Zi(e):ec,[e]);return m.useEffect(()=>{t.current=e},[e]),r}function Kg(e){const[t,r]=m.useState(null),n=m.useRef(e),s=m.useCallback(i=>{const a=ya(i.target);a&&r(o=>o?(o.set(a,po(a)),new Map(o)):null)},[]);return m.useEffect(()=>{const i=n.current;if(e!==i){a(i);const o=e.map(l=>{const u=ya(l);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,po(u)]):null}).filter(l=>l!=null);r(o.length?new Map(o):null),n.current=e}return()=>{a(e),a(i)};function a(o){o.forEach(l=>{const u=ya(l);u==null||u.removeEventListener("scroll",s)})}},[s,e]),m.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>En(i,a),er):Qd(e):er,[e,t])}function tc(e,t){t===void 0&&(t=[]);const r=m.useRef(null);return m.useEffect(()=>{r.current=null},t),m.useEffect(()=>{const n=e!==er;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?Es(e,r.current):er}function Yg(e){m.useEffect(()=>{if(!Wi)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function Zg(e,t){return m.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=a=>{i(a,t)},r},{}),[e,t])}function Kd(e){return m.useMemo(()=>e?Sg(e):null,[e])}const rc=[];function Xg(e,t){t===void 0&&(t=Gn);const[r]=e,n=Kd(r?Tt(r):null),[s,i]=m.useState(rc);function a(){i(()=>e.length?e.map(l=>Vd(l)?n:new Zo(t(l),l)):rc)}const o=Ji({callback:a});return Jt(()=>{o==null||o.disconnect(),a(),e.forEach(l=>o==null?void 0:o.observe(l))},[e]),s}function Yd(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ms(t)?t:e}function Jg(e){let{measure:t}=e;const[r,n]=m.useState(null),s=m.useCallback(u=>{for(const{target:f}of u)if(Ms(f)){n(d=>{const g=t(f);return d?{...d,width:g.width,height:g.height}:g});break}},[t]),i=Ji({callback:s}),a=m.useCallback(u=>{const f=Yd(u);i==null||i.disconnect(),f&&(i==null||i.observe(f)),n(f?t(f):null)},[t,i]),[o,l]=Di(a);return m.useMemo(()=>({nodeRef:o,rect:r,setRef:l}),[r,o,l])}const ey=[{sensor:Xi,options:{}},{sensor:Xo,options:{}}],ty={current:{}},fi={draggable:{measure:Wl},droppable:{measure:Wl,strategy:Is.WhileDragging,frequency:go.Optimized},dragOverlay:{measure:Gn}};class bs extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const ry={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new bs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ji},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:fi,measureDroppableContainers:ji,windowRect:null,measuringScheduled:!1},Zd={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ji,draggableNodes:new Map,over:null,measureDroppableContainers:ji},qs=m.createContext(Zd),Xd=m.createContext(ry);function ny(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new bs}}}function sy(e,t){switch(t.type){case et.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case et.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case et.DragEnd:case et.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case et.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new bs(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case et.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const a=new bs(e.droppable.containers);return a.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:a}}}case et.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new bs(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function iy(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=m.useContext(qs),i=Ni(n),a=Ni(r==null?void 0:r.id);return m.useEffect(()=>{if(!t&&!n&&i&&a!=null){if(!Yi(i)||document.activeElement===i.target)return;const o=s.get(a);if(!o)return;const{activatorNode:l,node:u}=o;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[l.current,u.current]){if(!f)continue;const d=tg(f);if(d){d.focus();break}}})}},[n,t,s,a,i]),null}function Jd(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function ay(e){return m.useMemo(()=>({draggable:{...fi.draggable,...e==null?void 0:e.draggable},droppable:{...fi.droppable,...e==null?void 0:e.droppable},dragOverlay:{...fi.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function oy(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const i=m.useRef(!1),{x:a,y:o}=typeof s=="boolean"?{x:s,y:s}:s;Jt(()=>{if(!a&&!o||!t){i.current=!1;return}if(i.current||!n)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const f=r(u),d=Bd(f,n);if(a||(d.x=0),o||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const g=qd(u);g&&g.scrollBy({top:d.y,left:d.x})}},[t,a,o,n,r])}const ea=m.createContext({...er,scaleX:1,scaleY:1});var Ar;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ar||(Ar={}));const ef=m.memo(function(t){var r,n,s,i;let{id:a,accessibility:o,autoScroll:l=!0,children:u,sensors:f=ey,collisionDetection:d=gg,measuring:g,modifiers:p,...w}=t;const h=m.useReducer(sy,void 0,ny),[y,v]=h,[b,C]=og(),[S,_]=m.useState(Ar.Uninitialized),E=S===Ar.Initialized,{draggable:{active:N,nodes:R,translate:P},droppable:{containers:B}}=y,D=N!=null?R.get(N):null,j=m.useRef({initial:null,translated:null}),M=m.useMemo(()=>{var rt;return N!=null?{id:N,data:(rt=D==null?void 0:D.data)!=null?rt:ty,rect:j}:null},[N,D]),k=m.useRef(null),[L,z]=m.useState(null),[X,ye]=m.useState(null),_e=Ts(w,Object.values(w)),we=$s("DndDescribedBy",a),de=m.useMemo(()=>B.getEnabled(),[B]),Q=ay(g),{droppableRects:ne,measureDroppableContainers:te,measuringScheduled:q}=zg(de,{dragging:E,dependencies:[P.x,P.y],config:Q.droppable}),V=qg(R,N),ie=m.useMemo(()=>X?Ri(X):null,[X]),fe=zr(),J=Vg(V,Q.draggable.measure);oy({activeNode:N!=null?R.get(N):null,config:fe.layoutShiftCompensation,initialRect:J,measure:Q.draggable.measure});const se=Jl(V,Q.draggable.measure,J),je=Jl(V?V.parentElement:null),Te=m.useRef({activatorEvent:null,active:null,activeNode:V,collisionRect:null,collisions:null,droppableRects:ne,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),$e=B.getNodeFor((r=Te.current.over)==null?void 0:r.id),Ve=Jg({measure:Q.dragOverlay.measure}),qe=(n=Ve.nodeRef.current)!=null?n:V,re=E?(s=Ve.rect)!=null?s:se:null,He=!!(Ve.nodeRef.current&&Ve.rect),ze=Gg(He?null:se),Ue=Kd(qe?Tt(qe):null),Ze=Wg(E?$e??V:null),Bt=Xg(Ze),St=Jd(p,{transform:{x:P.x-ze.x,y:P.y-ze.y,scaleX:1,scaleY:1},activatorEvent:X,active:M,activeNodeRect:se,containerNodeRect:je,draggingNodeRect:re,over:Te.current.over,overlayNodeRect:Ve.rect,scrollableAncestors:Ze,scrollableAncestorRects:Bt,windowRect:Ue}),K=ie?En(ie,P):null,pe=Kg(Ze),ve=tc(pe),$t=tc(pe,[se]),x=En(St,ve),O=re?bg(re,St):null,A=M&&O?d({active:M,collisionRect:O,droppableRects:ne,droppableContainers:de,pointerCoordinates:K}):null,U=Md(A,"id"),[$,G]=m.useState(null),H=He?St:En(St,$t),ee=yg(H,(i=$==null?void 0:$.rect)!=null?i:null,se),ge=m.useRef(null),Qe=m.useCallback((rt,ht)=>{let{sensor:xt,options:Wt}=ht;if(k.current==null)return;const qt=R.get(k.current);if(!qt)return;const jt=rt.nativeEvent,nr=new xt({active:k.current,activeNode:qt,event:jt,options:Wt,context:Te,onAbort(lt){if(!R.get(lt))return;const{onDragAbort:sr}=_e.current,mr={id:lt};sr==null||sr(mr),b({type:"onDragAbort",event:mr})},onPending(lt,Sr,sr,mr){if(!R.get(lt))return;const{onDragPending:ts}=_e.current,xr={id:lt,constraint:Sr,initialCoordinates:sr,offset:mr};ts==null||ts(xr),b({type:"onDragPending",event:xr})},onStart(lt){const Sr=k.current;if(Sr==null)return;const sr=R.get(Sr);if(!sr)return;const{onDragStart:mr}=_e.current,es={activatorEvent:jt,active:{id:Sr,data:sr.data,rect:j}};Br.unstable_batchedUpdates(()=>{mr==null||mr(es),_(Ar.Initializing),v({type:et.DragStart,initialCoordinates:lt,active:Sr}),b({type:"onDragStart",event:es}),z(ge.current),ye(jt)})},onMove(lt){v({type:et.DragMove,coordinates:lt})},onEnd:pn(et.DragEnd),onCancel:pn(et.DragCancel)});ge.current=nr;function pn(lt){return async function(){const{active:sr,collisions:mr,over:es,scrollAdjustedTranslate:ts}=Te.current;let xr=null;if(sr&&ts){const{cancelDrop:rs}=_e.current;xr={activatorEvent:jt,active:sr,collisions:mr,delta:ts,over:es},lt===et.DragEnd&&typeof rs=="function"&&await Promise.resolve(rs(xr))&&(lt=et.DragCancel)}k.current=null,Br.unstable_batchedUpdates(()=>{v({type:lt}),_(Ar.Uninitialized),G(null),z(null),ye(null),ge.current=null;const rs=lt===et.DragEnd?"onDragEnd":"onDragCancel";if(xr){const pa=_e.current[rs];pa==null||pa(xr),b({type:rs,event:xr})}})}}},[R]),Et=m.useCallback((rt,ht)=>(xt,Wt)=>{const qt=xt.nativeEvent,jt=R.get(Wt);if(k.current!==null||!jt||qt.dndKit||qt.defaultPrevented)return;const nr={active:jt};rt(xt,ht.options,nr)===!0&&(qt.dndKit={capturedBy:ht.sensor},k.current=Wt,Qe(xt,ht))},[R,Qe]),It=Ug(f,Et);Yg(f),Jt(()=>{se&&S===Ar.Initializing&&_(Ar.Initialized)},[se,S]),m.useEffect(()=>{const{onDragMove:rt}=_e.current,{active:ht,activatorEvent:xt,collisions:Wt,over:qt}=Te.current;if(!ht||!xt)return;const jt={active:ht,activatorEvent:xt,collisions:Wt,delta:{x:x.x,y:x.y},over:qt};Br.unstable_batchedUpdates(()=>{rt==null||rt(jt),b({type:"onDragMove",event:jt})})},[x.x,x.y]),m.useEffect(()=>{const{active:rt,activatorEvent:ht,collisions:xt,droppableContainers:Wt,scrollAdjustedTranslate:qt}=Te.current;if(!rt||k.current==null||!ht||!qt)return;const{onDragOver:jt}=_e.current,nr=Wt.get(U),pn=nr&&nr.rect.current?{id:nr.id,rect:nr.rect.current,data:nr.data,disabled:nr.disabled}:null,lt={active:rt,activatorEvent:ht,collisions:xt,delta:{x:qt.x,y:qt.y},over:pn};Br.unstable_batchedUpdates(()=>{G(pn),jt==null||jt(lt),b({type:"onDragOver",event:lt})})},[U]),Jt(()=>{Te.current={activatorEvent:X,active:M,activeNode:V,collisionRect:O,collisions:A,droppableRects:ne,draggableNodes:R,draggingNode:qe,draggingNodeRect:re,droppableContainers:B,over:$,scrollableAncestors:Ze,scrollAdjustedTranslate:x},j.current={initial:re,translated:O}},[M,V,A,O,R,qe,re,ne,B,$,Ze,x]),Mg({...fe,delta:P,draggingRect:O,pointerCoordinates:K,scrollableAncestors:Ze,scrollableAncestorRects:Bt});const pr=m.useMemo(()=>({active:M,activeNode:V,activeNodeRect:se,activatorEvent:X,collisions:A,containerNodeRect:je,dragOverlay:Ve,draggableNodes:R,droppableContainers:B,droppableRects:ne,over:$,measureDroppableContainers:te,scrollableAncestors:Ze,scrollableAncestorRects:Bt,measuringConfiguration:Q,measuringScheduled:q,windowRect:Ue}),[M,V,se,X,A,je,Ve,R,B,ne,$,te,Ze,Bt,Q,q,Ue]),Jn=m.useMemo(()=>({activatorEvent:X,activators:It,active:M,activeNodeRect:se,ariaDescribedById:{draggable:we},dispatch:v,draggableNodes:R,over:$,measureDroppableContainers:te}),[X,It,M,se,v,we,R,$,te]);return m.createElement(kd.Provider,{value:C},m.createElement(qs.Provider,{value:Jn},m.createElement(Xd.Provider,{value:pr},m.createElement(ea.Provider,{value:ee},u)),m.createElement(iy,{disabled:(o==null?void 0:o.restoreFocus)===!1})),m.createElement(ug,{...o,hiddenTextDescribedById:we}));function zr(){const rt=(L==null?void 0:L.autoScrollEnabled)===!1,ht=typeof l=="object"?l.enabled===!1:l===!1,xt=E&&!rt&&!ht;return typeof l=="object"?{...l,enabled:xt}:{enabled:xt}}}),ly=m.createContext(null),nc="button",cy="Draggable";function tf(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=$s(cy),{activators:a,activatorEvent:o,active:l,activeNodeRect:u,ariaDescribedById:f,draggableNodes:d,over:g}=m.useContext(qs),{role:p=nc,roleDescription:w="draggable",tabIndex:h=0}=s??{},y=(l==null?void 0:l.id)===t,v=m.useContext(y?ea:ly),[b,C]=Di(),[S,_]=Di(),E=Zg(a,t),N=Ts(r);Jt(()=>(d.set(t,{id:t,key:i,node:b,activatorNode:S,data:N}),()=>{const P=d.get(t);P&&P.key===i&&d.delete(t)}),[d,t]);const R=m.useMemo(()=>({role:p,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&p===nc?!0:void 0,"aria-roledescription":w,"aria-describedby":f.draggable}),[n,p,h,y,w,f.draggable]);return{active:l,activatorEvent:o,activeNodeRect:u,attributes:R,isDragging:y,listeners:n?void 0:E,node:b,over:g,setNodeRef:C,setActivatorNodeRef:_,transform:v}}function rf(){return m.useContext(Xd)}const uy="Droppable",dy={timeout:25};function fy(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=$s(uy),{active:a,dispatch:o,over:l,measureDroppableContainers:u}=m.useContext(qs),f=m.useRef({disabled:r}),d=m.useRef(!1),g=m.useRef(null),p=m.useRef(null),{disabled:w,updateMeasurementsFor:h,timeout:y}={...dy,...s},v=Ts(h??n),b=m.useCallback(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),p.current=null},y)},[y]),C=Ji({callback:b,disabled:w||!a}),S=m.useCallback((R,P)=>{C&&(P&&(C.unobserve(P),d.current=!1),R&&C.observe(R))},[C]),[_,E]=Di(S),N=Ts(t);return m.useEffect(()=>{!C||!_.current||(C.disconnect(),d.current=!1,C.observe(_.current))},[_,C]),m.useEffect(()=>(o({type:et.RegisterDroppable,element:{id:n,key:i,disabled:r,node:_,rect:g,data:N}}),()=>o({type:et.UnregisterDroppable,key:i,id:n})),[n]),m.useEffect(()=>{r!==f.current.disabled&&(o({type:et.SetDroppableDisabled,id:n,key:i,disabled:r}),f.current.disabled=r)},[n,i,r,o]),{active:a,rect:g,isOver:(l==null?void 0:l.id)===n,node:_,over:l,setNodeRef:E}}function hy(e){let{animation:t,children:r}=e;const[n,s]=m.useState(null),[i,a]=m.useState(null),o=Ni(r);return!r&&!n&&o&&s(o),Jt(()=>{if(!i)return;const l=n==null?void 0:n.key,u=n==null?void 0:n.props.id;if(l==null||u==null){s(null);return}Promise.resolve(t(u,i)).then(()=>{s(null)})},[t,n,i]),m.createElement(m.Fragment,null,r,n?m.cloneElement(n,{ref:a}):null)}const py={x:0,y:0,scaleX:1,scaleY:1};function my(e){let{children:t}=e;return m.createElement(qs.Provider,{value:Zd},m.createElement(ea.Provider,{value:py},t))}const gy={position:"fixed",touchAction:"none"},yy=e=>Yi(e)?"transform 250ms ease":void 0,vy=m.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:a,rect:o,style:l,transform:u,transition:f=yy}=e;if(!o)return null;const d=s?u:{...u,scaleX:1,scaleY:1},g={...gy,width:o.width,height:o.height,top:o.top,left:o.left,transform:qr.Transform.toString(d),transformOrigin:s&&n?dg(n,o):void 0,transition:typeof f=="function"?f(n):f,...l};return m.createElement(r,{className:a,style:g,ref:t},i)}),by=e=>t=>{let{active:r,dragOverlay:n}=t;const s={},{styles:i,className:a}=e;if(i!=null&&i.active)for(const[o,l]of Object.entries(i.active))l!==void 0&&(s[o]=r.node.style.getPropertyValue(o),r.node.style.setProperty(o,l));if(i!=null&&i.dragOverlay)for(const[o,l]of Object.entries(i.dragOverlay))l!==void 0&&n.node.style.setProperty(o,l);return a!=null&&a.active&&r.node.classList.add(a.active),a!=null&&a.dragOverlay&&n.node.classList.add(a.dragOverlay),function(){for(const[l,u]of Object.entries(s))r.node.style.setProperty(l,u);a!=null&&a.active&&r.node.classList.remove(a.active)}},wy=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:qr.Transform.toString(t)},{transform:qr.Transform.toString(r)}]},Cy={duration:250,easing:"ease",keyframes:wy,sideEffects:by({styles:{active:{opacity:"0"}}})};function Sy(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Ki((i,a)=>{if(t===null)return;const o=r.get(i);if(!o)return;const l=o.node.current;if(!l)return;const u=Yd(a);if(!u)return;const{transform:f}=Tt(a).getComputedStyle(a),d=$d(f);if(!d)return;const g=typeof t=="function"?t:xy(t);return Gd(l,s.draggable.measure),g({active:{id:i,data:o.data,node:l,rect:s.draggable.measure(l)},draggableNodes:r,dragOverlay:{node:a,rect:s.dragOverlay.measure(u)},droppableContainers:n,measuringConfiguration:s,transform:d})})}function xy(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...Cy,...e};return i=>{let{active:a,dragOverlay:o,transform:l,...u}=i;if(!t)return;const f={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},d={scaleX:l.scaleX!==1?a.rect.width*l.scaleX/o.rect.width:1,scaleY:l.scaleY!==1?a.rect.height*l.scaleY/o.rect.height:1},g={x:l.x-f.x,y:l.y-f.y,...d},p=s({...u,active:a,dragOverlay:o,transform:{initial:l,final:g}}),[w]=p,h=p[p.length-1];if(JSON.stringify(w)===JSON.stringify(h))return;const y=n==null?void 0:n({active:a,dragOverlay:o,...u}),v=o.node.animate(p,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{v.onfinish=()=>{y==null||y(),b()}})}}let sc=0;function _y(e){return m.useMemo(()=>{if(e!=null)return sc++,sc},[e])}const Ty=m.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:i,modifiers:a,wrapperElement:o="div",className:l,zIndex:u=999}=e;const{activatorEvent:f,active:d,activeNodeRect:g,containerNodeRect:p,draggableNodes:w,droppableContainers:h,dragOverlay:y,over:v,measuringConfiguration:b,scrollableAncestors:C,scrollableAncestorRects:S,windowRect:_}=rf(),E=m.useContext(ea),N=_y(d==null?void 0:d.id),R=Jd(a,{activatorEvent:f,active:d,activeNodeRect:g,containerNodeRect:p,draggingNodeRect:y.rect,over:v,overlayNodeRect:y.rect,scrollableAncestors:C,scrollableAncestorRects:S,transform:E,windowRect:_}),P=el(g),B=Sy({config:n,draggableNodes:w,droppableContainers:h,measuringConfiguration:b}),D=P?y.setRef:void 0;return m.createElement(my,null,m.createElement(hy,{animation:B},d&&N?m.createElement(vy,{key:N,id:d.id,ref:D,as:o,activatorEvent:f,adjustScale:t,className:l,transition:i,rect:P,style:{zIndex:u,...s},transform:R},r):null))});/**
|
|
181
|
+
`},cg={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function ug(e){let{announcements:t=cg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=lg}=e;const{announce:i,announcement:a}=ig(),o=$s("DndLiveRegion"),[l,u]=m.useState(!1);if(m.useEffect(()=>{u(!0)},[]),ag(m.useMemo(()=>({onDragStart(d){let{active:g}=d;i(t.onDragStart({active:g}))},onDragMove(d){let{active:g,over:p}=d;t.onDragMove&&i(t.onDragMove({active:g,over:p}))},onDragOver(d){let{active:g,over:p}=d;i(t.onDragOver({active:g,over:p}))},onDragEnd(d){let{active:g,over:p}=d;i(t.onDragEnd({active:g,over:p}))},onDragCancel(d){let{active:g,over:p}=d;i(t.onDragCancel({active:g,over:p}))}}),[i,t])),!l)return null;const f=m.createElement(m.Fragment,null,m.createElement(ng,{id:n,value:s.draggable}),m.createElement(sg,{id:o,announcement:a}));return r?Br.createPortal(f,r):f}var et;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(et||(et={}));function ki(){}function uo(e,t){return m.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function kd(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return m.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const er=Object.freeze({x:0,y:0});function jd(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function dg(e,t){const r=Ri(e);if(!r)return"0 0";const n={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return n.x+"% "+n.y+"%"}function Ld(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function fg(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Vl(e){let{left:t,top:r,height:n,width:s}=e;return[{x:t,y:r},{x:t+s,y:r},{x:t,y:r+n},{x:t+s,y:r+n}]}function Pd(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function Hl(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const hg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Hl(t,t.left,t.top),i=[];for(const a of n){const{id:o}=a,l=r.get(o);if(l){const u=jd(Hl(l),s);i.push({id:o,data:{droppableContainer:a,value:u}})}}return i.sort(Ld)},pg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Vl(t),i=[];for(const a of n){const{id:o}=a,l=r.get(o);if(l){const u=Vl(l),f=s.reduce((g,p,w)=>g+jd(u[w],p),0),d=Number((f/4).toFixed(4));i.push({id:o,data:{droppableContainer:a,value:d}})}}return i.sort(Ld)};function mg(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=s-n,o=i-r;if(n<s&&r<i){const l=t.width*t.height,u=e.width*e.height,f=a*o,d=f/(l+u-f);return Number(d.toFixed(4))}return 0}const gg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const i of n){const{id:a}=i,o=r.get(a);if(o){const l=mg(o,t);l>0&&s.push({id:a,data:{droppableContainer:i,value:l}})}}return s.sort(fg)};function yg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Fd(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:er}function vg(e){return function(r){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return s.reduce((a,o)=>({...a,top:a.top+e*o.y,bottom:a.bottom+e*o.y,left:a.left+e*o.x,right:a.right+e*o.x}),{...r})}}const bg=vg(1);function Md(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function wg(e,t,r){const n=Md(t);if(!n)return e;const{scaleX:s,scaleY:i,x:a,y:o}=n,l=e.left-a-(1-s)*parseFloat(r),u=e.top-o-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),f=s?e.width/s:e.width,d=i?e.height/i:e.height;return{width:f,height:d,top:u,right:l+f,bottom:u+d,left:l}}const Cg={ignoreTransform:!1};function Gn(e,t){t===void 0&&(t=Cg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=Tt(e).getComputedStyle(e);u&&(r=wg(r,u,f))}const{top:n,left:s,width:i,height:a,bottom:o,right:l}=r;return{top:n,left:s,width:i,height:a,bottom:o,right:l}}function Ql(e){return Gn(e,{ignoreTransform:!0})}function Sg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function xg(e,t){return t===void 0&&(t=Tt(e).getComputedStyle(e)),t.position==="fixed"}function _g(e,t){t===void 0&&(t=Tt(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?r.test(i):!1})}function Yi(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Wo(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!Ms(s)||Dd(s)||r.includes(s))return r;const i=Tt(e).getComputedStyle(s);return s!==e&&_g(s,i)&&r.push(s),xg(s,i)?r:n(s.parentNode)}return e?n(e):r}function Bd(e){const[t]=Yi(e,1);return t??null}function ga(e){return!Gi||!e?null:Hn(e)?e:Go(e)?Wo(e)||e===Qn(e).scrollingElement?window:Ms(e)?e:null:null}function $d(e){return Hn(e)?e.scrollX:e.scrollLeft}function qd(e){return Hn(e)?e.scrollY:e.scrollTop}function fo(e){return{x:$d(e),y:qd(e)}}var ot;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ot||(ot={}));function Ud(e){return!Gi||!e?!1:e===document.scrollingElement}function zd(e){const t={x:0,y:0},r=Ud(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=n.y,o=e.scrollLeft>=n.x;return{isTop:s,isLeft:i,isBottom:a,isRight:o,maxScroll:n,minScroll:t}}const Tg={x:.2,y:.2};function Eg(e,t,r,n,s){let{top:i,left:a,right:o,bottom:l}=r;n===void 0&&(n=10),s===void 0&&(s=Tg);const{isTop:u,isBottom:f,isLeft:d,isRight:g}=zd(e),p={x:0,y:0},w={x:0,y:0},h={height:t.height*s.y,width:t.width*s.x};return!u&&i<=t.top+h.height?(p.y=ot.Backward,w.y=n*Math.abs((t.top+h.height-i)/h.height)):!f&&l>=t.bottom-h.height&&(p.y=ot.Forward,w.y=n*Math.abs((t.bottom-h.height-l)/h.height)),!g&&o>=t.right-h.width?(p.x=ot.Forward,w.x=n*Math.abs((t.right-h.width-o)/h.width)):!d&&a<=t.left+h.width&&(p.x=ot.Backward,w.x=n*Math.abs((t.left+h.width-a)/h.width)),{direction:p,speed:w}}function Ig(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:t,left:r,right:n,bottom:s}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:s,width:e.clientWidth,height:e.clientHeight}}function Vd(e){return e.reduce((t,r)=>En(t,fo(r)),er)}function Og(e){return e.reduce((t,r)=>t+$d(r),0)}function Ag(e){return e.reduce((t,r)=>t+qd(r),0)}function Hd(e,t){if(t===void 0&&(t=Gn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);Bd(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Dg=[["x",["left","right"],Og],["y",["top","bottom"],Ag]];class Ko{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Yi(r),s=Vd(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,o]of Dg)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=o(n),f=s[i]-u;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ys{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var s;(s=this.target)==null||s.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function Ng(e){const{EventTarget:t}=Tt(e);return e instanceof t?e:Qn(e)}function ya(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var Qt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Qt||(Qt={}));function Gl(e){e.preventDefault()}function Rg(e){e.stopPropagation()}var xe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(xe||(xe={}));const Qd={start:[xe.Space,xe.Enter],cancel:[xe.Esc],end:[xe.Space,xe.Enter,xe.Tab]},kg=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case xe.Right:return{...r,x:r.x+25};case xe.Left:return{...r,x:r.x-25};case xe.Down:return{...r,y:r.y+25};case xe.Up:return{...r,y:r.y-25}}};class Yo{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new ys(Qn(r)),this.windowListeners=new ys(Tt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Qt.Resize,this.handleCancel),this.windowListeners.add(Qt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Qt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Hd(n),r(er)}handleKeyDown(t){if(Ki(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=Qd,coordinateGetter:a=kg,scrollBehavior:o="smooth"}=s,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=n.current,f=u?{x:u.left,y:u.top}:er;this.referenceCoordinates||(this.referenceCoordinates=f);const d=a(t,{active:r,context:n.current,currentCoordinates:f});if(d){const g=Es(d,f),p={x:0,y:0},{scrollableAncestors:w}=n.current;for(const h of w){const y=t.code,{isTop:v,isRight:b,isLeft:C,isBottom:S,maxScroll:_,minScroll:E}=zd(h),N=Ig(h),R={x:Math.min(y===xe.Right?N.right-N.width/2:N.right,Math.max(y===xe.Right?N.left:N.left+N.width/2,d.x)),y:Math.min(y===xe.Down?N.bottom-N.height/2:N.bottom,Math.max(y===xe.Down?N.top:N.top+N.height/2,d.y))},M=y===xe.Right&&!b||y===xe.Left&&!C,$=y===xe.Down&&!S||y===xe.Up&&!v;if(M&&R.x!==d.x){const D=h.scrollLeft+g.x,j=y===xe.Right&&D<=_.x||y===xe.Left&&D>=E.x;if(j&&!g.y){h.scrollTo({left:D,behavior:o});return}j?p.x=h.scrollLeft-D:p.x=y===xe.Right?h.scrollLeft-_.x:h.scrollLeft-E.x,p.x&&h.scrollBy({left:-p.x,behavior:o});break}else if($&&R.y!==d.y){const D=h.scrollTop+g.y,j=y===xe.Down&&D<=_.y||y===xe.Up&&D>=E.y;if(j&&!g.x){h.scrollTo({top:D,behavior:o});return}j?p.y=h.scrollTop-D:p.y=y===xe.Down?h.scrollTop-_.y:h.scrollTop-E.y,p.y&&h.scrollBy({top:-p.y,behavior:o});break}}this.handleMove(t,En(Es(d,this.referenceCoordinates),p))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Yo.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Qd,onActivation:s}=t,{active:i}=r;const{code:a}=e.nativeEvent;if(n.start.includes(a)){const o=i.activatorNode.current;return o&&e.target!==o?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function Wl(e){return!!(e&&"distance"in e)}function Kl(e){return!!(e&&"delay"in e)}class Zo{constructor(t,r,n){var s;n===void 0&&(n=Ng(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:i}=t,{target:a}=i;this.props=t,this.events=r,this.document=Qn(a),this.documentListeners=new ys(this.document),this.listeners=new ys(n),this.windowListeners=new ys(Tt(a)),this.initialCoordinates=(s=Ri(i))!=null?s:er,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Qt.Resize,this.handleCancel),this.windowListeners.add(Qt.DragStart,Gl),this.windowListeners.add(Qt.VisibilityChange,this.handleCancel),this.windowListeners.add(Qt.ContextMenu,Gl),this.documentListeners.add(Qt.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Kl(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Wl(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:s}=this.props;s(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Qt.Click,Rg,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Qt.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:i}=this,{onMove:a,options:{activationConstraint:o}}=i;if(!s)return;const l=(r=Ri(t))!=null?r:er,u=Es(s,l);if(!n&&o){if(Wl(o)){if(o.tolerance!=null&&ya(u,o.tolerance))return this.handleCancel();if(ya(u,o.distance))return this.handleStart()}if(Kl(o)&&ya(u,o.tolerance))return this.handleCancel();this.handlePending(o,u);return}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===xe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const jg={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Zi extends Zo{constructor(t){const{event:r}=t,n=Qn(r.target);super(t,jg,n)}}Zi.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const Lg={move:{name:"mousemove"},end:{name:"mouseup"}};var ho;(function(e){e[e.RightClick=2]="RightClick"})(ho||(ho={}));class Pg extends Zo{constructor(t){super(t,Lg,Qn(t.event.target))}}Pg.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===ho.RightClick?!1:(n==null||n({event:r}),!0)}}];const va={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Fg extends Zo{constructor(t){super(t,va)}static setup(){return window.addEventListener(va.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(va.move.name,t)};function t(){}}}Fg.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n==null||n({event:r}),!0)}}];var vs;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(vs||(vs={}));var ji;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ji||(ji={}));function Mg(e){let{acceleration:t,activator:r=vs.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:a=5,order:o=ji.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:f,delta:d,threshold:g}=e;const p=$g({delta:d,disabled:!i}),[w,h]=Xm(),y=m.useRef({x:0,y:0}),v=m.useRef({x:0,y:0}),b=m.useMemo(()=>{switch(r){case vs.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case vs.DraggableRect:return s}},[r,s,l]),C=m.useRef(null),S=m.useCallback(()=>{const E=C.current;if(!E)return;const N=y.current.x*v.current.x,R=y.current.y*v.current.y;E.scrollBy(N,R)},[]),_=m.useMemo(()=>o===ji.TreeOrder?[...u].reverse():u,[o,u]);m.useEffect(()=>{if(!i||!u.length||!b){h();return}for(const E of _){if((n==null?void 0:n(E))===!1)continue;const N=u.indexOf(E),R=f[N];if(!R)continue;const{direction:M,speed:$}=Eg(E,R,b,t,g);for(const D of["x","y"])p[D][M[D]]||($[D]=0,M[D]=0);if($.x>0||$.y>0){h(),C.current=E,w(S,a),y.current=$,v.current=M;return}}y.current={x:0,y:0},v.current={x:0,y:0},h()},[t,S,n,h,i,a,JSON.stringify(b),JSON.stringify(p),w,u,_,f,JSON.stringify(g)])}const Bg={x:{[ot.Backward]:!1,[ot.Forward]:!1},y:{[ot.Backward]:!1,[ot.Forward]:!1}};function $g(e){let{delta:t,disabled:r}=e;const n=Ni(t);return Bs(s=>{if(r||!n||!s)return Bg;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[ot.Backward]:s.x[ot.Backward]||i.x===-1,[ot.Forward]:s.x[ot.Forward]||i.x===1},y:{[ot.Backward]:s.y[ot.Backward]||i.y===-1,[ot.Forward]:s.y[ot.Forward]||i.y===1}}},[r,t,n])}function qg(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Bs(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function Ug(e,t){return m.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,i=s.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,n)}));return[...r,...i]},[]),[e,t])}var Is;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Is||(Is={}));var po;(function(e){e.Optimized="optimized"})(po||(po={}));const Yl=new Map;function zg(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,a]=m.useState(null),{frequency:o,measure:l,strategy:u}=s,f=m.useRef(e),d=y(),g=Ts(d),p=m.useCallback(function(v){v===void 0&&(v=[]),!g.current&&a(b=>b===null?v:b.concat(v.filter(C=>!b.includes(C))))},[g]),w=m.useRef(null),h=Bs(v=>{if(d&&!r)return Yl;if(!v||v===Yl||f.current!==e||i!=null){const b=new Map;for(let C of e){if(!C)continue;if(i&&i.length>0&&!i.includes(C.id)&&C.rect.current){b.set(C.id,C.rect.current);continue}const S=C.node.current,_=S?new Ko(l(S),S):null;C.rect.current=_,_&&b.set(C.id,_)}return b}return v},[e,i,r,d,l]);return m.useEffect(()=>{f.current=e},[e]),m.useEffect(()=>{d||p()},[r,d]),m.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),m.useEffect(()=>{d||typeof o!="number"||w.current!==null||(w.current=setTimeout(()=>{p(),w.current=null},o))},[o,d,p,...n]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:i!=null};function y(){switch(u){case Is.Always:return!1;case Is.BeforeDragging:return r;default:return!r}}}function Xo(e,t){return Bs(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function Vg(e,t){return Xo(e,t)}function Hg(e){let{callback:t,disabled:r}=e;const n=Wi(t),s=m.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return m.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Xi(e){let{callback:t,disabled:r}=e;const n=Wi(t),s=m.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return m.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Qg(e){return new Ko(Gn(e),e)}function Zl(e,t,r){t===void 0&&(t=Qg);const[n,s]=m.useState(null);function i(){s(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??r)!=null?u:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const a=Hg({callback(l){if(e)for(const u of l){const{type:f,target:d}=u;if(f==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),o=Xi({callback:i});return Jt(()=>{i(),e?(o==null||o.observe(e),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(o==null||o.disconnect(),a==null||a.disconnect())},[e]),n}function Gg(e){const t=Xo(e);return Fd(e,t)}const Xl=[];function Wg(e){const t=m.useRef(e),r=Bs(n=>e?n&&n!==Xl&&e&&t.current&&e.parentNode===t.current.parentNode?n:Yi(e):Xl,[e]);return m.useEffect(()=>{t.current=e},[e]),r}function Kg(e){const[t,r]=m.useState(null),n=m.useRef(e),s=m.useCallback(i=>{const a=ga(i.target);a&&r(o=>o?(o.set(a,fo(a)),new Map(o)):null)},[]);return m.useEffect(()=>{const i=n.current;if(e!==i){a(i);const o=e.map(l=>{const u=ga(l);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,fo(u)]):null}).filter(l=>l!=null);r(o.length?new Map(o):null),n.current=e}return()=>{a(e),a(i)};function a(o){o.forEach(l=>{const u=ga(l);u==null||u.removeEventListener("scroll",s)})}},[s,e]),m.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>En(i,a),er):Vd(e):er,[e,t])}function Jl(e,t){t===void 0&&(t=[]);const r=m.useRef(null);return m.useEffect(()=>{r.current=null},t),m.useEffect(()=>{const n=e!==er;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?Es(e,r.current):er}function Yg(e){m.useEffect(()=>{if(!Gi)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function Zg(e,t){return m.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=a=>{i(a,t)},r},{}),[e,t])}function Gd(e){return m.useMemo(()=>e?Sg(e):null,[e])}const ec=[];function Xg(e,t){t===void 0&&(t=Gn);const[r]=e,n=Gd(r?Tt(r):null),[s,i]=m.useState(ec);function a(){i(()=>e.length?e.map(l=>Ud(l)?n:new Ko(t(l),l)):ec)}const o=Xi({callback:a});return Jt(()=>{o==null||o.disconnect(),a(),e.forEach(l=>o==null?void 0:o.observe(l))},[e]),s}function Wd(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ms(t)?t:e}function Jg(e){let{measure:t}=e;const[r,n]=m.useState(null),s=m.useCallback(u=>{for(const{target:f}of u)if(Ms(f)){n(d=>{const g=t(f);return d?{...d,width:g.width,height:g.height}:g});break}},[t]),i=Xi({callback:s}),a=m.useCallback(u=>{const f=Wd(u);i==null||i.disconnect(),f&&(i==null||i.observe(f)),n(f?t(f):null)},[t,i]),[o,l]=Di(a);return m.useMemo(()=>({nodeRef:o,rect:r,setRef:l}),[r,o,l])}const ey=[{sensor:Zi,options:{}},{sensor:Yo,options:{}}],ty={current:{}},fi={draggable:{measure:Ql},droppable:{measure:Ql,strategy:Is.WhileDragging,frequency:po.Optimized},dragOverlay:{measure:Gn}};class bs extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const ry={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new bs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ki},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:fi,measureDroppableContainers:ki,windowRect:null,measuringScheduled:!1},Kd={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ki,draggableNodes:new Map,over:null,measureDroppableContainers:ki},qs=m.createContext(Kd),Yd=m.createContext(ry);function ny(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new bs}}}function sy(e,t){switch(t.type){case et.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case et.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case et.DragEnd:case et.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case et.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new bs(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case et.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const a=new bs(e.droppable.containers);return a.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:a}}}case et.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new bs(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function iy(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=m.useContext(qs),i=Ni(n),a=Ni(r==null?void 0:r.id);return m.useEffect(()=>{if(!t&&!n&&i&&a!=null){if(!Ki(i)||document.activeElement===i.target)return;const o=s.get(a);if(!o)return;const{activatorNode:l,node:u}=o;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[l.current,u.current]){if(!f)continue;const d=tg(f);if(d){d.focus();break}}})}},[n,t,s,a,i]),null}function Zd(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function ay(e){return m.useMemo(()=>({draggable:{...fi.draggable,...e==null?void 0:e.draggable},droppable:{...fi.droppable,...e==null?void 0:e.droppable},dragOverlay:{...fi.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function oy(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const i=m.useRef(!1),{x:a,y:o}=typeof s=="boolean"?{x:s,y:s}:s;Jt(()=>{if(!a&&!o||!t){i.current=!1;return}if(i.current||!n)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const f=r(u),d=Fd(f,n);if(a||(d.x=0),o||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const g=Bd(u);g&&g.scrollBy({top:d.y,left:d.x})}},[t,a,o,n,r])}const Ji=m.createContext({...er,scaleX:1,scaleY:1});var Ar;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ar||(Ar={}));const Xd=m.memo(function(t){var r,n,s,i;let{id:a,accessibility:o,autoScroll:l=!0,children:u,sensors:f=ey,collisionDetection:d=gg,measuring:g,modifiers:p,...w}=t;const h=m.useReducer(sy,void 0,ny),[y,v]=h,[b,C]=og(),[S,_]=m.useState(Ar.Uninitialized),E=S===Ar.Initialized,{draggable:{active:N,nodes:R,translate:M},droppable:{containers:$}}=y,D=N!=null?R.get(N):null,j=m.useRef({initial:null,translated:null}),P=m.useMemo(()=>{var rt;return N!=null?{id:N,data:(rt=D==null?void 0:D.data)!=null?rt:ty,rect:j}:null},[N,D]),k=m.useRef(null),[L,z]=m.useState(null),[X,ye]=m.useState(null),_e=Ts(w,Object.values(w)),we=$s("DndDescribedBy",a),de=m.useMemo(()=>$.getEnabled(),[$]),Q=ay(g),{droppableRects:ne,measureDroppableContainers:te,measuringScheduled:q}=zg(de,{dragging:E,dependencies:[M.x,M.y],config:Q.droppable}),V=qg(R,N),ie=m.useMemo(()=>X?Ri(X):null,[X]),fe=zr(),J=Vg(V,Q.draggable.measure);oy({activeNode:N!=null?R.get(N):null,config:fe.layoutShiftCompensation,initialRect:J,measure:Q.draggable.measure});const se=Zl(V,Q.draggable.measure,J),ke=Zl(V?V.parentElement:null),Te=m.useRef({activatorEvent:null,active:null,activeNode:V,collisionRect:null,collisions:null,droppableRects:ne,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:$,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),$e=$.getNodeFor((r=Te.current.over)==null?void 0:r.id),Ve=Jg({measure:Q.dragOverlay.measure}),qe=(n=Ve.nodeRef.current)!=null?n:V,re=E?(s=Ve.rect)!=null?s:se:null,He=!!(Ve.nodeRef.current&&Ve.rect),ze=Gg(He?null:se),Ue=Gd(qe?Tt(qe):null),Ze=Wg(E?$e??V:null),Bt=Xg(Ze),St=Zd(p,{transform:{x:M.x-ze.x,y:M.y-ze.y,scaleX:1,scaleY:1},activatorEvent:X,active:P,activeNodeRect:se,containerNodeRect:ke,draggingNodeRect:re,over:Te.current.over,overlayNodeRect:Ve.rect,scrollableAncestors:Ze,scrollableAncestorRects:Bt,windowRect:Ue}),K=ie?En(ie,M):null,pe=Kg(Ze),ve=Jl(pe),$t=Jl(pe,[se]),x=En(St,ve),O=re?bg(re,St):null,A=P&&O?d({active:P,collisionRect:O,droppableRects:ne,droppableContainers:de,pointerCoordinates:K}):null,U=Pd(A,"id"),[B,G]=m.useState(null),H=He?St:En(St,$t),ee=yg(H,(i=B==null?void 0:B.rect)!=null?i:null,se),ge=m.useRef(null),Qe=m.useCallback((rt,ht)=>{let{sensor:xt,options:Wt}=ht;if(k.current==null)return;const qt=R.get(k.current);if(!qt)return;const kt=rt.nativeEvent,nr=new xt({active:k.current,activeNode:qt,event:kt,options:Wt,context:Te,onAbort(lt){if(!R.get(lt))return;const{onDragAbort:sr}=_e.current,mr={id:lt};sr==null||sr(mr),b({type:"onDragAbort",event:mr})},onPending(lt,Sr,sr,mr){if(!R.get(lt))return;const{onDragPending:ts}=_e.current,xr={id:lt,constraint:Sr,initialCoordinates:sr,offset:mr};ts==null||ts(xr),b({type:"onDragPending",event:xr})},onStart(lt){const Sr=k.current;if(Sr==null)return;const sr=R.get(Sr);if(!sr)return;const{onDragStart:mr}=_e.current,es={activatorEvent:kt,active:{id:Sr,data:sr.data,rect:j}};Br.unstable_batchedUpdates(()=>{mr==null||mr(es),_(Ar.Initializing),v({type:et.DragStart,initialCoordinates:lt,active:Sr}),b({type:"onDragStart",event:es}),z(ge.current),ye(kt)})},onMove(lt){v({type:et.DragMove,coordinates:lt})},onEnd:pn(et.DragEnd),onCancel:pn(et.DragCancel)});ge.current=nr;function pn(lt){return async function(){const{active:sr,collisions:mr,over:es,scrollAdjustedTranslate:ts}=Te.current;let xr=null;if(sr&&ts){const{cancelDrop:rs}=_e.current;xr={activatorEvent:kt,active:sr,collisions:mr,delta:ts,over:es},lt===et.DragEnd&&typeof rs=="function"&&await Promise.resolve(rs(xr))&&(lt=et.DragCancel)}k.current=null,Br.unstable_batchedUpdates(()=>{v({type:lt}),_(Ar.Uninitialized),G(null),z(null),ye(null),ge.current=null;const rs=lt===et.DragEnd?"onDragEnd":"onDragCancel";if(xr){const ha=_e.current[rs];ha==null||ha(xr),b({type:rs,event:xr})}})}}},[R]),Et=m.useCallback((rt,ht)=>(xt,Wt)=>{const qt=xt.nativeEvent,kt=R.get(Wt);if(k.current!==null||!kt||qt.dndKit||qt.defaultPrevented)return;const nr={active:kt};rt(xt,ht.options,nr)===!0&&(qt.dndKit={capturedBy:ht.sensor},k.current=Wt,Qe(xt,ht))},[R,Qe]),It=Ug(f,Et);Yg(f),Jt(()=>{se&&S===Ar.Initializing&&_(Ar.Initialized)},[se,S]),m.useEffect(()=>{const{onDragMove:rt}=_e.current,{active:ht,activatorEvent:xt,collisions:Wt,over:qt}=Te.current;if(!ht||!xt)return;const kt={active:ht,activatorEvent:xt,collisions:Wt,delta:{x:x.x,y:x.y},over:qt};Br.unstable_batchedUpdates(()=>{rt==null||rt(kt),b({type:"onDragMove",event:kt})})},[x.x,x.y]),m.useEffect(()=>{const{active:rt,activatorEvent:ht,collisions:xt,droppableContainers:Wt,scrollAdjustedTranslate:qt}=Te.current;if(!rt||k.current==null||!ht||!qt)return;const{onDragOver:kt}=_e.current,nr=Wt.get(U),pn=nr&&nr.rect.current?{id:nr.id,rect:nr.rect.current,data:nr.data,disabled:nr.disabled}:null,lt={active:rt,activatorEvent:ht,collisions:xt,delta:{x:qt.x,y:qt.y},over:pn};Br.unstable_batchedUpdates(()=>{G(pn),kt==null||kt(lt),b({type:"onDragOver",event:lt})})},[U]),Jt(()=>{Te.current={activatorEvent:X,active:P,activeNode:V,collisionRect:O,collisions:A,droppableRects:ne,draggableNodes:R,draggingNode:qe,draggingNodeRect:re,droppableContainers:$,over:B,scrollableAncestors:Ze,scrollAdjustedTranslate:x},j.current={initial:re,translated:O}},[P,V,A,O,R,qe,re,ne,$,B,Ze,x]),Mg({...fe,delta:M,draggingRect:O,pointerCoordinates:K,scrollableAncestors:Ze,scrollableAncestorRects:Bt});const pr=m.useMemo(()=>({active:P,activeNode:V,activeNodeRect:se,activatorEvent:X,collisions:A,containerNodeRect:ke,dragOverlay:Ve,draggableNodes:R,droppableContainers:$,droppableRects:ne,over:B,measureDroppableContainers:te,scrollableAncestors:Ze,scrollableAncestorRects:Bt,measuringConfiguration:Q,measuringScheduled:q,windowRect:Ue}),[P,V,se,X,A,ke,Ve,R,$,ne,B,te,Ze,Bt,Q,q,Ue]),Jn=m.useMemo(()=>({activatorEvent:X,activators:It,active:P,activeNodeRect:se,ariaDescribedById:{draggable:we},dispatch:v,draggableNodes:R,over:B,measureDroppableContainers:te}),[X,It,P,se,v,we,R,B,te]);return m.createElement(Rd.Provider,{value:C},m.createElement(qs.Provider,{value:Jn},m.createElement(Yd.Provider,{value:pr},m.createElement(Ji.Provider,{value:ee},u)),m.createElement(iy,{disabled:(o==null?void 0:o.restoreFocus)===!1})),m.createElement(ug,{...o,hiddenTextDescribedById:we}));function zr(){const rt=(L==null?void 0:L.autoScrollEnabled)===!1,ht=typeof l=="object"?l.enabled===!1:l===!1,xt=E&&!rt&&!ht;return typeof l=="object"?{...l,enabled:xt}:{enabled:xt}}}),ly=m.createContext(null),tc="button",cy="Draggable";function Jd(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=$s(cy),{activators:a,activatorEvent:o,active:l,activeNodeRect:u,ariaDescribedById:f,draggableNodes:d,over:g}=m.useContext(qs),{role:p=tc,roleDescription:w="draggable",tabIndex:h=0}=s??{},y=(l==null?void 0:l.id)===t,v=m.useContext(y?Ji:ly),[b,C]=Di(),[S,_]=Di(),E=Zg(a,t),N=Ts(r);Jt(()=>(d.set(t,{id:t,key:i,node:b,activatorNode:S,data:N}),()=>{const M=d.get(t);M&&M.key===i&&d.delete(t)}),[d,t]);const R=m.useMemo(()=>({role:p,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&p===tc?!0:void 0,"aria-roledescription":w,"aria-describedby":f.draggable}),[n,p,h,y,w,f.draggable]);return{active:l,activatorEvent:o,activeNodeRect:u,attributes:R,isDragging:y,listeners:n?void 0:E,node:b,over:g,setNodeRef:C,setActivatorNodeRef:_,transform:v}}function ef(){return m.useContext(Yd)}const uy="Droppable",dy={timeout:25};function fy(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=$s(uy),{active:a,dispatch:o,over:l,measureDroppableContainers:u}=m.useContext(qs),f=m.useRef({disabled:r}),d=m.useRef(!1),g=m.useRef(null),p=m.useRef(null),{disabled:w,updateMeasurementsFor:h,timeout:y}={...dy,...s},v=Ts(h??n),b=m.useCallback(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),p.current=null},y)},[y]),C=Xi({callback:b,disabled:w||!a}),S=m.useCallback((R,M)=>{C&&(M&&(C.unobserve(M),d.current=!1),R&&C.observe(R))},[C]),[_,E]=Di(S),N=Ts(t);return m.useEffect(()=>{!C||!_.current||(C.disconnect(),d.current=!1,C.observe(_.current))},[_,C]),m.useEffect(()=>(o({type:et.RegisterDroppable,element:{id:n,key:i,disabled:r,node:_,rect:g,data:N}}),()=>o({type:et.UnregisterDroppable,key:i,id:n})),[n]),m.useEffect(()=>{r!==f.current.disabled&&(o({type:et.SetDroppableDisabled,id:n,key:i,disabled:r}),f.current.disabled=r)},[n,i,r,o]),{active:a,rect:g,isOver:(l==null?void 0:l.id)===n,node:_,over:l,setNodeRef:E}}function hy(e){let{animation:t,children:r}=e;const[n,s]=m.useState(null),[i,a]=m.useState(null),o=Ni(r);return!r&&!n&&o&&s(o),Jt(()=>{if(!i)return;const l=n==null?void 0:n.key,u=n==null?void 0:n.props.id;if(l==null||u==null){s(null);return}Promise.resolve(t(u,i)).then(()=>{s(null)})},[t,n,i]),m.createElement(m.Fragment,null,r,n?m.cloneElement(n,{ref:a}):null)}const py={x:0,y:0,scaleX:1,scaleY:1};function my(e){let{children:t}=e;return m.createElement(qs.Provider,{value:Kd},m.createElement(Ji.Provider,{value:py},t))}const gy={position:"fixed",touchAction:"none"},yy=e=>Ki(e)?"transform 250ms ease":void 0,vy=m.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:a,rect:o,style:l,transform:u,transition:f=yy}=e;if(!o)return null;const d=s?u:{...u,scaleX:1,scaleY:1},g={...gy,width:o.width,height:o.height,top:o.top,left:o.left,transform:qr.Transform.toString(d),transformOrigin:s&&n?dg(n,o):void 0,transition:typeof f=="function"?f(n):f,...l};return m.createElement(r,{className:a,style:g,ref:t},i)}),by=e=>t=>{let{active:r,dragOverlay:n}=t;const s={},{styles:i,className:a}=e;if(i!=null&&i.active)for(const[o,l]of Object.entries(i.active))l!==void 0&&(s[o]=r.node.style.getPropertyValue(o),r.node.style.setProperty(o,l));if(i!=null&&i.dragOverlay)for(const[o,l]of Object.entries(i.dragOverlay))l!==void 0&&n.node.style.setProperty(o,l);return a!=null&&a.active&&r.node.classList.add(a.active),a!=null&&a.dragOverlay&&n.node.classList.add(a.dragOverlay),function(){for(const[l,u]of Object.entries(s))r.node.style.setProperty(l,u);a!=null&&a.active&&r.node.classList.remove(a.active)}},wy=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:qr.Transform.toString(t)},{transform:qr.Transform.toString(r)}]},Cy={duration:250,easing:"ease",keyframes:wy,sideEffects:by({styles:{active:{opacity:"0"}}})};function Sy(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Wi((i,a)=>{if(t===null)return;const o=r.get(i);if(!o)return;const l=o.node.current;if(!l)return;const u=Wd(a);if(!u)return;const{transform:f}=Tt(a).getComputedStyle(a),d=Md(f);if(!d)return;const g=typeof t=="function"?t:xy(t);return Hd(l,s.draggable.measure),g({active:{id:i,data:o.data,node:l,rect:s.draggable.measure(l)},draggableNodes:r,dragOverlay:{node:a,rect:s.dragOverlay.measure(u)},droppableContainers:n,measuringConfiguration:s,transform:d})})}function xy(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...Cy,...e};return i=>{let{active:a,dragOverlay:o,transform:l,...u}=i;if(!t)return;const f={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},d={scaleX:l.scaleX!==1?a.rect.width*l.scaleX/o.rect.width:1,scaleY:l.scaleY!==1?a.rect.height*l.scaleY/o.rect.height:1},g={x:l.x-f.x,y:l.y-f.y,...d},p=s({...u,active:a,dragOverlay:o,transform:{initial:l,final:g}}),[w]=p,h=p[p.length-1];if(JSON.stringify(w)===JSON.stringify(h))return;const y=n==null?void 0:n({active:a,dragOverlay:o,...u}),v=o.node.animate(p,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{v.onfinish=()=>{y==null||y(),b()}})}}let rc=0;function _y(e){return m.useMemo(()=>{if(e!=null)return rc++,rc},[e])}const Ty=m.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:i,modifiers:a,wrapperElement:o="div",className:l,zIndex:u=999}=e;const{activatorEvent:f,active:d,activeNodeRect:g,containerNodeRect:p,draggableNodes:w,droppableContainers:h,dragOverlay:y,over:v,measuringConfiguration:b,scrollableAncestors:C,scrollableAncestorRects:S,windowRect:_}=ef(),E=m.useContext(Ji),N=_y(d==null?void 0:d.id),R=Zd(a,{activatorEvent:f,active:d,activeNodeRect:g,containerNodeRect:p,draggingNodeRect:y.rect,over:v,overlayNodeRect:y.rect,scrollableAncestors:C,scrollableAncestorRects:S,transform:E,windowRect:_}),M=Xo(g),$=Sy({config:n,draggableNodes:w,droppableContainers:h,measuringConfiguration:b}),D=M?y.setRef:void 0;return m.createElement(my,null,m.createElement(hy,{animation:$},d&&N?m.createElement(vy,{key:N,id:d.id,ref:D,as:o,activatorEvent:f,adjustScale:t,className:l,transition:i,rect:M,style:{zIndex:u,...s},transform:R},r):null))});/**
|
|
182
182
|
* @license lucide-react v0.400.0 - ISC
|
|
183
183
|
*
|
|
184
184
|
* This source code is licensed under the ISC license.
|
|
185
185
|
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
-
*/const Ey=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),
|
|
186
|
+
*/const Ey=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),tf=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/**
|
|
187
187
|
* @license lucide-react v0.400.0 - ISC
|
|
188
188
|
*
|
|
189
189
|
* This source code is licensed under the ISC license.
|
|
@@ -193,12 +193,12 @@ to {
|
|
|
193
193
|
*
|
|
194
194
|
* This source code is licensed under the ISC license.
|
|
195
195
|
* See the LICENSE file in the root directory of this source tree.
|
|
196
|
-
*/const Oy=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:a,...o},l)=>m.createElement("svg",{ref:l,...Iy,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:
|
|
196
|
+
*/const Oy=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:a,...o},l)=>m.createElement("svg",{ref:l,...Iy,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:tf("lucide",s),...o},[...a.map(([u,f])=>m.createElement(u,f)),...Array.isArray(i)?i:[i]]));/**
|
|
197
197
|
* @license lucide-react v0.400.0 - ISC
|
|
198
198
|
*
|
|
199
199
|
* This source code is licensed under the ISC license.
|
|
200
200
|
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
-
*/const oe=(e,t)=>{const r=m.forwardRef(({className:n,...s},i)=>m.createElement(Oy,{ref:i,iconNode:t,className:
|
|
201
|
+
*/const oe=(e,t)=>{const r=m.forwardRef(({className:n,...s},i)=>m.createElement(Oy,{ref:i,iconNode:t,className:tf(`lucide-${Ey(e)}`,n),...s}));return r.displayName=`${e}`,r};/**
|
|
202
202
|
* @license lucide-react v0.400.0 - ISC
|
|
203
203
|
*
|
|
204
204
|
* This source code is licensed under the ISC license.
|
|
@@ -233,27 +233,27 @@ to {
|
|
|
233
233
|
*
|
|
234
234
|
* This source code is licensed under the ISC license.
|
|
235
235
|
* See the LICENSE file in the root directory of this source tree.
|
|
236
|
-
*/const
|
|
236
|
+
*/const rf=oe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
237
237
|
* @license lucide-react v0.400.0 - ISC
|
|
238
238
|
*
|
|
239
239
|
* This source code is licensed under the ISC license.
|
|
240
240
|
* See the LICENSE file in the root directory of this source tree.
|
|
241
|
-
*/const
|
|
241
|
+
*/const ky=oe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
242
242
|
* @license lucide-react v0.400.0 - ISC
|
|
243
243
|
*
|
|
244
244
|
* This source code is licensed under the ISC license.
|
|
245
245
|
* See the LICENSE file in the root directory of this source tree.
|
|
246
|
-
*/const
|
|
246
|
+
*/const nf=oe("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
247
247
|
* @license lucide-react v0.400.0 - ISC
|
|
248
248
|
*
|
|
249
249
|
* This source code is licensed under the ISC license.
|
|
250
250
|
* See the LICENSE file in the root directory of this source tree.
|
|
251
|
-
*/const
|
|
251
|
+
*/const Jo=oe("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
252
252
|
* @license lucide-react v0.400.0 - ISC
|
|
253
253
|
*
|
|
254
254
|
* This source code is licensed under the ISC license.
|
|
255
255
|
* See the LICENSE file in the root directory of this source tree.
|
|
256
|
-
*/const
|
|
256
|
+
*/const jy=oe("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
|
257
257
|
* @license lucide-react v0.400.0 - ISC
|
|
258
258
|
*
|
|
259
259
|
* This source code is licensed under the ISC license.
|
|
@@ -268,12 +268,12 @@ to {
|
|
|
268
268
|
*
|
|
269
269
|
* This source code is licensed under the ISC license.
|
|
270
270
|
* See the LICENSE file in the root directory of this source tree.
|
|
271
|
-
*/const
|
|
271
|
+
*/const sf=oe("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
|
|
272
272
|
* @license lucide-react v0.400.0 - ISC
|
|
273
273
|
*
|
|
274
274
|
* This source code is licensed under the ISC license.
|
|
275
275
|
* See the LICENSE file in the root directory of this source tree.
|
|
276
|
-
*/const
|
|
276
|
+
*/const ea=oe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
277
277
|
* @license lucide-react v0.400.0 - ISC
|
|
278
278
|
*
|
|
279
279
|
* This source code is licensed under the ISC license.
|
|
@@ -288,7 +288,7 @@ to {
|
|
|
288
288
|
*
|
|
289
289
|
* This source code is licensed under the ISC license.
|
|
290
290
|
* See the LICENSE file in the root directory of this source tree.
|
|
291
|
-
*/const
|
|
291
|
+
*/const af=oe("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
292
292
|
* @license lucide-react v0.400.0 - ISC
|
|
293
293
|
*
|
|
294
294
|
* This source code is licensed under the ISC license.
|
|
@@ -303,7 +303,7 @@ to {
|
|
|
303
303
|
*
|
|
304
304
|
* This source code is licensed under the ISC license.
|
|
305
305
|
* See the LICENSE file in the root directory of this source tree.
|
|
306
|
-
*/const
|
|
306
|
+
*/const of=oe("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
|
|
307
307
|
* @license lucide-react v0.400.0 - ISC
|
|
308
308
|
*
|
|
309
309
|
* This source code is licensed under the ISC license.
|
|
@@ -313,17 +313,17 @@ to {
|
|
|
313
313
|
*
|
|
314
314
|
* This source code is licensed under the ISC license.
|
|
315
315
|
* See the LICENSE file in the root directory of this source tree.
|
|
316
|
-
*/const
|
|
316
|
+
*/const lf=oe("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
|
|
317
317
|
* @license lucide-react v0.400.0 - ISC
|
|
318
318
|
*
|
|
319
319
|
* This source code is licensed under the ISC license.
|
|
320
320
|
* See the LICENSE file in the root directory of this source tree.
|
|
321
|
-
*/const
|
|
321
|
+
*/const el=oe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
322
322
|
* @license lucide-react v0.400.0 - ISC
|
|
323
323
|
*
|
|
324
324
|
* This source code is licensed under the ISC license.
|
|
325
325
|
* See the LICENSE file in the root directory of this source tree.
|
|
326
|
-
*/const
|
|
326
|
+
*/const tl=oe("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
|
|
327
327
|
* @license lucide-react v0.400.0 - ISC
|
|
328
328
|
*
|
|
329
329
|
* This source code is licensed under the ISC license.
|
|
@@ -338,12 +338,12 @@ to {
|
|
|
338
338
|
*
|
|
339
339
|
* This source code is licensed under the ISC license.
|
|
340
340
|
* See the LICENSE file in the root directory of this source tree.
|
|
341
|
-
*/const
|
|
341
|
+
*/const rl=oe("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
|
|
342
342
|
* @license lucide-react v0.400.0 - ISC
|
|
343
343
|
*
|
|
344
344
|
* This source code is licensed under the ISC license.
|
|
345
345
|
* See the LICENSE file in the root directory of this source tree.
|
|
346
|
-
*/const
|
|
346
|
+
*/const nl=oe("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
|
|
347
347
|
* @license lucide-react v0.400.0 - ISC
|
|
348
348
|
*
|
|
349
349
|
* This source code is licensed under the ISC license.
|
|
@@ -373,12 +373,12 @@ to {
|
|
|
373
373
|
*
|
|
374
374
|
* This source code is licensed under the ISC license.
|
|
375
375
|
* See the LICENSE file in the root directory of this source tree.
|
|
376
|
-
*/const
|
|
376
|
+
*/const nc=oe("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
|
|
377
377
|
* @license lucide-react v0.400.0 - ISC
|
|
378
378
|
*
|
|
379
379
|
* This source code is licensed under the ISC license.
|
|
380
380
|
* See the LICENSE file in the root directory of this source tree.
|
|
381
|
-
*/const
|
|
381
|
+
*/const sc=oe("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
382
382
|
* @license lucide-react v0.400.0 - ISC
|
|
383
383
|
*
|
|
384
384
|
* This source code is licensed under the ISC license.
|
|
@@ -398,7 +398,7 @@ to {
|
|
|
398
398
|
*
|
|
399
399
|
* This source code is licensed under the ISC license.
|
|
400
400
|
* See the LICENSE file in the root directory of this source tree.
|
|
401
|
-
*/const
|
|
401
|
+
*/const mo=oe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
402
402
|
* @license lucide-react v0.400.0 - ISC
|
|
403
403
|
*
|
|
404
404
|
* This source code is licensed under the ISC license.
|
|
@@ -423,7 +423,7 @@ to {
|
|
|
423
423
|
*
|
|
424
424
|
* This source code is licensed under the ISC license.
|
|
425
425
|
* See the LICENSE file in the root directory of this source tree.
|
|
426
|
-
*/const
|
|
426
|
+
*/const sl=oe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
427
427
|
* @license lucide-react v0.400.0 - ISC
|
|
428
428
|
*
|
|
429
429
|
* This source code is licensed under the ISC license.
|
|
@@ -433,7 +433,7 @@ to {
|
|
|
433
433
|
*
|
|
434
434
|
* This source code is licensed under the ISC license.
|
|
435
435
|
* See the LICENSE file in the root directory of this source tree.
|
|
436
|
-
*/const
|
|
436
|
+
*/const go=oe("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
437
437
|
* @license lucide-react v0.400.0 - ISC
|
|
438
438
|
*
|
|
439
439
|
* This source code is licensed under the ISC license.
|
|
@@ -448,12 +448,12 @@ to {
|
|
|
448
448
|
*
|
|
449
449
|
* This source code is licensed under the ISC license.
|
|
450
450
|
* See the LICENSE file in the root directory of this source tree.
|
|
451
|
-
*/const
|
|
451
|
+
*/const il=oe("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/**
|
|
452
452
|
* @license lucide-react v0.400.0 - ISC
|
|
453
453
|
*
|
|
454
454
|
* This source code is licensed under the ISC license.
|
|
455
455
|
* See the LICENSE file in the root directory of this source tree.
|
|
456
|
-
*/const Cr=oe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),rv={},
|
|
456
|
+
*/const Cr=oe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),rv={},ic=e=>{let t;const r=new Set,n=(f,d)=>{const g=typeof f=="function"?f(t):f;if(!Object.is(g,t)){const p=t;t=d??(typeof g!="object"||g===null)?g:Object.assign({},t,g),r.forEach(w=>w(t,p))}},s=()=>t,l={setState:n,getState:s,getInitialState:()=>u,subscribe:f=>(r.add(f),()=>r.delete(f)),destroy:()=>{(rv?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},u=t=e(n,s,l);return l},nv=e=>e?ic(e):ic;function cf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yo={exports:{}},ba={},Js={exports:{}},wa={};/**
|
|
457
457
|
* @license React
|
|
458
458
|
* use-sync-external-store-shim.production.js
|
|
459
459
|
*
|
|
@@ -461,7 +461,7 @@ to {
|
|
|
461
461
|
*
|
|
462
462
|
* This source code is licensed under the MIT license found in the
|
|
463
463
|
* LICENSE file in the root directory of this source tree.
|
|
464
|
-
*/var
|
|
464
|
+
*/var ac;function sv(){if(ac)return wa;ac=1;var e=m;function t(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,s=e.useEffect,i=e.useLayoutEffect,a=e.useDebugValue;function o(d,g){var p=g(),w=n({inst:{value:p,getSnapshot:g}}),h=w[0].inst,y=w[1];return i(function(){h.value=p,h.getSnapshot=g,l(h)&&y({inst:h})},[d,p,g]),s(function(){return l(h)&&y({inst:h}),d(function(){l(h)&&y({inst:h})})},[d]),a(p),p}function l(d){var g=d.getSnapshot;d=d.value;try{var p=g();return!r(d,p)}catch{return!0}}function u(d,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:o;return wa.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,wa}var Ca={};/**
|
|
465
465
|
* @license React
|
|
466
466
|
* use-sync-external-store-shim.development.js
|
|
467
467
|
*
|
|
@@ -469,7 +469,7 @@ to {
|
|
|
469
469
|
*
|
|
470
470
|
* This source code is licensed under the MIT license found in the
|
|
471
471
|
* LICENSE file in the root directory of this source tree.
|
|
472
|
-
*/var
|
|
472
|
+
*/var oc;function iv(){return oc||(oc=1,process.env.NODE_ENV!=="production"&&function(){function e(p,w){return p===w&&(p!==0||1/p===1/w)||p!==p&&w!==w}function t(p,w){f||s.startTransition===void 0||(f=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=w();if(!d){var y=w();i(h,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}y=a({inst:{value:h,getSnapshot:w}});var v=y[0].inst,b=y[1];return l(function(){v.value=h,v.getSnapshot=w,r(v)&&b({inst:v})},[p,h,w]),o(function(){return r(v)&&b({inst:v}),p(function(){r(v)&&b({inst:v})})},[p]),u(h),h}function r(p){var w=p.getSnapshot;p=p.value;try{var h=w();return!i(p,h)}catch{return!0}}function n(p,w){return w()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=m,i=typeof Object.is=="function"?Object.is:e,a=s.useState,o=s.useEffect,l=s.useLayoutEffect,u=s.useDebugValue,f=!1,d=!1,g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;Ca.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:g,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ca}var lc;function al(){return lc||(lc=1,process.env.NODE_ENV==="production"?Js.exports=sv():Js.exports=iv()),Js.exports}/**
|
|
473
473
|
* @license React
|
|
474
474
|
* use-sync-external-store-shim/with-selector.production.js
|
|
475
475
|
*
|
|
@@ -477,7 +477,7 @@ to {
|
|
|
477
477
|
*
|
|
478
478
|
* This source code is licensed under the MIT license found in the
|
|
479
479
|
* LICENSE file in the root directory of this source tree.
|
|
480
|
-
*/var
|
|
480
|
+
*/var cc;function av(){if(cc)return ba;cc=1;var e=m,t=al();function r(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var n=typeof Object.is=="function"?Object.is:r,s=t.useSyncExternalStore,i=e.useRef,a=e.useEffect,o=e.useMemo,l=e.useDebugValue;return ba.useSyncExternalStoreWithSelector=function(u,f,d,g,p){var w=i(null);if(w.current===null){var h={hasValue:!1,value:null};w.current=h}else h=w.current;w=o(function(){function v(E){if(!b){if(b=!0,C=E,E=g(E),p!==void 0&&h.hasValue){var N=h.value;if(p(N,E))return S=N}return S=E}if(N=S,n(C,E))return N;var R=g(E);return p!==void 0&&p(N,R)?(C=E,N):(C=E,S=R)}var b=!1,C,S,_=d===void 0?null:d;return[function(){return v(f())},_===null?void 0:function(){return v(_())}]},[f,d,g,p]);var y=s(u,w[0],w[1]);return a(function(){h.hasValue=!0,h.value=y},[y]),l(y),y},ba}var Sa={};/**
|
|
481
481
|
* @license React
|
|
482
482
|
* use-sync-external-store-shim/with-selector.development.js
|
|
483
483
|
*
|
|
@@ -485,22 +485,22 @@ to {
|
|
|
485
485
|
*
|
|
486
486
|
* This source code is licensed under the MIT license found in the
|
|
487
487
|
* LICENSE file in the root directory of this source tree.
|
|
488
|
-
*/var fc;function ov(){return fc||(fc=1,process.env.NODE_ENV!=="production"&&function(){function e(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=m,r=ll(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,a=t.useEffect,o=t.useMemo,l=t.useDebugValue;xa.useSyncExternalStoreWithSelector=function(u,f,d,g,p){var w=i(null);if(w.current===null){var h={hasValue:!1,value:null};w.current=h}else h=w.current;w=o(function(){function v(E){if(!b){if(b=!0,C=E,E=g(E),p!==void 0&&h.hasValue){var N=h.value;if(p(N,E))return S=N}return S=E}if(N=S,n(C,E))return N;var R=g(E);return p!==void 0&&p(N,R)?(C=E,N):(C=E,S=R)}var b=!1,C,S,_=d===void 0?null:d;return[function(){return v(f())},_===null?void 0:function(){return v(_())}]},[f,d,g,p]);var y=s(u,w[0],w[1]);return a(function(){h.hasValue=!0,h.value=y},[y]),l(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),xa}process.env.NODE_ENV==="production"?bo.exports=av():bo.exports=ov();var lv=bo.exports;const cv=df(lv),ff={},{useDebugValue:uv}=m,{useSyncExternalStoreWithSelector:dv}=cv;let hc=!1;const fv=e=>e;function hv(e,t=fv,r){(ff?"production":void 0)!=="production"&&r&&!hc&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),hc=!0);const n=dv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return uv(n),n}const pc=e=>{(ff?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?nv(e):e,r=(n,s)=>hv(t,n,s);return Object.assign(r,t),r},zs=e=>e?pc(e):pc,ce=zs(e=>({editorConfig:null,editorMode:"edit",buttonLoaders:{saveCollection:!1,publishCollection:!1,addFromLibrary:!1,rejectCollection:!1,sourcingApproveCollection:!1,sourcingRejectCollection:!1},showPreview:!1,pageId:"collection_editor",isCurrentNodeFolder:!1,isCurrentNodeRoot:!1,isQumlPlayer:!1,isDirty:!1,lastSaved:null,formStatusMapper:{},contentFramework:null,contentTargetFWIds:null,rootFormConfig:null,unitFormConfig:null,childFormConfig:null,searchFormConfig:null,relationalFormConfig:null,publishChecklist:null,reviewChecklist:null,rfcChecklist:null,categoryMeta:null,setEditorConfig:t=>e({editorConfig:t}),setEditorMode:t=>e({editorMode:t}),setButtonLoader:(t,r)=>e(n=>({buttonLoaders:{...n.buttonLoaders,[t]:r}})),setShowPreview:t=>e({showPreview:t}),setPageId:t=>e({pageId:t}),setNodeFlags:t=>e({...t.isFolder!==void 0&&{isCurrentNodeFolder:t.isFolder},...t.isRoot!==void 0&&{isCurrentNodeRoot:t.isRoot},...t.isQuml!==void 0&&{isQumlPlayer:t.isQuml}}),setLastSaved:t=>e({lastSaved:t}),setIsDirty:t=>e({isDirty:t}),setContentFramework:(t,r)=>e({contentFramework:t,contentTargetFWIds:r}),setFormStatus:(t,r)=>e(n=>({formStatusMapper:{...n.formStatusMapper,[t]:r}})),validateAllForms:t=>{const r=ce.getState().formStatusMapper,n=[...t];for(;n.length>0;){const s=n.shift();if(r[s.id]===!1)return!1;s.children&&n.push(...s.children)}return!0},setCategoryDefinition:t=>e({rootFormConfig:t.rootForm,unitFormConfig:t.unitForm,childFormConfig:t.childForm,searchFormConfig:t.searchForm,relationalFormConfig:t.relationalForm,publishChecklist:t.publishChecklist,reviewChecklist:t.reviewChecklist,rfcChecklist:t.rfcChecklist,categoryMeta:{schemaDefaults:t.schemaDefaults,frameworkMetadata:t.frameworkMetadata,sourcingSettings:t.sourcingSettings}})})),pv=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:ce},Symbol.toStringTag,{value:"Module"}));function Gr(e,t){const r=[...e];for(;r.length>0;){const n=r.shift();if(n.id===t)return n;n.children&&r.push(...n.children)}}function hf(e,t,r=0){var n;for(const s of e){if(s.id===t)return r;if((n=s.children)!=null&&n.length){const i=hf(s.children,t,r+1);if(i>=0)return i}}return-1}const mv=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function pf(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const a of mv)a in r&&(i[a]=r[a]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:pf(n.children,t,r)}:n})}function pi(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:pi(n.children,t,r)}:n)}function wo(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?wo(r.children,t):[]}))}function mf(e,t,r,n){return e.map(s=>{if(s.id===t){const i=[...s.children??[]],[a]=i.splice(r,1);return i.splice(n,0,a),{...s,children:i}}return s.children&&s.children.length>0?{...s,children:mf(s.children,t,r,n)}:s})}function gf(e,t){return e.map(r=>{const n=t[r.id]??r.id,s=r.parent?t[r.parent]??r.parent:r.parent;return{...r,id:n,identifier:n,parent:s,children:r.children?gf(r.children,t):[]}})}function gv(e){let t=0;const r=[...e];for(;r.length>0;){const n=r.shift();n.isFolder||t++,n.children&&r.push(...n.children)}return t}function yv(e,t){const r=Gr(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?Gr(e,s.parent):void 0;return n}const Oe=zs((e,t)=>({treeData:[],selectedNodeId:null,treeCache:{},breadcrumb:[],activeNodeMeta:{},setTreeData:r=>{var s;const n=((s=r[0])==null?void 0:s.id)??null;e({treeData:r,selectedNodeId:n}),n&&setTimeout(()=>t().selectNode(n),0)},selectNode:r=>{const{treeData:n,treeCache:s,getBreadcrumb:i}=t(),a=Gr(n,r),o=i(r),l={...(a==null?void 0:a.metadata)??{},...s[r]??{}};ce.getState().setNodeFlags({isFolder:(a==null?void 0:a.isFolder)??!1,isRoot:!(a!=null&&a.parent),isQuml:!1}),e({selectedNodeId:r,breadcrumb:o,activeNodeMeta:l})},updateNode:(r,n)=>{e(s=>({treeData:pf(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),t().markDirty()},addNode:(r,n)=>{var u,f;const s=t(),i=((f=(u=ce.getState().editorConfig)==null?void 0:u.config)==null?void 0:f.maxDepth)??4,a=hf(s.treeData,r);if(a>=i)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${i}). parentDepth=${a}`),"";const o="temp-"+Math.random().toString(36).slice(2),l={id:o,identifier:o,name:"Untitled Unit",isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:o,name:"Untitled Unit",visibility:"Parent"}};return e(d=>({treeData:pi(d.treeData,r,l),treeCache:{...d.treeCache,[o]:{...l.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(o),0),o},deleteNode:r=>{e(n=>({treeData:wo(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:mf(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const a=Gr(i.treeData,r);if(!a)return i;let o=wo(i.treeData,r);return o=pi(o,s,{...a,parent:s}),{treeData:o}}),t().markDirty()},addResource:(r,n)=>{var f,d,g;const s=ce.getState().editorConfig,i=((f=s==null?void 0:s.config)==null?void 0:f.allowContentUnderRoot)??!1,a=(d=t().treeData[0])==null?void 0:d.id;if(!i&&n===a||Gr(t().treeData,r.identifier))return!1;const o=((g=s==null?void 0:s.config)==null?void 0:g.maxContentsLimit)??1200;if(gv(t().treeData)>=o)return!1;const u={id:r.identifier,identifier:r.identifier,name:r.name,isFolder:!1,children:[],parent:n,mimeType:r.mimeType,primaryCategory:r.primaryCategory,contentType:r.contentType,appIcon:r.appIcon,status:r.status,metadata:r};return e(p=>({treeData:pi(p.treeData,n,u)})),t().markDirty(),!0},markDirty:()=>{const{editorMode:r,setIsDirty:n}=ce.getState();r==="edit"&&n(!0)},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const s=gf(n.treeData,r),i={};for(const[o,l]of Object.entries(n.treeCache)){const u=r[o]??o,{isNew:f,...d}=l;i[u]=d}const a=n.selectedNodeId?r[n.selectedNodeId]??n.selectedNodeId:null;return{treeData:s,treeCache:i,selectedNodeId:a}})},getNodeById:r=>Gr(t().treeData,r),getChildrenOf:r=>{const n=Gr(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>yv(t().treeData,r)})),vv=zs(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),bv="_spin_1ah4d_9",wv={spin:bv},Cv={emptyStateMessage:"Select a unit from the outline to edit its details",reviewCommentLabel:"Reviewer comment:",untitledPlaceholder:"Untitled",nodeTitleAriaLabel:"Node title",dropZoneLabel:"Drop to add content to this unit"},Sv={ariaLabel:"Select language"},xv={errorBoundaryTitle:"Something went wrong",retryButton:"Retry",loadingMessage:"Loading editor...",loadErrorTitle:"Failed to load editor"},_v={nodePathAriaLabel:"Node path",homeAriaLabel:"Home"},Tv={detailsTab:"Details",audienceCurriculumTab:"Audience & Curriculum",licensingTab:"Licensing",metadataSectionsAriaLabel:"Metadata sections",hasErrorsAriaLabel:"Has errors"},Ev={moveToAnotherUnitButton:"Move to another unit",collapseMetadataPanelAriaLabel:"Collapse metadata panel",expandMetadataPanelAriaLabel:"Expand metadata panel",collapseTitle:"Collapse",expandTitle:"Expand",iconAlt:"icon",contentNamePlaceholder:"Content name",keywordsLabel:"Keywords",addKeywordPlaceholder:"Add keyword and press Enter",addButton:"Add",optionalInCollectionLabel:"Optional in Collection",yesOption:"Yes",noOption:"No"},Iv={selectAppIconAriaLabel:"Select app icon",appIconAriaLabel:"App icon",appIconAlt:"App icon",removeIconAriaLabel:"Remove icon"},Ov={removeConfirm:"Remove this content from the unit?",heading:"Content in this unit",emptyTitle:"No content yet",emptyHint:"Drag from the library or click Add content",addContentAriaLabel:"Add content to unit",addContent:"Add content"},Av={dragToReorderAriaLabel:"Drag to reorder",removeAriaLabel:"Remove {name}"},Dv={invalidFileType:"Only .csv files are accepted.",fileTooLarge:"File size must not exceed 50 MB.",downloadSampleFailed:"Failed to download sample CSV.",processingFailed:"Upload processing failed. Please check the error rows below.",connectionLost:"Lost connection while checking status. Please try again.",uploadFailed:"Upload failed. Please check your file and try again.",statusUploading:"Uploading...",statusProcessing:"Processing...",statusDone:"Done!",statusError:"Error",titleUpdate:"Update Folder Metadata via CSV",titleCreate:"Create Folders via CSV",closeAriaLabel:"Close",dropZoneAriaLabel:"Drop CSV file here or click to browse",dropText:"Drag & drop your CSV here",dropSubtext:"or click to browse",downloadSample:"Download Sample CSV",itemsImportedSuffix:"— {count} item(s) imported",failedRowsTitle:"Failed Rows ({count})",rowHeader:"Row",nameHeader:"Name",reasonHeader:"Reason",unknownError:"Unknown error",cancel:"Cancel",uploaded:"Uploaded",upload:"Upload"},Nv={saveFailed:"Failed to save collaborators. Please try again.",title:"Manage Collaborators",closeAriaLabel:"Close",searchUsersLabel:"Search users",searchPlaceholder:"Search by name or email...",searchingAriaLabel:"Searching...",searchResultsAriaLabel:"Search results",add:"Add",noUsersFound:"No users found.",currentCollaborators:"Current Collaborators",noCollaboratorsYet:"No collaborators added yet.",remove:"Remove",saveSuccess:"Collaborators saved successfully.",cancel:"Cancel",save:"Save"},Rv={shuffleEnabledMessage:"Shuffling is enabled for this question set.",noFieldsMessage:"No fields configured for this tab."},jv={requiredError:"{field} is required",selectIconAriaLabel:"Select app icon",iconAlt:"App icon",selectIconLabel:"Select icon",removeIconAriaLabel:"Remove app icon",removeLabel:"Remove"},kv={dialogAriaLabel:"Select App Icon",title:"Select App Icon",closeAriaLabel:"Close",myImagesTab:"My Images",allImagesTab:"All Images",uploadTab:"Upload",searchPlaceholder:"Search images…",loadingText:"Loading…",noImagesFound:"No images found",noThumbnailText:"IMG",loadMoreButton:"Load More",previewAlt:"Preview",dropZoneText:"Drag & drop or click to browse",acceptedTypesInfo:"{types} · max {size} MB",cancelButton:"Cancel",uploadingText:"Uploading…",uploadAndUseButton:"Upload & Use",useSelectedButton:"Use Selected",invalidFileTypeError:"Only {types} files are accepted.",fileTooLargeError:"Image must be under {size} MB.",uploadFailedError:"Upload failed."},Lv={addPlaceholder:"Add…",addButtonLabel:"Add"},Pv={requiredError:"{field} is required"},Fv={requiredError:"{field} is required",enterCodeMessage:"Enter a dial code to validate.",validMessage:"Dial code is valid.",notFoundMessage:"Dial code not found.",validationFailedMessage:"Validation failed. Please try again.",placeholderExample:"e.g. A1B2C3",validateAriaLabel:"Validate dial code",validatingLabel:"Validating…",validateButtonLabel:"Validate"},Mv={requiredError:"{field} is required",inputPlaceholder:"Type and press Enter or comma…"},Bv={requiredError:"{field} is required",selectPlaceholder:"Select license…"},$v={requiredError:"{field} is required",selectedCountSuffix:"selected",selectPlaceholder:"Select…",noOptionsMessage:"No options"},qv={requiredError:"{field} is required",selectPlaceholder:"Select…"},Uv={requiredError:"{field} is required"},zv={requiredError:"{field} is required",selectPlaceholder:"Select…",noOptionsMessage:"No options"},Vv={requiredError:"{field} is required",maxLengthError:"Max {max} characters"},Hv={dialogAriaLabel:"Asset Browser",title:"Asset Browser",closeAriaLabel:"Close",browseTab:"Browse",uploadTab:"Upload",searchPlaceholder:"Search assets...",searchButton:"Search",loadingMessage:"Loading...",uploadingMessage:"Uploading...",chooseFileButton:"Choose file to upload"},Qv={dialogAriaLabel:"Move resource",moveHeaderPrefix:"Move",closeAriaLabel:"Close",selectUnitHint:"Select a unit to move this content to:",noUnitsAvailable:"No other units available",cancelButton:"Cancel",moveButton:"Move here"},Gv={dialogAriaLabel:"Assign Page Numbers",title:"Assign Page Numbers",closeAriaLabel:"Close",emptyState:"No content items found in this collection.",contentColumnHeader:"Content",pageNumberColumnHeader:"Page Number",cancelButton:"Cancel",saveButton:"Save"},Wv={confirmButton:"Confirm",cancelButton:"Cancel",closeAriaLabel:"Close"},Kv={publishTitlePrefix:"Publish",closeAriaLabel:"Close",confirmPublishPrefix:"Are you sure you want to publish this",checklistInstructions:"Please confirm that ALL the following items are verified (by ticking the check-boxes) before you can publish:",noButton:"No",yesButton:"Yes"},Yv={reviewQualityTitle:"Review Quality",rejectContentTitle:"Reject Content",closeAriaLabel:"Close",qualityScoreLabel:"Quality Score",scorePoorLabel:"0 — Poor",scoreExcellentLabel:"10 — Excellent",commentLabel:"Comment",optionalLabel:"(optional)",commentPlaceholder:"Add any notes for the content creator…",rejectionReasonLabel:"Rejection Reason",rejectReasonPlaceholder:"Describe why this content is being rejected…",rejectionRequiredMessage:"A rejection reason is required.",cancelButton:"Cancel",approveButton:"Approve",rejectButton:"Reject"},Zv={title:"Unsaved changes",closeAriaLabel:"Close",bodyMessage:"You have unsaved changes. Would you like to save them before leaving?",cancelButton:"Cancel",discardButton:"Discard",saveButton:"Save"},Xv={contentTypeFiltersAriaLabel:"Content type filters"},Jv={alreadyAddedAriaLabel:"Already added",alreadyAddedTitle:"Already added to this collection",addItemAriaLabel:"Add {name} to unit",addToUnitTitle:"Add to unit",selectUnitToAddTitle:"Select a unit to add",draftOnlyTitle:"Only Draft content can be added"},eb={selectUnitFirstToast:"Select a unit first",selectUnitFromOutlineToast:"Select a unit from the outline to add content — resources cannot be added directly to the course.",itemAlreadyAddedToast:'"{name}" is already in this collection',itemAddedToast:'Added "{name}"',collapseLibraryPanelAriaLabel:"Collapse library panel",collapseLibraryTitle:"Collapse library",headerTitle:"Library",searchPlaceholder:"Search content…",searchAriaLabel:"Search library",sortAZAriaLabel:"Sort: A–Z (click for Recent)",sortRecentAriaLabel:"Sort: Recent (click for A–Z)",sortAZTitle:"A–Z",sortRecentTitle:"Recent",toggleAdvancedFiltersAriaLabel:"Toggle advanced filters",advancedFiltersTitle:"Advanced filters",libraryContentAriaLabel:"Library content",loadMoreAriaLabel:"Load more content",loadingText:"Loading…",loadMoreText:"Load More",noContentFound:"No content found",tryDifferentSearch:"Try a different search or filter"},tb={boardLabel:"Board",mediumLabel:"Medium",classLabel:"Class",subjectLabel:"Subject",primaryCategoryLabel:"Primary Category",filterLibraryAriaLabel:"Filter library",filtersHeaderTitle:"Filters",closeFiltersAriaLabel:"Close filters",resetButton:"Reset",applyButton:"Apply"},rb={contentPreviewAriaLabel:"Content preview",closePreviewAriaLabel:"Close preview",addToUnitButton:"+ Add to Unit"},nb={maxDepthReachedToast:"Maximum depth reached",downloadCsvFailedToast:"Failed to download CSV",outlineRefreshedToast:"Course outline refreshed.",outlineRefreshFailedToast:"Outline could not be refreshed automatically. Please reload the page.",moreOptionsAriaLabel:"More options",moreOptionsTitle:"More options",foldersExistTitle:'Folders already exist — use "Update" instead',createFoldersCsvButton:"Create folders using csv file",noFoldersYetTitle:'No folders yet — use "Create" first',downloadFoldersCsvButton:"Download folders as csv file",updateFoldersCsvButton:"Update folder metadata using csv file",expandOutlineAriaLabel:"Expand outline",collapseOutlineAriaLabel:"Collapse outline",addUnitButton:"Add Unit",addSubunitButton:"Add Sub-unit"},sb={expandAriaLabel:"Expand",collapseAriaLabel:"Collapse",dropHereLabel:"Drop here",nodeOptionsAriaLabel:"Node options",renameMenuItem:"Rename",addSubunitMenuItem:"Add sub-unit",addSiblingMenuItem:"Add Sibling",deleteMenuItem:"Delete"},ib={mimeLabelVideo:"Video",mimeLabelAudio:"Audio",mimeLabelPdf:"PDF",mimeLabelEpub:"ePub",mimeLabelEcml:"ECML",mimeLabelH5p:"H5P",mimeLabelScorm:"SCORM",mimeLabelOther:"Content",infoFieldAuthor:"Author",infoFieldLicense:"License",infoFieldLanguage:"Language",infoFieldClass:"Class",infoFieldSubject:"Subject",infoFieldType:"Type",loadingPreview:"Loading preview…",previewPlayerUnavailable:"Preview player unavailable. Check that /content/preview is reachable.",failedToInitializePlayer:"Failed to initialize the content player.",previewPlayerLoadFailed:"Preview player could not be loaded.",unableToLoadQuestionset:"Unable to load questionset:",parentQuestionsetNotResolved:"Could not resolve the parent questionset for this question.",questionNotFoundInQuestionset:"Question not found in the questionset."},ab={title:"QR Code (Dialcode)",invalidFormatError:"Invalid DIAL code format. Use uppercase letters and digits only (e.g. A1B2C3).",duplicateDialcodeError:'DIAL code "{code}" is already linked to another node in this collection.',dialcodeNotFoundError:"Dialcode not found. Please enter a valid code.",linkFailedError:"Failed to link dialcode. Please try again.",unlinkFailedError:"Failed to remove dialcode. Please try again.",qrCodeAltPrefix:"QR code for",linkedCodeLabel:"Linked code:",removeButton:"Remove",noCodeLinkedMessage:"No QR code linked to this content.",linkManuallyLabel:"Link manually",dialcodeInputPlaceholder:"Enter dialcode (e.g. A1B2C3)",dialcodeInputAriaLabel:"Dialcode input",linkButton:"Link",linkedSuccessMessage:"Dialcode linked successfully."},ob={unitsAddedLabel:"Units added",contentItemsLabel:"Content items",progressLabel:"Progress"},lb={dropOntoUnitError:"Drop onto a unit to add content",dropOntoCourseError:"Drop content onto a unit, not directly on the course.",alreadyInCollectionError:'"{name}" is already in this collection',addedToUnitSuccess:'Added "{name}" to unit',fillRequiredMetadataError:"Please fill the required metadata",outlineAriaLabel:"Course outline",showOutlineTitle:"Show outline",editorAriaLabel:"Content editor",libraryAriaLabel:"Content library",showLibraryTitle:"Show library"},cb={draftStatusFallback:"Draft",backAriaLabel:"Go back",statusAriaLabelPrefix:"Status:",savingIndicator:"Saving…",unsavedIndicator:"Unsaved",savedIndicatorPrefix:"Saved",fillRequiredFieldsTooltip:"Fill all required fields before saving",saveAsDraftButton:"Save as Draft",sendForReviewButton:"Send for review",collaboratorsLabel:"Collaborators",qrCodesLabel:"QR Codes",generatingEllipsis:"Generating…",generateQrCodesMenuItem:"Generate QR Codes",downloadingEllipsis:"Downloading…",downloadQrCodesMenuItem:"Download QR Codes",publishButton:"Publish",requestForChangesButton:"Request for Changes",approveButton:"Approve",qrGenerationStartedToast:'QR Codes generation started. Use "Download QR Codes" once ready.',qrGenerationFailedToast:"Failed to generate QR Codes. Please try again.",qrCodesNotGeneratedToast:"No QR codes generated yet. Generate QR Codes first.",qrGenerationInProgressToast:"QR code image generation is in progress. Please try downloading after some time.",qrCodesNotReadyToast:"QR Codes not ready yet. Please wait and try again.",qrCodesDownloadedToast:"QR codes downloaded.",qrCodesDownloadFailedToast:"Failed to download QR Codes.",requestChangesTitle:"Request Changes",changesRequestedLabel:"Changes requested",describeChangesPlaceholder:"Describe the changes the author needs to make"},ub={closeAriaLabel:"Close",fillCommentsError:"Fill comments",cancelButton:"Cancel"},db={closeAriaLabel:"Close",title:"Accepting Terms & Conditions",agreementTextPart1:"I agree that by submitting / publishing this Content, I confirm that this Content complies with prescribed guidelines, including the Terms of Use and Content Policy and that I consent to publish it under the",creativeCommonsLinkText:"Creative Commons Framework",agreementTextPart2:"in accordance with the",contentPolicyText:"Content Policy",agreementTextPart3:". I have made sure that I do not violate others' copyright or privacy rights.",cancelButton:"Cancel",submitButton:"Submit"},fb={closeAriaLabel:"Close",title:"Generate QR Codes",numberOfCodesLabel:"Number of QR Codes",countPlaceholder:"Enter number (2–250)",countRangeError:"Enter a number between 2 and 250.",cancelButton:"Cancel",generateButton:"Generate"},hb={remove:"Remove"},pb={dropHere:"Drop here"},mb={loading:"Loading"},Co={contextualEditor:Cv,languageSelector:Sv,collectionEditor:xv,breadcrumb:_v,tabBar:Tv,contentEditForm:Ev,titleAppIcon:Iv,unitContentList:Ov,contentRow:Av,csvUpload:Dv,manageCollaborators:Nv,sparkMetaForm:Rv,appIconField:jv,appIconPickerModal:kv,chipGroupField:Lv,dateTimeField:Pv,dialcodeInputField:Fv,keywordSuggestField:Mv,licenseSelectField:Bv,multiSelectField:$v,nestedSelectField:qv,radioField:Uv,selectField:zv,textField:Vv,assetBrowser:Hv,resourceReorderDialog:Qv,assignPageNumber:Gv,confirmDialog:Wv,publishChecklist:Kv,qualityParamsModal:Yv,unsavedChangesModal:Zv,filterChips:Xv,libraryCard:Jv,libraryDock:eb,libraryFilterPanel:tb,libraryPreviewPanel:rb,outlineTree:nb,treeNode:sb,contentPlayer:ib,dialcodePanel:ab,progressStatus:ob,splitBuilderShell:lb,topbar:cb,reviewCommentModal:ub,confirmReviewModal:db,generateQRModal:fb,chip:hb,dropZone:pb,spinner:mb},gb={emptyStateMessage:"اختر وحدة من المخطط التفصيلي لتحرير تفاصيلها",reviewCommentLabel:"تعليق المراجع:",untitledPlaceholder:"بدون عنوان",nodeTitleAriaLabel:"عنوان العنصر",dropZoneLabel:"أفلت هنا لإضافة محتوى إلى هذه الوحدة"},yb={ariaLabel:"اختيار اللغة"},vb={errorBoundaryTitle:"حدث خطأ ما",retryButton:"إعادة المحاولة",loadingMessage:"جارٍ تحميل المحرر...",loadErrorTitle:"فشل تحميل المحرر"},bb={nodePathAriaLabel:"مسار العنصر",homeAriaLabel:"الصفحة الرئيسية"},wb={detailsTab:"التفاصيل",audienceCurriculumTab:"الجمهور والمنهج",licensingTab:"الترخيص",metadataSectionsAriaLabel:"أقسام البيانات الوصفية",hasErrorsAriaLabel:"يحتوي على أخطاء"},Cb={moveToAnotherUnitButton:"نقل إلى وحدة أخرى",collapseMetadataPanelAriaLabel:"طي لوحة البيانات الوصفية",expandMetadataPanelAriaLabel:"توسيع لوحة البيانات الوصفية",collapseTitle:"طي",expandTitle:"توسيع",iconAlt:"أيقونة",contentNamePlaceholder:"اسم المحتوى",keywordsLabel:"الكلمات المفتاحية",addKeywordPlaceholder:"أضف كلمة مفتاحية واضغط Enter",addButton:"إضافة",optionalInCollectionLabel:"اختياري في المجموعة",yesOption:"نعم",noOption:"لا"},Sb={selectAppIconAriaLabel:"اختيار أيقونة التطبيق",appIconAriaLabel:"أيقونة التطبيق",appIconAlt:"أيقونة التطبيق",removeIconAriaLabel:"إزالة الأيقونة"},xb={removeConfirm:"هل تريد إزالة هذا المحتوى من الوحدة؟",heading:"المحتوى في هذه الوحدة",emptyTitle:"لا يوجد محتوى بعد",emptyHint:"اسحب من المكتبة أو انقر فوق إضافة محتوى",addContentAriaLabel:"إضافة محتوى إلى الوحدة",addContent:"إضافة محتوى"},_b={dragToReorderAriaLabel:"اسحب لإعادة الترتيب",removeAriaLabel:"إزالة {name}"},Tb={invalidFileType:"يُقبل فقط ملفات .csv.",fileTooLarge:"يجب ألا يتجاوز حجم الملف 50 ميجابايت.",downloadSampleFailed:"فشل تنزيل نموذج ملف CSV.",processingFailed:"فشلت معالجة التحميل. يرجى التحقق من صفوف الأخطاء أدناه.",connectionLost:"انقطع الاتصال أثناء التحقق من الحالة. يرجى المحاولة مرة أخرى.",uploadFailed:"فشل التحميل. يرجى التحقق من الملف والمحاولة مرة أخرى.",statusUploading:"جارٍ التحميل...",statusProcessing:"جارٍ المعالجة...",statusDone:"تم!",statusError:"خطأ",titleUpdate:"تحديث بيانات المجلدات الوصفية عبر CSV",titleCreate:"إنشاء مجلدات عبر CSV",closeAriaLabel:"إغلاق",dropZoneAriaLabel:"أفلت ملف CSV هنا أو انقر للتصفح",dropText:"اسحب وأفلت ملف CSV هنا",dropSubtext:"أو انقر للتصفح",downloadSample:"تنزيل نموذج CSV",itemsImportedSuffix:"— تم استيراد {count} عنصر (عناصر)",failedRowsTitle:"الصفوف الفاشلة ({count})",rowHeader:"الصف",nameHeader:"الاسم",reasonHeader:"السبب",unknownError:"خطأ غير معروف",cancel:"إلغاء",uploaded:"تم التحميل",upload:"تحميل"},Eb={saveFailed:"فشل حفظ المتعاونين. يرجى المحاولة مرة أخرى.",title:"إدارة المتعاونين",closeAriaLabel:"إغلاق",searchUsersLabel:"البحث عن المستخدمين",searchPlaceholder:"البحث بالاسم أو البريد الإلكتروني...",searchingAriaLabel:"جارٍ البحث...",searchResultsAriaLabel:"نتائج البحث",add:"إضافة",noUsersFound:"لم يتم العثور على مستخدمين.",currentCollaborators:"المتعاونون الحاليون",noCollaboratorsYet:"لم تتم إضافة أي متعاونين بعد.",remove:"إزالة",saveSuccess:"تم حفظ المتعاونين بنجاح.",cancel:"إلغاء",save:"حفظ"},Ib={shuffleEnabledMessage:"تم تفعيل الترتيب العشوائي لهذه المجموعة من الأسئلة.",noFieldsMessage:"لا توجد حقول مُهيَّأة لهذا التبويب."},Ob={requiredError:"{field} مطلوب",selectIconAriaLabel:"اختيار أيقونة التطبيق",iconAlt:"أيقونة التطبيق",selectIconLabel:"اختيار أيقونة",removeIconAriaLabel:"إزالة أيقونة التطبيق",removeLabel:"إزالة"},Ab={dialogAriaLabel:"اختيار أيقونة التطبيق",title:"اختيار أيقونة التطبيق",closeAriaLabel:"إغلاق",myImagesTab:"صوري",allImagesTab:"جميع الصور",uploadTab:"تحميل",searchPlaceholder:"البحث في الصور…",loadingText:"جارٍ التحميل…",noImagesFound:"لم يتم العثور على صور",noThumbnailText:"صورة",loadMoreButton:"تحميل المزيد",previewAlt:"معاينة",dropZoneText:"اسحب وأفلت أو انقر للتصفح",acceptedTypesInfo:"{types} · بحد أقصى {size} ميجابايت",cancelButton:"إلغاء",uploadingText:"جارٍ التحميل…",uploadAndUseButton:"تحميل واستخدام",useSelectedButton:"استخدام المحدد",invalidFileTypeError:"يُقبل فقط ملفات {types}.",fileTooLargeError:"يجب أن يكون حجم الصورة أقل من {size} ميجابايت.",uploadFailedError:"فشل التحميل."},Db={addPlaceholder:"إضافة…",addButtonLabel:"إضافة"},Nb={requiredError:"{field} مطلوب"},Rb={requiredError:"{field} مطلوب",enterCodeMessage:"أدخل رمز الطلب للتحقق منه.",validMessage:"رمز الطلب صالح.",notFoundMessage:"رمز الطلب غير موجود.",validationFailedMessage:"فشل التحقق. يرجى المحاولة مرة أخرى.",placeholderExample:"مثال: A1B2C3",validateAriaLabel:"التحقق من رمز الطلب",validatingLabel:"جارٍ التحقق…",validateButtonLabel:"تحقق"},jb={requiredError:"{field} مطلوب",inputPlaceholder:"اكتب واضغط Enter أو فاصلة…"},kb={requiredError:"{field} مطلوب",selectPlaceholder:"اختر ترخيصًا…"},Lb={requiredError:"{field} مطلوب",selectedCountSuffix:"محدد",selectPlaceholder:"اختر…",noOptionsMessage:"لا توجد خيارات"},Pb={requiredError:"{field} مطلوب",selectPlaceholder:"اختر…"},Fb={requiredError:"{field} مطلوب"},Mb={requiredError:"{field} مطلوب",selectPlaceholder:"اختر…",noOptionsMessage:"لا توجد خيارات"},Bb={requiredError:"{field} مطلوب",maxLengthError:"الحد الأقصى {max} حرفًا"},$b={dialogAriaLabel:"متصفح الأصول",title:"متصفح الأصول",closeAriaLabel:"إغلاق",browseTab:"تصفح",uploadTab:"تحميل",searchPlaceholder:"البحث في الأصول...",searchButton:"بحث",loadingMessage:"جارٍ التحميل...",uploadingMessage:"جارٍ التحميل...",chooseFileButton:"اختر ملفًا للتحميل"},qb={dialogAriaLabel:"نقل المورد",moveHeaderPrefix:"نقل",closeAriaLabel:"إغلاق",selectUnitHint:"اختر وحدة لنقل هذا المحتوى إليها:",noUnitsAvailable:"لا توجد وحدات أخرى متاحة",cancelButton:"إلغاء",moveButton:"نقل إلى هنا"},Ub={dialogAriaLabel:"تعيين أرقام الصفحات",title:"تعيين أرقام الصفحات",closeAriaLabel:"إغلاق",emptyState:"لم يتم العثور على عناصر محتوى في هذه المجموعة.",contentColumnHeader:"المحتوى",pageNumberColumnHeader:"رقم الصفحة",cancelButton:"إلغاء",saveButton:"حفظ"},zb={confirmButton:"تأكيد",cancelButton:"إلغاء",closeAriaLabel:"إغلاق"},Vb={publishTitlePrefix:"نشر",closeAriaLabel:"إغلاق",confirmPublishPrefix:"هل أنت متأكد من رغبتك في نشر هذا",checklistInstructions:"يرجى تأكيد التحقق من جميع العناصر التالية (بتحديد مربعات الاختيار) قبل أن تتمكن من النشر:",noButton:"لا",yesButton:"نعم"},Hb={reviewQualityTitle:"مراجعة الجودة",rejectContentTitle:"رفض المحتوى",closeAriaLabel:"إغلاق",qualityScoreLabel:"درجة الجودة",scorePoorLabel:"0 — ضعيف",scoreExcellentLabel:"10 — ممتاز",commentLabel:"تعليق",optionalLabel:"(اختياري)",commentPlaceholder:"أضف أي ملاحظات لمنشئ المحتوى…",rejectionReasonLabel:"سبب الرفض",rejectReasonPlaceholder:"اذكر سبب رفض هذا المحتوى…",rejectionRequiredMessage:"سبب الرفض مطلوب.",cancelButton:"إلغاء",approveButton:"قبول",rejectButton:"رفض"},Qb={title:"تغييرات غير محفوظة",closeAriaLabel:"إغلاق",bodyMessage:"لديك تغييرات غير محفوظة. هل تريد حفظها قبل المغادرة؟",cancelButton:"إلغاء",discardButton:"تجاهل",saveButton:"حفظ"},Gb={contentTypeFiltersAriaLabel:"مرشحات نوع المحتوى"},Wb={alreadyAddedAriaLabel:"تمت إضافته مسبقًا",alreadyAddedTitle:"تمت إضافته مسبقًا إلى هذه المجموعة",addItemAriaLabel:"إضافة {name} إلى الوحدة",addToUnitTitle:"إضافة إلى الوحدة",selectUnitToAddTitle:"اختر وحدة للإضافة إليها",draftOnlyTitle:"يمكن إضافة المحتوى المسودة فقط"},Kb={selectUnitFirstToast:"اختر وحدة أولاً",selectUnitFromOutlineToast:"اختر وحدة من المخطط التفصيلي لإضافة محتوى — لا يمكن إضافة الموارد مباشرة إلى الدورة.",itemAlreadyAddedToast:'"{name}" موجود مسبقًا في هذه المجموعة',itemAddedToast:'تمت إضافة "{name}"',collapseLibraryPanelAriaLabel:"طي لوحة المكتبة",collapseLibraryTitle:"طي المكتبة",headerTitle:"المكتبة",searchPlaceholder:"البحث في المحتوى…",searchAriaLabel:"البحث في المكتبة",sortAZAriaLabel:"الترتيب: أ–ي (انقر للأحدث)",sortRecentAriaLabel:"الترتيب: الأحدث (انقر لـ أ–ي)",sortAZTitle:"أ–ي",sortRecentTitle:"الأحدث",toggleAdvancedFiltersAriaLabel:"تبديل المرشحات المتقدمة",advancedFiltersTitle:"المرشحات المتقدمة",libraryContentAriaLabel:"محتوى المكتبة",loadMoreAriaLabel:"تحميل المزيد من المحتوى",loadingText:"جارٍ التحميل…",loadMoreText:"تحميل المزيد",noContentFound:"لم يتم العثور على محتوى",tryDifferentSearch:"جرّب بحثًا أو مرشحًا مختلفًا"},Yb={boardLabel:"المجلس التعليمي",mediumLabel:"لغة التدريس",classLabel:"الصف",subjectLabel:"المادة",primaryCategoryLabel:"الفئة الأساسية",filterLibraryAriaLabel:"تصفية المكتبة",filtersHeaderTitle:"المرشحات",closeFiltersAriaLabel:"إغلاق المرشحات",resetButton:"إعادة تعيين",applyButton:"تطبيق"},Zb={contentPreviewAriaLabel:"معاينة المحتوى",closePreviewAriaLabel:"إغلاق المعاينة",addToUnitButton:"+ إضافة إلى الوحدة"},Xb={maxDepthReachedToast:"تم الوصول إلى الحد الأقصى للعمق",downloadCsvFailedToast:"فشل تنزيل ملف CSV",outlineRefreshedToast:"تم تحديث مخطط الدورة.",outlineRefreshFailedToast:"تعذّر تحديث المخطط التفصيلي تلقائيًا. يرجى إعادة تحميل الصفحة.",moreOptionsAriaLabel:"خيارات إضافية",moreOptionsTitle:"خيارات إضافية",foldersExistTitle:'المجلدات موجودة مسبقًا — استخدم "تحديث" بدلاً من ذلك',createFoldersCsvButton:"إنشاء مجلدات باستخدام ملف csv",noFoldersYetTitle:'لا توجد مجلدات بعد — استخدم "إنشاء" أولاً',downloadFoldersCsvButton:"تنزيل المجلدات كملف csv",updateFoldersCsvButton:"تحديث بيانات المجلدات الوصفية باستخدام ملف csv",expandOutlineAriaLabel:"توسيع المخطط التفصيلي",collapseOutlineAriaLabel:"طي المخطط التفصيلي",addUnitButton:"إضافة وحدة",addSubunitButton:"إضافة وحدة فرعية"},Jb={expandAriaLabel:"توسيع",collapseAriaLabel:"طي",dropHereLabel:"أفلت هنا",nodeOptionsAriaLabel:"خيارات العنصر",renameMenuItem:"إعادة تسمية",addSubunitMenuItem:"إضافة وحدة فرعية",addSiblingMenuItem:"إضافة عنصر مماثل",deleteMenuItem:"حذف"},ew={mimeLabelVideo:"فيديو",mimeLabelAudio:"صوت",mimeLabelPdf:"PDF",mimeLabelEpub:"ePub",mimeLabelEcml:"ECML",mimeLabelH5p:"H5P",mimeLabelScorm:"SCORM",mimeLabelOther:"محتوى",infoFieldAuthor:"المؤلف",infoFieldLicense:"الترخيص",infoFieldLanguage:"اللغة",infoFieldClass:"الصف",infoFieldSubject:"المادة",infoFieldType:"النوع",loadingPreview:"جارٍ تحميل المعاينة…",previewPlayerUnavailable:"مشغّل المعاينة غير متاح. تحقق من إمكانية الوصول إلى /content/preview.",failedToInitializePlayer:"فشل تهيئة مشغّل المحتوى.",previewPlayerLoadFailed:"تعذّر تحميل مشغّل المعاينة.",unableToLoadQuestionset:"تعذّر تحميل مجموعة الأسئلة:",parentQuestionsetNotResolved:"تعذّر تحديد مجموعة الأسئلة الرئيسية لهذا السؤال.",questionNotFoundInQuestionset:"لم يتم العثور على السؤال في مجموعة الأسئلة."},tw={title:"رمز الاستجابة السريعة (رمز الطلب)",invalidFormatError:"تنسيق رمز DIAL غير صالح. استخدم الأحرف الكبيرة والأرقام فقط (مثال: A1B2C3).",duplicateDialcodeError:'رمز DIAL "{code}" مرتبط مسبقًا بعنصر آخر في هذه المجموعة.',dialcodeNotFoundError:"رمز الطلب غير موجود. يرجى إدخال رمز صالح.",linkFailedError:"فشل ربط رمز الطلب. يرجى المحاولة مرة أخرى.",unlinkFailedError:"فشلت إزالة رمز الطلب. يرجى المحاولة مرة أخرى.",qrCodeAltPrefix:"رمز الاستجابة السريعة لـ",linkedCodeLabel:"الرمز المرتبط:",removeButton:"إزالة",noCodeLinkedMessage:"لا يوجد رمز استجابة سريعة مرتبط بهذا المحتوى.",linkManuallyLabel:"الربط يدويًا",dialcodeInputPlaceholder:"أدخل رمز الطلب (مثال: A1B2C3)",dialcodeInputAriaLabel:"إدخال رمز الطلب",linkButton:"ربط",linkedSuccessMessage:"تم ربط رمز الطلب بنجاح."},rw={unitsAddedLabel:"الوحدات المضافة",contentItemsLabel:"عناصر المحتوى",progressLabel:"التقدّم"},nw={dropOntoUnitError:"أفلت على وحدة لإضافة محتوى",dropOntoCourseError:"أفلت المحتوى على وحدة، وليس مباشرة على الدورة.",alreadyInCollectionError:'"{name}" موجود مسبقًا في هذه المجموعة',addedToUnitSuccess:'تمت إضافة "{name}" إلى الوحدة',fillRequiredMetadataError:"يرجى تعبئة البيانات الوصفية المطلوبة",outlineAriaLabel:"مخطط الدورة",showOutlineTitle:"إظهار المخطط التفصيلي",editorAriaLabel:"محرر المحتوى",libraryAriaLabel:"مكتبة المحتوى",showLibraryTitle:"إظهار المكتبة"},sw={draftStatusFallback:"مسودة",backAriaLabel:"رجوع",statusAriaLabelPrefix:"الحالة:",savingIndicator:"جارٍ الحفظ…",unsavedIndicator:"غير محفوظ",savedIndicatorPrefix:"تم الحفظ",fillRequiredFieldsTooltip:"عبّئ جميع الحقول المطلوبة قبل الحفظ",saveAsDraftButton:"حفظ كمسودة",sendForReviewButton:"إرسال للمراجعة",collaboratorsLabel:"المتعاونون",qrCodesLabel:"رموز الاستجابة السريعة",generatingEllipsis:"جارٍ الإنشاء…",generateQrCodesMenuItem:"إنشاء رموز استجابة سريعة",downloadingEllipsis:"جارٍ التنزيل…",downloadQrCodesMenuItem:"تنزيل رموز الاستجابة السريعة",publishButton:"نشر",requestForChangesButton:"طلب إجراء تغييرات",approveButton:"قبول",qrGenerationStartedToast:'بدأ إنشاء رموز الاستجابة السريعة. استخدم "تنزيل رموز الاستجابة السريعة" عند الجهوز.',qrGenerationFailedToast:"فشل إنشاء رموز الاستجابة السريعة. يرجى المحاولة مرة أخرى.",qrCodesNotGeneratedToast:"لم يتم إنشاء أي رموز استجابة سريعة بعد. قم بإنشاء رموز الاستجابة السريعة أولاً.",qrGenerationInProgressToast:"إنشاء صور رموز الاستجابة السريعة قيد التنفيذ. يرجى المحاولة بالتنزيل بعد قليل.",qrCodesNotReadyToast:"رموز الاستجابة السريعة ليست جاهزة بعد. يرجى الانتظار والمحاولة مرة أخرى.",qrCodesDownloadedToast:"تم تنزيل رموز الاستجابة السريعة.",qrCodesDownloadFailedToast:"فشل تنزيل رموز الاستجابة السريعة.",requestChangesTitle:"طلب إجراء تغييرات",changesRequestedLabel:"تم طلب تغييرات",describeChangesPlaceholder:"اذكر التغييرات التي يجب على المؤلف إجراؤها"},iw={closeAriaLabel:"إغلاق",fillCommentsError:"أضف تعليقات",cancelButton:"إلغاء"},aw={closeAriaLabel:"إغلاق",title:"قبول الشروط والأحكام",agreementTextPart1:"أوافق على أنه بإرسال / نشر هذا المحتوى، فإنني أؤكد أن هذا المحتوى يتوافق مع الإرشادات المعتمدة، بما في ذلك شروط الاستخدام وسياسة المحتوى، وأني أوافق على نشره بموجب",creativeCommonsLinkText:"إطار عمل Creative Commons",agreementTextPart2:"وفقًا لـ",contentPolicyText:"سياسة المحتوى",agreementTextPart3:". وقد تحققت من أنني لا أنتهك حقوق النشر أو الخصوصية الخاصة بالآخرين.",cancelButton:"إلغاء",submitButton:"إرسال"},ow={closeAriaLabel:"إغلاق",title:"إنشاء رموز الاستجابة السريعة",numberOfCodesLabel:"عدد رموز الاستجابة السريعة",countPlaceholder:"أدخل رقمًا (2–250)",countRangeError:"أدخل رقمًا بين 2 و 250.",cancelButton:"إلغاء",generateButton:"إنشاء"},lw={remove:"إزالة"},cw={dropHere:"أفلت هنا"},uw={loading:"جارٍ التحميل"},dw={contextualEditor:gb,languageSelector:yb,collectionEditor:vb,breadcrumb:bb,tabBar:wb,contentEditForm:Cb,titleAppIcon:Sb,unitContentList:xb,contentRow:_b,csvUpload:Tb,manageCollaborators:Eb,sparkMetaForm:Ib,appIconField:Ob,appIconPickerModal:Ab,chipGroupField:Db,dateTimeField:Nb,dialcodeInputField:Rb,keywordSuggestField:jb,licenseSelectField:kb,multiSelectField:Lb,nestedSelectField:Pb,radioField:Fb,selectField:Mb,textField:Bb,assetBrowser:$b,resourceReorderDialog:qb,assignPageNumber:Ub,confirmDialog:zb,publishChecklist:Vb,qualityParamsModal:Hb,unsavedChangesModal:Qb,filterChips:Gb,libraryCard:Wb,libraryDock:Kb,libraryFilterPanel:Yb,libraryPreviewPanel:Zb,outlineTree:Xb,treeNode:Jb,contentPlayer:ew,dialcodePanel:tw,progressStatus:rw,splitBuilderShell:nw,topbar:sw,reviewCommentModal:iw,confirmReviewModal:aw,generateQRModal:ow,chip:lw,dropZone:cw,spinner:uw},fw={emptyStateMessage:"Sélectionnez une unité dans le plan pour modifier ses détails",reviewCommentLabel:"Commentaire du réviseur :",untitledPlaceholder:"Sans titre",nodeTitleAriaLabel:"Titre du nœud",dropZoneLabel:"Déposez ici pour ajouter du contenu à cette unité"},hw={ariaLabel:"Sélectionner la langue"},pw={errorBoundaryTitle:"Une erreur s'est produite",retryButton:"Réessayer",loadingMessage:"Chargement de l'éditeur...",loadErrorTitle:"Échec du chargement de l'éditeur"},mw={nodePathAriaLabel:"Chemin du nœud",homeAriaLabel:"Accueil"},gw={detailsTab:"Détails",audienceCurriculumTab:"Public et programme",licensingTab:"Licence",metadataSectionsAriaLabel:"Sections de métadonnées",hasErrorsAriaLabel:"Contient des erreurs"},yw={moveToAnotherUnitButton:"Déplacer vers une autre unité",collapseMetadataPanelAriaLabel:"Réduire le panneau de métadonnées",expandMetadataPanelAriaLabel:"Développer le panneau de métadonnées",collapseTitle:"Réduire",expandTitle:"Développer",iconAlt:"icône",contentNamePlaceholder:"Nom du contenu",keywordsLabel:"Mots-clés",addKeywordPlaceholder:"Ajoutez un mot-clé et appuyez sur Entrée",addButton:"Ajouter",optionalInCollectionLabel:"Facultatif dans la collection",yesOption:"Oui",noOption:"Non"},vw={selectAppIconAriaLabel:"Sélectionner l'icône de l'application",appIconAriaLabel:"Icône de l'application",appIconAlt:"Icône de l'application",removeIconAriaLabel:"Supprimer l'icône"},bw={removeConfirm:"Retirer ce contenu de l'unité ?",heading:"Contenu de cette unité",emptyTitle:"Aucun contenu pour le moment",emptyHint:"Faites glisser depuis la bibliothèque ou cliquez sur Ajouter du contenu",addContentAriaLabel:"Ajouter du contenu à l'unité",addContent:"Ajouter du contenu"},ww={dragToReorderAriaLabel:"Faire glisser pour réorganiser",removeAriaLabel:"Supprimer {name}"},Cw={invalidFileType:"Seuls les fichiers .csv sont acceptés.",fileTooLarge:"La taille du fichier ne doit pas dépasser 50 Mo.",downloadSampleFailed:"Échec du téléchargement de l'exemple de CSV.",processingFailed:"Le traitement du téléversement a échoué. Veuillez vérifier les lignes en erreur ci-dessous.",connectionLost:"Connexion perdue pendant la vérification du statut. Veuillez réessayer.",uploadFailed:"Le téléversement a échoué. Veuillez vérifier votre fichier et réessayer.",statusUploading:"Téléversement en cours...",statusProcessing:"Traitement en cours...",statusDone:"Terminé !",statusError:"Erreur",titleUpdate:"Mettre à jour les métadonnées des dossiers via CSV",titleCreate:"Créer des dossiers via CSV",closeAriaLabel:"Fermer",dropZoneAriaLabel:"Déposez le fichier CSV ici ou cliquez pour parcourir",dropText:"Faites glisser et déposez votre CSV ici",dropSubtext:"ou cliquez pour parcourir",downloadSample:"Télécharger l'exemple de CSV",itemsImportedSuffix:"— {count} élément(s) importé(s)",failedRowsTitle:"Lignes en échec ({count})",rowHeader:"Ligne",nameHeader:"Nom",reasonHeader:"Raison",unknownError:"Erreur inconnue",cancel:"Annuler",uploaded:"Téléversé",upload:"Téléverser"},Sw={saveFailed:"Échec de l'enregistrement des collaborateurs. Veuillez réessayer.",title:"Gérer les collaborateurs",closeAriaLabel:"Fermer",searchUsersLabel:"Rechercher des utilisateurs",searchPlaceholder:"Rechercher par nom ou e-mail...",searchingAriaLabel:"Recherche en cours...",searchResultsAriaLabel:"Résultats de recherche",add:"Ajouter",noUsersFound:"Aucun utilisateur trouvé.",currentCollaborators:"Collaborateurs actuels",noCollaboratorsYet:"Aucun collaborateur ajouté pour le moment.",remove:"Retirer",saveSuccess:"Collaborateurs enregistrés avec succès.",cancel:"Annuler",save:"Enregistrer"},xw={shuffleEnabledMessage:"La lecture aléatoire est activée pour cet ensemble de questions.",noFieldsMessage:"Aucun champ configuré pour cet onglet."},_w={requiredError:"{field} est requis",selectIconAriaLabel:"Sélectionner l'icône de l'application",iconAlt:"Icône de l'application",selectIconLabel:"Sélectionner l'icône",removeIconAriaLabel:"Supprimer l'icône de l'application",removeLabel:"Supprimer"},Tw={dialogAriaLabel:"Sélectionner l'icône de l'application",title:"Sélectionner l'icône de l'application",closeAriaLabel:"Fermer",myImagesTab:"Mes images",allImagesTab:"Toutes les images",uploadTab:"Téléverser",searchPlaceholder:"Rechercher des images…",loadingText:"Chargement…",noImagesFound:"Aucune image trouvée",noThumbnailText:"IMG",loadMoreButton:"Charger plus",previewAlt:"Aperçu",dropZoneText:"Faites glisser et déposez ou cliquez pour parcourir",acceptedTypesInfo:"{types} · max {size} Mo",cancelButton:"Annuler",uploadingText:"Téléversement…",uploadAndUseButton:"Téléverser et utiliser",useSelectedButton:"Utiliser la sélection",invalidFileTypeError:"Seuls les fichiers {types} sont acceptés.",fileTooLargeError:"L'image doit faire moins de {size} Mo.",uploadFailedError:"Le téléversement a échoué."},Ew={addPlaceholder:"Ajouter…",addButtonLabel:"Ajouter"},Iw={requiredError:"{field} est requis"},Ow={requiredError:"{field} est requis",enterCodeMessage:"Saisissez un code d'appel à valider.",validMessage:"Le code d'appel est valide.",notFoundMessage:"Code d'appel introuvable.",validationFailedMessage:"La validation a échoué. Veuillez réessayer.",placeholderExample:"ex. A1B2C3",validateAriaLabel:"Valider le code d'appel",validatingLabel:"Validation en cours…",validateButtonLabel:"Valider"},Aw={requiredError:"{field} est requis",inputPlaceholder:"Saisissez et appuyez sur Entrée ou virgule…"},Dw={requiredError:"{field} est requis",selectPlaceholder:"Sélectionner une licence…"},Nw={requiredError:"{field} est requis",selectedCountSuffix:"sélectionné(s)",selectPlaceholder:"Sélectionner…",noOptionsMessage:"Aucune option"},Rw={requiredError:"{field} est requis",selectPlaceholder:"Sélectionner…"},jw={requiredError:"{field} est requis"},kw={requiredError:"{field} est requis",selectPlaceholder:"Sélectionner…",noOptionsMessage:"Aucune option"},Lw={requiredError:"{field} est requis",maxLengthError:"Maximum {max} caractères"},Pw={dialogAriaLabel:"Navigateur de ressources",title:"Navigateur de ressources",closeAriaLabel:"Fermer",browseTab:"Parcourir",uploadTab:"Téléverser",searchPlaceholder:"Rechercher des ressources...",searchButton:"Rechercher",loadingMessage:"Chargement...",uploadingMessage:"Téléversement...",chooseFileButton:"Choisir un fichier à téléverser"},Fw={dialogAriaLabel:"Déplacer la ressource",moveHeaderPrefix:"Déplacer",closeAriaLabel:"Fermer",selectUnitHint:"Sélectionnez une unité vers laquelle déplacer ce contenu :",noUnitsAvailable:"Aucune autre unité disponible",cancelButton:"Annuler",moveButton:"Déplacer ici"},Mw={dialogAriaLabel:"Attribuer des numéros de page",title:"Attribuer des numéros de page",closeAriaLabel:"Fermer",emptyState:"Aucun élément de contenu trouvé dans cette collection.",contentColumnHeader:"Contenu",pageNumberColumnHeader:"Numéro de page",cancelButton:"Annuler",saveButton:"Enregistrer"},Bw={confirmButton:"Confirmer",cancelButton:"Annuler",closeAriaLabel:"Fermer"},$w={publishTitlePrefix:"Publier",closeAriaLabel:"Fermer",confirmPublishPrefix:"Êtes-vous sûr de vouloir publier ce",checklistInstructions:"Veuillez confirmer que TOUS les éléments suivants sont vérifiés (en cochant les cases) avant de pouvoir publier :",noButton:"Non",yesButton:"Oui"},qw={reviewQualityTitle:"Évaluer la qualité",rejectContentTitle:"Rejeter le contenu",closeAriaLabel:"Fermer",qualityScoreLabel:"Score de qualité",scorePoorLabel:"0 — Faible",scoreExcellentLabel:"10 — Excellent",commentLabel:"Commentaire",optionalLabel:"(facultatif)",commentPlaceholder:"Ajoutez des remarques pour le créateur du contenu…",rejectionReasonLabel:"Motif du rejet",rejectReasonPlaceholder:"Décrivez pourquoi ce contenu est rejeté…",rejectionRequiredMessage:"Un motif de rejet est requis.",cancelButton:"Annuler",approveButton:"Approuver",rejectButton:"Rejeter"},Uw={title:"Modifications non enregistrées",closeAriaLabel:"Fermer",bodyMessage:"Vous avez des modifications non enregistrées. Souhaitez-vous les enregistrer avant de quitter ?",cancelButton:"Annuler",discardButton:"Ignorer",saveButton:"Enregistrer"},zw={contentTypeFiltersAriaLabel:"Filtres par type de contenu"},Vw={alreadyAddedAriaLabel:"Déjà ajouté",alreadyAddedTitle:"Déjà ajouté à cette collection",addItemAriaLabel:"Ajouter {name} à l'unité",addToUnitTitle:"Ajouter à l'unité",selectUnitToAddTitle:"Sélectionner une unité pour ajouter",draftOnlyTitle:"Seul le contenu à l'état de brouillon peut être ajouté"},Hw={selectUnitFirstToast:"Sélectionnez d'abord une unité",selectUnitFromOutlineToast:"Sélectionnez une unité dans le plan pour ajouter du contenu — les ressources ne peuvent pas être ajoutées directement au cours.",itemAlreadyAddedToast:"« {name} » est déjà dans cette collection",itemAddedToast:"« {name} » ajouté",collapseLibraryPanelAriaLabel:"Réduire le panneau de la bibliothèque",collapseLibraryTitle:"Réduire la bibliothèque",headerTitle:"Bibliothèque",searchPlaceholder:"Rechercher du contenu…",searchAriaLabel:"Rechercher dans la bibliothèque",sortAZAriaLabel:"Trier : A–Z (cliquer pour Récent)",sortRecentAriaLabel:"Trier : Récent (cliquer pour A–Z)",sortAZTitle:"A–Z",sortRecentTitle:"Récent",toggleAdvancedFiltersAriaLabel:"Afficher/masquer les filtres avancés",advancedFiltersTitle:"Filtres avancés",libraryContentAriaLabel:"Contenu de la bibliothèque",loadMoreAriaLabel:"Charger plus de contenu",loadingText:"Chargement…",loadMoreText:"Charger plus",noContentFound:"Aucun contenu trouvé",tryDifferentSearch:"Essayez une autre recherche ou un autre filtre"},Qw={boardLabel:"Conseil",mediumLabel:"Médium",classLabel:"Classe",subjectLabel:"Matière",primaryCategoryLabel:"Catégorie principale",filterLibraryAriaLabel:"Filtrer la bibliothèque",filtersHeaderTitle:"Filtres",closeFiltersAriaLabel:"Fermer les filtres",resetButton:"Réinitialiser",applyButton:"Appliquer"},Gw={contentPreviewAriaLabel:"Aperçu du contenu",closePreviewAriaLabel:"Fermer l'aperçu",addToUnitButton:"+ Ajouter à l'unité"},Ww={maxDepthReachedToast:"Profondeur maximale atteinte",downloadCsvFailedToast:"Échec du téléchargement du CSV",outlineRefreshedToast:"Plan du cours actualisé.",outlineRefreshFailedToast:"Le plan n'a pas pu être actualisé automatiquement. Veuillez recharger la page.",moreOptionsAriaLabel:"Plus d'options",moreOptionsTitle:"Plus d'options",foldersExistTitle:"Des dossiers existent déjà — utilisez « Mettre à jour » à la place",createFoldersCsvButton:"Créer des dossiers à partir d'un fichier CSV",noFoldersYetTitle:"Aucun dossier pour le moment — utilisez d'abord « Créer »",downloadFoldersCsvButton:"Télécharger les dossiers en fichier CSV",updateFoldersCsvButton:"Mettre à jour les métadonnées des dossiers à partir d'un fichier CSV",expandOutlineAriaLabel:"Développer le plan",collapseOutlineAriaLabel:"Réduire le plan",addUnitButton:"Ajouter une unité",addSubunitButton:"Ajouter une sous-unité"},Kw={expandAriaLabel:"Développer",collapseAriaLabel:"Réduire",dropHereLabel:"Déposer ici",nodeOptionsAriaLabel:"Options du nœud",renameMenuItem:"Renommer",addSubunitMenuItem:"Ajouter une sous-unité",addSiblingMenuItem:"Ajouter un élément au même niveau",deleteMenuItem:"Supprimer"},Yw={mimeLabelVideo:"Vidéo",mimeLabelAudio:"Audio",mimeLabelPdf:"PDF",mimeLabelEpub:"ePub",mimeLabelEcml:"ECML",mimeLabelH5p:"H5P",mimeLabelScorm:"SCORM",mimeLabelOther:"Contenu",infoFieldAuthor:"Auteur",infoFieldLicense:"Licence",infoFieldLanguage:"Langue",infoFieldClass:"Classe",infoFieldSubject:"Matière",infoFieldType:"Type",loadingPreview:"Chargement de l'aperçu…",previewPlayerUnavailable:"Lecteur d'aperçu indisponible. Vérifiez que /content/preview est accessible.",failedToInitializePlayer:"Échec de l'initialisation du lecteur de contenu.",previewPlayerLoadFailed:"Le lecteur d'aperçu n'a pas pu être chargé.",unableToLoadQuestionset:"Impossible de charger l'ensemble de questions :",parentQuestionsetNotResolved:"Impossible de résoudre l'ensemble de questions parent pour cette question.",questionNotFoundInQuestionset:"Question introuvable dans l'ensemble de questions."},Zw={title:"Code QR (Dialcode)",invalidFormatError:"Format de code DIAL invalide. Utilisez uniquement des lettres majuscules et des chiffres (ex. A1B2C3).",duplicateDialcodeError:"Le code DIAL « {code} » est déjà associé à un autre nœud de cette collection.",dialcodeNotFoundError:"Code d'appel introuvable. Veuillez saisir un code valide.",linkFailedError:"Échec de l'association du code d'appel. Veuillez réessayer.",unlinkFailedError:"Échec de la suppression du code d'appel. Veuillez réessayer.",qrCodeAltPrefix:"Code QR pour",linkedCodeLabel:"Code associé :",removeButton:"Supprimer",noCodeLinkedMessage:"Aucun code QR associé à ce contenu.",linkManuallyLabel:"Associer manuellement",dialcodeInputPlaceholder:"Saisissez le code d'appel (ex. A1B2C3)",dialcodeInputAriaLabel:"Champ de saisie du code d'appel",linkButton:"Associer",linkedSuccessMessage:"Code d'appel associé avec succès."},Xw={unitsAddedLabel:"Unités ajoutées",contentItemsLabel:"Éléments de contenu",progressLabel:"Progression"},Jw={dropOntoUnitError:"Déposez sur une unité pour ajouter du contenu",dropOntoCourseError:"Déposez le contenu sur une unité, pas directement sur le cours.",alreadyInCollectionError:"« {name} » est déjà dans cette collection",addedToUnitSuccess:"« {name} » ajouté à l'unité",fillRequiredMetadataError:"Veuillez renseigner les métadonnées requises",outlineAriaLabel:"Plan du cours",showOutlineTitle:"Afficher le plan",editorAriaLabel:"Éditeur de contenu",libraryAriaLabel:"Bibliothèque de contenu",showLibraryTitle:"Afficher la bibliothèque"},eC={draftStatusFallback:"Brouillon",backAriaLabel:"Retour",statusAriaLabelPrefix:"Statut :",savingIndicator:"Enregistrement…",unsavedIndicator:"Non enregistré",savedIndicatorPrefix:"Enregistré",fillRequiredFieldsTooltip:"Renseignez tous les champs requis avant d'enregistrer",saveAsDraftButton:"Enregistrer comme brouillon",sendForReviewButton:"Envoyer pour révision",collaboratorsLabel:"Collaborateurs",qrCodesLabel:"Codes QR",generatingEllipsis:"Génération en cours…",generateQrCodesMenuItem:"Générer des codes QR",downloadingEllipsis:"Téléchargement…",downloadQrCodesMenuItem:"Télécharger les codes QR",publishButton:"Publier",requestForChangesButton:"Demander des modifications",approveButton:"Approuver",qrGenerationStartedToast:"La génération des codes QR a démarré. Utilisez « Télécharger les codes QR » une fois prêts.",qrGenerationFailedToast:"Échec de la génération des codes QR. Veuillez réessayer.",qrCodesNotGeneratedToast:"Aucun code QR généré pour le moment. Générez d'abord des codes QR.",qrGenerationInProgressToast:"La génération des images de codes QR est en cours. Veuillez réessayer le téléchargement dans quelques instants.",qrCodesNotReadyToast:"Les codes QR ne sont pas encore prêts. Veuillez patienter et réessayer.",qrCodesDownloadedToast:"Codes QR téléchargés.",qrCodesDownloadFailedToast:"Échec du téléchargement des codes QR.",requestChangesTitle:"Demander des modifications",changesRequestedLabel:"Modifications demandées",describeChangesPlaceholder:"Décrivez les modifications que l'auteur doit apporter"},tC={closeAriaLabel:"Fermer",fillCommentsError:"Renseignez les commentaires",cancelButton:"Annuler"},rC={closeAriaLabel:"Fermer",title:"Acceptation des conditions générales",agreementTextPart1:"J'accepte qu'en soumettant / publiant ce contenu, je confirme qu'il est conforme aux directives prescrites, y compris les conditions d'utilisation et la politique de contenu, et que je consens à le publier selon le",creativeCommonsLinkText:"cadre Creative Commons",agreementTextPart2:"conformément à la",contentPolicyText:"politique de contenu",agreementTextPart3:". Je me suis assuré(e) de ne pas porter atteinte aux droits d'auteur ou à la vie privée d'autrui.",cancelButton:"Annuler",submitButton:"Soumettre"},nC={closeAriaLabel:"Fermer",title:"Générer des codes QR",numberOfCodesLabel:"Nombre de codes QR",countPlaceholder:"Saisissez un nombre (2–250)",countRangeError:"Saisissez un nombre entre 2 et 250.",cancelButton:"Annuler",generateButton:"Générer"},sC={remove:"Supprimer"},iC={dropHere:"Déposer ici"},aC={loading:"Chargement"},oC={contextualEditor:fw,languageSelector:hw,collectionEditor:pw,breadcrumb:mw,tabBar:gw,contentEditForm:yw,titleAppIcon:vw,unitContentList:bw,contentRow:ww,csvUpload:Cw,manageCollaborators:Sw,sparkMetaForm:xw,appIconField:_w,appIconPickerModal:Tw,chipGroupField:Ew,dateTimeField:Iw,dialcodeInputField:Ow,keywordSuggestField:Aw,licenseSelectField:Dw,multiSelectField:Nw,nestedSelectField:Rw,radioField:jw,selectField:kw,textField:Lw,assetBrowser:Pw,resourceReorderDialog:Fw,assignPageNumber:Mw,confirmDialog:Bw,publishChecklist:$w,qualityParamsModal:qw,unsavedChangesModal:Uw,filterChips:zw,libraryCard:Vw,libraryDock:Hw,libraryFilterPanel:Qw,libraryPreviewPanel:Gw,outlineTree:Ww,treeNode:Kw,contentPlayer:Yw,dialcodePanel:Zw,progressStatus:Xw,splitBuilderShell:Jw,topbar:eC,reviewCommentModal:tC,confirmReviewModal:rC,generateQRModal:nC,chip:sC,dropZone:iC,spinner:aC},lC={emptyStateMessage:"Selecione uma unidade no esquema para editar seus detalhes",reviewCommentLabel:"Comentário do revisor:",untitledPlaceholder:"Sem título",nodeTitleAriaLabel:"Título do nó",dropZoneLabel:"Solte para adicionar conteúdo a esta unidade"},cC={ariaLabel:"Selecionar idioma"},uC={errorBoundaryTitle:"Algo deu errado",retryButton:"Tentar novamente",loadingMessage:"Carregando editor...",loadErrorTitle:"Falha ao carregar o editor"},dC={nodePathAriaLabel:"Caminho do nó",homeAriaLabel:"Início"},fC={detailsTab:"Detalhes",audienceCurriculumTab:"Público e Currículo",licensingTab:"Licenciamento",metadataSectionsAriaLabel:"Seções de metadados",hasErrorsAriaLabel:"Contém erros"},hC={moveToAnotherUnitButton:"Mover para outra unidade",collapseMetadataPanelAriaLabel:"Recolher painel de metadados",expandMetadataPanelAriaLabel:"Expandir painel de metadados",collapseTitle:"Recolher",expandTitle:"Expandir",iconAlt:"ícone",contentNamePlaceholder:"Nome do conteúdo",keywordsLabel:"Palavras-chave",addKeywordPlaceholder:"Adicione uma palavra-chave e pressione Enter",addButton:"Adicionar",optionalInCollectionLabel:"Opcional na coleção",yesOption:"Sim",noOption:"Não"},pC={selectAppIconAriaLabel:"Selecionar ícone do aplicativo",appIconAriaLabel:"Ícone do aplicativo",appIconAlt:"Ícone do aplicativo",removeIconAriaLabel:"Remover ícone"},mC={removeConfirm:"Remover este conteúdo da unidade?",heading:"Conteúdo nesta unidade",emptyTitle:"Ainda não há conteúdo",emptyHint:"Arraste da biblioteca ou clique em Adicionar conteúdo",addContentAriaLabel:"Adicionar conteúdo à unidade",addContent:"Adicionar conteúdo"},gC={dragToReorderAriaLabel:"Arrastar para reordenar",removeAriaLabel:"Remover {name}"},yC={invalidFileType:"Somente arquivos .csv são aceitos.",fileTooLarge:"O tamanho do arquivo não deve exceder 50 MB.",downloadSampleFailed:"Falha ao baixar o CSV de exemplo.",processingFailed:"Falha no processamento do upload. Verifique as linhas com erro abaixo.",connectionLost:"Conexão perdida ao verificar o status. Tente novamente.",uploadFailed:"Falha no envio. Verifique seu arquivo e tente novamente.",statusUploading:"Enviando...",statusProcessing:"Processando...",statusDone:"Concluído!",statusError:"Erro",titleUpdate:"Atualizar metadados das pastas via CSV",titleCreate:"Criar pastas via CSV",closeAriaLabel:"Fechar",dropZoneAriaLabel:"Solte o arquivo CSV aqui ou clique para procurar",dropText:"Arraste e solte seu CSV aqui",dropSubtext:"ou clique para procurar",downloadSample:"Baixar CSV de exemplo",itemsImportedSuffix:"— {count} item(ns) importado(s)",failedRowsTitle:"Linhas com falha ({count})",rowHeader:"Linha",nameHeader:"Nome",reasonHeader:"Motivo",unknownError:"Erro desconhecido",cancel:"Cancelar",uploaded:"Enviado",upload:"Enviar"},vC={saveFailed:"Falha ao salvar colaboradores. Tente novamente.",title:"Gerenciar colaboradores",closeAriaLabel:"Fechar",searchUsersLabel:"Buscar usuários",searchPlaceholder:"Buscar por nome ou e-mail...",searchingAriaLabel:"Buscando...",searchResultsAriaLabel:"Resultados da busca",add:"Adicionar",noUsersFound:"Nenhum usuário encontrado.",currentCollaborators:"Colaboradores atuais",noCollaboratorsYet:"Nenhum colaborador adicionado ainda.",remove:"Remover",saveSuccess:"Colaboradores salvos com sucesso.",cancel:"Cancelar",save:"Salvar"},bC={shuffleEnabledMessage:"A ordem aleatória está ativada para este conjunto de questões.",noFieldsMessage:"Nenhum campo configurado para esta aba."},wC={requiredError:"{field} é obrigatório",selectIconAriaLabel:"Selecionar ícone do aplicativo",iconAlt:"Ícone do aplicativo",selectIconLabel:"Selecionar ícone",removeIconAriaLabel:"Remover ícone do aplicativo",removeLabel:"Remover"},CC={dialogAriaLabel:"Selecionar ícone do aplicativo",title:"Selecionar ícone do aplicativo",closeAriaLabel:"Fechar",myImagesTab:"Minhas imagens",allImagesTab:"Todas as imagens",uploadTab:"Enviar",searchPlaceholder:"Buscar imagens…",loadingText:"Carregando…",noImagesFound:"Nenhuma imagem encontrada",noThumbnailText:"IMG",loadMoreButton:"Carregar mais",previewAlt:"Pré-visualização",dropZoneText:"Arraste e solte ou clique para procurar",acceptedTypesInfo:"{types} · máx. {size} MB",cancelButton:"Cancelar",uploadingText:"Enviando…",uploadAndUseButton:"Enviar e usar",useSelectedButton:"Usar selecionado",invalidFileTypeError:"Somente arquivos {types} são aceitos.",fileTooLargeError:"A imagem deve ter menos de {size} MB.",uploadFailedError:"Falha no envio."},SC={addPlaceholder:"Adicionar…",addButtonLabel:"Adicionar"},xC={requiredError:"{field} é obrigatório"},_C={requiredError:"{field} é obrigatório",enterCodeMessage:"Insira um código dial para validar.",validMessage:"O código dial é válido.",notFoundMessage:"Código dial não encontrado.",validationFailedMessage:"Falha na validação. Tente novamente.",placeholderExample:"ex. A1B2C3",validateAriaLabel:"Validar código dial",validatingLabel:"Validando…",validateButtonLabel:"Validar"},TC={requiredError:"{field} é obrigatório",inputPlaceholder:"Digite e pressione Enter ou vírgula…"},EC={requiredError:"{field} é obrigatório",selectPlaceholder:"Selecionar licença…"},IC={requiredError:"{field} é obrigatório",selectedCountSuffix:"selecionado(s)",selectPlaceholder:"Selecionar…",noOptionsMessage:"Sem opções"},OC={requiredError:"{field} é obrigatório",selectPlaceholder:"Selecionar…"},AC={requiredError:"{field} é obrigatório"},DC={requiredError:"{field} é obrigatório",selectPlaceholder:"Selecionar…",noOptionsMessage:"Sem opções"},NC={requiredError:"{field} é obrigatório",maxLengthError:"Máx. {max} caracteres"},RC={dialogAriaLabel:"Navegador de recursos",title:"Navegador de recursos",closeAriaLabel:"Fechar",browseTab:"Procurar",uploadTab:"Enviar",searchPlaceholder:"Buscar recursos...",searchButton:"Buscar",loadingMessage:"Carregando...",uploadingMessage:"Enviando...",chooseFileButton:"Escolher arquivo para enviar"},jC={dialogAriaLabel:"Mover recurso",moveHeaderPrefix:"Mover",closeAriaLabel:"Fechar",selectUnitHint:"Selecione uma unidade para mover este conteúdo:",noUnitsAvailable:"Nenhuma outra unidade disponível",cancelButton:"Cancelar",moveButton:"Mover para aqui"},kC={dialogAriaLabel:"Atribuir números de página",title:"Atribuir números de página",closeAriaLabel:"Fechar",emptyState:"Nenhum item de conteúdo encontrado nesta coleção.",contentColumnHeader:"Conteúdo",pageNumberColumnHeader:"Número da página",cancelButton:"Cancelar",saveButton:"Salvar"},LC={confirmButton:"Confirmar",cancelButton:"Cancelar",closeAriaLabel:"Fechar"},PC={publishTitlePrefix:"Publicar",closeAriaLabel:"Fechar",confirmPublishPrefix:"Tem certeza de que deseja publicar este(a)",checklistInstructions:"Confirme que TODOS os itens a seguir foram verificados (marcando as caixas de seleção) antes de publicar:",noButton:"Não",yesButton:"Sim"},FC={reviewQualityTitle:"Revisar qualidade",rejectContentTitle:"Rejeitar conteúdo",closeAriaLabel:"Fechar",qualityScoreLabel:"Nota de qualidade",scorePoorLabel:"0 — Ruim",scoreExcellentLabel:"10 — Excelente",commentLabel:"Comentário",optionalLabel:"(opcional)",commentPlaceholder:"Adicione observações para o criador do conteúdo…",rejectionReasonLabel:"Motivo da rejeição",rejectReasonPlaceholder:"Descreva por que este conteúdo está sendo rejeitado…",rejectionRequiredMessage:"É necessário informar um motivo de rejeição.",cancelButton:"Cancelar",approveButton:"Aprovar",rejectButton:"Rejeitar"},MC={title:"Alterações não salvas",closeAriaLabel:"Fechar",bodyMessage:"Você tem alterações não salvas. Deseja salvá-las antes de sair?",cancelButton:"Cancelar",discardButton:"Descartar",saveButton:"Salvar"},BC={contentTypeFiltersAriaLabel:"Filtros de tipo de conteúdo"},$C={alreadyAddedAriaLabel:"Já adicionado",alreadyAddedTitle:"Já adicionado a esta coleção",addItemAriaLabel:"Adicionar {name} à unidade",addToUnitTitle:"Adicionar à unidade",selectUnitToAddTitle:"Selecione uma unidade para adicionar",draftOnlyTitle:"Somente conteúdo em rascunho pode ser adicionado"},qC={selectUnitFirstToast:"Selecione uma unidade primeiro",selectUnitFromOutlineToast:"Selecione uma unidade no esquema para adicionar conteúdo — recursos não podem ser adicionados diretamente ao curso.",itemAlreadyAddedToast:'"{name}" já está nesta coleção',itemAddedToast:'"{name}" adicionado',collapseLibraryPanelAriaLabel:"Recolher painel da biblioteca",collapseLibraryTitle:"Recolher biblioteca",headerTitle:"Biblioteca",searchPlaceholder:"Buscar conteúdo…",searchAriaLabel:"Buscar na biblioteca",sortAZAriaLabel:"Ordenar: A–Z (clique para Recentes)",sortRecentAriaLabel:"Ordenar: Recentes (clique para A–Z)",sortAZTitle:"A–Z",sortRecentTitle:"Recentes",toggleAdvancedFiltersAriaLabel:"Alternar filtros avançados",advancedFiltersTitle:"Filtros avançados",libraryContentAriaLabel:"Conteúdo da biblioteca",loadMoreAriaLabel:"Carregar mais conteúdo",loadingText:"Carregando…",loadMoreText:"Carregar mais",noContentFound:"Nenhum conteúdo encontrado",tryDifferentSearch:"Tente uma busca ou filtro diferente"},UC={boardLabel:"Conselho",mediumLabel:"Idioma de Instrução",classLabel:"Série",subjectLabel:"Disciplina",primaryCategoryLabel:"Categoria principal",filterLibraryAriaLabel:"Filtrar biblioteca",filtersHeaderTitle:"Filtros",closeFiltersAriaLabel:"Fechar filtros",resetButton:"Redefinir",applyButton:"Aplicar"},zC={contentPreviewAriaLabel:"Pré-visualização do conteúdo",closePreviewAriaLabel:"Fechar pré-visualização",addToUnitButton:"+ Adicionar à unidade"},VC={maxDepthReachedToast:"Profundidade máxima atingida",downloadCsvFailedToast:"Falha ao baixar o CSV",outlineRefreshedToast:"Esquema do curso atualizado.",outlineRefreshFailedToast:"Não foi possível atualizar o esquema automaticamente. Recarregue a página.",moreOptionsAriaLabel:"Mais opções",moreOptionsTitle:"Mais opções",foldersExistTitle:'As pastas já existem — use "Atualizar"',createFoldersCsvButton:"Criar pastas usando arquivo csv",noFoldersYetTitle:'Ainda não há pastas — use "Criar" primeiro',downloadFoldersCsvButton:"Baixar pastas como arquivo csv",updateFoldersCsvButton:"Atualizar metadados das pastas usando arquivo csv",expandOutlineAriaLabel:"Expandir esquema",collapseOutlineAriaLabel:"Recolher esquema",addUnitButton:"Adicionar unidade",addSubunitButton:"Adicionar subunidade"},HC={expandAriaLabel:"Expandir",collapseAriaLabel:"Recolher",dropHereLabel:"Solte aqui",nodeOptionsAriaLabel:"Opções do nó",renameMenuItem:"Renomear",addSubunitMenuItem:"Adicionar subunidade",addSiblingMenuItem:"Adicionar item no mesmo nível",deleteMenuItem:"Excluir"},QC={mimeLabelVideo:"Vídeo",mimeLabelAudio:"Áudio",mimeLabelPdf:"PDF",mimeLabelEpub:"ePub",mimeLabelEcml:"ECML",mimeLabelH5p:"H5P",mimeLabelScorm:"SCORM",mimeLabelOther:"Conteúdo",infoFieldAuthor:"Autor",infoFieldLicense:"Licença",infoFieldLanguage:"Idioma",infoFieldClass:"Série",infoFieldSubject:"Disciplina",infoFieldType:"Tipo",loadingPreview:"Carregando pré-visualização…",previewPlayerUnavailable:"Player de pré-visualização indisponível. Verifique se /content/preview está acessível.",failedToInitializePlayer:"Falha ao inicializar o player de conteúdo.",previewPlayerLoadFailed:"Não foi possível carregar o player de pré-visualização.",unableToLoadQuestionset:"Não foi possível carregar o conjunto de questões:",parentQuestionsetNotResolved:"Não foi possível identificar o conjunto de questões principal desta questão.",questionNotFoundInQuestionset:"Questão não encontrada no conjunto de questões."},GC={title:"Código QR (Dialcode)",invalidFormatError:"Formato de código DIAL inválido. Use apenas letras maiúsculas e números (ex. A1B2C3).",duplicateDialcodeError:'O código DIAL "{code}" já está vinculado a outro nó nesta coleção.',dialcodeNotFoundError:"Dialcode não encontrado. Insira um código válido.",linkFailedError:"Falha ao vincular o dialcode. Tente novamente.",unlinkFailedError:"Falha ao remover o dialcode. Tente novamente.",qrCodeAltPrefix:"Código QR para",linkedCodeLabel:"Código vinculado:",removeButton:"Remover",noCodeLinkedMessage:"Nenhum código QR vinculado a este conteúdo.",linkManuallyLabel:"Vincular manualmente",dialcodeInputPlaceholder:"Insira o dialcode (ex. A1B2C3)",dialcodeInputAriaLabel:"Campo de dialcode",linkButton:"Vincular",linkedSuccessMessage:"Dialcode vinculado com sucesso."},WC={unitsAddedLabel:"Unidades adicionadas",contentItemsLabel:"Itens de conteúdo",progressLabel:"Progresso"},KC={dropOntoUnitError:"Solte sobre uma unidade para adicionar conteúdo",dropOntoCourseError:"Solte o conteúdo sobre uma unidade, não diretamente sobre o curso.",alreadyInCollectionError:'"{name}" já está nesta coleção',addedToUnitSuccess:'"{name}" adicionado à unidade',fillRequiredMetadataError:"Preencha os metadados obrigatórios",outlineAriaLabel:"Esquema do curso",showOutlineTitle:"Mostrar esquema",editorAriaLabel:"Editor de conteúdo",libraryAriaLabel:"Biblioteca de conteúdo",showLibraryTitle:"Mostrar biblioteca"},YC={draftStatusFallback:"Rascunho",backAriaLabel:"Voltar",statusAriaLabelPrefix:"Status:",savingIndicator:"Salvando…",unsavedIndicator:"Não salvo",savedIndicatorPrefix:"Salvo",fillRequiredFieldsTooltip:"Preencha todos os campos obrigatórios antes de salvar",saveAsDraftButton:"Salvar como rascunho",sendForReviewButton:"Enviar para revisão",collaboratorsLabel:"Colaboradores",qrCodesLabel:"Códigos QR",generatingEllipsis:"Gerando…",generateQrCodesMenuItem:"Gerar códigos QR",downloadingEllipsis:"Baixando…",downloadQrCodesMenuItem:"Baixar códigos QR",publishButton:"Publicar",requestForChangesButton:"Solicitar alterações",approveButton:"Aprovar",qrGenerationStartedToast:'Geração dos códigos QR iniciada. Use "Baixar códigos QR" quando estiverem prontos.',qrGenerationFailedToast:"Falha ao gerar os códigos QR. Tente novamente.",qrCodesNotGeneratedToast:"Nenhum código QR gerado ainda. Gere os códigos QR primeiro.",qrGenerationInProgressToast:"A geração das imagens dos códigos QR está em andamento. Tente baixar novamente mais tarde.",qrCodesNotReadyToast:"Os códigos QR ainda não estão prontos. Aguarde e tente novamente.",qrCodesDownloadedToast:"Códigos QR baixados.",qrCodesDownloadFailedToast:"Falha ao baixar os códigos QR.",requestChangesTitle:"Solicitar alterações",changesRequestedLabel:"Alterações solicitadas",describeChangesPlaceholder:"Descreva as alterações que o autor precisa fazer"},ZC={closeAriaLabel:"Fechar",fillCommentsError:"Preencha os comentários",cancelButton:"Cancelar"},XC={closeAriaLabel:"Fechar",title:"Aceitar Termos e Condições",agreementTextPart1:"Concordo que, ao enviar/publicar este Conteúdo, confirmo que ele está em conformidade com as diretrizes estabelecidas, incluindo os Termos de Uso e a Política de Conteúdo, e que consinto em publicá-lo sob a",creativeCommonsLinkText:"Estrutura Creative Commons",agreementTextPart2:"de acordo com a",contentPolicyText:"Política de Conteúdo",agreementTextPart3:". Certifiquei-me de que não violo direitos de autor ou de privacidade de terceiros.",cancelButton:"Cancelar",submitButton:"Enviar"},JC={closeAriaLabel:"Fechar",title:"Gerar códigos QR",numberOfCodesLabel:"Número de códigos QR",countPlaceholder:"Insira um número (2–250)",countRangeError:"Insira um número entre 2 e 250.",cancelButton:"Cancelar",generateButton:"Gerar"},eS={remove:"Remover"},tS={dropHere:"Solte aqui"},rS={loading:"Carregando"},nS={contextualEditor:lC,languageSelector:cC,collectionEditor:uC,breadcrumb:dC,tabBar:fC,contentEditForm:hC,titleAppIcon:pC,unitContentList:mC,contentRow:gC,csvUpload:yC,manageCollaborators:vC,sparkMetaForm:bC,appIconField:wC,appIconPickerModal:CC,chipGroupField:SC,dateTimeField:xC,dialcodeInputField:_C,keywordSuggestField:TC,licenseSelectField:EC,multiSelectField:IC,nestedSelectField:OC,radioField:AC,selectField:DC,textField:NC,assetBrowser:RC,resourceReorderDialog:jC,assignPageNumber:kC,confirmDialog:LC,publishChecklist:PC,qualityParamsModal:FC,unsavedChangesModal:MC,filterChips:BC,libraryCard:$C,libraryDock:qC,libraryFilterPanel:UC,libraryPreviewPanel:zC,outlineTree:VC,treeNode:HC,contentPlayer:QC,dialcodePanel:GC,progressStatus:WC,splitBuilderShell:KC,topbar:YC,reviewCommentModal:ZC,confirmReviewModal:XC,generateQRModal:JC,chip:eS,dropZone:tS,spinner:rS},sS=["en","ar","fr","pt"],iS=["ar"],aS={en:Co,ar:dw,fr:oC,pt:nS};function yf(e,t){const r={...e};for(const n of Object.keys(t)){const s=e[n],i=t[n];s&&i&&typeof s=="object"&&typeof i=="object"&&!Array.isArray(s)&&!Array.isArray(i)?r[n]=yf(s,i):i!==void 0&&(r[n]=i)}return r}function mc(e){const t=aS[e];return!t||e==="en"?Co:yf(Co,t)}function oS(e){return iS.includes(e)}const So="app-language",xo="app-language-change",Li=zs(e=>({lang:"en",labelConfig:mc("en"),setLanguage:(t,r={})=>{e({lang:t,labelConfig:mc(t)}),localStorage.setItem(So,t),document.documentElement.setAttribute("dir",oS(t)?"rtl":"ltr"),document.documentElement.setAttribute("lang",t),r.broadcast!==!1&&window.dispatchEvent(new CustomEvent(xo,{detail:{lang:t}}))}}));function le(){return Li(e=>e.labelConfig)}const lS=({size:e=16,color:t="currentColor"})=>{const r=le();return c.jsx("svg",{className:wv.spin,width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-label":r.spinner.loading,role:"status",children:c.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"3",strokeDasharray:"31.4",strokeDashoffset:"10",strokeLinecap:"round"})})},Fe=({variant:e="ghost",size:t="md",isLoading:r,disabled:n,onClick:s,children:i,className:a,type:o="button"})=>c.jsxs("button",{type:o,className:`sbx-btn-${e} ${t==="sm"?"sbx-btn-sm":""} ${a??""}`,onClick:s,disabled:r||n,"aria-busy":r?!0:void 0,children:[r?c.jsx(lS,{size:14}):null,i]}),cS="_languageSelector_vmwcn_1",uS="_languageBtn_vmwcn_10",dS="_active_vmwcn_24",_a={languageSelector:cS,languageBtn:uS,active:dS},fS={en:"EN",ar:"AR",fr:"FR",pt:"PT"},hS=()=>{const e=le(),t=Li(n=>n.lang),r=Li(n=>n.setLanguage);return c.jsx("div",{className:_a.languageSelector,role:"group","aria-label":e.languageSelector.ariaLabel,children:sS.map(n=>c.jsx("button",{type:"button",className:`${_a.languageBtn} ${t===n?_a.active:""}`,onClick:()=>r(n),"aria-pressed":t===n,children:fS[n]},n))})},pS="_overlay_w9xez_1",mS="_modal_w9xez_11",gS="_modalHeader_w9xez_23",yS="_modalHeaderClose_w9xez_33",vS="_modalBody_w9xez_51",bS="_modalFooter_w9xez_58",wS="_checkRow_w9xez_65",CS="_formGroup_w9xez_108",SS="_textarea_w9xez_119",xS="_sliderGroup_w9xez_140",_S="_sliderValue_w9xez_152",TS="_sliderLabels_w9xez_160",ES="_sectionTitle_w9xez_168",ke={overlay:pS,modal:mS,modalHeader:gS,modalHeaderClose:yS,modalBody:vS,modalFooter:bS,checkRow:wS,formGroup:CS,textarea:SS,sliderGroup:xS,sliderValue:_S,sliderLabels:TS,sectionTitle:ES},IS=({contentId:e,onConfirm:t,onCancel:r})=>{const n=le(),s=ce(d=>{var g,p;return(p=(g=d.editorConfig)==null?void 0:g.config)==null?void 0:p.objectType})||"Content",i=ce(d=>d.publishChecklist)??[],[a,o]=m.useState({}),l=i.every(d=>a[d.code]),u=i.length===0||l,f=()=>{t()};return c.jsx("div",{className:ke.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:c.jsxs("div",{className:ke.modal,children:[c.jsxs("div",{className:ke.modalHeader,children:[c.jsxs("span",{id:"publish-modal-title",children:[n.publishChecklist.publishTitlePrefix," ",s]}),c.jsx("button",{className:ke.modalHeaderClose,onClick:r,"aria-label":n.publishChecklist.closeAriaLabel,children:"×"})]}),c.jsx("div",{className:ke.modalBody,children:i.length===0?c.jsxs("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:[n.publishChecklist.confirmPublishPrefix," ",s,"?"]}):c.jsxs(c.Fragment,{children:[c.jsx("p",{className:ke.sectionTitle,children:n.publishChecklist.checklistInstructions}),i.map(d=>c.jsxs("label",{className:ke.checkRow,children:[c.jsx("input",{type:"checkbox",checked:!!a[d.code],onChange:g=>o(p=>({...p,[d.code]:g.target.checked}))}),c.jsx("span",{children:d.label})]},d.code))]})}),c.jsxs("div",{className:ke.modalFooter,children:[c.jsx(Fe,{variant:"ghost",onClick:r,children:n.publishChecklist.noButton}),c.jsx(Fe,{variant:"primary",onClick:f,disabled:!u,children:n.publishChecklist.yesButton})]})]})})},OS=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const s=le(),[i,a]=m.useState(""),[o,l]=m.useState(7),u=t==="approve",f=u?s.qualityParamsModal.reviewQualityTitle:s.qualityParamsModal.rejectContentTitle,d=!u&&i.trim().length===0,g=()=>{u?r(i.trim(),o):r(i.trim())};return c.jsx("div",{className:ke.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:c.jsxs("div",{className:ke.modal,children:[c.jsxs("div",{className:ke.modalHeader,children:[c.jsx("span",{id:"quality-modal-title",children:f}),c.jsx("button",{className:ke.modalHeaderClose,onClick:n,"aria-label":s.qualityParamsModal.closeAriaLabel,children:"×"})]}),c.jsx("div",{className:ke.modalBody,children:u?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:ke.formGroup,children:[c.jsx("label",{htmlFor:"quality-score",children:s.qualityParamsModal.qualityScoreLabel}),c.jsxs("div",{className:ke.sliderGroup,children:[c.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:p=>l(Number(p.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),c.jsx("span",{className:ke.sliderValue,children:o})]}),c.jsxs("div",{className:ke.sliderLabels,children:[c.jsx("span",{children:s.qualityParamsModal.scorePoorLabel}),c.jsx("span",{children:s.qualityParamsModal.scoreExcellentLabel})]})]}),c.jsxs("div",{className:ke.formGroup,children:[c.jsxs("label",{htmlFor:"quality-comment",children:[s.qualityParamsModal.commentLabel," ",c.jsx("span",{style:{fontWeight:400,color:"var(--sbx-gray-400, #9CA3AF)"},children:s.qualityParamsModal.optionalLabel})]}),c.jsx("textarea",{id:"quality-comment",className:ke.textarea,placeholder:s.qualityParamsModal.commentPlaceholder,value:i,onChange:p=>a(p.target.value),rows:4})]})]}):c.jsxs("div",{className:ke.formGroup,children:[c.jsxs("label",{htmlFor:"reject-reason",children:[s.qualityParamsModal.rejectionReasonLabel," ",c.jsx("span",{style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),c.jsx("textarea",{id:"reject-reason",className:ke.textarea,placeholder:s.qualityParamsModal.rejectReasonPlaceholder,value:i,onChange:p=>a(p.target.value),rows:5,required:!0,"aria-required":"true"}),i.trim().length===0&&c.jsx("p",{style:{fontSize:12,color:"var(--sbx-error, #DC2626)",marginTop:4},children:s.qualityParamsModal.rejectionRequiredMessage})]})}),c.jsxs("div",{className:ke.modalFooter,children:[c.jsx(Fe,{variant:"ghost",onClick:n,children:s.qualityParamsModal.cancelButton}),c.jsx(Fe,{variant:u?"primary":"danger",onClick:g,disabled:d,children:u?s.qualityParamsModal.approveButton:s.qualityParamsModal.rejectButton})]})]})})};function vf(e,t){return function(){return e.apply(t,arguments)}}const{toString:AS}=Object.prototype,{getPrototypeOf:qn}=Object,{iterator:Vs,toStringTag:bf}=Symbol,Pi=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Os=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),Pi(r,t))return!0;r=qn(r)}return!1},DS=(e,t)=>e!=null&&Os(e,t)?e[t]:void 0,cl=(e=>t=>{const r=AS.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),tr=e=>(e=e.toLowerCase(),t=>cl(t)===e),ra=e=>t=>typeof t===e,{isArray:un}=Array,Un=ra("undefined");function Zn(e){return e!==null&&!Un(e)&&e.constructor!==null&&!Un(e.constructor)&&Nt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const wf=tr("ArrayBuffer");function NS(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&wf(e.buffer),t}const RS=ra("string"),Nt=ra("function"),Cf=ra("number"),Xn=e=>e!==null&&typeof e=="object",jS=e=>e===!0||e===!1,mi=e=>{if(!Xn(e))return!1;const t=qn(e);return(t===null||t===Object.prototype||qn(t)===null)&&!Os(e,bf)&&!Os(e,Vs)},kS=e=>{if(!Xn(e)||Zn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},LS=tr("Date"),PS=tr("File"),FS=e=>!!(e&&typeof e.uri<"u"),MS=e=>e&&typeof e.getParts<"u",BS=tr("Blob"),$S=tr("FileList"),qS=e=>Xn(e)&&Nt(e.pipe);function US(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const gc=US(),yc=typeof gc.FormData<"u"?gc.FormData:void 0,zS=e=>{if(!e)return!1;if(yc&&e instanceof yc)return!0;const t=qn(e);if(!t||t===Object.prototype||!Nt(e.append))return!1;const r=cl(e);return r==="formdata"||r==="object"&&Nt(e.toString)&&e.toString()==="[object FormData]"},VS=tr("URLSearchParams"),[HS,QS,GS,WS]=["ReadableStream","Request","Response","Headers"].map(tr),KS=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Hs(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),un(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(Zn(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let o;for(n=0;n<a;n++)o=i[n],t.call(null,e[o],o,e)}}function Sf(e,t){if(Zn(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,s;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const Kr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,xf=e=>!Un(e)&&e!==Kr;function _o(...e){const{caseless:t,skipUndefined:r}=xf(this)&&this||{},n={},s=(i,a)=>{if(a==="__proto__"||a==="constructor"||a==="prototype")return;const o=t&&typeof a=="string"&&Sf(n,a)||a,l=Pi(n,o)?n[o]:void 0;mi(l)&&mi(i)?n[o]=_o(l,i):mi(i)?n[o]=_o({},i):un(i)?n[o]=i.slice():(!r||!Un(i))&&(n[o]=i)};for(let i=0,a=e.length;i<a;i++){const o=e[i];if(!o||Zn(o)||(Hs(o,s),typeof o!="object"||un(o)))continue;const l=Object.getOwnPropertySymbols(o);for(let u=0;u<l.length;u++){const f=l[u];ox.call(o,f)&&s(o[f],f)}}return n}const YS=(e,t,r,{allOwnKeys:n}={})=>(Hs(t,(s,i)=>{r&&Nt(s)?Object.defineProperty(e,i,{__proto__:null,value:vf(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),ZS=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),XS=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),r&&Object.assign(e.prototype,r)},JS=(e,t,r,n)=>{let s,i,a;const o={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)a=s[i],(!n||n(a,e,t))&&!o[a]&&(t[a]=e[a],o[a]=!0);e=r!==!1&&qn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},ex=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},tx=e=>{if(!e)return null;if(un(e))return e;let t=e.length;if(!Cf(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},rx=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&qn(Uint8Array)),nx=(e,t)=>{const n=(e&&e[Vs]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},sx=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},ix=tr("HTMLFormElement"),ax=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:ox}=Object.prototype,lx=tr("RegExp"),_f=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Hs(r,(s,i)=>{let a;(a=t(s,i,e))!==!1&&(n[i]=a||s)}),Object.defineProperties(e,n)},cx=e=>{_f(e,(t,r)=>{if(Nt(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Nt(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},ux=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return un(e)?n(e):n(String(e).split(t)),r},dx=()=>{},fx=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function hx(e){return!!(e&&Nt(e.append)&&e[bf]==="FormData"&&e[Vs])}const px=e=>{const t=new WeakSet,r=n=>{if(Xn(n)){if(t.has(n))return;if(Zn(n))return n;if(!("toJSON"in n)){t.add(n);const s=un(n)?[]:{};return Hs(n,(i,a)=>{const o=r(i);!Un(o)&&(s[a]=o)}),t.delete(n),s}}return n};return r(e)},mx=tr("AsyncFunction"),gx=e=>e&&(Xn(e)||Nt(e))&&Nt(e.then)&&Nt(e.catch),Tf=((e,t)=>e?setImmediate:t?((r,n)=>(Kr.addEventListener("message",({source:s,data:i})=>{s===Kr&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),Kr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Nt(Kr.postMessage)),yx=typeof queueMicrotask<"u"?queueMicrotask.bind(Kr):typeof process<"u"&&process.nextTick||Tf,Ef=e=>e!=null&&Nt(e[Vs]),vx=e=>e!=null&&Os(e,Vs)&&Ef(e),I={isArray:un,isArrayBuffer:wf,isBuffer:Zn,isFormData:zS,isArrayBufferView:NS,isString:RS,isNumber:Cf,isBoolean:jS,isObject:Xn,isPlainObject:mi,isEmptyObject:kS,isReadableStream:HS,isRequest:QS,isResponse:GS,isHeaders:WS,isUndefined:Un,isDate:LS,isFile:PS,isReactNativeBlob:FS,isReactNative:MS,isBlob:BS,isRegExp:lx,isFunction:Nt,isStream:qS,isURLSearchParams:VS,isTypedArray:rx,isFileList:$S,forEach:Hs,merge:_o,extend:YS,trim:KS,stripBOM:ZS,inherits:XS,toFlatObject:JS,kindOf:cl,kindOfTest:tr,endsWith:ex,toArray:tx,forEachEntry:nx,matchAll:sx,isHTMLForm:ix,hasOwnProperty:Pi,hasOwnProp:Pi,hasOwnInPrototypeChain:Os,getSafeProp:DS,reduceDescriptors:_f,freezeMethods:cx,toObjectSet:ux,toCamelCase:ax,noop:dx,toFiniteNumber:fx,findKey:Sf,global:Kr,isContextDefined:xf,isSpecCompliantForm:hx,toJSONObject:px,isAsyncFn:mx,isThenable:gx,setImmediate:Tf,asap:yx,isIterable:Ef,isSafeIterable:vx},bx=I.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),wx=e=>{const t={};let r,n,s;return e&&e.split(`
|
|
489
|
-
`).forEach(function(a){s=a.indexOf(":"),r=a.substring(0,s).trim().toLowerCase(),n=a.substring(s+1).trim(),!(!r||t[r]&&
|
|
490
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(s=>n.set(s)),n}static accessor(t){const n=(this[vc]=this[vc]={accessors:{}}).accessors,s=this.prototype;function i(a){const o=ss(a);n[o]||(Ax(s,a),n[o]=!0)}return I.isArray(t)?t.forEach(i):i(t),this}};Ct.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);I.reduceDescriptors(Ct.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});I.freezeMethods(Ct);const Dx="[REDACTED ****]";function Nx(e){if(I.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(I.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Rx(e,t){const r=new Set(t.map(i=>String(i).toLowerCase())),n=[],s=i=>{if(i===null||typeof i!="object"||I.isBuffer(i))return i;if(n.indexOf(i)!==-1)return;i instanceof Ct&&(i=i.toJSON()),n.push(i);let a;if(I.isArray(i))a=[],i.forEach((o,l)=>{const u=s(o);I.isUndefined(u)||(a[l]=u)});else{if(!I.isPlainObject(i)&&Nx(i))return n.pop(),i;a=Object.create(null);for(const[o,l]of Object.entries(i)){const u=r.has(o.toLowerCase())?Dx:s(l);I.isUndefined(u)||(a[o]=u)}}return n.pop(),a};return s(e)}let Z=class Of extends Error{static from(t,r,n,s,i,a){const o=new Of(t.message,r||t.code,n,s,i);return o.cause=t,o.name=t.name,t.status!=null&&o.status==null&&(o.status=t.status),a&&Object.assign(o,a),o}constructor(t,r,n,s,i){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,r=t&&I.hasOwnProp(t,"redact")?t.redact:void 0,n=I.isArray(r)&&r.length>0?Rx(t,r):I.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}};Z.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Z.ERR_BAD_OPTION="ERR_BAD_OPTION";Z.ECONNABORTED="ECONNABORTED";Z.ETIMEDOUT="ETIMEDOUT";Z.ECONNREFUSED="ECONNREFUSED";Z.ERR_NETWORK="ERR_NETWORK";Z.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Z.ERR_DEPRECATED="ERR_DEPRECATED";Z.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Z.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Z.ERR_CANCELED="ERR_CANCELED";Z.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Z.ERR_INVALID_URL="ERR_INVALID_URL";Z.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const jx=null,Af=100;function To(e){return I.isPlainObject(e)||I.isArray(e)}function Df(e){return I.endsWith(e,"[]")?e.slice(0,-2):e}function Ea(e,t,r){return e?e.concat(t).map(function(s,i){return s=Df(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function kx(e){return I.isArray(e)&&!e.some(To)}const Lx=I.toFlatObject(I,{},null,function(t){return/^is[A-Z]/.test(t)});function na(e,t,r){if(!I.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=I.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,C){return!I.isUndefined(C[b])});const n=r.metaTokens,s=r.visitor||w,i=r.dots,a=r.indexes,o=r.Blob||typeof Blob<"u"&&Blob,l=r.maxDepth===void 0?Af:r.maxDepth,u=o&&I.isSpecCompliantForm(t),f=[];if(!I.isFunction(s))throw new TypeError("visitor must be a function");function d(v){if(v===null)return"";if(I.isDate(v))return v.toISOString();if(I.isBoolean(v))return v.toString();if(!u&&I.isBlob(v))throw new Z("Blob is not supported. Use a Buffer instead.");return I.isArrayBuffer(v)||I.isTypedArray(v)?u&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function g(v){if(v>l)throw new Z("Object is too deeply nested ("+v+" levels). Max depth: "+l,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function p(v,b){if(l===1/0)return JSON.stringify(v);const C=[];return JSON.stringify(v,function(_,E){if(!I.isObject(E))return E;for(;C.length&&C[C.length-1]!==this;)C.pop();return C.push(E),g(b+C.length-1),E})}function w(v,b,C){let S=v;if(I.isReactNative(t)&&I.isReactNativeBlob(v))return t.append(Ea(C,b,i),d(v)),!1;if(v&&!C&&typeof v=="object"){if(I.endsWith(b,"{}"))b=n?b:b.slice(0,-2),v=p(v,1);else if(I.isArray(v)&&kx(v)||(I.isFileList(v)||I.endsWith(b,"[]"))&&(S=I.toArray(v)))return b=Df(b),S.forEach(function(E,N){!(I.isUndefined(E)||E===null)&&t.append(a===!0?Ea([b],N,i):a===null?b:b+"[]",d(E))}),!1}return To(v)?!0:(t.append(Ea(C,b,i),d(v)),!1)}const h=Object.assign(Lx,{defaultVisitor:w,convertValue:d,isVisitable:To});function y(v,b,C=0){if(!I.isUndefined(v)){if(g(C),f.indexOf(v)!==-1)throw new Error("Circular reference detected in "+b.join("."));f.push(v),I.forEach(v,function(_,E){(!(I.isUndefined(_)||_===null)&&s.call(t,_,I.isString(E)?E.trim():E,b,h))===!0&&y(_,b?b.concat(E):[E],C+1)}),f.pop()}}if(!I.isObject(e))throw new TypeError("data must be an object");return y(e),t}function bc(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function dl(e,t){this._pairs=[],e&&na(e,this,t)}const Nf=dl.prototype;Nf.append=function(t,r){this._pairs.push([t,r])};Nf.toString=function(t){const r=t?function(n){return t.call(this,n,bc)}:bc;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Px(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Rf(e,t,r){if(!t)return e;const n=I.isFunction(r)?{serialize:r}:r,s=I.getSafeProp(n,"encode")||Px,i=I.getSafeProp(n,"serialize");let a;if(i?a=i(t,n):a=I.isURLSearchParams(t)?t.toString():new dl(t,n).toString(s),a){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}class wc{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){I.forEach(this.handlers,function(n){n!==null&&t(n)})}}const fl={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Fx=typeof URLSearchParams<"u"?URLSearchParams:dl,Mx=typeof FormData<"u"?FormData:null,Bx=typeof Blob<"u"?Blob:null,$x={isBrowser:!0,classes:{URLSearchParams:Fx,FormData:Mx,Blob:Bx},protocols:["http","https","file","blob","url","data"]},hl=typeof window<"u"&&typeof document<"u",Eo=typeof navigator=="object"&&navigator||void 0,qx=hl&&(!Eo||["ReactNative","NativeScript","NS"].indexOf(Eo.product)<0),Ux=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",zx=hl&&window.location.href||"http://localhost",Vx=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:hl,hasStandardBrowserEnv:qx,hasStandardBrowserWebWorkerEnv:Ux,navigator:Eo,origin:zx},Symbol.toStringTag,{value:"Module"})),ft={...Vx,...$x};function Hx(e,t){return na(e,new ft.classes.URLSearchParams,{visitor:function(r,n,s,i){return ft.isNode&&I.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const Cc=Af;function jf(e){if(e>Cc)throw new Z("FormData field is too deeply nested ("+e+" levels). Max depth: "+Cc,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Qx(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)jf(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function Gx(e){const t={},r=Object.keys(e);let n;const s=r.length;let i;for(n=0;n<s;n++)i=r[n],t[i]=e[i];return t}function kf(e){function t(r,n,s,i){jf(i);let a=r[i++];if(a==="__proto__")return!0;const o=Number.isFinite(+a),l=i>=r.length;return a=!a&&I.isArray(s)?s.length:a,l?(I.hasOwnProp(s,a)?s[a]=I.isArray(s[a])?s[a].concat(n):[s[a],n]:s[a]=n,!o):((!I.hasOwnProp(s,a)||!I.isObject(s[a]))&&(s[a]=[]),t(r,n,s[a],i)&&I.isArray(s[a])&&(s[a]=Gx(s[a])),!o)}if(I.isFormData(e)&&I.isFunction(e.entries)){const r={};return I.forEachEntry(e,(n,s)=>{t(Qx(n),s,r,0)}),r}return null}const mn=(e,t)=>e!=null&&I.hasOwnProp(e,t)?e[t]:void 0;function Wx(e,t,r){if(I.isString(e))try{return(t||JSON.parse)(e),I.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const Qs={transitional:fl,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=I.isObject(t);if(i&&I.isHTMLForm(t)&&(t=new FormData(t)),I.isFormData(t))return s?JSON.stringify(kf(t)):t;if(I.isArrayBuffer(t)||I.isBuffer(t)||I.isStream(t)||I.isFile(t)||I.isBlob(t)||I.isReadableStream(t))return t;if(I.isArrayBufferView(t))return t.buffer;if(I.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(i){const l=mn(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return Hx(t,l).toString();if((o=I.isFileList(t))||n.indexOf("multipart/form-data")>-1){const u=mn(this,"env"),f=u&&u.FormData;return na(o?{"files[]":t}:t,f&&new f,l)}}return i||s?(r.setContentType("application/json",!1),Wx(t)):t}],transformResponse:[function(t){const r=mn(this,"transitional")||Qs.transitional,n=r&&r.forcedJSONParsing,s=mn(this,"responseType"),i=s==="json";if(I.isResponse(t)||I.isReadableStream(t))return t;if(t&&I.isString(t)&&(n&&!s||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,mn(this,"parseReviver"))}catch(l){if(o)throw l.name==="SyntaxError"?Z.from(l,Z.ERR_BAD_RESPONSE,this,null,mn(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ft.classes.FormData,Blob:ft.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};I.forEach(["delete","get","head","post","put","patch","query"],e=>{Qs.headers[e]={}});function Ia(e,t){const r=this||Qs,n=t||r,s=Ct.from(n.headers);let i=n.data;return I.forEach(e,function(o){i=o.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Lf(e){return!!(e&&e.__CANCEL__)}let Gs=class extends Z{constructor(t,r,n){super(t??"canceled",Z.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function Pf(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new Z("Request failed with status code "+r.status,r.status>=400&&r.status<500?Z.ERR_BAD_REQUEST:Z.ERR_BAD_RESPONSE,r.config,r.request,r))}function Kx(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Yx(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,i=0,a;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),f=n[i];a||(a=u),r[s]=l,n[s]=u;let d=i,g=0;for(;d!==s;)g+=r[d++],d=d%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-a<t)return;const p=f&&u-f;return p?Math.round(g*1e3/p):void 0}}function Zx(e,t){let r=0,n=1e3/t,s,i;const a=(u,f=Date.now())=>{r=f,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const f=Date.now(),d=f-r;d>=n?a(u,f):(s=u,i||(i=setTimeout(()=>{i=null,a(s)},n-d)))},()=>s&&a(s)]}const Fi=(e,t,r=3)=>{let n=0;const s=Yx(50,250);return Zx(i=>{if(!i||typeof i.loaded!="number")return;const a=i.loaded,o=i.lengthComputable?i.total:void 0,l=o!=null?Math.min(a,o):a,u=Math.max(0,l-n),f=s(u);n=Math.max(n,l);const d={loaded:l,total:o,progress:o?l/o:void 0,bytes:u,rate:f||void 0,estimated:f&&o?(o-l)/f:void 0,event:i,lengthComputable:o!=null,[t?"download":"upload"]:!0};e(d)},r)},Sc=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},xc=e=>(...t)=>I.asap(()=>e(...t)),Xx=ft.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,ft.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(ft.origin),ft.navigator&&/(msie|trident)/i.test(ft.navigator.userAgent)):()=>!0,Jx=ft.hasStandardBrowserEnv?{write(e,t,r,n,s,i,a){if(typeof document>"u")return;const o=[`${e}=${encodeURIComponent(t)}`];I.isNumber(r)&&o.push(`expires=${new Date(r).toUTCString()}`),I.isString(n)&&o.push(`path=${n}`),I.isString(s)&&o.push(`domain=${s}`),i===!0&&o.push("secure"),I.isString(a)&&o.push(`SameSite=${a}`),document.cookie=o.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let r=0;r<t.length;r++){const n=t[r].replace(/^\s+/,""),s=n.indexOf("=");if(s!==-1&&n.slice(0,s)===e)return decodeURIComponent(n.slice(s+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function e_(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function t_(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const r_=/^https?:(?!\/\/)/i,n_=/[\t\n\r]/g;function s_(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function i_(e){return s_(e).replace(n_,"")}function _c(e,t){if(typeof e=="string"&&r_.test(i_(e)))throw new Z('Invalid URL: missing "//" after protocol',Z.ERR_INVALID_URL,t)}function Ff(e,t,r,n){_c(t,n);let s=!e_(t);return e&&(s||r===!1)?(_c(e,n),t_(e,t)):t}const Tc=e=>e instanceof Ct?{...e}:e;function dn(e,t){t=t||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(f,d,g,p){return I.isPlainObject(f)&&I.isPlainObject(d)?I.merge.call({caseless:p},f,d):I.isPlainObject(d)?I.merge({},d):I.isArray(d)?d.slice():d}function s(f,d,g,p){if(I.isUndefined(d)){if(!I.isUndefined(f))return n(void 0,f,g,p)}else return n(f,d,g,p)}function i(f,d){if(!I.isUndefined(d))return n(void 0,d)}function a(f,d){if(I.isUndefined(d)){if(!I.isUndefined(f))return n(void 0,f)}else return n(void 0,d)}function o(f){const d=I.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!I.isUndefined(d))if(I.isPlainObject(d)){if(I.hasOwnProp(d,f))return d[f]}else return;const g=I.hasOwnProp(e,"transitional")?e.transitional:void 0;if(I.isPlainObject(g)&&I.hasOwnProp(g,f))return g[f]}function l(f,d,g){if(I.hasOwnProp(t,g))return n(f,d);if(I.hasOwnProp(e,g))return n(void 0,f)}const u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,allowedSocketPaths:a,responseEncoding:a,validateStatus:l,headers:(f,d,g)=>s(Tc(f),Tc(d),g,!0)};return I.forEach(Object.keys({...e,...t}),function(d){if(d==="__proto__"||d==="constructor"||d==="prototype")return;const g=I.hasOwnProp(u,d)?u[d]:s,p=I.hasOwnProp(e,d)?e[d]:void 0,w=I.hasOwnProp(t,d)?t[d]:void 0,h=g(p,w,d);I.isUndefined(h)&&g!==l||(r[d]=h)}),I.hasOwnProp(t,"validateStatus")&&I.isUndefined(t.validateStatus)&&o("validateStatusUndefinedResolves")===!1&&(I.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const a_=["content-type","content-length"];function o_(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{a_.includes(n.toLowerCase())&&e.set(n,s)})}const l_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function Mf(e){const t=dn({},e),r=g=>I.hasOwnProp(t,g)?t[g]:void 0,n=r("data");let s=r("withXSRFToken");const i=r("xsrfHeaderName"),a=r("xsrfCookieName");let o=r("headers");const l=r("auth"),u=r("baseURL"),f=r("allowAbsoluteUrls"),d=r("url");if(t.headers=o=Ct.from(o),t.url=Rf(Ff(u,d,f,t),r("params"),r("paramsSerializer")),l){const g=I.getSafeProp(l,"username")||"",p=I.getSafeProp(l,"password")||"";o.set("Authorization","Basic "+btoa(g+":"+(p?l_(p):"")))}if(I.isFormData(n)&&(ft.hasStandardBrowserEnv||ft.hasStandardBrowserWebWorkerEnv||I.isReactNative(n)?o.setContentType(void 0):I.isFunction(n.getHeaders)&&o_(o,n.getHeaders(),r("formDataHeaderPolicy"))),ft.hasStandardBrowserEnv&&(I.isFunction(s)&&(s=s(t)),s===!0||s==null&&Xx(t.url))){const p=i&&a&&Jx.read(a);p&&o.set(i,p)}return t}const c_=typeof XMLHttpRequest<"u",u_=c_&&function(e){return new Promise(function(r,n){const s=Mf(e);let i=s.data;const a=Ct.from(s.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:u}=s,f,d,g,p,w;function h(){p&&p(),w&&w(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function v(){if(!y)return;const C=Ct.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),_={data:!o||o==="text"||o==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:C,config:e,request:y};Pf(function(N){r(N),h()},function(N){n(N),h()},_),y=null}"onloadend"in y?y.onloadend=v:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(v)},y.onabort=function(){y&&(n(new Z("Request aborted",Z.ECONNABORTED,e,y)),h(),y=null)},y.onerror=function(S){const _=S&&S.message?S.message:"Network Error",E=new Z(_,Z.ERR_NETWORK,e,y);E.event=S||null,n(E),h(),y=null},y.ontimeout=function(){let S=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const _=s.transitional||fl;s.timeoutErrorMessage&&(S=s.timeoutErrorMessage),n(new Z(S,_.clarifyTimeoutError?Z.ETIMEDOUT:Z.ECONNABORTED,e,y)),h(),y=null},i===void 0&&a.setContentType(null),"setRequestHeader"in y&&I.forEach(If(a),function(S,_){y.setRequestHeader(_,S)}),I.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),o&&o!=="json"&&(y.responseType=s.responseType),u&&([g,w]=Fi(u,!0),y.addEventListener("progress",g)),l&&y.upload&&([d,p]=Fi(l),y.upload.addEventListener("progress",d),y.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(f=C=>{y&&(n(!C||C.type?new Gs(null,e,y):C),y.abort(),h(),y=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const b=Kx(s.url);if(b&&!ft.protocols.includes(b)){n(new Z("Unsupported protocol "+b+":",Z.ERR_BAD_REQUEST,e));return}y.send(i||null)})},d_=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const s=function(l){if(!n){n=!0,a();const u=l instanceof Error?l:this.reason;r.abort(u instanceof Z?u:new Gs(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,s(new Z(`timeout of ${t}ms exceeded`,Z.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),e=null)};e.forEach(l=>l.addEventListener("abort",s));const{signal:o}=r;return o.unsubscribe=()=>I.asap(a),o},f_=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,s;for(;n<r;)s=n+t,yield e.slice(n,s),n=s},h_=async function*(e,t){for await(const r of p_(e))yield*f_(r,t)},p_=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},Ec=(e,t,r,n)=>{const s=h_(e,t);let i=0,a,o=l=>{a||(a=!0,n&&n(l))};return new ReadableStream({async pull(l){try{const{done:u,value:f}=await s.next();if(u){o(),l.close();return}let d=f.byteLength;if(r){let g=i+=d;r(g)}l.enqueue(new Uint8Array(f))}catch(u){throw o(u),u}},cancel(l){return o(l),s.return()}},{highWaterMark:2})},Mi=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,m_=(e,t,r)=>t+2<r&&Mi(e.charCodeAt(t+1))&&Mi(e.charCodeAt(t+2));function g_(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let a=n.length;const o=n.length;for(let p=0;p<o;p++)if(n.charCodeAt(p)===37&&p+2<o){const w=n.charCodeAt(p+1),h=n.charCodeAt(p+2);Mi(w)&&Mi(h)&&(a-=2,p+=2)}let l=0,u=o-1;const f=p=>p>=2&&n.charCodeAt(p-2)===37&&n.charCodeAt(p-1)===51&&(n.charCodeAt(p)===68||n.charCodeAt(p)===100);u>=0&&(n.charCodeAt(u)===61?(l++,u--):f(u)&&(l++,u-=3)),l===1&&u>=0&&(n.charCodeAt(u)===61||f(u))&&l++;const g=Math.floor(a/4)*3-(l||0);return g>0?g:0}let i=0;for(let a=0,o=n.length;a<o;a++){const l=n.charCodeAt(a);if(l===37&&m_(n,a,o))i+=1,a+=2;else if(l<128)i+=1;else if(l<2048)i+=2;else if(l>=55296&&l<=56319&&a+1<o){const u=n.charCodeAt(a+1);u>=56320&&u<=57343?(i+=4,a++):i+=3}else i+=3}return i}const pl="1.18.0",Ic=64*1024,{isFunction:ei}=I,y_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),Oc=e=>{if(!I.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Ac=(e,...t)=>{try{return!!e(...t)}catch{return!1}},v_=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},b_=e=>{const t=I.global!==void 0&&I.global!==null?I.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=I.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:a}=e,o=s?ei(s):typeof fetch=="function",l=ei(i),u=ei(a);if(!o)return!1;const f=o&&ei(r),d=o&&(typeof n=="function"?(v=>b=>v.encode(b))(new n):async v=>new Uint8Array(await new i(v).arrayBuffer())),g=l&&f&&Ac(()=>{let v=!1;const b=new i(ft.origin,{body:new r,method:"POST",get duplex(){return v=!0,"half"}}),C=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),v&&!C}),p=u&&f&&Ac(()=>I.isReadableStream(new a("").body)),w={stream:p&&(v=>v.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!w[v]&&(w[v]=(b,C)=>{let S=b&&b[v];if(S)return S.call(b);throw new Z(`Response type '${v}' is not supported`,Z.ERR_NOT_SUPPORT,C)})});const h=async v=>{if(v==null)return 0;if(I.isBlob(v))return v.size;if(I.isSpecCompliantForm(v))return(await new i(ft.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(I.isArrayBufferView(v)||I.isArrayBuffer(v))return v.byteLength;if(I.isURLSearchParams(v)&&(v=v+""),I.isString(v))return(await d(v)).byteLength},y=async(v,b)=>{const C=I.toFiniteNumber(v.getContentLength());return C??h(b)};return async v=>{let{url:b,method:C,data:S,signal:_,cancelToken:E,timeout:N,onDownloadProgress:R,onUploadProgress:P,responseType:B,headers:D,withCredentials:j="same-origin",fetchOptions:M,maxContentLength:k,maxBodyLength:L}=Mf(v);const z=I.isNumber(k)&&k>-1,X=I.isNumber(L)&&L>-1,ye=V=>I.hasOwnProp(v,V)?v[V]:void 0;let _e=s||fetch;B=B?(B+"").toLowerCase():"text";let we=d_([_,E&&E.toAbortSignal()],N),de=null;const Q=we&&we.unsubscribe&&(()=>{we.unsubscribe()});let ne,te=null;const q=()=>new Z("Request body larger than maxBodyLength limit",Z.ERR_BAD_REQUEST,v,de);try{let V;const ie=ye("auth");if(ie){const re=I.getSafeProp(ie,"username")||"",He=I.getSafeProp(ie,"password")||"";V={username:re,password:He}}if(v_(b)){const re=new URL(b,ft.origin);if(!V&&(re.username||re.password)){const He=Oc(re.username),ze=Oc(re.password);V={username:He,password:ze}}(re.username||re.password)&&(re.username="",re.password="",b=re.href)}if(V&&(D.delete("authorization"),D.set("Authorization","Basic "+btoa(y_((V.username||"")+":"+(V.password||""))))),z&&typeof b=="string"&&b.startsWith("data:")&&g_(b)>k)throw new Z("maxContentLength size of "+k+" exceeded",Z.ERR_BAD_RESPONSE,v,de);if(X&&C!=="get"&&C!=="head"){const re=await h(S);if(typeof re=="number"&&isFinite(re)&&(ne=re,re>L))throw q()}const fe=X&&(I.isReadableStream(S)||I.isStream(S)),J=(re,He,ze)=>Ec(re,Ic,Ue=>{if(X&&Ue>L)throw te=q();He&&He(Ue)},ze);if(g&&C!=="get"&&C!=="head"&&(P||fe)){if(ne=ne??await y(D,S),ne!==0||fe){let re=new i(b,{method:"POST",body:S,duplex:"half"}),He;if(I.isFormData(S)&&(He=re.headers.get("content-type"))&&D.setContentType(He),re.body){const[ze,Ue]=P&&Sc(ne,Fi(xc(P)))||[];S=J(re.body,ze,Ue)}}}else if(fe&&!l&&f&&C!=="get"&&C!=="head")S=J(S);else if(fe&&l&&!g&&C!=="get"&&C!=="head")throw new Z("Stream request bodies are not supported by the current fetch implementation",Z.ERR_NOT_SUPPORT,v,de);I.isString(j)||(j=j?"include":"omit");const se=l&&"credentials"in i.prototype;if(I.isFormData(S)){const re=D.getContentType();re&&/^multipart\/form-data/i.test(re)&&!/boundary=/i.test(re)&&D.delete("content-type")}D.set("User-Agent","axios/"+pl,!1);const je={...M,signal:we,method:C.toUpperCase(),headers:If(D.normalize()),body:S,duplex:"half",credentials:se?j:void 0};de=l&&new i(b,je);let Te=await(l?_e(de,M):_e(b,je));const $e=Ct.from(Te.headers);if(z){const re=I.toFiniteNumber($e.getContentLength());if(re!=null&&re>k)throw new Z("maxContentLength size of "+k+" exceeded",Z.ERR_BAD_RESPONSE,v,de)}const Ve=p&&(B==="stream"||B==="response");if(p&&Te.body&&(R||z||Ve&&Q)){const re={};["status","statusText","headers"].forEach(St=>{re[St]=Te[St]});const He=I.toFiniteNumber($e.getContentLength()),[ze,Ue]=R&&Sc(He,Fi(xc(R),!0))||[];let Ze=0;const Bt=St=>{if(z&&(Ze=St,Ze>k))throw new Z("maxContentLength size of "+k+" exceeded",Z.ERR_BAD_RESPONSE,v,de);ze&&ze(St)};Te=new a(Ec(Te.body,Ic,Bt,()=>{Ue&&Ue(),Q&&Q()}),re)}B=B||"text";let qe=await w[I.findKey(w,B)||"text"](Te,v);if(z&&!p&&!Ve){let re;if(qe!=null&&(typeof qe.byteLength=="number"?re=qe.byteLength:typeof qe.size=="number"?re=qe.size:typeof qe=="string"&&(re=typeof n=="function"?new n().encode(qe).byteLength:qe.length)),typeof re=="number"&&re>k)throw new Z("maxContentLength size of "+k+" exceeded",Z.ERR_BAD_RESPONSE,v,de)}return!Ve&&Q&&Q(),await new Promise((re,He)=>{Pf(re,He,{data:qe,headers:Ct.from(Te.headers),status:Te.status,statusText:Te.statusText,config:v,request:de})})}catch(V){if(Q&&Q(),we&&we.aborted&&we.reason instanceof Z){const ie=we.reason;throw ie.config=v,de&&(ie.request=de),V!==ie&&(ie.cause=V),ie}throw te?(de&&!te.request&&(te.request=de),te):V instanceof Z?(de&&!V.request&&(V.request=de),V):V&&V.name==="TypeError"&&/Load failed|fetch/i.test(V.message)?Object.assign(new Z("Network Error",Z.ERR_NETWORK,v,de,V&&V.response),{cause:V.cause||V}):Z.from(V,V&&V.code,v,de,V&&V.response)}}},w_=new Map,Bf=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,i=[n,s,r];let a=i.length,o=a,l,u,f=w_;for(;o--;)l=i[o],u=f.get(l),u===void 0&&f.set(l,u=o?new Map:b_(t)),f=u;return u};Bf();const ml={http:jx,xhr:u_,fetch:{get:Bf}};I.forEach(ml,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Dc=e=>`- ${e}`,C_=e=>I.isFunction(e)||e===null||e===!1;function S_(e,t){e=I.isArray(e)?e:[e];const{length:r}=e;let n,s;const i={};for(let a=0;a<r;a++){n=e[a];let o;if(s=n,!C_(n)&&(s=ml[(o=String(n)).toLowerCase()],s===void 0))throw new Z(`Unknown adapter '${o}'`);if(s&&(I.isFunction(s)||(s=s.get(t))))break;i[o||"#"+a]=s}if(!s){const a=Object.entries(i).map(([l,u])=>`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=r?a.length>1?`since :
|
|
491
|
-
`+a.map(
|
|
492
|
-
`):" "+
|
|
488
|
+
*/var uc;function ov(){return uc||(uc=1,process.env.NODE_ENV!=="production"&&function(){function e(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=m,r=al(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,a=t.useEffect,o=t.useMemo,l=t.useDebugValue;Sa.useSyncExternalStoreWithSelector=function(u,f,d,g,p){var w=i(null);if(w.current===null){var h={hasValue:!1,value:null};w.current=h}else h=w.current;w=o(function(){function v(E){if(!b){if(b=!0,C=E,E=g(E),p!==void 0&&h.hasValue){var N=h.value;if(p(N,E))return S=N}return S=E}if(N=S,n(C,E))return N;var R=g(E);return p!==void 0&&p(N,R)?(C=E,N):(C=E,S=R)}var b=!1,C,S,_=d===void 0?null:d;return[function(){return v(f())},_===null?void 0:function(){return v(_())}]},[f,d,g,p]);var y=s(u,w[0],w[1]);return a(function(){h.hasValue=!0,h.value=y},[y]),l(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Sa}process.env.NODE_ENV==="production"?yo.exports=av():yo.exports=ov();var lv=yo.exports;const cv=cf(lv),uf={},{useDebugValue:uv}=m,{useSyncExternalStoreWithSelector:dv}=cv;let dc=!1;const fv=e=>e;function hv(e,t=fv,r){(uf?"production":void 0)!=="production"&&r&&!dc&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),dc=!0);const n=dv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return uv(n),n}const fc=e=>{(uf?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?nv(e):e,r=(n,s)=>hv(t,n,s);return Object.assign(r,t),r},zs=e=>e?fc(e):fc,le=zs(e=>({editorConfig:null,editorMode:"edit",buttonLoaders:{saveCollection:!1,publishCollection:!1,addFromLibrary:!1,rejectCollection:!1,sourcingApproveCollection:!1,sourcingRejectCollection:!1},showPreview:!1,pageId:"collection_editor",isCurrentNodeFolder:!1,isCurrentNodeRoot:!1,isQumlPlayer:!1,isDirty:!1,lastSaved:null,formStatusMapper:{},contentFramework:null,contentTargetFWIds:null,rootFormConfig:null,unitFormConfig:null,childFormConfig:null,searchFormConfig:null,relationalFormConfig:null,publishChecklist:null,reviewChecklist:null,rfcChecklist:null,categoryMeta:null,setEditorConfig:t=>e({editorConfig:t}),setEditorMode:t=>e({editorMode:t}),setButtonLoader:(t,r)=>e(n=>({buttonLoaders:{...n.buttonLoaders,[t]:r}})),setShowPreview:t=>e({showPreview:t}),setPageId:t=>e({pageId:t}),setNodeFlags:t=>e({...t.isFolder!==void 0&&{isCurrentNodeFolder:t.isFolder},...t.isRoot!==void 0&&{isCurrentNodeRoot:t.isRoot},...t.isQuml!==void 0&&{isQumlPlayer:t.isQuml}}),setLastSaved:t=>e({lastSaved:t}),setIsDirty:t=>e({isDirty:t}),setContentFramework:(t,r)=>e({contentFramework:t,contentTargetFWIds:r}),setFormStatus:(t,r)=>e(n=>({formStatusMapper:{...n.formStatusMapper,[t]:r}})),validateAllForms:t=>{const r=le.getState().formStatusMapper,n=[...t];for(;n.length>0;){const s=n.shift();if(r[s.id]===!1)return!1;s.children&&n.push(...s.children)}return!0},setCategoryDefinition:t=>e({rootFormConfig:t.rootForm,unitFormConfig:t.unitForm,childFormConfig:t.childForm,searchFormConfig:t.searchForm,relationalFormConfig:t.relationalForm,publishChecklist:t.publishChecklist,reviewChecklist:t.reviewChecklist,rfcChecklist:t.rfcChecklist,categoryMeta:{schemaDefaults:t.schemaDefaults,frameworkMetadata:t.frameworkMetadata,sourcingSettings:t.sourcingSettings}})})),pv=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:le},Symbol.toStringTag,{value:"Module"}));function Gr(e,t){const r=[...e];for(;r.length>0;){const n=r.shift();if(n.id===t)return n;n.children&&r.push(...n.children)}}function df(e,t,r=0){var n;for(const s of e){if(s.id===t)return r;if((n=s.children)!=null&&n.length){const i=df(s.children,t,r+1);if(i>=0)return i}}return-1}const mv=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function ff(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const a of mv)a in r&&(i[a]=r[a]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:ff(n.children,t,r)}:n})}function pi(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:pi(n.children,t,r)}:n)}function vo(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?vo(r.children,t):[]}))}function hf(e,t,r,n){return e.map(s=>{if(s.id===t){const i=[...s.children??[]],[a]=i.splice(r,1);return i.splice(n,0,a),{...s,children:i}}return s.children&&s.children.length>0?{...s,children:hf(s.children,t,r,n)}:s})}function pf(e,t){return e.map(r=>{const n=t[r.id]??r.id,s=r.parent?t[r.parent]??r.parent:r.parent;return{...r,id:n,identifier:n,parent:s,children:r.children?pf(r.children,t):[]}})}function gv(e){let t=0;const r=[...e];for(;r.length>0;){const n=r.shift();n.isFolder||t++,n.children&&r.push(...n.children)}return t}function yv(e,t){const r=Gr(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?Gr(e,s.parent):void 0;return n}const Oe=zs((e,t)=>({treeData:[],selectedNodeId:null,treeCache:{},breadcrumb:[],activeNodeMeta:{},setTreeData:r=>{var s;const n=((s=r[0])==null?void 0:s.id)??null;e({treeData:r,selectedNodeId:n}),n&&setTimeout(()=>t().selectNode(n),0)},selectNode:r=>{const{treeData:n,treeCache:s,getBreadcrumb:i}=t(),a=Gr(n,r),o=i(r),l={...(a==null?void 0:a.metadata)??{},...s[r]??{}};le.getState().setNodeFlags({isFolder:(a==null?void 0:a.isFolder)??!1,isRoot:!(a!=null&&a.parent),isQuml:!1}),e({selectedNodeId:r,breadcrumb:o,activeNodeMeta:l})},updateNode:(r,n)=>{e(s=>({treeData:ff(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),t().markDirty()},addNode:(r,n)=>{var u,f;const s=t(),i=((f=(u=le.getState().editorConfig)==null?void 0:u.config)==null?void 0:f.maxDepth)??4,a=df(s.treeData,r);if(a>=i)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${i}). parentDepth=${a}`),"";const o="temp-"+Math.random().toString(36).slice(2),l={id:o,identifier:o,name:"Untitled Unit",isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:o,name:"Untitled Unit",visibility:"Parent"}};return e(d=>({treeData:pi(d.treeData,r,l),treeCache:{...d.treeCache,[o]:{...l.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(o),0),o},deleteNode:r=>{e(n=>({treeData:vo(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:hf(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const a=Gr(i.treeData,r);if(!a)return i;let o=vo(i.treeData,r);return o=pi(o,s,{...a,parent:s}),{treeData:o}}),t().markDirty()},addResource:(r,n)=>{var f,d,g;const s=le.getState().editorConfig,i=((f=s==null?void 0:s.config)==null?void 0:f.allowContentUnderRoot)??!1,a=(d=t().treeData[0])==null?void 0:d.id;if(!i&&n===a||Gr(t().treeData,r.identifier))return!1;const o=((g=s==null?void 0:s.config)==null?void 0:g.maxContentsLimit)??1200;if(gv(t().treeData)>=o)return!1;const u={id:r.identifier,identifier:r.identifier,name:r.name,isFolder:!1,children:[],parent:n,mimeType:r.mimeType,primaryCategory:r.primaryCategory,contentType:r.contentType,appIcon:r.appIcon,status:r.status,metadata:r};return e(p=>({treeData:pi(p.treeData,n,u)})),t().markDirty(),!0},markDirty:()=>{const{editorMode:r,setIsDirty:n}=le.getState();r==="edit"&&n(!0)},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const s=pf(n.treeData,r),i={};for(const[o,l]of Object.entries(n.treeCache)){const u=r[o]??o,{isNew:f,...d}=l;i[u]=d}const a=n.selectedNodeId?r[n.selectedNodeId]??n.selectedNodeId:null;return{treeData:s,treeCache:i,selectedNodeId:a}})},getNodeById:r=>Gr(t().treeData,r),getChildrenOf:r=>{const n=Gr(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>yv(t().treeData,r)})),vv=zs(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),bv="_spin_1ah4d_9",wv={spin:bv},Cv={emptyStateMessage:"Select a unit from the outline to edit its details",reviewCommentLabel:"Reviewer comment:",untitledPlaceholder:"Untitled",nodeTitleAriaLabel:"Node title",dropZoneLabel:"Drop to add content to this unit"},Sv={ariaLabel:"Select language"},xv={errorBoundaryTitle:"Something went wrong",retryButton:"Retry",loadingMessage:"Loading editor...",loadErrorTitle:"Failed to load editor"},_v={nodePathAriaLabel:"Node path",homeAriaLabel:"Home"},Tv={detailsTab:"Details",audienceCurriculumTab:"Audience & Curriculum",licensingTab:"Licensing",metadataSectionsAriaLabel:"Metadata sections",hasErrorsAriaLabel:"Has errors"},Ev={moveToAnotherUnitButton:"Move to another unit",collapseMetadataPanelAriaLabel:"Collapse metadata panel",expandMetadataPanelAriaLabel:"Expand metadata panel",collapseTitle:"Collapse",expandTitle:"Expand",iconAlt:"icon",contentNamePlaceholder:"Content name",keywordsLabel:"Keywords",addKeywordPlaceholder:"Add keyword and press Enter",addButton:"Add",optionalInCollectionLabel:"Optional in Collection",yesOption:"Yes",noOption:"No"},Iv={selectAppIconAriaLabel:"Select app icon",appIconAriaLabel:"App icon",appIconAlt:"App icon",removeIconAriaLabel:"Remove icon"},Ov={removeConfirm:"Remove this content from the unit?",heading:"Content in this unit",emptyTitle:"No content yet",emptyHint:"Drag from the library or click Add content",addContentAriaLabel:"Add content to unit",addContent:"Add content"},Av={dragToReorderAriaLabel:"Drag to reorder",removeAriaLabel:"Remove {name}"},Dv={invalidFileType:"Only .csv files are accepted.",fileTooLarge:"File size must not exceed 50 MB.",downloadSampleFailed:"Failed to download sample CSV.",processingFailed:"Upload processing failed. Please check the error rows below.",connectionLost:"Lost connection while checking status. Please try again.",uploadFailed:"Upload failed. Please check your file and try again.",statusUploading:"Uploading...",statusProcessing:"Processing...",statusDone:"Done!",statusError:"Error",titleUpdate:"Update Folder Metadata via CSV",titleCreate:"Create Folders via CSV",closeAriaLabel:"Close",dropZoneAriaLabel:"Drop CSV file here or click to browse",dropText:"Drag & drop your CSV here",dropSubtext:"or click to browse",downloadSample:"Download Sample CSV",itemsImportedSuffix:"— {count} item(s) imported",failedRowsTitle:"Failed Rows ({count})",rowHeader:"Row",nameHeader:"Name",reasonHeader:"Reason",unknownError:"Unknown error",cancel:"Cancel",uploaded:"Uploaded",upload:"Upload"},Nv={saveFailed:"Failed to save collaborators. Please try again.",title:"Manage Collaborators",closeAriaLabel:"Close",searchUsersLabel:"Search users",searchPlaceholder:"Search by name or email...",searchingAriaLabel:"Searching...",searchResultsAriaLabel:"Search results",add:"Add",noUsersFound:"No users found.",currentCollaborators:"Current Collaborators",noCollaboratorsYet:"No collaborators added yet.",remove:"Remove",saveSuccess:"Collaborators saved successfully.",cancel:"Cancel",save:"Save"},Rv={shuffleEnabledMessage:"Shuffling is enabled for this question set.",noFieldsMessage:"No fields configured for this tab."},kv={requiredError:"{field} is required",selectIconAriaLabel:"Select app icon",iconAlt:"App icon",selectIconLabel:"Select icon",removeIconAriaLabel:"Remove app icon",removeLabel:"Remove"},jv={dialogAriaLabel:"Select App Icon",title:"Select App Icon",closeAriaLabel:"Close",myImagesTab:"My Images",allImagesTab:"All Images",uploadTab:"Upload",searchPlaceholder:"Search images…",loadingText:"Loading…",noImagesFound:"No images found",noThumbnailText:"IMG",loadMoreButton:"Load More",previewAlt:"Preview",dropZoneText:"Drag & drop or click to browse",acceptedTypesInfo:"{types} · max {size} MB",cancelButton:"Cancel",uploadingText:"Uploading…",uploadAndUseButton:"Upload & Use",useSelectedButton:"Use Selected",invalidFileTypeError:"Only {types} files are accepted.",fileTooLargeError:"Image must be under {size} MB.",uploadFailedError:"Upload failed."},Lv={addPlaceholder:"Add…",addButtonLabel:"Add"},Pv={requiredError:"{field} is required"},Fv={requiredError:"{field} is required",enterCodeMessage:"Enter a dial code to validate.",validMessage:"Dial code is valid.",notFoundMessage:"Dial code not found.",validationFailedMessage:"Validation failed. Please try again.",placeholderExample:"e.g. A1B2C3",validateAriaLabel:"Validate dial code",validatingLabel:"Validating…",validateButtonLabel:"Validate"},Mv={requiredError:"{field} is required",inputPlaceholder:"Type and press Enter or comma…"},Bv={requiredError:"{field} is required",selectPlaceholder:"Select license…"},$v={requiredError:"{field} is required",selectedCountSuffix:"selected",selectPlaceholder:"Select…",noOptionsMessage:"No options"},qv={requiredError:"{field} is required",selectPlaceholder:"Select…"},Uv={requiredError:"{field} is required"},zv={requiredError:"{field} is required",selectPlaceholder:"Select…",noOptionsMessage:"No options"},Vv={requiredError:"{field} is required",maxLengthError:"Max {max} characters"},Hv={dialogAriaLabel:"Asset Browser",title:"Asset Browser",closeAriaLabel:"Close",browseTab:"Browse",uploadTab:"Upload",searchPlaceholder:"Search assets...",searchButton:"Search",loadingMessage:"Loading...",uploadingMessage:"Uploading...",chooseFileButton:"Choose file to upload"},Qv={dialogAriaLabel:"Move resource",moveHeaderPrefix:"Move",closeAriaLabel:"Close",selectUnitHint:"Select a unit to move this content to:",noUnitsAvailable:"No other units available",cancelButton:"Cancel",moveButton:"Move here"},Gv={dialogAriaLabel:"Assign Page Numbers",title:"Assign Page Numbers",closeAriaLabel:"Close",emptyState:"No content items found in this collection.",contentColumnHeader:"Content",pageNumberColumnHeader:"Page Number",cancelButton:"Cancel",saveButton:"Save"},Wv={confirmButton:"Confirm",cancelButton:"Cancel",closeAriaLabel:"Close"},Kv={publishTitlePrefix:"Publish",closeAriaLabel:"Close",confirmPublishPrefix:"Are you sure you want to publish this",checklistInstructions:"Please confirm that ALL the following items are verified (by ticking the check-boxes) before you can publish:",noButton:"No",yesButton:"Yes"},Yv={reviewQualityTitle:"Review Quality",rejectContentTitle:"Reject Content",closeAriaLabel:"Close",qualityScoreLabel:"Quality Score",scorePoorLabel:"0 — Poor",scoreExcellentLabel:"10 — Excellent",commentLabel:"Comment",optionalLabel:"(optional)",commentPlaceholder:"Add any notes for the content creator…",rejectionReasonLabel:"Rejection Reason",rejectReasonPlaceholder:"Describe why this content is being rejected…",rejectionRequiredMessage:"A rejection reason is required.",cancelButton:"Cancel",approveButton:"Approve",rejectButton:"Reject"},Zv={title:"Unsaved changes",closeAriaLabel:"Close",bodyMessage:"You have unsaved changes. Would you like to save them before leaving?",cancelButton:"Cancel",discardButton:"Discard",saveButton:"Save"},Xv={contentTypeFiltersAriaLabel:"Content type filters"},Jv={alreadyAddedAriaLabel:"Already added",alreadyAddedTitle:"Already added to this collection",addItemAriaLabel:"Add {name} to unit",addToUnitTitle:"Add to unit",selectUnitToAddTitle:"Select a unit to add",draftOnlyTitle:"Only Draft content can be added"},eb={selectUnitFirstToast:"Select a unit first",selectUnitFromOutlineToast:"Select a unit from the outline to add content — resources cannot be added directly to the course.",itemAlreadyAddedToast:'"{name}" is already in this collection',itemAddedToast:'Added "{name}"',collapseLibraryPanelAriaLabel:"Collapse library panel",collapseLibraryTitle:"Collapse library",headerTitle:"Library",searchPlaceholder:"Search content…",searchAriaLabel:"Search library",sortAZAriaLabel:"Sort: A–Z (click for Recent)",sortRecentAriaLabel:"Sort: Recent (click for A–Z)",sortAZTitle:"A–Z",sortRecentTitle:"Recent",toggleAdvancedFiltersAriaLabel:"Toggle advanced filters",advancedFiltersTitle:"Advanced filters",libraryContentAriaLabel:"Library content",loadMoreAriaLabel:"Load more content",loadingText:"Loading…",loadMoreText:"Load More",noContentFound:"No content found",tryDifferentSearch:"Try a different search or filter"},tb={boardLabel:"Board",mediumLabel:"Medium",classLabel:"Class",subjectLabel:"Subject",primaryCategoryLabel:"Primary Category",filterLibraryAriaLabel:"Filter library",filtersHeaderTitle:"Filters",closeFiltersAriaLabel:"Close filters",resetButton:"Reset",applyButton:"Apply"},rb={contentPreviewAriaLabel:"Content preview",closePreviewAriaLabel:"Close preview",addToUnitButton:"+ Add to Unit"},nb={maxDepthReachedToast:"Maximum depth reached",downloadCsvFailedToast:"Failed to download CSV",outlineRefreshedToast:"Course outline refreshed.",outlineRefreshFailedToast:"Outline could not be refreshed automatically. Please reload the page.",moreOptionsAriaLabel:"More options",moreOptionsTitle:"More options",foldersExistTitle:'Folders already exist — use "Update" instead',createFoldersCsvButton:"Create folders using csv file",noFoldersYetTitle:'No folders yet — use "Create" first',downloadFoldersCsvButton:"Download folders as csv file",updateFoldersCsvButton:"Update folder metadata using csv file",expandOutlineAriaLabel:"Expand outline",collapseOutlineAriaLabel:"Collapse outline",addUnitButton:"Add Unit",addSubunitButton:"Add Sub-unit"},sb={expandAriaLabel:"Expand",collapseAriaLabel:"Collapse",dropHereLabel:"Drop here",nodeOptionsAriaLabel:"Node options",renameMenuItem:"Rename",addSubunitMenuItem:"Add sub-unit",addSiblingMenuItem:"Add Sibling",deleteMenuItem:"Delete"},ib={mimeLabelVideo:"Video",mimeLabelAudio:"Audio",mimeLabelPdf:"PDF",mimeLabelEpub:"ePub",mimeLabelEcml:"ECML",mimeLabelH5p:"H5P",mimeLabelScorm:"SCORM",mimeLabelOther:"Content",infoFieldAuthor:"Author",infoFieldLicense:"License",infoFieldLanguage:"Language",infoFieldClass:"Class",infoFieldSubject:"Subject",infoFieldType:"Type",loadingPreview:"Loading preview…",previewPlayerUnavailable:"Preview player unavailable. Check that /content/preview is reachable.",failedToInitializePlayer:"Failed to initialize the content player.",previewPlayerLoadFailed:"Preview player could not be loaded.",unableToLoadQuestionset:"Unable to load questionset:",parentQuestionsetNotResolved:"Could not resolve the parent questionset for this question.",questionNotFoundInQuestionset:"Question not found in the questionset."},ab={title:"QR Code (Dialcode)",invalidFormatError:"Invalid DIAL code format. Use uppercase letters and digits only (e.g. A1B2C3).",duplicateDialcodeError:'DIAL code "{code}" is already linked to another node in this collection.',dialcodeNotFoundError:"Dialcode not found. Please enter a valid code.",linkFailedError:"Failed to link dialcode. Please try again.",unlinkFailedError:"Failed to remove dialcode. Please try again.",qrCodeAltPrefix:"QR code for",linkedCodeLabel:"Linked code:",removeButton:"Remove",noCodeLinkedMessage:"No QR code linked to this content.",linkManuallyLabel:"Link manually",dialcodeInputPlaceholder:"Enter dialcode (e.g. A1B2C3)",dialcodeInputAriaLabel:"Dialcode input",linkButton:"Link",linkedSuccessMessage:"Dialcode linked successfully."},ob={unitsAddedLabel:"Units added",contentItemsLabel:"Content items",progressLabel:"Progress"},lb={dropOntoUnitError:"Drop onto a unit to add content",dropOntoCourseError:"Drop content onto a unit, not directly on the course.",alreadyInCollectionError:'"{name}" is already in this collection',addedToUnitSuccess:'Added "{name}" to unit',fillRequiredMetadataError:"Please fill the required metadata",outlineAriaLabel:"Course outline",showOutlineTitle:"Show outline",editorAriaLabel:"Content editor",libraryAriaLabel:"Content library",showLibraryTitle:"Show library"},cb={draftStatusFallback:"Draft",backAriaLabel:"Go back",statusAriaLabelPrefix:"Status:",savingIndicator:"Saving…",unsavedIndicator:"Unsaved",savedIndicatorPrefix:"Saved",fillRequiredFieldsTooltip:"Fill all required fields before saving",saveAsDraftButton:"Save as Draft",sendForReviewButton:"Send for review",collaboratorsLabel:"Collaborators",qrCodesLabel:"QR Codes",generatingEllipsis:"Generating…",generateQrCodesMenuItem:"Generate QR Codes",downloadingEllipsis:"Downloading…",downloadQrCodesMenuItem:"Download QR Codes",publishButton:"Publish",requestForChangesButton:"Request for Changes",approveButton:"Approve",qrGenerationStartedToast:'QR Codes generation started. Use "Download QR Codes" once ready.',qrGenerationFailedToast:"Failed to generate QR Codes. Please try again.",qrCodesNotGeneratedToast:"No QR codes generated yet. Generate QR Codes first.",qrGenerationInProgressToast:"QR code image generation is in progress. Please try downloading after some time.",qrCodesNotReadyToast:"QR Codes not ready yet. Please wait and try again.",qrCodesDownloadedToast:"QR codes downloaded.",qrCodesDownloadFailedToast:"Failed to download QR Codes.",requestChangesTitle:"Request Changes",changesRequestedLabel:"Changes requested",describeChangesPlaceholder:"Describe the changes the author needs to make"},ub={closeAriaLabel:"Close",fillCommentsError:"Fill comments",cancelButton:"Cancel"},db={closeAriaLabel:"Close",title:"Accepting Terms & Conditions",agreementTextPart1:"I agree that by submitting / publishing this Content, I confirm that this Content complies with prescribed guidelines, including the Terms of Use and Content Policy and that I consent to publish it under the",creativeCommonsLinkText:"Creative Commons Framework",agreementTextPart2:"in accordance with the",contentPolicyText:"Content Policy",agreementTextPart3:". I have made sure that I do not violate others' copyright or privacy rights.",cancelButton:"Cancel",submitButton:"Submit"},fb={closeAriaLabel:"Close",title:"Generate QR Codes",numberOfCodesLabel:"Number of QR Codes",countPlaceholder:"Enter number (2–250)",countRangeError:"Enter a number between 2 and 250.",cancelButton:"Cancel",generateButton:"Generate"},hb={remove:"Remove"},pb={dropHere:"Drop here"},mb={loading:"Loading"},bo={contextualEditor:Cv,languageSelector:Sv,collectionEditor:xv,breadcrumb:_v,tabBar:Tv,contentEditForm:Ev,titleAppIcon:Iv,unitContentList:Ov,contentRow:Av,csvUpload:Dv,manageCollaborators:Nv,sparkMetaForm:Rv,appIconField:kv,appIconPickerModal:jv,chipGroupField:Lv,dateTimeField:Pv,dialcodeInputField:Fv,keywordSuggestField:Mv,licenseSelectField:Bv,multiSelectField:$v,nestedSelectField:qv,radioField:Uv,selectField:zv,textField:Vv,assetBrowser:Hv,resourceReorderDialog:Qv,assignPageNumber:Gv,confirmDialog:Wv,publishChecklist:Kv,qualityParamsModal:Yv,unsavedChangesModal:Zv,filterChips:Xv,libraryCard:Jv,libraryDock:eb,libraryFilterPanel:tb,libraryPreviewPanel:rb,outlineTree:nb,treeNode:sb,contentPlayer:ib,dialcodePanel:ab,progressStatus:ob,splitBuilderShell:lb,topbar:cb,reviewCommentModal:ub,confirmReviewModal:db,generateQRModal:fb,chip:hb,dropZone:pb,spinner:mb},gb={emptyStateMessage:"اختر وحدة من المخطط التفصيلي لتحرير تفاصيلها",reviewCommentLabel:"تعليق المراجع:",untitledPlaceholder:"بدون عنوان",nodeTitleAriaLabel:"عنوان العنصر",dropZoneLabel:"أفلت هنا لإضافة محتوى إلى هذه الوحدة"},yb={ariaLabel:"اختيار اللغة"},vb={errorBoundaryTitle:"حدث خطأ ما",retryButton:"إعادة المحاولة",loadingMessage:"جارٍ تحميل المحرر...",loadErrorTitle:"فشل تحميل المحرر"},bb={nodePathAriaLabel:"مسار العنصر",homeAriaLabel:"الصفحة الرئيسية"},wb={detailsTab:"التفاصيل",audienceCurriculumTab:"الجمهور والمنهج",licensingTab:"الترخيص",metadataSectionsAriaLabel:"أقسام البيانات الوصفية",hasErrorsAriaLabel:"يحتوي على أخطاء"},Cb={moveToAnotherUnitButton:"نقل إلى وحدة أخرى",collapseMetadataPanelAriaLabel:"طي لوحة البيانات الوصفية",expandMetadataPanelAriaLabel:"توسيع لوحة البيانات الوصفية",collapseTitle:"طي",expandTitle:"توسيع",iconAlt:"أيقونة",contentNamePlaceholder:"اسم المحتوى",keywordsLabel:"الكلمات المفتاحية",addKeywordPlaceholder:"أضف كلمة مفتاحية واضغط Enter",addButton:"إضافة",optionalInCollectionLabel:"اختياري في المجموعة",yesOption:"نعم",noOption:"لا"},Sb={selectAppIconAriaLabel:"اختيار أيقونة التطبيق",appIconAriaLabel:"أيقونة التطبيق",appIconAlt:"أيقونة التطبيق",removeIconAriaLabel:"إزالة الأيقونة"},xb={removeConfirm:"هل تريد إزالة هذا المحتوى من الوحدة؟",heading:"المحتوى في هذه الوحدة",emptyTitle:"لا يوجد محتوى بعد",emptyHint:"اسحب من المكتبة أو انقر فوق إضافة محتوى",addContentAriaLabel:"إضافة محتوى إلى الوحدة",addContent:"إضافة محتوى"},_b={dragToReorderAriaLabel:"اسحب لإعادة الترتيب",removeAriaLabel:"إزالة {name}"},Tb={invalidFileType:"يُقبل فقط ملفات .csv.",fileTooLarge:"يجب ألا يتجاوز حجم الملف 50 ميجابايت.",downloadSampleFailed:"فشل تنزيل نموذج ملف CSV.",processingFailed:"فشلت معالجة التحميل. يرجى التحقق من صفوف الأخطاء أدناه.",connectionLost:"انقطع الاتصال أثناء التحقق من الحالة. يرجى المحاولة مرة أخرى.",uploadFailed:"فشل التحميل. يرجى التحقق من الملف والمحاولة مرة أخرى.",statusUploading:"جارٍ التحميل...",statusProcessing:"جارٍ المعالجة...",statusDone:"تم!",statusError:"خطأ",titleUpdate:"تحديث بيانات المجلدات الوصفية عبر CSV",titleCreate:"إنشاء مجلدات عبر CSV",closeAriaLabel:"إغلاق",dropZoneAriaLabel:"أفلت ملف CSV هنا أو انقر للتصفح",dropText:"اسحب وأفلت ملف CSV هنا",dropSubtext:"أو انقر للتصفح",downloadSample:"تنزيل نموذج CSV",itemsImportedSuffix:"— تم استيراد {count} عنصر (عناصر)",failedRowsTitle:"الصفوف الفاشلة ({count})",rowHeader:"الصف",nameHeader:"الاسم",reasonHeader:"السبب",unknownError:"خطأ غير معروف",cancel:"إلغاء",uploaded:"تم التحميل",upload:"تحميل"},Eb={saveFailed:"فشل حفظ المتعاونين. يرجى المحاولة مرة أخرى.",title:"إدارة المتعاونين",closeAriaLabel:"إغلاق",searchUsersLabel:"البحث عن المستخدمين",searchPlaceholder:"البحث بالاسم أو البريد الإلكتروني...",searchingAriaLabel:"جارٍ البحث...",searchResultsAriaLabel:"نتائج البحث",add:"إضافة",noUsersFound:"لم يتم العثور على مستخدمين.",currentCollaborators:"المتعاونون الحاليون",noCollaboratorsYet:"لم تتم إضافة أي متعاونين بعد.",remove:"إزالة",saveSuccess:"تم حفظ المتعاونين بنجاح.",cancel:"إلغاء",save:"حفظ"},Ib={shuffleEnabledMessage:"تم تفعيل الترتيب العشوائي لهذه المجموعة من الأسئلة.",noFieldsMessage:"لا توجد حقول مُهيَّأة لهذا التبويب."},Ob={requiredError:"{field} مطلوب",selectIconAriaLabel:"اختيار أيقونة التطبيق",iconAlt:"أيقونة التطبيق",selectIconLabel:"اختيار أيقونة",removeIconAriaLabel:"إزالة أيقونة التطبيق",removeLabel:"إزالة"},Ab={dialogAriaLabel:"اختيار أيقونة التطبيق",title:"اختيار أيقونة التطبيق",closeAriaLabel:"إغلاق",myImagesTab:"صوري",allImagesTab:"جميع الصور",uploadTab:"تحميل",searchPlaceholder:"البحث في الصور…",loadingText:"جارٍ التحميل…",noImagesFound:"لم يتم العثور على صور",noThumbnailText:"صورة",loadMoreButton:"تحميل المزيد",previewAlt:"معاينة",dropZoneText:"اسحب وأفلت أو انقر للتصفح",acceptedTypesInfo:"{types} · بحد أقصى {size} ميجابايت",cancelButton:"إلغاء",uploadingText:"جارٍ التحميل…",uploadAndUseButton:"تحميل واستخدام",useSelectedButton:"استخدام المحدد",invalidFileTypeError:"يُقبل فقط ملفات {types}.",fileTooLargeError:"يجب أن يكون حجم الصورة أقل من {size} ميجابايت.",uploadFailedError:"فشل التحميل."},Db={addPlaceholder:"إضافة…",addButtonLabel:"إضافة"},Nb={requiredError:"{field} مطلوب"},Rb={requiredError:"{field} مطلوب",enterCodeMessage:"أدخل رمز الطلب للتحقق منه.",validMessage:"رمز الطلب صالح.",notFoundMessage:"رمز الطلب غير موجود.",validationFailedMessage:"فشل التحقق. يرجى المحاولة مرة أخرى.",placeholderExample:"مثال: A1B2C3",validateAriaLabel:"التحقق من رمز الطلب",validatingLabel:"جارٍ التحقق…",validateButtonLabel:"تحقق"},kb={requiredError:"{field} مطلوب",inputPlaceholder:"اكتب واضغط Enter أو فاصلة…"},jb={requiredError:"{field} مطلوب",selectPlaceholder:"اختر ترخيصًا…"},Lb={requiredError:"{field} مطلوب",selectedCountSuffix:"محدد",selectPlaceholder:"اختر…",noOptionsMessage:"لا توجد خيارات"},Pb={requiredError:"{field} مطلوب",selectPlaceholder:"اختر…"},Fb={requiredError:"{field} مطلوب"},Mb={requiredError:"{field} مطلوب",selectPlaceholder:"اختر…",noOptionsMessage:"لا توجد خيارات"},Bb={requiredError:"{field} مطلوب",maxLengthError:"الحد الأقصى {max} حرفًا"},$b={dialogAriaLabel:"متصفح الأصول",title:"متصفح الأصول",closeAriaLabel:"إغلاق",browseTab:"تصفح",uploadTab:"تحميل",searchPlaceholder:"البحث في الأصول...",searchButton:"بحث",loadingMessage:"جارٍ التحميل...",uploadingMessage:"جارٍ التحميل...",chooseFileButton:"اختر ملفًا للتحميل"},qb={dialogAriaLabel:"نقل المورد",moveHeaderPrefix:"نقل",closeAriaLabel:"إغلاق",selectUnitHint:"اختر وحدة لنقل هذا المحتوى إليها:",noUnitsAvailable:"لا توجد وحدات أخرى متاحة",cancelButton:"إلغاء",moveButton:"نقل إلى هنا"},Ub={dialogAriaLabel:"تعيين أرقام الصفحات",title:"تعيين أرقام الصفحات",closeAriaLabel:"إغلاق",emptyState:"لم يتم العثور على عناصر محتوى في هذه المجموعة.",contentColumnHeader:"المحتوى",pageNumberColumnHeader:"رقم الصفحة",cancelButton:"إلغاء",saveButton:"حفظ"},zb={confirmButton:"تأكيد",cancelButton:"إلغاء",closeAriaLabel:"إغلاق"},Vb={publishTitlePrefix:"نشر",closeAriaLabel:"إغلاق",confirmPublishPrefix:"هل أنت متأكد من رغبتك في نشر هذا",checklistInstructions:"يرجى تأكيد التحقق من جميع العناصر التالية (بتحديد مربعات الاختيار) قبل أن تتمكن من النشر:",noButton:"لا",yesButton:"نعم"},Hb={reviewQualityTitle:"مراجعة الجودة",rejectContentTitle:"رفض المحتوى",closeAriaLabel:"إغلاق",qualityScoreLabel:"درجة الجودة",scorePoorLabel:"0 — ضعيف",scoreExcellentLabel:"10 — ممتاز",commentLabel:"تعليق",optionalLabel:"(اختياري)",commentPlaceholder:"أضف أي ملاحظات لمنشئ المحتوى…",rejectionReasonLabel:"سبب الرفض",rejectReasonPlaceholder:"اذكر سبب رفض هذا المحتوى…",rejectionRequiredMessage:"سبب الرفض مطلوب.",cancelButton:"إلغاء",approveButton:"قبول",rejectButton:"رفض"},Qb={title:"تغييرات غير محفوظة",closeAriaLabel:"إغلاق",bodyMessage:"لديك تغييرات غير محفوظة. هل تريد حفظها قبل المغادرة؟",cancelButton:"إلغاء",discardButton:"تجاهل",saveButton:"حفظ"},Gb={contentTypeFiltersAriaLabel:"مرشحات نوع المحتوى"},Wb={alreadyAddedAriaLabel:"تمت إضافته مسبقًا",alreadyAddedTitle:"تمت إضافته مسبقًا إلى هذه المجموعة",addItemAriaLabel:"إضافة {name} إلى الوحدة",addToUnitTitle:"إضافة إلى الوحدة",selectUnitToAddTitle:"اختر وحدة للإضافة إليها",draftOnlyTitle:"يمكن إضافة المحتوى المسودة فقط"},Kb={selectUnitFirstToast:"اختر وحدة أولاً",selectUnitFromOutlineToast:"اختر وحدة من المخطط التفصيلي لإضافة محتوى — لا يمكن إضافة الموارد مباشرة إلى الدورة.",itemAlreadyAddedToast:'"{name}" موجود مسبقًا في هذه المجموعة',itemAddedToast:'تمت إضافة "{name}"',collapseLibraryPanelAriaLabel:"طي لوحة المكتبة",collapseLibraryTitle:"طي المكتبة",headerTitle:"المكتبة",searchPlaceholder:"البحث في المحتوى…",searchAriaLabel:"البحث في المكتبة",sortAZAriaLabel:"الترتيب: أ–ي (انقر للأحدث)",sortRecentAriaLabel:"الترتيب: الأحدث (انقر لـ أ–ي)",sortAZTitle:"أ–ي",sortRecentTitle:"الأحدث",toggleAdvancedFiltersAriaLabel:"تبديل المرشحات المتقدمة",advancedFiltersTitle:"المرشحات المتقدمة",libraryContentAriaLabel:"محتوى المكتبة",loadMoreAriaLabel:"تحميل المزيد من المحتوى",loadingText:"جارٍ التحميل…",loadMoreText:"تحميل المزيد",noContentFound:"لم يتم العثور على محتوى",tryDifferentSearch:"جرّب بحثًا أو مرشحًا مختلفًا"},Yb={boardLabel:"المجلس التعليمي",mediumLabel:"لغة التدريس",classLabel:"الصف",subjectLabel:"المادة",primaryCategoryLabel:"الفئة الأساسية",filterLibraryAriaLabel:"تصفية المكتبة",filtersHeaderTitle:"المرشحات",closeFiltersAriaLabel:"إغلاق المرشحات",resetButton:"إعادة تعيين",applyButton:"تطبيق"},Zb={contentPreviewAriaLabel:"معاينة المحتوى",closePreviewAriaLabel:"إغلاق المعاينة",addToUnitButton:"+ إضافة إلى الوحدة"},Xb={maxDepthReachedToast:"تم الوصول إلى الحد الأقصى للعمق",downloadCsvFailedToast:"فشل تنزيل ملف CSV",outlineRefreshedToast:"تم تحديث مخطط الدورة.",outlineRefreshFailedToast:"تعذّر تحديث المخطط التفصيلي تلقائيًا. يرجى إعادة تحميل الصفحة.",moreOptionsAriaLabel:"خيارات إضافية",moreOptionsTitle:"خيارات إضافية",foldersExistTitle:'المجلدات موجودة مسبقًا — استخدم "تحديث" بدلاً من ذلك',createFoldersCsvButton:"إنشاء مجلدات باستخدام ملف csv",noFoldersYetTitle:'لا توجد مجلدات بعد — استخدم "إنشاء" أولاً',downloadFoldersCsvButton:"تنزيل المجلدات كملف csv",updateFoldersCsvButton:"تحديث بيانات المجلدات الوصفية باستخدام ملف csv",expandOutlineAriaLabel:"توسيع المخطط التفصيلي",collapseOutlineAriaLabel:"طي المخطط التفصيلي",addUnitButton:"إضافة وحدة",addSubunitButton:"إضافة وحدة فرعية"},Jb={expandAriaLabel:"توسيع",collapseAriaLabel:"طي",dropHereLabel:"أفلت هنا",nodeOptionsAriaLabel:"خيارات العنصر",renameMenuItem:"إعادة تسمية",addSubunitMenuItem:"إضافة وحدة فرعية",addSiblingMenuItem:"إضافة عنصر مماثل",deleteMenuItem:"حذف"},ew={mimeLabelVideo:"فيديو",mimeLabelAudio:"صوت",mimeLabelPdf:"PDF",mimeLabelEpub:"ePub",mimeLabelEcml:"ECML",mimeLabelH5p:"H5P",mimeLabelScorm:"SCORM",mimeLabelOther:"محتوى",infoFieldAuthor:"المؤلف",infoFieldLicense:"الترخيص",infoFieldLanguage:"اللغة",infoFieldClass:"الصف",infoFieldSubject:"المادة",infoFieldType:"النوع",loadingPreview:"جارٍ تحميل المعاينة…",previewPlayerUnavailable:"مشغّل المعاينة غير متاح. تحقق من إمكانية الوصول إلى /content/preview.",failedToInitializePlayer:"فشل تهيئة مشغّل المحتوى.",previewPlayerLoadFailed:"تعذّر تحميل مشغّل المعاينة.",unableToLoadQuestionset:"تعذّر تحميل مجموعة الأسئلة:",parentQuestionsetNotResolved:"تعذّر تحديد مجموعة الأسئلة الرئيسية لهذا السؤال.",questionNotFoundInQuestionset:"لم يتم العثور على السؤال في مجموعة الأسئلة."},tw={title:"رمز الاستجابة السريعة (رمز الطلب)",invalidFormatError:"تنسيق رمز DIAL غير صالح. استخدم الأحرف الكبيرة والأرقام فقط (مثال: A1B2C3).",duplicateDialcodeError:'رمز DIAL "{code}" مرتبط مسبقًا بعنصر آخر في هذه المجموعة.',dialcodeNotFoundError:"رمز الطلب غير موجود. يرجى إدخال رمز صالح.",linkFailedError:"فشل ربط رمز الطلب. يرجى المحاولة مرة أخرى.",unlinkFailedError:"فشلت إزالة رمز الطلب. يرجى المحاولة مرة أخرى.",qrCodeAltPrefix:"رمز الاستجابة السريعة لـ",linkedCodeLabel:"الرمز المرتبط:",removeButton:"إزالة",noCodeLinkedMessage:"لا يوجد رمز استجابة سريعة مرتبط بهذا المحتوى.",linkManuallyLabel:"الربط يدويًا",dialcodeInputPlaceholder:"أدخل رمز الطلب (مثال: A1B2C3)",dialcodeInputAriaLabel:"إدخال رمز الطلب",linkButton:"ربط",linkedSuccessMessage:"تم ربط رمز الطلب بنجاح."},rw={unitsAddedLabel:"الوحدات المضافة",contentItemsLabel:"عناصر المحتوى",progressLabel:"التقدّم"},nw={dropOntoUnitError:"أفلت على وحدة لإضافة محتوى",dropOntoCourseError:"أفلت المحتوى على وحدة، وليس مباشرة على الدورة.",alreadyInCollectionError:'"{name}" موجود مسبقًا في هذه المجموعة',addedToUnitSuccess:'تمت إضافة "{name}" إلى الوحدة',fillRequiredMetadataError:"يرجى تعبئة البيانات الوصفية المطلوبة",outlineAriaLabel:"مخطط الدورة",showOutlineTitle:"إظهار المخطط التفصيلي",editorAriaLabel:"محرر المحتوى",libraryAriaLabel:"مكتبة المحتوى",showLibraryTitle:"إظهار المكتبة"},sw={draftStatusFallback:"مسودة",backAriaLabel:"رجوع",statusAriaLabelPrefix:"الحالة:",savingIndicator:"جارٍ الحفظ…",unsavedIndicator:"غير محفوظ",savedIndicatorPrefix:"تم الحفظ",fillRequiredFieldsTooltip:"عبّئ جميع الحقول المطلوبة قبل الحفظ",saveAsDraftButton:"حفظ كمسودة",sendForReviewButton:"إرسال للمراجعة",collaboratorsLabel:"المتعاونون",qrCodesLabel:"رموز الاستجابة السريعة",generatingEllipsis:"جارٍ الإنشاء…",generateQrCodesMenuItem:"إنشاء رموز استجابة سريعة",downloadingEllipsis:"جارٍ التنزيل…",downloadQrCodesMenuItem:"تنزيل رموز الاستجابة السريعة",publishButton:"نشر",requestForChangesButton:"طلب إجراء تغييرات",approveButton:"قبول",qrGenerationStartedToast:'بدأ إنشاء رموز الاستجابة السريعة. استخدم "تنزيل رموز الاستجابة السريعة" عند الجهوز.',qrGenerationFailedToast:"فشل إنشاء رموز الاستجابة السريعة. يرجى المحاولة مرة أخرى.",qrCodesNotGeneratedToast:"لم يتم إنشاء أي رموز استجابة سريعة بعد. قم بإنشاء رموز الاستجابة السريعة أولاً.",qrGenerationInProgressToast:"إنشاء صور رموز الاستجابة السريعة قيد التنفيذ. يرجى المحاولة بالتنزيل بعد قليل.",qrCodesNotReadyToast:"رموز الاستجابة السريعة ليست جاهزة بعد. يرجى الانتظار والمحاولة مرة أخرى.",qrCodesDownloadedToast:"تم تنزيل رموز الاستجابة السريعة.",qrCodesDownloadFailedToast:"فشل تنزيل رموز الاستجابة السريعة.",requestChangesTitle:"طلب إجراء تغييرات",changesRequestedLabel:"تم طلب تغييرات",describeChangesPlaceholder:"اذكر التغييرات التي يجب على المؤلف إجراؤها"},iw={closeAriaLabel:"إغلاق",fillCommentsError:"أضف تعليقات",cancelButton:"إلغاء"},aw={closeAriaLabel:"إغلاق",title:"قبول الشروط والأحكام",agreementTextPart1:"أوافق على أنه بإرسال / نشر هذا المحتوى، فإنني أؤكد أن هذا المحتوى يتوافق مع الإرشادات المعتمدة، بما في ذلك شروط الاستخدام وسياسة المحتوى، وأني أوافق على نشره بموجب",creativeCommonsLinkText:"إطار عمل Creative Commons",agreementTextPart2:"وفقًا لـ",contentPolicyText:"سياسة المحتوى",agreementTextPart3:". وقد تحققت من أنني لا أنتهك حقوق النشر أو الخصوصية الخاصة بالآخرين.",cancelButton:"إلغاء",submitButton:"إرسال"},ow={closeAriaLabel:"إغلاق",title:"إنشاء رموز الاستجابة السريعة",numberOfCodesLabel:"عدد رموز الاستجابة السريعة",countPlaceholder:"أدخل رقمًا (2–250)",countRangeError:"أدخل رقمًا بين 2 و 250.",cancelButton:"إلغاء",generateButton:"إنشاء"},lw={remove:"إزالة"},cw={dropHere:"أفلت هنا"},uw={loading:"جارٍ التحميل"},dw={contextualEditor:gb,languageSelector:yb,collectionEditor:vb,breadcrumb:bb,tabBar:wb,contentEditForm:Cb,titleAppIcon:Sb,unitContentList:xb,contentRow:_b,csvUpload:Tb,manageCollaborators:Eb,sparkMetaForm:Ib,appIconField:Ob,appIconPickerModal:Ab,chipGroupField:Db,dateTimeField:Nb,dialcodeInputField:Rb,keywordSuggestField:kb,licenseSelectField:jb,multiSelectField:Lb,nestedSelectField:Pb,radioField:Fb,selectField:Mb,textField:Bb,assetBrowser:$b,resourceReorderDialog:qb,assignPageNumber:Ub,confirmDialog:zb,publishChecklist:Vb,qualityParamsModal:Hb,unsavedChangesModal:Qb,filterChips:Gb,libraryCard:Wb,libraryDock:Kb,libraryFilterPanel:Yb,libraryPreviewPanel:Zb,outlineTree:Xb,treeNode:Jb,contentPlayer:ew,dialcodePanel:tw,progressStatus:rw,splitBuilderShell:nw,topbar:sw,reviewCommentModal:iw,confirmReviewModal:aw,generateQRModal:ow,chip:lw,dropZone:cw,spinner:uw},fw={emptyStateMessage:"Sélectionnez une unité dans le plan pour modifier ses détails",reviewCommentLabel:"Commentaire du réviseur :",untitledPlaceholder:"Sans titre",nodeTitleAriaLabel:"Titre du nœud",dropZoneLabel:"Déposez ici pour ajouter du contenu à cette unité"},hw={ariaLabel:"Sélectionner la langue"},pw={errorBoundaryTitle:"Une erreur s'est produite",retryButton:"Réessayer",loadingMessage:"Chargement de l'éditeur...",loadErrorTitle:"Échec du chargement de l'éditeur"},mw={nodePathAriaLabel:"Chemin du nœud",homeAriaLabel:"Accueil"},gw={detailsTab:"Détails",audienceCurriculumTab:"Public et programme",licensingTab:"Licence",metadataSectionsAriaLabel:"Sections de métadonnées",hasErrorsAriaLabel:"Contient des erreurs"},yw={moveToAnotherUnitButton:"Déplacer vers une autre unité",collapseMetadataPanelAriaLabel:"Réduire le panneau de métadonnées",expandMetadataPanelAriaLabel:"Développer le panneau de métadonnées",collapseTitle:"Réduire",expandTitle:"Développer",iconAlt:"icône",contentNamePlaceholder:"Nom du contenu",keywordsLabel:"Mots-clés",addKeywordPlaceholder:"Ajoutez un mot-clé et appuyez sur Entrée",addButton:"Ajouter",optionalInCollectionLabel:"Facultatif dans la collection",yesOption:"Oui",noOption:"Non"},vw={selectAppIconAriaLabel:"Sélectionner l'icône de l'application",appIconAriaLabel:"Icône de l'application",appIconAlt:"Icône de l'application",removeIconAriaLabel:"Supprimer l'icône"},bw={removeConfirm:"Retirer ce contenu de l'unité ?",heading:"Contenu de cette unité",emptyTitle:"Aucun contenu pour le moment",emptyHint:"Faites glisser depuis la bibliothèque ou cliquez sur Ajouter du contenu",addContentAriaLabel:"Ajouter du contenu à l'unité",addContent:"Ajouter du contenu"},ww={dragToReorderAriaLabel:"Faire glisser pour réorganiser",removeAriaLabel:"Supprimer {name}"},Cw={invalidFileType:"Seuls les fichiers .csv sont acceptés.",fileTooLarge:"La taille du fichier ne doit pas dépasser 50 Mo.",downloadSampleFailed:"Échec du téléchargement de l'exemple de CSV.",processingFailed:"Le traitement du téléversement a échoué. Veuillez vérifier les lignes en erreur ci-dessous.",connectionLost:"Connexion perdue pendant la vérification du statut. Veuillez réessayer.",uploadFailed:"Le téléversement a échoué. Veuillez vérifier votre fichier et réessayer.",statusUploading:"Téléversement en cours...",statusProcessing:"Traitement en cours...",statusDone:"Terminé !",statusError:"Erreur",titleUpdate:"Mettre à jour les métadonnées des dossiers via CSV",titleCreate:"Créer des dossiers via CSV",closeAriaLabel:"Fermer",dropZoneAriaLabel:"Déposez le fichier CSV ici ou cliquez pour parcourir",dropText:"Faites glisser et déposez votre CSV ici",dropSubtext:"ou cliquez pour parcourir",downloadSample:"Télécharger l'exemple de CSV",itemsImportedSuffix:"— {count} élément(s) importé(s)",failedRowsTitle:"Lignes en échec ({count})",rowHeader:"Ligne",nameHeader:"Nom",reasonHeader:"Raison",unknownError:"Erreur inconnue",cancel:"Annuler",uploaded:"Téléversé",upload:"Téléverser"},Sw={saveFailed:"Échec de l'enregistrement des collaborateurs. Veuillez réessayer.",title:"Gérer les collaborateurs",closeAriaLabel:"Fermer",searchUsersLabel:"Rechercher des utilisateurs",searchPlaceholder:"Rechercher par nom ou e-mail...",searchingAriaLabel:"Recherche en cours...",searchResultsAriaLabel:"Résultats de recherche",add:"Ajouter",noUsersFound:"Aucun utilisateur trouvé.",currentCollaborators:"Collaborateurs actuels",noCollaboratorsYet:"Aucun collaborateur ajouté pour le moment.",remove:"Retirer",saveSuccess:"Collaborateurs enregistrés avec succès.",cancel:"Annuler",save:"Enregistrer"},xw={shuffleEnabledMessage:"La lecture aléatoire est activée pour cet ensemble de questions.",noFieldsMessage:"Aucun champ configuré pour cet onglet."},_w={requiredError:"{field} est requis",selectIconAriaLabel:"Sélectionner l'icône de l'application",iconAlt:"Icône de l'application",selectIconLabel:"Sélectionner l'icône",removeIconAriaLabel:"Supprimer l'icône de l'application",removeLabel:"Supprimer"},Tw={dialogAriaLabel:"Sélectionner l'icône de l'application",title:"Sélectionner l'icône de l'application",closeAriaLabel:"Fermer",myImagesTab:"Mes images",allImagesTab:"Toutes les images",uploadTab:"Téléverser",searchPlaceholder:"Rechercher des images…",loadingText:"Chargement…",noImagesFound:"Aucune image trouvée",noThumbnailText:"IMG",loadMoreButton:"Charger plus",previewAlt:"Aperçu",dropZoneText:"Faites glisser et déposez ou cliquez pour parcourir",acceptedTypesInfo:"{types} · max {size} Mo",cancelButton:"Annuler",uploadingText:"Téléversement…",uploadAndUseButton:"Téléverser et utiliser",useSelectedButton:"Utiliser la sélection",invalidFileTypeError:"Seuls les fichiers {types} sont acceptés.",fileTooLargeError:"L'image doit faire moins de {size} Mo.",uploadFailedError:"Le téléversement a échoué."},Ew={addPlaceholder:"Ajouter…",addButtonLabel:"Ajouter"},Iw={requiredError:"{field} est requis"},Ow={requiredError:"{field} est requis",enterCodeMessage:"Saisissez un code d'appel à valider.",validMessage:"Le code d'appel est valide.",notFoundMessage:"Code d'appel introuvable.",validationFailedMessage:"La validation a échoué. Veuillez réessayer.",placeholderExample:"ex. A1B2C3",validateAriaLabel:"Valider le code d'appel",validatingLabel:"Validation en cours…",validateButtonLabel:"Valider"},Aw={requiredError:"{field} est requis",inputPlaceholder:"Saisissez et appuyez sur Entrée ou virgule…"},Dw={requiredError:"{field} est requis",selectPlaceholder:"Sélectionner une licence…"},Nw={requiredError:"{field} est requis",selectedCountSuffix:"sélectionné(s)",selectPlaceholder:"Sélectionner…",noOptionsMessage:"Aucune option"},Rw={requiredError:"{field} est requis",selectPlaceholder:"Sélectionner…"},kw={requiredError:"{field} est requis"},jw={requiredError:"{field} est requis",selectPlaceholder:"Sélectionner…",noOptionsMessage:"Aucune option"},Lw={requiredError:"{field} est requis",maxLengthError:"Maximum {max} caractères"},Pw={dialogAriaLabel:"Navigateur de ressources",title:"Navigateur de ressources",closeAriaLabel:"Fermer",browseTab:"Parcourir",uploadTab:"Téléverser",searchPlaceholder:"Rechercher des ressources...",searchButton:"Rechercher",loadingMessage:"Chargement...",uploadingMessage:"Téléversement...",chooseFileButton:"Choisir un fichier à téléverser"},Fw={dialogAriaLabel:"Déplacer la ressource",moveHeaderPrefix:"Déplacer",closeAriaLabel:"Fermer",selectUnitHint:"Sélectionnez une unité vers laquelle déplacer ce contenu :",noUnitsAvailable:"Aucune autre unité disponible",cancelButton:"Annuler",moveButton:"Déplacer ici"},Mw={dialogAriaLabel:"Attribuer des numéros de page",title:"Attribuer des numéros de page",closeAriaLabel:"Fermer",emptyState:"Aucun élément de contenu trouvé dans cette collection.",contentColumnHeader:"Contenu",pageNumberColumnHeader:"Numéro de page",cancelButton:"Annuler",saveButton:"Enregistrer"},Bw={confirmButton:"Confirmer",cancelButton:"Annuler",closeAriaLabel:"Fermer"},$w={publishTitlePrefix:"Publier",closeAriaLabel:"Fermer",confirmPublishPrefix:"Êtes-vous sûr de vouloir publier ce",checklistInstructions:"Veuillez confirmer que TOUS les éléments suivants sont vérifiés (en cochant les cases) avant de pouvoir publier :",noButton:"Non",yesButton:"Oui"},qw={reviewQualityTitle:"Évaluer la qualité",rejectContentTitle:"Rejeter le contenu",closeAriaLabel:"Fermer",qualityScoreLabel:"Score de qualité",scorePoorLabel:"0 — Faible",scoreExcellentLabel:"10 — Excellent",commentLabel:"Commentaire",optionalLabel:"(facultatif)",commentPlaceholder:"Ajoutez des remarques pour le créateur du contenu…",rejectionReasonLabel:"Motif du rejet",rejectReasonPlaceholder:"Décrivez pourquoi ce contenu est rejeté…",rejectionRequiredMessage:"Un motif de rejet est requis.",cancelButton:"Annuler",approveButton:"Approuver",rejectButton:"Rejeter"},Uw={title:"Modifications non enregistrées",closeAriaLabel:"Fermer",bodyMessage:"Vous avez des modifications non enregistrées. Souhaitez-vous les enregistrer avant de quitter ?",cancelButton:"Annuler",discardButton:"Ignorer",saveButton:"Enregistrer"},zw={contentTypeFiltersAriaLabel:"Filtres par type de contenu"},Vw={alreadyAddedAriaLabel:"Déjà ajouté",alreadyAddedTitle:"Déjà ajouté à cette collection",addItemAriaLabel:"Ajouter {name} à l'unité",addToUnitTitle:"Ajouter à l'unité",selectUnitToAddTitle:"Sélectionner une unité pour ajouter",draftOnlyTitle:"Seul le contenu à l'état de brouillon peut être ajouté"},Hw={selectUnitFirstToast:"Sélectionnez d'abord une unité",selectUnitFromOutlineToast:"Sélectionnez une unité dans le plan pour ajouter du contenu — les ressources ne peuvent pas être ajoutées directement au cours.",itemAlreadyAddedToast:"« {name} » est déjà dans cette collection",itemAddedToast:"« {name} » ajouté",collapseLibraryPanelAriaLabel:"Réduire le panneau de la bibliothèque",collapseLibraryTitle:"Réduire la bibliothèque",headerTitle:"Bibliothèque",searchPlaceholder:"Rechercher du contenu…",searchAriaLabel:"Rechercher dans la bibliothèque",sortAZAriaLabel:"Trier : A–Z (cliquer pour Récent)",sortRecentAriaLabel:"Trier : Récent (cliquer pour A–Z)",sortAZTitle:"A–Z",sortRecentTitle:"Récent",toggleAdvancedFiltersAriaLabel:"Afficher/masquer les filtres avancés",advancedFiltersTitle:"Filtres avancés",libraryContentAriaLabel:"Contenu de la bibliothèque",loadMoreAriaLabel:"Charger plus de contenu",loadingText:"Chargement…",loadMoreText:"Charger plus",noContentFound:"Aucun contenu trouvé",tryDifferentSearch:"Essayez une autre recherche ou un autre filtre"},Qw={boardLabel:"Conseil",mediumLabel:"Médium",classLabel:"Classe",subjectLabel:"Matière",primaryCategoryLabel:"Catégorie principale",filterLibraryAriaLabel:"Filtrer la bibliothèque",filtersHeaderTitle:"Filtres",closeFiltersAriaLabel:"Fermer les filtres",resetButton:"Réinitialiser",applyButton:"Appliquer"},Gw={contentPreviewAriaLabel:"Aperçu du contenu",closePreviewAriaLabel:"Fermer l'aperçu",addToUnitButton:"+ Ajouter à l'unité"},Ww={maxDepthReachedToast:"Profondeur maximale atteinte",downloadCsvFailedToast:"Échec du téléchargement du CSV",outlineRefreshedToast:"Plan du cours actualisé.",outlineRefreshFailedToast:"Le plan n'a pas pu être actualisé automatiquement. Veuillez recharger la page.",moreOptionsAriaLabel:"Plus d'options",moreOptionsTitle:"Plus d'options",foldersExistTitle:"Des dossiers existent déjà — utilisez « Mettre à jour » à la place",createFoldersCsvButton:"Créer des dossiers à partir d'un fichier CSV",noFoldersYetTitle:"Aucun dossier pour le moment — utilisez d'abord « Créer »",downloadFoldersCsvButton:"Télécharger les dossiers en fichier CSV",updateFoldersCsvButton:"Mettre à jour les métadonnées des dossiers à partir d'un fichier CSV",expandOutlineAriaLabel:"Développer le plan",collapseOutlineAriaLabel:"Réduire le plan",addUnitButton:"Ajouter une unité",addSubunitButton:"Ajouter une sous-unité"},Kw={expandAriaLabel:"Développer",collapseAriaLabel:"Réduire",dropHereLabel:"Déposer ici",nodeOptionsAriaLabel:"Options du nœud",renameMenuItem:"Renommer",addSubunitMenuItem:"Ajouter une sous-unité",addSiblingMenuItem:"Ajouter un élément au même niveau",deleteMenuItem:"Supprimer"},Yw={mimeLabelVideo:"Vidéo",mimeLabelAudio:"Audio",mimeLabelPdf:"PDF",mimeLabelEpub:"ePub",mimeLabelEcml:"ECML",mimeLabelH5p:"H5P",mimeLabelScorm:"SCORM",mimeLabelOther:"Contenu",infoFieldAuthor:"Auteur",infoFieldLicense:"Licence",infoFieldLanguage:"Langue",infoFieldClass:"Classe",infoFieldSubject:"Matière",infoFieldType:"Type",loadingPreview:"Chargement de l'aperçu…",previewPlayerUnavailable:"Lecteur d'aperçu indisponible. Vérifiez que /content/preview est accessible.",failedToInitializePlayer:"Échec de l'initialisation du lecteur de contenu.",previewPlayerLoadFailed:"Le lecteur d'aperçu n'a pas pu être chargé.",unableToLoadQuestionset:"Impossible de charger l'ensemble de questions :",parentQuestionsetNotResolved:"Impossible de résoudre l'ensemble de questions parent pour cette question.",questionNotFoundInQuestionset:"Question introuvable dans l'ensemble de questions."},Zw={title:"Code QR (Dialcode)",invalidFormatError:"Format de code DIAL invalide. Utilisez uniquement des lettres majuscules et des chiffres (ex. A1B2C3).",duplicateDialcodeError:"Le code DIAL « {code} » est déjà associé à un autre nœud de cette collection.",dialcodeNotFoundError:"Code d'appel introuvable. Veuillez saisir un code valide.",linkFailedError:"Échec de l'association du code d'appel. Veuillez réessayer.",unlinkFailedError:"Échec de la suppression du code d'appel. Veuillez réessayer.",qrCodeAltPrefix:"Code QR pour",linkedCodeLabel:"Code associé :",removeButton:"Supprimer",noCodeLinkedMessage:"Aucun code QR associé à ce contenu.",linkManuallyLabel:"Associer manuellement",dialcodeInputPlaceholder:"Saisissez le code d'appel (ex. A1B2C3)",dialcodeInputAriaLabel:"Champ de saisie du code d'appel",linkButton:"Associer",linkedSuccessMessage:"Code d'appel associé avec succès."},Xw={unitsAddedLabel:"Unités ajoutées",contentItemsLabel:"Éléments de contenu",progressLabel:"Progression"},Jw={dropOntoUnitError:"Déposez sur une unité pour ajouter du contenu",dropOntoCourseError:"Déposez le contenu sur une unité, pas directement sur le cours.",alreadyInCollectionError:"« {name} » est déjà dans cette collection",addedToUnitSuccess:"« {name} » ajouté à l'unité",fillRequiredMetadataError:"Veuillez renseigner les métadonnées requises",outlineAriaLabel:"Plan du cours",showOutlineTitle:"Afficher le plan",editorAriaLabel:"Éditeur de contenu",libraryAriaLabel:"Bibliothèque de contenu",showLibraryTitle:"Afficher la bibliothèque"},eC={draftStatusFallback:"Brouillon",backAriaLabel:"Retour",statusAriaLabelPrefix:"Statut :",savingIndicator:"Enregistrement…",unsavedIndicator:"Non enregistré",savedIndicatorPrefix:"Enregistré",fillRequiredFieldsTooltip:"Renseignez tous les champs requis avant d'enregistrer",saveAsDraftButton:"Enregistrer comme brouillon",sendForReviewButton:"Envoyer pour révision",collaboratorsLabel:"Collaborateurs",qrCodesLabel:"Codes QR",generatingEllipsis:"Génération en cours…",generateQrCodesMenuItem:"Générer des codes QR",downloadingEllipsis:"Téléchargement…",downloadQrCodesMenuItem:"Télécharger les codes QR",publishButton:"Publier",requestForChangesButton:"Demander des modifications",approveButton:"Approuver",qrGenerationStartedToast:"La génération des codes QR a démarré. Utilisez « Télécharger les codes QR » une fois prêts.",qrGenerationFailedToast:"Échec de la génération des codes QR. Veuillez réessayer.",qrCodesNotGeneratedToast:"Aucun code QR généré pour le moment. Générez d'abord des codes QR.",qrGenerationInProgressToast:"La génération des images de codes QR est en cours. Veuillez réessayer le téléchargement dans quelques instants.",qrCodesNotReadyToast:"Les codes QR ne sont pas encore prêts. Veuillez patienter et réessayer.",qrCodesDownloadedToast:"Codes QR téléchargés.",qrCodesDownloadFailedToast:"Échec du téléchargement des codes QR.",requestChangesTitle:"Demander des modifications",changesRequestedLabel:"Modifications demandées",describeChangesPlaceholder:"Décrivez les modifications que l'auteur doit apporter"},tC={closeAriaLabel:"Fermer",fillCommentsError:"Renseignez les commentaires",cancelButton:"Annuler"},rC={closeAriaLabel:"Fermer",title:"Acceptation des conditions générales",agreementTextPart1:"J'accepte qu'en soumettant / publiant ce contenu, je confirme qu'il est conforme aux directives prescrites, y compris les conditions d'utilisation et la politique de contenu, et que je consens à le publier selon le",creativeCommonsLinkText:"cadre Creative Commons",agreementTextPart2:"conformément à la",contentPolicyText:"politique de contenu",agreementTextPart3:". Je me suis assuré(e) de ne pas porter atteinte aux droits d'auteur ou à la vie privée d'autrui.",cancelButton:"Annuler",submitButton:"Soumettre"},nC={closeAriaLabel:"Fermer",title:"Générer des codes QR",numberOfCodesLabel:"Nombre de codes QR",countPlaceholder:"Saisissez un nombre (2–250)",countRangeError:"Saisissez un nombre entre 2 et 250.",cancelButton:"Annuler",generateButton:"Générer"},sC={remove:"Supprimer"},iC={dropHere:"Déposer ici"},aC={loading:"Chargement"},oC={contextualEditor:fw,languageSelector:hw,collectionEditor:pw,breadcrumb:mw,tabBar:gw,contentEditForm:yw,titleAppIcon:vw,unitContentList:bw,contentRow:ww,csvUpload:Cw,manageCollaborators:Sw,sparkMetaForm:xw,appIconField:_w,appIconPickerModal:Tw,chipGroupField:Ew,dateTimeField:Iw,dialcodeInputField:Ow,keywordSuggestField:Aw,licenseSelectField:Dw,multiSelectField:Nw,nestedSelectField:Rw,radioField:kw,selectField:jw,textField:Lw,assetBrowser:Pw,resourceReorderDialog:Fw,assignPageNumber:Mw,confirmDialog:Bw,publishChecklist:$w,qualityParamsModal:qw,unsavedChangesModal:Uw,filterChips:zw,libraryCard:Vw,libraryDock:Hw,libraryFilterPanel:Qw,libraryPreviewPanel:Gw,outlineTree:Ww,treeNode:Kw,contentPlayer:Yw,dialcodePanel:Zw,progressStatus:Xw,splitBuilderShell:Jw,topbar:eC,reviewCommentModal:tC,confirmReviewModal:rC,generateQRModal:nC,chip:sC,dropZone:iC,spinner:aC},lC={emptyStateMessage:"Selecione uma unidade no esquema para editar seus detalhes",reviewCommentLabel:"Comentário do revisor:",untitledPlaceholder:"Sem título",nodeTitleAriaLabel:"Título do nó",dropZoneLabel:"Solte para adicionar conteúdo a esta unidade"},cC={ariaLabel:"Selecionar idioma"},uC={errorBoundaryTitle:"Algo deu errado",retryButton:"Tentar novamente",loadingMessage:"Carregando editor...",loadErrorTitle:"Falha ao carregar o editor"},dC={nodePathAriaLabel:"Caminho do nó",homeAriaLabel:"Início"},fC={detailsTab:"Detalhes",audienceCurriculumTab:"Público e Currículo",licensingTab:"Licenciamento",metadataSectionsAriaLabel:"Seções de metadados",hasErrorsAriaLabel:"Contém erros"},hC={moveToAnotherUnitButton:"Mover para outra unidade",collapseMetadataPanelAriaLabel:"Recolher painel de metadados",expandMetadataPanelAriaLabel:"Expandir painel de metadados",collapseTitle:"Recolher",expandTitle:"Expandir",iconAlt:"ícone",contentNamePlaceholder:"Nome do conteúdo",keywordsLabel:"Palavras-chave",addKeywordPlaceholder:"Adicione uma palavra-chave e pressione Enter",addButton:"Adicionar",optionalInCollectionLabel:"Opcional na coleção",yesOption:"Sim",noOption:"Não"},pC={selectAppIconAriaLabel:"Selecionar ícone do aplicativo",appIconAriaLabel:"Ícone do aplicativo",appIconAlt:"Ícone do aplicativo",removeIconAriaLabel:"Remover ícone"},mC={removeConfirm:"Remover este conteúdo da unidade?",heading:"Conteúdo nesta unidade",emptyTitle:"Ainda não há conteúdo",emptyHint:"Arraste da biblioteca ou clique em Adicionar conteúdo",addContentAriaLabel:"Adicionar conteúdo à unidade",addContent:"Adicionar conteúdo"},gC={dragToReorderAriaLabel:"Arrastar para reordenar",removeAriaLabel:"Remover {name}"},yC={invalidFileType:"Somente arquivos .csv são aceitos.",fileTooLarge:"O tamanho do arquivo não deve exceder 50 MB.",downloadSampleFailed:"Falha ao baixar o CSV de exemplo.",processingFailed:"Falha no processamento do upload. Verifique as linhas com erro abaixo.",connectionLost:"Conexão perdida ao verificar o status. Tente novamente.",uploadFailed:"Falha no envio. Verifique seu arquivo e tente novamente.",statusUploading:"Enviando...",statusProcessing:"Processando...",statusDone:"Concluído!",statusError:"Erro",titleUpdate:"Atualizar metadados das pastas via CSV",titleCreate:"Criar pastas via CSV",closeAriaLabel:"Fechar",dropZoneAriaLabel:"Solte o arquivo CSV aqui ou clique para procurar",dropText:"Arraste e solte seu CSV aqui",dropSubtext:"ou clique para procurar",downloadSample:"Baixar CSV de exemplo",itemsImportedSuffix:"— {count} item(ns) importado(s)",failedRowsTitle:"Linhas com falha ({count})",rowHeader:"Linha",nameHeader:"Nome",reasonHeader:"Motivo",unknownError:"Erro desconhecido",cancel:"Cancelar",uploaded:"Enviado",upload:"Enviar"},vC={saveFailed:"Falha ao salvar colaboradores. Tente novamente.",title:"Gerenciar colaboradores",closeAriaLabel:"Fechar",searchUsersLabel:"Buscar usuários",searchPlaceholder:"Buscar por nome ou e-mail...",searchingAriaLabel:"Buscando...",searchResultsAriaLabel:"Resultados da busca",add:"Adicionar",noUsersFound:"Nenhum usuário encontrado.",currentCollaborators:"Colaboradores atuais",noCollaboratorsYet:"Nenhum colaborador adicionado ainda.",remove:"Remover",saveSuccess:"Colaboradores salvos com sucesso.",cancel:"Cancelar",save:"Salvar"},bC={shuffleEnabledMessage:"A ordem aleatória está ativada para este conjunto de questões.",noFieldsMessage:"Nenhum campo configurado para esta aba."},wC={requiredError:"{field} é obrigatório",selectIconAriaLabel:"Selecionar ícone do aplicativo",iconAlt:"Ícone do aplicativo",selectIconLabel:"Selecionar ícone",removeIconAriaLabel:"Remover ícone do aplicativo",removeLabel:"Remover"},CC={dialogAriaLabel:"Selecionar ícone do aplicativo",title:"Selecionar ícone do aplicativo",closeAriaLabel:"Fechar",myImagesTab:"Minhas imagens",allImagesTab:"Todas as imagens",uploadTab:"Enviar",searchPlaceholder:"Buscar imagens…",loadingText:"Carregando…",noImagesFound:"Nenhuma imagem encontrada",noThumbnailText:"IMG",loadMoreButton:"Carregar mais",previewAlt:"Pré-visualização",dropZoneText:"Arraste e solte ou clique para procurar",acceptedTypesInfo:"{types} · máx. {size} MB",cancelButton:"Cancelar",uploadingText:"Enviando…",uploadAndUseButton:"Enviar e usar",useSelectedButton:"Usar selecionado",invalidFileTypeError:"Somente arquivos {types} são aceitos.",fileTooLargeError:"A imagem deve ter menos de {size} MB.",uploadFailedError:"Falha no envio."},SC={addPlaceholder:"Adicionar…",addButtonLabel:"Adicionar"},xC={requiredError:"{field} é obrigatório"},_C={requiredError:"{field} é obrigatório",enterCodeMessage:"Insira um código dial para validar.",validMessage:"O código dial é válido.",notFoundMessage:"Código dial não encontrado.",validationFailedMessage:"Falha na validação. Tente novamente.",placeholderExample:"ex. A1B2C3",validateAriaLabel:"Validar código dial",validatingLabel:"Validando…",validateButtonLabel:"Validar"},TC={requiredError:"{field} é obrigatório",inputPlaceholder:"Digite e pressione Enter ou vírgula…"},EC={requiredError:"{field} é obrigatório",selectPlaceholder:"Selecionar licença…"},IC={requiredError:"{field} é obrigatório",selectedCountSuffix:"selecionado(s)",selectPlaceholder:"Selecionar…",noOptionsMessage:"Sem opções"},OC={requiredError:"{field} é obrigatório",selectPlaceholder:"Selecionar…"},AC={requiredError:"{field} é obrigatório"},DC={requiredError:"{field} é obrigatório",selectPlaceholder:"Selecionar…",noOptionsMessage:"Sem opções"},NC={requiredError:"{field} é obrigatório",maxLengthError:"Máx. {max} caracteres"},RC={dialogAriaLabel:"Navegador de recursos",title:"Navegador de recursos",closeAriaLabel:"Fechar",browseTab:"Procurar",uploadTab:"Enviar",searchPlaceholder:"Buscar recursos...",searchButton:"Buscar",loadingMessage:"Carregando...",uploadingMessage:"Enviando...",chooseFileButton:"Escolher arquivo para enviar"},kC={dialogAriaLabel:"Mover recurso",moveHeaderPrefix:"Mover",closeAriaLabel:"Fechar",selectUnitHint:"Selecione uma unidade para mover este conteúdo:",noUnitsAvailable:"Nenhuma outra unidade disponível",cancelButton:"Cancelar",moveButton:"Mover para aqui"},jC={dialogAriaLabel:"Atribuir números de página",title:"Atribuir números de página",closeAriaLabel:"Fechar",emptyState:"Nenhum item de conteúdo encontrado nesta coleção.",contentColumnHeader:"Conteúdo",pageNumberColumnHeader:"Número da página",cancelButton:"Cancelar",saveButton:"Salvar"},LC={confirmButton:"Confirmar",cancelButton:"Cancelar",closeAriaLabel:"Fechar"},PC={publishTitlePrefix:"Publicar",closeAriaLabel:"Fechar",confirmPublishPrefix:"Tem certeza de que deseja publicar este(a)",checklistInstructions:"Confirme que TODOS os itens a seguir foram verificados (marcando as caixas de seleção) antes de publicar:",noButton:"Não",yesButton:"Sim"},FC={reviewQualityTitle:"Revisar qualidade",rejectContentTitle:"Rejeitar conteúdo",closeAriaLabel:"Fechar",qualityScoreLabel:"Nota de qualidade",scorePoorLabel:"0 — Ruim",scoreExcellentLabel:"10 — Excelente",commentLabel:"Comentário",optionalLabel:"(opcional)",commentPlaceholder:"Adicione observações para o criador do conteúdo…",rejectionReasonLabel:"Motivo da rejeição",rejectReasonPlaceholder:"Descreva por que este conteúdo está sendo rejeitado…",rejectionRequiredMessage:"É necessário informar um motivo de rejeição.",cancelButton:"Cancelar",approveButton:"Aprovar",rejectButton:"Rejeitar"},MC={title:"Alterações não salvas",closeAriaLabel:"Fechar",bodyMessage:"Você tem alterações não salvas. Deseja salvá-las antes de sair?",cancelButton:"Cancelar",discardButton:"Descartar",saveButton:"Salvar"},BC={contentTypeFiltersAriaLabel:"Filtros de tipo de conteúdo"},$C={alreadyAddedAriaLabel:"Já adicionado",alreadyAddedTitle:"Já adicionado a esta coleção",addItemAriaLabel:"Adicionar {name} à unidade",addToUnitTitle:"Adicionar à unidade",selectUnitToAddTitle:"Selecione uma unidade para adicionar",draftOnlyTitle:"Somente conteúdo em rascunho pode ser adicionado"},qC={selectUnitFirstToast:"Selecione uma unidade primeiro",selectUnitFromOutlineToast:"Selecione uma unidade no esquema para adicionar conteúdo — recursos não podem ser adicionados diretamente ao curso.",itemAlreadyAddedToast:'"{name}" já está nesta coleção',itemAddedToast:'"{name}" adicionado',collapseLibraryPanelAriaLabel:"Recolher painel da biblioteca",collapseLibraryTitle:"Recolher biblioteca",headerTitle:"Biblioteca",searchPlaceholder:"Buscar conteúdo…",searchAriaLabel:"Buscar na biblioteca",sortAZAriaLabel:"Ordenar: A–Z (clique para Recentes)",sortRecentAriaLabel:"Ordenar: Recentes (clique para A–Z)",sortAZTitle:"A–Z",sortRecentTitle:"Recentes",toggleAdvancedFiltersAriaLabel:"Alternar filtros avançados",advancedFiltersTitle:"Filtros avançados",libraryContentAriaLabel:"Conteúdo da biblioteca",loadMoreAriaLabel:"Carregar mais conteúdo",loadingText:"Carregando…",loadMoreText:"Carregar mais",noContentFound:"Nenhum conteúdo encontrado",tryDifferentSearch:"Tente uma busca ou filtro diferente"},UC={boardLabel:"Conselho",mediumLabel:"Idioma de Instrução",classLabel:"Série",subjectLabel:"Disciplina",primaryCategoryLabel:"Categoria principal",filterLibraryAriaLabel:"Filtrar biblioteca",filtersHeaderTitle:"Filtros",closeFiltersAriaLabel:"Fechar filtros",resetButton:"Redefinir",applyButton:"Aplicar"},zC={contentPreviewAriaLabel:"Pré-visualização do conteúdo",closePreviewAriaLabel:"Fechar pré-visualização",addToUnitButton:"+ Adicionar à unidade"},VC={maxDepthReachedToast:"Profundidade máxima atingida",downloadCsvFailedToast:"Falha ao baixar o CSV",outlineRefreshedToast:"Esquema do curso atualizado.",outlineRefreshFailedToast:"Não foi possível atualizar o esquema automaticamente. Recarregue a página.",moreOptionsAriaLabel:"Mais opções",moreOptionsTitle:"Mais opções",foldersExistTitle:'As pastas já existem — use "Atualizar"',createFoldersCsvButton:"Criar pastas usando arquivo csv",noFoldersYetTitle:'Ainda não há pastas — use "Criar" primeiro',downloadFoldersCsvButton:"Baixar pastas como arquivo csv",updateFoldersCsvButton:"Atualizar metadados das pastas usando arquivo csv",expandOutlineAriaLabel:"Expandir esquema",collapseOutlineAriaLabel:"Recolher esquema",addUnitButton:"Adicionar unidade",addSubunitButton:"Adicionar subunidade"},HC={expandAriaLabel:"Expandir",collapseAriaLabel:"Recolher",dropHereLabel:"Solte aqui",nodeOptionsAriaLabel:"Opções do nó",renameMenuItem:"Renomear",addSubunitMenuItem:"Adicionar subunidade",addSiblingMenuItem:"Adicionar item no mesmo nível",deleteMenuItem:"Excluir"},QC={mimeLabelVideo:"Vídeo",mimeLabelAudio:"Áudio",mimeLabelPdf:"PDF",mimeLabelEpub:"ePub",mimeLabelEcml:"ECML",mimeLabelH5p:"H5P",mimeLabelScorm:"SCORM",mimeLabelOther:"Conteúdo",infoFieldAuthor:"Autor",infoFieldLicense:"Licença",infoFieldLanguage:"Idioma",infoFieldClass:"Série",infoFieldSubject:"Disciplina",infoFieldType:"Tipo",loadingPreview:"Carregando pré-visualização…",previewPlayerUnavailable:"Player de pré-visualização indisponível. Verifique se /content/preview está acessível.",failedToInitializePlayer:"Falha ao inicializar o player de conteúdo.",previewPlayerLoadFailed:"Não foi possível carregar o player de pré-visualização.",unableToLoadQuestionset:"Não foi possível carregar o conjunto de questões:",parentQuestionsetNotResolved:"Não foi possível identificar o conjunto de questões principal desta questão.",questionNotFoundInQuestionset:"Questão não encontrada no conjunto de questões."},GC={title:"Código QR (Dialcode)",invalidFormatError:"Formato de código DIAL inválido. Use apenas letras maiúsculas e números (ex. A1B2C3).",duplicateDialcodeError:'O código DIAL "{code}" já está vinculado a outro nó nesta coleção.',dialcodeNotFoundError:"Dialcode não encontrado. Insira um código válido.",linkFailedError:"Falha ao vincular o dialcode. Tente novamente.",unlinkFailedError:"Falha ao remover o dialcode. Tente novamente.",qrCodeAltPrefix:"Código QR para",linkedCodeLabel:"Código vinculado:",removeButton:"Remover",noCodeLinkedMessage:"Nenhum código QR vinculado a este conteúdo.",linkManuallyLabel:"Vincular manualmente",dialcodeInputPlaceholder:"Insira o dialcode (ex. A1B2C3)",dialcodeInputAriaLabel:"Campo de dialcode",linkButton:"Vincular",linkedSuccessMessage:"Dialcode vinculado com sucesso."},WC={unitsAddedLabel:"Unidades adicionadas",contentItemsLabel:"Itens de conteúdo",progressLabel:"Progresso"},KC={dropOntoUnitError:"Solte sobre uma unidade para adicionar conteúdo",dropOntoCourseError:"Solte o conteúdo sobre uma unidade, não diretamente sobre o curso.",alreadyInCollectionError:'"{name}" já está nesta coleção',addedToUnitSuccess:'"{name}" adicionado à unidade',fillRequiredMetadataError:"Preencha os metadados obrigatórios",outlineAriaLabel:"Esquema do curso",showOutlineTitle:"Mostrar esquema",editorAriaLabel:"Editor de conteúdo",libraryAriaLabel:"Biblioteca de conteúdo",showLibraryTitle:"Mostrar biblioteca"},YC={draftStatusFallback:"Rascunho",backAriaLabel:"Voltar",statusAriaLabelPrefix:"Status:",savingIndicator:"Salvando…",unsavedIndicator:"Não salvo",savedIndicatorPrefix:"Salvo",fillRequiredFieldsTooltip:"Preencha todos os campos obrigatórios antes de salvar",saveAsDraftButton:"Salvar como rascunho",sendForReviewButton:"Enviar para revisão",collaboratorsLabel:"Colaboradores",qrCodesLabel:"Códigos QR",generatingEllipsis:"Gerando…",generateQrCodesMenuItem:"Gerar códigos QR",downloadingEllipsis:"Baixando…",downloadQrCodesMenuItem:"Baixar códigos QR",publishButton:"Publicar",requestForChangesButton:"Solicitar alterações",approveButton:"Aprovar",qrGenerationStartedToast:'Geração dos códigos QR iniciada. Use "Baixar códigos QR" quando estiverem prontos.',qrGenerationFailedToast:"Falha ao gerar os códigos QR. Tente novamente.",qrCodesNotGeneratedToast:"Nenhum código QR gerado ainda. Gere os códigos QR primeiro.",qrGenerationInProgressToast:"A geração das imagens dos códigos QR está em andamento. Tente baixar novamente mais tarde.",qrCodesNotReadyToast:"Os códigos QR ainda não estão prontos. Aguarde e tente novamente.",qrCodesDownloadedToast:"Códigos QR baixados.",qrCodesDownloadFailedToast:"Falha ao baixar os códigos QR.",requestChangesTitle:"Solicitar alterações",changesRequestedLabel:"Alterações solicitadas",describeChangesPlaceholder:"Descreva as alterações que o autor precisa fazer"},ZC={closeAriaLabel:"Fechar",fillCommentsError:"Preencha os comentários",cancelButton:"Cancelar"},XC={closeAriaLabel:"Fechar",title:"Aceitar Termos e Condições",agreementTextPart1:"Concordo que, ao enviar/publicar este Conteúdo, confirmo que ele está em conformidade com as diretrizes estabelecidas, incluindo os Termos de Uso e a Política de Conteúdo, e que consinto em publicá-lo sob a",creativeCommonsLinkText:"Estrutura Creative Commons",agreementTextPart2:"de acordo com a",contentPolicyText:"Política de Conteúdo",agreementTextPart3:". Certifiquei-me de que não violo direitos de autor ou de privacidade de terceiros.",cancelButton:"Cancelar",submitButton:"Enviar"},JC={closeAriaLabel:"Fechar",title:"Gerar códigos QR",numberOfCodesLabel:"Número de códigos QR",countPlaceholder:"Insira um número (2–250)",countRangeError:"Insira um número entre 2 e 250.",cancelButton:"Cancelar",generateButton:"Gerar"},eS={remove:"Remover"},tS={dropHere:"Solte aqui"},rS={loading:"Carregando"},nS={contextualEditor:lC,languageSelector:cC,collectionEditor:uC,breadcrumb:dC,tabBar:fC,contentEditForm:hC,titleAppIcon:pC,unitContentList:mC,contentRow:gC,csvUpload:yC,manageCollaborators:vC,sparkMetaForm:bC,appIconField:wC,appIconPickerModal:CC,chipGroupField:SC,dateTimeField:xC,dialcodeInputField:_C,keywordSuggestField:TC,licenseSelectField:EC,multiSelectField:IC,nestedSelectField:OC,radioField:AC,selectField:DC,textField:NC,assetBrowser:RC,resourceReorderDialog:kC,assignPageNumber:jC,confirmDialog:LC,publishChecklist:PC,qualityParamsModal:FC,unsavedChangesModal:MC,filterChips:BC,libraryCard:$C,libraryDock:qC,libraryFilterPanel:UC,libraryPreviewPanel:zC,outlineTree:VC,treeNode:HC,contentPlayer:QC,dialcodePanel:GC,progressStatus:WC,splitBuilderShell:KC,topbar:YC,reviewCommentModal:ZC,confirmReviewModal:XC,generateQRModal:JC,chip:eS,dropZone:tS,spinner:rS},sS=["ar"],iS={en:bo,ar:dw,fr:oC,pt:nS};function mf(e,t){const r={...e};for(const n of Object.keys(t)){const s=e[n],i=t[n];s&&i&&typeof s=="object"&&typeof i=="object"&&!Array.isArray(s)&&!Array.isArray(i)?r[n]=mf(s,i):i!==void 0&&(r[n]=i)}return r}function hc(e){const t=iS[e];return!t||e==="en"?bo:mf(bo,t)}function aS(e){return sS.includes(e)}const wo="app-language",Co="app-language-change",gf=zs(e=>({lang:"en",labelConfig:hc("en"),setLanguage:(t,r={})=>{e({lang:t,labelConfig:hc(t)}),localStorage.setItem(wo,t),document.documentElement.setAttribute("dir",aS(t)?"rtl":"ltr"),document.documentElement.setAttribute("lang",t),r.broadcast!==!1&&window.dispatchEvent(new CustomEvent(Co,{detail:{lang:t}}))}}));function ce(){return gf(e=>e.labelConfig)}const oS=({size:e=16,color:t="currentColor"})=>{const r=ce();return c.jsx("svg",{className:wv.spin,width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-label":r.spinner.loading,role:"status",children:c.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"3",strokeDasharray:"31.4",strokeDashoffset:"10",strokeLinecap:"round"})})},Fe=({variant:e="ghost",size:t="md",isLoading:r,disabled:n,onClick:s,children:i,className:a,type:o="button"})=>c.jsxs("button",{type:o,className:`sbx-btn-${e} ${t==="sm"?"sbx-btn-sm":""} ${a??""}`,onClick:s,disabled:r||n,"aria-busy":r?!0:void 0,children:[r?c.jsx(oS,{size:14}):null,i]}),lS="_overlay_w9xez_1",cS="_modal_w9xez_11",uS="_modalHeader_w9xez_23",dS="_modalHeaderClose_w9xez_33",fS="_modalBody_w9xez_51",hS="_modalFooter_w9xez_58",pS="_checkRow_w9xez_65",mS="_formGroup_w9xez_108",gS="_textarea_w9xez_119",yS="_sliderGroup_w9xez_140",vS="_sliderValue_w9xez_152",bS="_sliderLabels_w9xez_160",wS="_sectionTitle_w9xez_168",je={overlay:lS,modal:cS,modalHeader:uS,modalHeaderClose:dS,modalBody:fS,modalFooter:hS,checkRow:pS,formGroup:mS,textarea:gS,sliderGroup:yS,sliderValue:vS,sliderLabels:bS,sectionTitle:wS},CS=({contentId:e,onConfirm:t,onCancel:r})=>{const n=ce(),s=le(d=>{var g,p;return(p=(g=d.editorConfig)==null?void 0:g.config)==null?void 0:p.objectType})||"Content",i=le(d=>d.publishChecklist)??[],[a,o]=m.useState({}),l=i.every(d=>a[d.code]),u=i.length===0||l,f=()=>{t()};return c.jsx("div",{className:je.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:c.jsxs("div",{className:je.modal,children:[c.jsxs("div",{className:je.modalHeader,children:[c.jsxs("span",{id:"publish-modal-title",children:[n.publishChecklist.publishTitlePrefix," ",s]}),c.jsx("button",{className:je.modalHeaderClose,onClick:r,"aria-label":n.publishChecklist.closeAriaLabel,children:"×"})]}),c.jsx("div",{className:je.modalBody,children:i.length===0?c.jsxs("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:[n.publishChecklist.confirmPublishPrefix," ",s,"?"]}):c.jsxs(c.Fragment,{children:[c.jsx("p",{className:je.sectionTitle,children:n.publishChecklist.checklistInstructions}),i.map(d=>c.jsxs("label",{className:je.checkRow,children:[c.jsx("input",{type:"checkbox",checked:!!a[d.code],onChange:g=>o(p=>({...p,[d.code]:g.target.checked}))}),c.jsx("span",{children:d.label})]},d.code))]})}),c.jsxs("div",{className:je.modalFooter,children:[c.jsx(Fe,{variant:"ghost",onClick:r,children:n.publishChecklist.noButton}),c.jsx(Fe,{variant:"primary",onClick:f,disabled:!u,children:n.publishChecklist.yesButton})]})]})})},SS=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const s=ce(),[i,a]=m.useState(""),[o,l]=m.useState(7),u=t==="approve",f=u?s.qualityParamsModal.reviewQualityTitle:s.qualityParamsModal.rejectContentTitle,d=!u&&i.trim().length===0,g=()=>{u?r(i.trim(),o):r(i.trim())};return c.jsx("div",{className:je.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:c.jsxs("div",{className:je.modal,children:[c.jsxs("div",{className:je.modalHeader,children:[c.jsx("span",{id:"quality-modal-title",children:f}),c.jsx("button",{className:je.modalHeaderClose,onClick:n,"aria-label":s.qualityParamsModal.closeAriaLabel,children:"×"})]}),c.jsx("div",{className:je.modalBody,children:u?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:je.formGroup,children:[c.jsx("label",{htmlFor:"quality-score",children:s.qualityParamsModal.qualityScoreLabel}),c.jsxs("div",{className:je.sliderGroup,children:[c.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:p=>l(Number(p.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),c.jsx("span",{className:je.sliderValue,children:o})]}),c.jsxs("div",{className:je.sliderLabels,children:[c.jsx("span",{children:s.qualityParamsModal.scorePoorLabel}),c.jsx("span",{children:s.qualityParamsModal.scoreExcellentLabel})]})]}),c.jsxs("div",{className:je.formGroup,children:[c.jsxs("label",{htmlFor:"quality-comment",children:[s.qualityParamsModal.commentLabel," ",c.jsx("span",{style:{fontWeight:400,color:"var(--sbx-gray-400, #9CA3AF)"},children:s.qualityParamsModal.optionalLabel})]}),c.jsx("textarea",{id:"quality-comment",className:je.textarea,placeholder:s.qualityParamsModal.commentPlaceholder,value:i,onChange:p=>a(p.target.value),rows:4})]})]}):c.jsxs("div",{className:je.formGroup,children:[c.jsxs("label",{htmlFor:"reject-reason",children:[s.qualityParamsModal.rejectionReasonLabel," ",c.jsx("span",{style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),c.jsx("textarea",{id:"reject-reason",className:je.textarea,placeholder:s.qualityParamsModal.rejectReasonPlaceholder,value:i,onChange:p=>a(p.target.value),rows:5,required:!0,"aria-required":"true"}),i.trim().length===0&&c.jsx("p",{style:{fontSize:12,color:"var(--sbx-error, #DC2626)",marginTop:4},children:s.qualityParamsModal.rejectionRequiredMessage})]})}),c.jsxs("div",{className:je.modalFooter,children:[c.jsx(Fe,{variant:"ghost",onClick:n,children:s.qualityParamsModal.cancelButton}),c.jsx(Fe,{variant:u?"primary":"danger",onClick:g,disabled:d,children:u?s.qualityParamsModal.approveButton:s.qualityParamsModal.rejectButton})]})]})})};function yf(e,t){return function(){return e.apply(t,arguments)}}const{toString:xS}=Object.prototype,{getPrototypeOf:qn}=Object,{iterator:Vs,toStringTag:vf}=Symbol,Li=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Os=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),Li(r,t))return!0;r=qn(r)}return!1},_S=(e,t)=>e!=null&&Os(e,t)?e[t]:void 0,ol=(e=>t=>{const r=xS.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),tr=e=>(e=e.toLowerCase(),t=>ol(t)===e),ta=e=>t=>typeof t===e,{isArray:un}=Array,Un=ta("undefined");function Zn(e){return e!==null&&!Un(e)&&e.constructor!==null&&!Un(e.constructor)&&Nt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const bf=tr("ArrayBuffer");function TS(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&bf(e.buffer),t}const ES=ta("string"),Nt=ta("function"),wf=ta("number"),Xn=e=>e!==null&&typeof e=="object",IS=e=>e===!0||e===!1,mi=e=>{if(!Xn(e))return!1;const t=qn(e);return(t===null||t===Object.prototype||qn(t)===null)&&!Os(e,vf)&&!Os(e,Vs)},OS=e=>{if(!Xn(e)||Zn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},AS=tr("Date"),DS=tr("File"),NS=e=>!!(e&&typeof e.uri<"u"),RS=e=>e&&typeof e.getParts<"u",kS=tr("Blob"),jS=tr("FileList"),LS=e=>Xn(e)&&Nt(e.pipe);function PS(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const pc=PS(),mc=typeof pc.FormData<"u"?pc.FormData:void 0,FS=e=>{if(!e)return!1;if(mc&&e instanceof mc)return!0;const t=qn(e);if(!t||t===Object.prototype||!Nt(e.append))return!1;const r=ol(e);return r==="formdata"||r==="object"&&Nt(e.toString)&&e.toString()==="[object FormData]"},MS=tr("URLSearchParams"),[BS,$S,qS,US]=["ReadableStream","Request","Response","Headers"].map(tr),zS=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Hs(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),un(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(Zn(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length;let o;for(n=0;n<a;n++)o=i[n],t.call(null,e[o],o,e)}}function Cf(e,t){if(Zn(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,s;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const Kr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Sf=e=>!Un(e)&&e!==Kr;function So(...e){const{caseless:t,skipUndefined:r}=Sf(this)&&this||{},n={},s=(i,a)=>{if(a==="__proto__"||a==="constructor"||a==="prototype")return;const o=t&&typeof a=="string"&&Cf(n,a)||a,l=Li(n,o)?n[o]:void 0;mi(l)&&mi(i)?n[o]=So(l,i):mi(i)?n[o]=So({},i):un(i)?n[o]=i.slice():(!r||!Un(i))&&(n[o]=i)};for(let i=0,a=e.length;i<a;i++){const o=e[i];if(!o||Zn(o)||(Hs(o,s),typeof o!="object"||un(o)))continue;const l=Object.getOwnPropertySymbols(o);for(let u=0;u<l.length;u++){const f=l[u];tx.call(o,f)&&s(o[f],f)}}return n}const VS=(e,t,r,{allOwnKeys:n}={})=>(Hs(t,(s,i)=>{r&&Nt(s)?Object.defineProperty(e,i,{__proto__:null,value:yf(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),HS=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),QS=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),r&&Object.assign(e.prototype,r)},GS=(e,t,r,n)=>{let s,i,a;const o={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)a=s[i],(!n||n(a,e,t))&&!o[a]&&(t[a]=e[a],o[a]=!0);e=r!==!1&&qn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},WS=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},KS=e=>{if(!e)return null;if(un(e))return e;let t=e.length;if(!wf(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},YS=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&qn(Uint8Array)),ZS=(e,t)=>{const n=(e&&e[Vs]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},XS=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},JS=tr("HTMLFormElement"),ex=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:tx}=Object.prototype,rx=tr("RegExp"),xf=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Hs(r,(s,i)=>{let a;(a=t(s,i,e))!==!1&&(n[i]=a||s)}),Object.defineProperties(e,n)},nx=e=>{xf(e,(t,r)=>{if(Nt(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Nt(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},sx=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return un(e)?n(e):n(String(e).split(t)),r},ix=()=>{},ax=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function ox(e){return!!(e&&Nt(e.append)&&e[vf]==="FormData"&&e[Vs])}const lx=e=>{const t=new WeakSet,r=n=>{if(Xn(n)){if(t.has(n))return;if(Zn(n))return n;if(!("toJSON"in n)){t.add(n);const s=un(n)?[]:{};return Hs(n,(i,a)=>{const o=r(i);!Un(o)&&(s[a]=o)}),t.delete(n),s}}return n};return r(e)},cx=tr("AsyncFunction"),ux=e=>e&&(Xn(e)||Nt(e))&&Nt(e.then)&&Nt(e.catch),_f=((e,t)=>e?setImmediate:t?((r,n)=>(Kr.addEventListener("message",({source:s,data:i})=>{s===Kr&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),Kr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Nt(Kr.postMessage)),dx=typeof queueMicrotask<"u"?queueMicrotask.bind(Kr):typeof process<"u"&&process.nextTick||_f,Tf=e=>e!=null&&Nt(e[Vs]),fx=e=>e!=null&&Os(e,Vs)&&Tf(e),I={isArray:un,isArrayBuffer:bf,isBuffer:Zn,isFormData:FS,isArrayBufferView:TS,isString:ES,isNumber:wf,isBoolean:IS,isObject:Xn,isPlainObject:mi,isEmptyObject:OS,isReadableStream:BS,isRequest:$S,isResponse:qS,isHeaders:US,isUndefined:Un,isDate:AS,isFile:DS,isReactNativeBlob:NS,isReactNative:RS,isBlob:kS,isRegExp:rx,isFunction:Nt,isStream:LS,isURLSearchParams:MS,isTypedArray:YS,isFileList:jS,forEach:Hs,merge:So,extend:VS,trim:zS,stripBOM:HS,inherits:QS,toFlatObject:GS,kindOf:ol,kindOfTest:tr,endsWith:WS,toArray:KS,forEachEntry:ZS,matchAll:XS,isHTMLForm:JS,hasOwnProperty:Li,hasOwnProp:Li,hasOwnInPrototypeChain:Os,getSafeProp:_S,reduceDescriptors:xf,freezeMethods:nx,toObjectSet:sx,toCamelCase:ex,noop:ix,toFiniteNumber:ax,findKey:Cf,global:Kr,isContextDefined:Sf,isSpecCompliantForm:ox,toJSONObject:lx,isAsyncFn:cx,isThenable:ux,setImmediate:_f,asap:dx,isIterable:Tf,isSafeIterable:fx},hx=I.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),px=e=>{const t={};let r,n,s;return e&&e.split(`
|
|
489
|
+
`).forEach(function(a){s=a.indexOf(":"),r=a.substring(0,s).trim().toLowerCase(),n=a.substring(s+1).trim(),!(!r||t[r]&&hx[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function mx(e){let t=0,r=e.length;for(;t<r;){const n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;r>t;){const n=e.charCodeAt(r-1);if(n!==9&&n!==32)break;r-=1}return t===0&&r===e.length?e:e.slice(t,r)}const gx=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),yx=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function ll(e,t){return I.isArray(e)?e.map(r=>ll(r,t)):mx(String(e).replace(t,""))}const vx=e=>ll(e,gx),bx=e=>ll(e,yx);function Ef(e){const t=Object.create(null);return I.forEach(e.toJSON(),(r,n)=>{t[n]=bx(r)}),t}const gc=Symbol("internals");function ss(e){return e&&String(e).trim().toLowerCase()}function gi(e){return e===!1||e==null?e:I.isArray(e)?e.map(gi):vx(String(e))}function wx(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const Cx=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function xa(e,t,r,n,s){if(I.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!I.isString(t)){if(I.isString(n))return t.indexOf(n)!==-1;if(I.isRegExp(n))return n.test(t)}}function Sx(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function xx(e,t){const r=I.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{__proto__:null,value:function(s,i,a){return this[n].call(this,t,s,i,a)},configurable:!0})})}let Ct=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(o,l,u){const f=ss(l);if(!f)return;const d=I.findKey(s,f);(!d||s[d]===void 0||u===!0||u===void 0&&s[d]!==!1)&&(s[d||l]=gi(o))}const a=(o,l)=>I.forEach(o,(u,f)=>i(u,f,l));if(I.isPlainObject(t)||t instanceof this.constructor)a(t,r);else if(I.isString(t)&&(t=t.trim())&&!Cx(t))a(px(t),r);else if(I.isObject(t)&&I.isSafeIterable(t)){let o=Object.create(null),l,u;for(const f of t){if(!I.isArray(f))throw new TypeError("Object iterator must return a key-value pair");u=f[0],I.hasOwnProp(o,u)?(l=o[u],o[u]=I.isArray(l)?[...l,f[1]]:[l,f[1]]):o[u]=f[1]}a(o,r)}else t!=null&&i(r,t,n);return this}get(t,r){if(t=ss(t),t){const n=I.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return wx(s);if(I.isFunction(r))return r.call(this,s,n);if(I.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=ss(t),t){const n=I.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||xa(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(a){if(a=ss(a),a){const o=I.findKey(n,a);o&&(!r||xa(n,n[o],o,r))&&(delete n[o],s=!0)}}return I.isArray(t)?t.forEach(i):i(t),s}clear(t){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const i=r[n];(!t||xa(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const r=this,n={};return I.forEach(this,(s,i)=>{const a=I.findKey(n,i);if(a){r[a]=gi(s),delete r[i];return}const o=t?Sx(i):String(i).trim();o!==i&&delete r[i],r[o]=gi(s),n[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return I.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&I.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
490
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(s=>n.set(s)),n}static accessor(t){const n=(this[gc]=this[gc]={accessors:{}}).accessors,s=this.prototype;function i(a){const o=ss(a);n[o]||(xx(s,a),n[o]=!0)}return I.isArray(t)?t.forEach(i):i(t),this}};Ct.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);I.reduceDescriptors(Ct.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});I.freezeMethods(Ct);const _x="[REDACTED ****]";function Tx(e){if(I.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(I.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Ex(e,t){const r=new Set(t.map(i=>String(i).toLowerCase())),n=[],s=i=>{if(i===null||typeof i!="object"||I.isBuffer(i))return i;if(n.indexOf(i)!==-1)return;i instanceof Ct&&(i=i.toJSON()),n.push(i);let a;if(I.isArray(i))a=[],i.forEach((o,l)=>{const u=s(o);I.isUndefined(u)||(a[l]=u)});else{if(!I.isPlainObject(i)&&Tx(i))return n.pop(),i;a=Object.create(null);for(const[o,l]of Object.entries(i)){const u=r.has(o.toLowerCase())?_x:s(l);I.isUndefined(u)||(a[o]=u)}}return n.pop(),a};return s(e)}let Z=class If extends Error{static from(t,r,n,s,i,a){const o=new If(t.message,r||t.code,n,s,i);return o.cause=t,o.name=t.name,t.status!=null&&o.status==null&&(o.status=t.status),a&&Object.assign(o,a),o}constructor(t,r,n,s,i){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,r=t&&I.hasOwnProp(t,"redact")?t.redact:void 0,n=I.isArray(r)&&r.length>0?Ex(t,r):I.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}};Z.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Z.ERR_BAD_OPTION="ERR_BAD_OPTION";Z.ECONNABORTED="ECONNABORTED";Z.ETIMEDOUT="ETIMEDOUT";Z.ECONNREFUSED="ECONNREFUSED";Z.ERR_NETWORK="ERR_NETWORK";Z.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Z.ERR_DEPRECATED="ERR_DEPRECATED";Z.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Z.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Z.ERR_CANCELED="ERR_CANCELED";Z.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Z.ERR_INVALID_URL="ERR_INVALID_URL";Z.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Ix=null,Of=100;function xo(e){return I.isPlainObject(e)||I.isArray(e)}function Af(e){return I.endsWith(e,"[]")?e.slice(0,-2):e}function _a(e,t,r){return e?e.concat(t).map(function(s,i){return s=Af(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function Ox(e){return I.isArray(e)&&!e.some(xo)}const Ax=I.toFlatObject(I,{},null,function(t){return/^is[A-Z]/.test(t)});function ra(e,t,r){if(!I.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=I.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,C){return!I.isUndefined(C[b])});const n=r.metaTokens,s=r.visitor||w,i=r.dots,a=r.indexes,o=r.Blob||typeof Blob<"u"&&Blob,l=r.maxDepth===void 0?Of:r.maxDepth,u=o&&I.isSpecCompliantForm(t),f=[];if(!I.isFunction(s))throw new TypeError("visitor must be a function");function d(v){if(v===null)return"";if(I.isDate(v))return v.toISOString();if(I.isBoolean(v))return v.toString();if(!u&&I.isBlob(v))throw new Z("Blob is not supported. Use a Buffer instead.");return I.isArrayBuffer(v)||I.isTypedArray(v)?u&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function g(v){if(v>l)throw new Z("Object is too deeply nested ("+v+" levels). Max depth: "+l,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function p(v,b){if(l===1/0)return JSON.stringify(v);const C=[];return JSON.stringify(v,function(_,E){if(!I.isObject(E))return E;for(;C.length&&C[C.length-1]!==this;)C.pop();return C.push(E),g(b+C.length-1),E})}function w(v,b,C){let S=v;if(I.isReactNative(t)&&I.isReactNativeBlob(v))return t.append(_a(C,b,i),d(v)),!1;if(v&&!C&&typeof v=="object"){if(I.endsWith(b,"{}"))b=n?b:b.slice(0,-2),v=p(v,1);else if(I.isArray(v)&&Ox(v)||(I.isFileList(v)||I.endsWith(b,"[]"))&&(S=I.toArray(v)))return b=Af(b),S.forEach(function(E,N){!(I.isUndefined(E)||E===null)&&t.append(a===!0?_a([b],N,i):a===null?b:b+"[]",d(E))}),!1}return xo(v)?!0:(t.append(_a(C,b,i),d(v)),!1)}const h=Object.assign(Ax,{defaultVisitor:w,convertValue:d,isVisitable:xo});function y(v,b,C=0){if(!I.isUndefined(v)){if(g(C),f.indexOf(v)!==-1)throw new Error("Circular reference detected in "+b.join("."));f.push(v),I.forEach(v,function(_,E){(!(I.isUndefined(_)||_===null)&&s.call(t,_,I.isString(E)?E.trim():E,b,h))===!0&&y(_,b?b.concat(E):[E],C+1)}),f.pop()}}if(!I.isObject(e))throw new TypeError("data must be an object");return y(e),t}function yc(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function cl(e,t){this._pairs=[],e&&ra(e,this,t)}const Df=cl.prototype;Df.append=function(t,r){this._pairs.push([t,r])};Df.toString=function(t){const r=t?function(n){return t.call(this,n,yc)}:yc;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Dx(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Nf(e,t,r){if(!t)return e;const n=I.isFunction(r)?{serialize:r}:r,s=I.getSafeProp(n,"encode")||Dx,i=I.getSafeProp(n,"serialize");let a;if(i?a=i(t,n):a=I.isURLSearchParams(t)?t.toString():new cl(t,n).toString(s),a){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}class vc{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){I.forEach(this.handlers,function(n){n!==null&&t(n)})}}const ul={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Nx=typeof URLSearchParams<"u"?URLSearchParams:cl,Rx=typeof FormData<"u"?FormData:null,kx=typeof Blob<"u"?Blob:null,jx={isBrowser:!0,classes:{URLSearchParams:Nx,FormData:Rx,Blob:kx},protocols:["http","https","file","blob","url","data"]},dl=typeof window<"u"&&typeof document<"u",_o=typeof navigator=="object"&&navigator||void 0,Lx=dl&&(!_o||["ReactNative","NativeScript","NS"].indexOf(_o.product)<0),Px=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Fx=dl&&window.location.href||"http://localhost",Mx=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:dl,hasStandardBrowserEnv:Lx,hasStandardBrowserWebWorkerEnv:Px,navigator:_o,origin:Fx},Symbol.toStringTag,{value:"Module"})),ft={...Mx,...jx};function Bx(e,t){return ra(e,new ft.classes.URLSearchParams,{visitor:function(r,n,s,i){return ft.isNode&&I.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const bc=Of;function Rf(e){if(e>bc)throw new Z("FormData field is too deeply nested ("+e+" levels). Max depth: "+bc,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function $x(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)Rf(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function qx(e){const t={},r=Object.keys(e);let n;const s=r.length;let i;for(n=0;n<s;n++)i=r[n],t[i]=e[i];return t}function kf(e){function t(r,n,s,i){Rf(i);let a=r[i++];if(a==="__proto__")return!0;const o=Number.isFinite(+a),l=i>=r.length;return a=!a&&I.isArray(s)?s.length:a,l?(I.hasOwnProp(s,a)?s[a]=I.isArray(s[a])?s[a].concat(n):[s[a],n]:s[a]=n,!o):((!I.hasOwnProp(s,a)||!I.isObject(s[a]))&&(s[a]=[]),t(r,n,s[a],i)&&I.isArray(s[a])&&(s[a]=qx(s[a])),!o)}if(I.isFormData(e)&&I.isFunction(e.entries)){const r={};return I.forEachEntry(e,(n,s)=>{t($x(n),s,r,0)}),r}return null}const mn=(e,t)=>e!=null&&I.hasOwnProp(e,t)?e[t]:void 0;function Ux(e,t,r){if(I.isString(e))try{return(t||JSON.parse)(e),I.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const Qs={transitional:ul,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=I.isObject(t);if(i&&I.isHTMLForm(t)&&(t=new FormData(t)),I.isFormData(t))return s?JSON.stringify(kf(t)):t;if(I.isArrayBuffer(t)||I.isBuffer(t)||I.isStream(t)||I.isFile(t)||I.isBlob(t)||I.isReadableStream(t))return t;if(I.isArrayBufferView(t))return t.buffer;if(I.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(i){const l=mn(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return Bx(t,l).toString();if((o=I.isFileList(t))||n.indexOf("multipart/form-data")>-1){const u=mn(this,"env"),f=u&&u.FormData;return ra(o?{"files[]":t}:t,f&&new f,l)}}return i||s?(r.setContentType("application/json",!1),Ux(t)):t}],transformResponse:[function(t){const r=mn(this,"transitional")||Qs.transitional,n=r&&r.forcedJSONParsing,s=mn(this,"responseType"),i=s==="json";if(I.isResponse(t)||I.isReadableStream(t))return t;if(t&&I.isString(t)&&(n&&!s||i)){const o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,mn(this,"parseReviver"))}catch(l){if(o)throw l.name==="SyntaxError"?Z.from(l,Z.ERR_BAD_RESPONSE,this,null,mn(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ft.classes.FormData,Blob:ft.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};I.forEach(["delete","get","head","post","put","patch","query"],e=>{Qs.headers[e]={}});function Ta(e,t){const r=this||Qs,n=t||r,s=Ct.from(n.headers);let i=n.data;return I.forEach(e,function(o){i=o.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function jf(e){return!!(e&&e.__CANCEL__)}let Gs=class extends Z{constructor(t,r,n){super(t??"canceled",Z.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function Lf(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new Z("Request failed with status code "+r.status,r.status>=400&&r.status<500?Z.ERR_BAD_REQUEST:Z.ERR_BAD_RESPONSE,r.config,r.request,r))}function zx(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Vx(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,i=0,a;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),f=n[i];a||(a=u),r[s]=l,n[s]=u;let d=i,g=0;for(;d!==s;)g+=r[d++],d=d%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-a<t)return;const p=f&&u-f;return p?Math.round(g*1e3/p):void 0}}function Hx(e,t){let r=0,n=1e3/t,s,i;const a=(u,f=Date.now())=>{r=f,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const f=Date.now(),d=f-r;d>=n?a(u,f):(s=u,i||(i=setTimeout(()=>{i=null,a(s)},n-d)))},()=>s&&a(s)]}const Pi=(e,t,r=3)=>{let n=0;const s=Vx(50,250);return Hx(i=>{if(!i||typeof i.loaded!="number")return;const a=i.loaded,o=i.lengthComputable?i.total:void 0,l=o!=null?Math.min(a,o):a,u=Math.max(0,l-n),f=s(u);n=Math.max(n,l);const d={loaded:l,total:o,progress:o?l/o:void 0,bytes:u,rate:f||void 0,estimated:f&&o?(o-l)/f:void 0,event:i,lengthComputable:o!=null,[t?"download":"upload"]:!0};e(d)},r)},wc=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Cc=e=>(...t)=>I.asap(()=>e(...t)),Qx=ft.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,ft.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(ft.origin),ft.navigator&&/(msie|trident)/i.test(ft.navigator.userAgent)):()=>!0,Gx=ft.hasStandardBrowserEnv?{write(e,t,r,n,s,i,a){if(typeof document>"u")return;const o=[`${e}=${encodeURIComponent(t)}`];I.isNumber(r)&&o.push(`expires=${new Date(r).toUTCString()}`),I.isString(n)&&o.push(`path=${n}`),I.isString(s)&&o.push(`domain=${s}`),i===!0&&o.push("secure"),I.isString(a)&&o.push(`SameSite=${a}`),document.cookie=o.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let r=0;r<t.length;r++){const n=t[r].replace(/^\s+/,""),s=n.indexOf("=");if(s!==-1&&n.slice(0,s)===e)return decodeURIComponent(n.slice(s+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Wx(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Kx(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Yx=/^https?:(?!\/\/)/i,Zx=/[\t\n\r]/g;function Xx(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Jx(e){return Xx(e).replace(Zx,"")}function Sc(e,t){if(typeof e=="string"&&Yx.test(Jx(e)))throw new Z('Invalid URL: missing "//" after protocol',Z.ERR_INVALID_URL,t)}function Pf(e,t,r,n){Sc(t,n);let s=!Wx(t);return e&&(s||r===!1)?(Sc(e,n),Kx(e,t)):t}const xc=e=>e instanceof Ct?{...e}:e;function dn(e,t){t=t||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(f,d,g,p){return I.isPlainObject(f)&&I.isPlainObject(d)?I.merge.call({caseless:p},f,d):I.isPlainObject(d)?I.merge({},d):I.isArray(d)?d.slice():d}function s(f,d,g,p){if(I.isUndefined(d)){if(!I.isUndefined(f))return n(void 0,f,g,p)}else return n(f,d,g,p)}function i(f,d){if(!I.isUndefined(d))return n(void 0,d)}function a(f,d){if(I.isUndefined(d)){if(!I.isUndefined(f))return n(void 0,f)}else return n(void 0,d)}function o(f){const d=I.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!I.isUndefined(d))if(I.isPlainObject(d)){if(I.hasOwnProp(d,f))return d[f]}else return;const g=I.hasOwnProp(e,"transitional")?e.transitional:void 0;if(I.isPlainObject(g)&&I.hasOwnProp(g,f))return g[f]}function l(f,d,g){if(I.hasOwnProp(t,g))return n(f,d);if(I.hasOwnProp(e,g))return n(void 0,f)}const u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,allowedSocketPaths:a,responseEncoding:a,validateStatus:l,headers:(f,d,g)=>s(xc(f),xc(d),g,!0)};return I.forEach(Object.keys({...e,...t}),function(d){if(d==="__proto__"||d==="constructor"||d==="prototype")return;const g=I.hasOwnProp(u,d)?u[d]:s,p=I.hasOwnProp(e,d)?e[d]:void 0,w=I.hasOwnProp(t,d)?t[d]:void 0,h=g(p,w,d);I.isUndefined(h)&&g!==l||(r[d]=h)}),I.hasOwnProp(t,"validateStatus")&&I.isUndefined(t.validateStatus)&&o("validateStatusUndefinedResolves")===!1&&(I.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const e_=["content-type","content-length"];function t_(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{e_.includes(n.toLowerCase())&&e.set(n,s)})}const r_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function Ff(e){const t=dn({},e),r=g=>I.hasOwnProp(t,g)?t[g]:void 0,n=r("data");let s=r("withXSRFToken");const i=r("xsrfHeaderName"),a=r("xsrfCookieName");let o=r("headers");const l=r("auth"),u=r("baseURL"),f=r("allowAbsoluteUrls"),d=r("url");if(t.headers=o=Ct.from(o),t.url=Nf(Pf(u,d,f,t),r("params"),r("paramsSerializer")),l){const g=I.getSafeProp(l,"username")||"",p=I.getSafeProp(l,"password")||"";o.set("Authorization","Basic "+btoa(g+":"+(p?r_(p):"")))}if(I.isFormData(n)&&(ft.hasStandardBrowserEnv||ft.hasStandardBrowserWebWorkerEnv||I.isReactNative(n)?o.setContentType(void 0):I.isFunction(n.getHeaders)&&t_(o,n.getHeaders(),r("formDataHeaderPolicy"))),ft.hasStandardBrowserEnv&&(I.isFunction(s)&&(s=s(t)),s===!0||s==null&&Qx(t.url))){const p=i&&a&&Gx.read(a);p&&o.set(i,p)}return t}const n_=typeof XMLHttpRequest<"u",s_=n_&&function(e){return new Promise(function(r,n){const s=Ff(e);let i=s.data;const a=Ct.from(s.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:u}=s,f,d,g,p,w;function h(){p&&p(),w&&w(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function v(){if(!y)return;const C=Ct.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),_={data:!o||o==="text"||o==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:C,config:e,request:y};Lf(function(N){r(N),h()},function(N){n(N),h()},_),y=null}"onloadend"in y?y.onloadend=v:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(v)},y.onabort=function(){y&&(n(new Z("Request aborted",Z.ECONNABORTED,e,y)),h(),y=null)},y.onerror=function(S){const _=S&&S.message?S.message:"Network Error",E=new Z(_,Z.ERR_NETWORK,e,y);E.event=S||null,n(E),h(),y=null},y.ontimeout=function(){let S=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const _=s.transitional||ul;s.timeoutErrorMessage&&(S=s.timeoutErrorMessage),n(new Z(S,_.clarifyTimeoutError?Z.ETIMEDOUT:Z.ECONNABORTED,e,y)),h(),y=null},i===void 0&&a.setContentType(null),"setRequestHeader"in y&&I.forEach(Ef(a),function(S,_){y.setRequestHeader(_,S)}),I.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),o&&o!=="json"&&(y.responseType=s.responseType),u&&([g,w]=Pi(u,!0),y.addEventListener("progress",g)),l&&y.upload&&([d,p]=Pi(l),y.upload.addEventListener("progress",d),y.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(f=C=>{y&&(n(!C||C.type?new Gs(null,e,y):C),y.abort(),h(),y=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const b=zx(s.url);if(b&&!ft.protocols.includes(b)){n(new Z("Unsupported protocol "+b+":",Z.ERR_BAD_REQUEST,e));return}y.send(i||null)})},i_=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const s=function(l){if(!n){n=!0,a();const u=l instanceof Error?l:this.reason;r.abort(u instanceof Z?u:new Gs(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,s(new Z(`timeout of ${t}ms exceeded`,Z.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),e=null)};e.forEach(l=>l.addEventListener("abort",s));const{signal:o}=r;return o.unsubscribe=()=>I.asap(a),o},a_=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,s;for(;n<r;)s=n+t,yield e.slice(n,s),n=s},o_=async function*(e,t){for await(const r of l_(e))yield*a_(r,t)},l_=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},_c=(e,t,r,n)=>{const s=o_(e,t);let i=0,a,o=l=>{a||(a=!0,n&&n(l))};return new ReadableStream({async pull(l){try{const{done:u,value:f}=await s.next();if(u){o(),l.close();return}let d=f.byteLength;if(r){let g=i+=d;r(g)}l.enqueue(new Uint8Array(f))}catch(u){throw o(u),u}},cancel(l){return o(l),s.return()}},{highWaterMark:2})},Fi=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,c_=(e,t,r)=>t+2<r&&Fi(e.charCodeAt(t+1))&&Fi(e.charCodeAt(t+2));function u_(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let a=n.length;const o=n.length;for(let p=0;p<o;p++)if(n.charCodeAt(p)===37&&p+2<o){const w=n.charCodeAt(p+1),h=n.charCodeAt(p+2);Fi(w)&&Fi(h)&&(a-=2,p+=2)}let l=0,u=o-1;const f=p=>p>=2&&n.charCodeAt(p-2)===37&&n.charCodeAt(p-1)===51&&(n.charCodeAt(p)===68||n.charCodeAt(p)===100);u>=0&&(n.charCodeAt(u)===61?(l++,u--):f(u)&&(l++,u-=3)),l===1&&u>=0&&(n.charCodeAt(u)===61||f(u))&&l++;const g=Math.floor(a/4)*3-(l||0);return g>0?g:0}let i=0;for(let a=0,o=n.length;a<o;a++){const l=n.charCodeAt(a);if(l===37&&c_(n,a,o))i+=1,a+=2;else if(l<128)i+=1;else if(l<2048)i+=2;else if(l>=55296&&l<=56319&&a+1<o){const u=n.charCodeAt(a+1);u>=56320&&u<=57343?(i+=4,a++):i+=3}else i+=3}return i}const fl="1.18.0",Tc=64*1024,{isFunction:ei}=I,d_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),Ec=e=>{if(!I.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Ic=(e,...t)=>{try{return!!e(...t)}catch{return!1}},f_=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},h_=e=>{const t=I.global!==void 0&&I.global!==null?I.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=I.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:a}=e,o=s?ei(s):typeof fetch=="function",l=ei(i),u=ei(a);if(!o)return!1;const f=o&&ei(r),d=o&&(typeof n=="function"?(v=>b=>v.encode(b))(new n):async v=>new Uint8Array(await new i(v).arrayBuffer())),g=l&&f&&Ic(()=>{let v=!1;const b=new i(ft.origin,{body:new r,method:"POST",get duplex(){return v=!0,"half"}}),C=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),v&&!C}),p=u&&f&&Ic(()=>I.isReadableStream(new a("").body)),w={stream:p&&(v=>v.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!w[v]&&(w[v]=(b,C)=>{let S=b&&b[v];if(S)return S.call(b);throw new Z(`Response type '${v}' is not supported`,Z.ERR_NOT_SUPPORT,C)})});const h=async v=>{if(v==null)return 0;if(I.isBlob(v))return v.size;if(I.isSpecCompliantForm(v))return(await new i(ft.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(I.isArrayBufferView(v)||I.isArrayBuffer(v))return v.byteLength;if(I.isURLSearchParams(v)&&(v=v+""),I.isString(v))return(await d(v)).byteLength},y=async(v,b)=>{const C=I.toFiniteNumber(v.getContentLength());return C??h(b)};return async v=>{let{url:b,method:C,data:S,signal:_,cancelToken:E,timeout:N,onDownloadProgress:R,onUploadProgress:M,responseType:$,headers:D,withCredentials:j="same-origin",fetchOptions:P,maxContentLength:k,maxBodyLength:L}=Ff(v);const z=I.isNumber(k)&&k>-1,X=I.isNumber(L)&&L>-1,ye=V=>I.hasOwnProp(v,V)?v[V]:void 0;let _e=s||fetch;$=$?($+"").toLowerCase():"text";let we=i_([_,E&&E.toAbortSignal()],N),de=null;const Q=we&&we.unsubscribe&&(()=>{we.unsubscribe()});let ne,te=null;const q=()=>new Z("Request body larger than maxBodyLength limit",Z.ERR_BAD_REQUEST,v,de);try{let V;const ie=ye("auth");if(ie){const re=I.getSafeProp(ie,"username")||"",He=I.getSafeProp(ie,"password")||"";V={username:re,password:He}}if(f_(b)){const re=new URL(b,ft.origin);if(!V&&(re.username||re.password)){const He=Ec(re.username),ze=Ec(re.password);V={username:He,password:ze}}(re.username||re.password)&&(re.username="",re.password="",b=re.href)}if(V&&(D.delete("authorization"),D.set("Authorization","Basic "+btoa(d_((V.username||"")+":"+(V.password||""))))),z&&typeof b=="string"&&b.startsWith("data:")&&u_(b)>k)throw new Z("maxContentLength size of "+k+" exceeded",Z.ERR_BAD_RESPONSE,v,de);if(X&&C!=="get"&&C!=="head"){const re=await h(S);if(typeof re=="number"&&isFinite(re)&&(ne=re,re>L))throw q()}const fe=X&&(I.isReadableStream(S)||I.isStream(S)),J=(re,He,ze)=>_c(re,Tc,Ue=>{if(X&&Ue>L)throw te=q();He&&He(Ue)},ze);if(g&&C!=="get"&&C!=="head"&&(M||fe)){if(ne=ne??await y(D,S),ne!==0||fe){let re=new i(b,{method:"POST",body:S,duplex:"half"}),He;if(I.isFormData(S)&&(He=re.headers.get("content-type"))&&D.setContentType(He),re.body){const[ze,Ue]=M&&wc(ne,Pi(Cc(M)))||[];S=J(re.body,ze,Ue)}}}else if(fe&&!l&&f&&C!=="get"&&C!=="head")S=J(S);else if(fe&&l&&!g&&C!=="get"&&C!=="head")throw new Z("Stream request bodies are not supported by the current fetch implementation",Z.ERR_NOT_SUPPORT,v,de);I.isString(j)||(j=j?"include":"omit");const se=l&&"credentials"in i.prototype;if(I.isFormData(S)){const re=D.getContentType();re&&/^multipart\/form-data/i.test(re)&&!/boundary=/i.test(re)&&D.delete("content-type")}D.set("User-Agent","axios/"+fl,!1);const ke={...P,signal:we,method:C.toUpperCase(),headers:Ef(D.normalize()),body:S,duplex:"half",credentials:se?j:void 0};de=l&&new i(b,ke);let Te=await(l?_e(de,P):_e(b,ke));const $e=Ct.from(Te.headers);if(z){const re=I.toFiniteNumber($e.getContentLength());if(re!=null&&re>k)throw new Z("maxContentLength size of "+k+" exceeded",Z.ERR_BAD_RESPONSE,v,de)}const Ve=p&&($==="stream"||$==="response");if(p&&Te.body&&(R||z||Ve&&Q)){const re={};["status","statusText","headers"].forEach(St=>{re[St]=Te[St]});const He=I.toFiniteNumber($e.getContentLength()),[ze,Ue]=R&&wc(He,Pi(Cc(R),!0))||[];let Ze=0;const Bt=St=>{if(z&&(Ze=St,Ze>k))throw new Z("maxContentLength size of "+k+" exceeded",Z.ERR_BAD_RESPONSE,v,de);ze&&ze(St)};Te=new a(_c(Te.body,Tc,Bt,()=>{Ue&&Ue(),Q&&Q()}),re)}$=$||"text";let qe=await w[I.findKey(w,$)||"text"](Te,v);if(z&&!p&&!Ve){let re;if(qe!=null&&(typeof qe.byteLength=="number"?re=qe.byteLength:typeof qe.size=="number"?re=qe.size:typeof qe=="string"&&(re=typeof n=="function"?new n().encode(qe).byteLength:qe.length)),typeof re=="number"&&re>k)throw new Z("maxContentLength size of "+k+" exceeded",Z.ERR_BAD_RESPONSE,v,de)}return!Ve&&Q&&Q(),await new Promise((re,He)=>{Lf(re,He,{data:qe,headers:Ct.from(Te.headers),status:Te.status,statusText:Te.statusText,config:v,request:de})})}catch(V){if(Q&&Q(),we&&we.aborted&&we.reason instanceof Z){const ie=we.reason;throw ie.config=v,de&&(ie.request=de),V!==ie&&(ie.cause=V),ie}throw te?(de&&!te.request&&(te.request=de),te):V instanceof Z?(de&&!V.request&&(V.request=de),V):V&&V.name==="TypeError"&&/Load failed|fetch/i.test(V.message)?Object.assign(new Z("Network Error",Z.ERR_NETWORK,v,de,V&&V.response),{cause:V.cause||V}):Z.from(V,V&&V.code,v,de,V&&V.response)}}},p_=new Map,Mf=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,i=[n,s,r];let a=i.length,o=a,l,u,f=p_;for(;o--;)l=i[o],u=f.get(l),u===void 0&&f.set(l,u=o?new Map:h_(t)),f=u;return u};Mf();const hl={http:Ix,xhr:s_,fetch:{get:Mf}};I.forEach(hl,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Oc=e=>`- ${e}`,m_=e=>I.isFunction(e)||e===null||e===!1;function g_(e,t){e=I.isArray(e)?e:[e];const{length:r}=e;let n,s;const i={};for(let a=0;a<r;a++){n=e[a];let o;if(s=n,!m_(n)&&(s=hl[(o=String(n)).toLowerCase()],s===void 0))throw new Z(`Unknown adapter '${o}'`);if(s&&(I.isFunction(s)||(s=s.get(t))))break;i[o||"#"+a]=s}if(!s){const a=Object.entries(i).map(([l,u])=>`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=r?a.length>1?`since :
|
|
491
|
+
`+a.map(Oc).join(`
|
|
492
|
+
`):" "+Oc(a[0]):"as no adapter specified";throw new Z("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return s}const Bf={getAdapter:g_,adapters:hl};function Ea(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Gs(null,e)}function Ac(e){return Ea(e),e.headers=Ct.from(e.headers),e.data=Ta.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Bf.getAdapter(e.adapter||Qs.adapter,e)(e).then(function(n){Ea(e),e.response=n;try{n.data=Ta.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=Ct.from(n.headers),n},function(n){if(!jf(n)&&(Ea(e),n&&n.response)){e.response=n.response;try{n.response.data=Ta.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=Ct.from(n.response.headers)}return Promise.reject(n)})}const na={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{na[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Dc={};na.transitional=function(t,r,n){function s(i,a){return"[Axios v"+fl+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return(i,a,o)=>{if(t===!1)throw new Z(s(a," has been removed"+(r?" in "+r:"")),Z.ERR_DEPRECATED);return r&&!Dc[a]&&(Dc[a]=!0,console.warn(s(a," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,a,o):!0}};na.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function y_(e,t,r){if(typeof e!="object")throw new Z("options must be an object",Z.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const i=n[s],a=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(a){const o=e[i],l=o===void 0||a(o,i,e);if(l!==!0)throw new Z("option "+i+" must be "+l,Z.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Z("Unknown option "+i,Z.ERR_BAD_OPTION)}}const yi={assertOptions:y_,validators:na},pt=yi.validators;let ln=class{constructor(t){this.defaults=t||{},this.interceptors={request:new vc,response:new vc}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=(()=>{if(!s.stack)return"";const a=s.stack.indexOf(`
|
|
493
493
|
`);return a===-1?"":s.stack.slice(a+1)})();try{if(!n.stack)n.stack=i;else if(i){const a=i.indexOf(`
|
|
494
494
|
`),o=a===-1?-1:i.indexOf(`
|
|
495
495
|
`,a+1),l=o===-1?"":i.slice(o+1);String(n.stack).endsWith(l)||(n.stack+=`
|
|
496
|
-
`+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=dn(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&yi.assertOptions(n,{silentJSONParsing:pt.transitional(pt.boolean),forcedJSONParsing:pt.transitional(pt.boolean),clarifyTimeoutError:pt.transitional(pt.boolean),legacyInterceptorReqResOrdering:pt.transitional(pt.boolean),advertiseZstdAcceptEncoding:pt.transitional(pt.boolean),validateStatusUndefinedResolves:pt.transitional(pt.boolean)},!1),s!=null&&(I.isFunction(s)?r.paramsSerializer={serialize:s}:yi.assertOptions(s,{encode:pt.function,serialize:pt.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),yi.assertOptions(r,{baseUrl:pt.spelling("baseURL"),withXsrfToken:pt.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=i&&I.merge(i.common,i[r.method]);i&&I.forEach(["delete","get","head","post","put","patch","query","common"],w=>{delete i[w]}),r.headers=Ct.concat(a,i);const o=[];let l=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(r)===!1)return;l=l&&h.synchronous;const y=r.transitional||fl;y&&y.legacyInterceptorReqResOrdering?o.unshift(h.fulfilled,h.rejected):o.push(h.fulfilled,h.rejected)});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let f,d=0,g;if(!l){const w=[Nc.bind(this),void 0];for(w.unshift(...o),w.push(...u),g=w.length,f=Promise.resolve(r);d<g;)f=f.then(w[d++],w[d++]);return f}g=o.length;let p=r;for(;d<g;){const w=o[d++],h=o[d++];try{p=w(p)}catch(y){h.call(this,y);break}}try{f=Nc.call(this,p)}catch(w){return Promise.reject(w)}for(d=0,g=u.length;d<g;)f=f.then(u[d++],u[d++]);return f}getUri(t){t=dn(this.defaults,t);const r=Ff(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Rf(r,t.params,t.paramsSerializer)}};I.forEach(["delete","get","head","options"],function(t){ln.prototype[t]=function(r,n){return this.request(dn(n||{},{method:t,url:r,data:n&&I.hasOwnProp(n,"data")?n.data:void 0}))}});I.forEach(["post","put","patch","query"],function(t){function r(n){return function(i,a,o){return this.request(dn(o||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}ln.prototype[t]=r(),t!=="query"&&(ln.prototype[t+"Form"]=r(!0))});let __=class qf{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const a=new Promise(o=>{n.subscribe(o),i=o}).then(s);return a.cancel=function(){n.unsubscribe(i)},a},t(function(i,a,o){n.reason||(n.reason=new Gs(i,a,o),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new qf(function(s){t=s}),cancel:t}}};function T_(e){return function(r){return e.apply(null,r)}}function E_(e){return I.isObject(e)&&e.isAxiosError===!0}const Io={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Io).forEach(([e,t])=>{Io[t]=e});function Uf(e){const t=new ln(e),r=vf(ln.prototype.request,t);return I.extend(r,ln.prototype,t,{allOwnKeys:!0}),I.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return Uf(dn(e,s))},r}const Xe=Uf(Qs);Xe.Axios=ln;Xe.CanceledError=Gs;Xe.CancelToken=__;Xe.isCancel=Lf;Xe.VERSION=pl;Xe.toFormData=na;Xe.AxiosError=Z;Xe.Cancel=Xe.CanceledError;Xe.all=function(t){return Promise.all(t)};Xe.spread=T_;Xe.isAxiosError=E_;Xe.mergeConfig=dn;Xe.AxiosHeaders=Ct;Xe.formToJSON=e=>kf(I.isHTMLForm(e)?new FormData(e):e);Xe.getAdapter=$f.getAdapter;Xe.HttpStatusCode=Io;Xe.default=Xe;const{Axios:rM,AxiosError:nM,CanceledError:sM,isCancel:iM,CancelToken:aM,VERSION:oM,all:lM,Cancel:cM,isAxiosError:uM,spread:dM,toFormData:fM,AxiosHeaders:hM,HttpStatusCode:pM,formToJSON:mM,getAdapter:gM,mergeConfig:yM,create:vM}=Xe;let Oo="";function zf(e){Oo=e}const Ne=Xe.create({timeout:3e4});Ne.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>pv),n=(s=t.getState().editorConfig)==null?void 0:s.context;return e.headers=e.headers??{},n!=null&&n.authToken&&(e.headers.Authorization=`Bearer ${n.authToken}`),n!=null&&n.userToken&&(e.headers["X-Authenticated-User-Token"]=n.userToken),n!=null&&n.channel&&(e.headers["X-Channel-Id"]=n.channel),Oo&&(e.baseURL=Oo),e});const Vf=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function I_(e,t={}){var l,u,f,d;const n={"organisations.roles":[((l=t.objectType)==null?void 0:l.toLowerCase())==="textbook"?"BOOK_CREATOR":"CONTENT_CREATOR"]};t.rootOrgId&&(n.rootOrgId=[t.rootOrgId]);const s=e.includes("@"),i=/^\d{10,}$/.test(e.trim()),a={filters:n,fields:Vf,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():a.query=e,((d=(f=(u=(await Ne.post("/action/user/v1/search",{request:a},{params:{fields:"orgName"},headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:u.result)==null?void 0:f.response)==null?void 0:d.content)??[]}async function O_(e){var r,n,s;return e.length?((s=(n=(r=(await Ne.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Vf,limit:e.length}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:r.result)==null?void 0:n.response)==null?void 0:s.content)??[]:[]}async function A_(e){var r,n;return((n=(r=(await Ne.get(`/portal/user/v5/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.response)??{}}const Hf="/portal";async function Qf(e){var n,s,i,a,o,l,u;const t=await Ne.get(`${Hf}/questionset/v2/hierarchy/${e}`,{params:{mode:"edit"}}),r=(s=(n=t.data)==null?void 0:n.result)==null?void 0:s.questionset;if(!r||!r.identifier){const f=((a=(i=t.data)==null?void 0:i.params)==null?void 0:a.errmsg)||((l=(o=t.data)==null?void 0:o.params)==null?void 0:l.err)||((u=t.data)==null?void 0:u.responseCode)||`No questionset returned for "${e}"`;throw new Error(`Unable to load questionset hierarchy: ${f}`)}return r}async function D_(e){var r,n;return e.length?((n=(r=(await Ne.post(`${Hf}/question/v2/list`,{request:{search:{identifier:e}}})).data)==null?void 0:r.result)==null?void 0:n.questions)??[]:[]}function gl(e,t){const r=e??{},n=r.identifier??"",s=r.objectType??"",i=r.mimeType??"",a=r.children,o=Array.isArray(a)?a.map(u=>gl(u,n)):[],l=i==="application/vnd.ekstep.content-collection"||s.toLowerCase().includes("unit")||s.toLowerCase().includes("textbook")||s.toLowerCase().includes("collection")||s.toLowerCase().includes("course")||s.toLowerCase().includes("lesson")||r.visibility==="Parent"||i==="application/vnd.sunbird.questionset"&&o.length>0;return{id:n,identifier:n,name:r.name??"Untitled",title:r.name??"Untitled",description:r.description,primaryCategory:r.primaryCategory,mimeType:r.mimeType,objectType:s,contentType:r.contentType,visibility:r.visibility,status:r.status,appIcon:r.appIcon,isFolder:l,children:o,metadata:r,parent:t}}async function Gf(e){var s,i,a,o,l,u,f;const t=await Ne.get(`/action/content/v3/hierarchy/${e}`,{params:{mode:"edit"}}),r=(i=(s=t.data)==null?void 0:s.result)==null?void 0:i.content;if(!r||!r.identifier){const d=((o=(a=t.data)==null?void 0:a.params)==null?void 0:o.errmsg)||((u=(l=t.data)==null?void 0:l.params)==null?void 0:u.err)||((f=t.data)==null?void 0:f.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${d}`)}const n=gl(r);return{content:r,rootNode:n}}async function N_(e){const t=await Qf(e),r=gl(t);return{content:t,rootNode:r}}async function R_(e,t,r,n){var i;return((i=(await Ne.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:i.result)??{}}async function j_(e,t=""){await Ne.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function k_(e){var r,n;return(n=(r=(await Ne.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function L_(e){await Ne.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function P_(e,t){await Ne.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function F_(e,t){await Ne.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const M_="_container_r27rp_1",B_="_header_r27rp_13",$_="_title_r27rp_22",q_="_closeBtn_r27rp_29",U_="_body_r27rp_45",z_="_label_r27rp_54",V_="_searchSection_r27rp_62",H_="_searchRow_r27rp_68",Q_="_searchInput_r27rp_74",G_="_searchSpinner_r27rp_89",W_="_resultsList_r27rp_105",K_="_resultItem_r27rp_118",Y_="_userInfo_r27rp_133",Z_="_userName_r27rp_141",X_="_userEmail_r27rp_150",J_="_userOrg_r27rp_158",e0="_noResults_r27rp_167",t0="_collabSection_r27rp_174",r0="_sectionTitle_r27rp_179",n0="_badge_r27rp_189",s0="_emptyCollab_r27rp_203",i0="_collabList_r27rp_214",a0="_collabItem_r27rp_223",o0="_userAvatar_r27rp_237",l0="_error_r27rp_251",c0="_success_r27rp_257",u0="_footer_r27rp_263",Ie={container:M_,header:B_,title:$_,closeBtn:q_,body:U_,label:z_,searchSection:V_,searchRow:H_,searchInput:Q_,searchSpinner:G_,resultsList:W_,resultItem:K_,userInfo:Y_,userName:Z_,userEmail:X_,userOrg:J_,noResults:e0,collabSection:t0,sectionTitle:r0,badge:n0,emptyCollab:s0,collabList:i0,collabItem:a0,userAvatar:o0,error:l0,success:c0,footer:u0},d0=({contentId:e,onClose:t})=>{var P,B;const r=le(),n=ce(D=>D.editorConfig),s=(P=n==null?void 0:n.context)==null?void 0:P.channel,i=(B=n==null?void 0:n.config)==null?void 0:B.objectType,[a,o]=m.useState(""),[l,u]=m.useState([]),[f,d]=m.useState(!1),[g,p]=m.useState([]),[w,h]=m.useState(!1),[y,v]=m.useState(""),[b,C]=m.useState(!1),S=m.useRef(null);m.useEffect(()=>{let D=!1;return(async()=>{try{const j=await k_(e),M=(j==null?void 0:j.collaborators)??[];if(!M.length)return;const k=await O_(M);if(D)return;const L=M.map(z=>k.find(X=>X.identifier===z)??{identifier:z,firstName:z});p(L)}catch{}})(),()=>{D=!0}},[e]),m.useEffect(()=>{S.current&&clearTimeout(S.current);const D=a.trim();if(D.length<2){u([]);return}return S.current=setTimeout(async()=>{d(!0);try{const j=await I_(D,{rootOrgId:s,objectType:i}),M=new Set(g.map(k=>k.identifier));u(j.filter(k=>!M.has(k.identifier)))}catch{u([])}finally{d(!1)}},300),()=>{S.current&&clearTimeout(S.current)}},[a,g,s,i]);const _=m.useCallback(D=>{p(j=>j.find(M=>M.identifier===D.identifier)?j:[...j,D]),u(j=>j.filter(M=>M.identifier!==D.identifier)),C(!1)},[]),E=m.useCallback(D=>{p(j=>j.filter(M=>M.identifier!==D)),C(!1)},[]),N=m.useCallback(async()=>{h(!0),v(""),C(!1);try{await F_(e,g.map(D=>D.identifier)),C(!0)}catch{v(r.manageCollaborators.saveFailed)}finally{h(!1)}},[e,g,r.manageCollaborators.saveFailed]),R=D=>`${D.firstName}${D.lastName?` ${D.lastName}`:""}`;return c.jsxs("div",{className:Ie.container,children:[c.jsxs("div",{className:Ie.header,children:[c.jsx("h2",{className:Ie.title,children:r.manageCollaborators.title}),c.jsx("button",{className:Ie.closeBtn,onClick:t,"aria-label":r.manageCollaborators.closeAriaLabel,children:c.jsx(Cr,{size:18})})]}),c.jsxs("div",{className:Ie.body,children:[c.jsxs("div",{className:Ie.searchSection,children:[c.jsx("label",{className:Ie.label,htmlFor:"collab-search",children:r.manageCollaborators.searchUsersLabel}),c.jsxs("div",{className:Ie.searchRow,children:[c.jsx("input",{id:"collab-search",type:"text",className:Ie.searchInput,placeholder:r.manageCollaborators.searchPlaceholder,value:a,onChange:D=>o(D.target.value)}),f&&c.jsx("span",{className:Ie.searchSpinner,"aria-label":r.manageCollaborators.searchingAriaLabel})]}),l.length>0&&c.jsx("ul",{className:Ie.resultsList,role:"listbox","aria-label":r.manageCollaborators.searchResultsAriaLabel,children:l.map(D=>{var j,M,k,L;return c.jsxs("li",{className:Ie.resultItem,role:"option","aria-selected":"false",children:[c.jsxs("div",{className:Ie.userInfo,children:[c.jsx("span",{className:Ie.userName,children:R(D)}),D.email&&c.jsx("span",{className:Ie.userEmail,children:D.email}),(((M=(j=D.organisations)==null?void 0:j[0])==null?void 0:M.orgName)??D.rootOrgName)&&c.jsx("span",{className:Ie.userOrg,children:((L=(k=D.organisations)==null?void 0:k[0])==null?void 0:L.orgName)??D.rootOrgName})]}),c.jsx(Fe,{variant:"primary",size:"sm",onClick:()=>_(D),children:r.manageCollaborators.add})]},D.identifier)})}),a.trim().length>=2&&!f&&l.length===0&&c.jsx("p",{className:Ie.noResults,children:r.manageCollaborators.noUsersFound})]}),c.jsxs("div",{className:Ie.collabSection,children:[c.jsxs("h3",{className:Ie.sectionTitle,children:[r.manageCollaborators.currentCollaborators,g.length>0&&c.jsx("span",{className:Ie.badge,children:g.length})]}),g.length===0?c.jsx("p",{className:Ie.emptyCollab,children:r.manageCollaborators.noCollaboratorsYet}):c.jsx("ul",{className:Ie.collabList,children:g.map(D=>{var j,M,k,L;return c.jsxs("li",{className:Ie.collabItem,children:[c.jsx("div",{className:Ie.userAvatar,"aria-hidden":"true",children:R(D).charAt(0).toUpperCase()}),c.jsxs("div",{className:Ie.userInfo,children:[c.jsx("span",{className:Ie.userName,children:R(D)}),D.email&&c.jsx("span",{className:Ie.userEmail,children:D.email}),(((M=(j=D.organisations)==null?void 0:j[0])==null?void 0:M.orgName)??D.rootOrgName)&&c.jsx("span",{className:Ie.userOrg,children:((L=(k=D.organisations)==null?void 0:k[0])==null?void 0:L.orgName)??D.rootOrgName})]}),c.jsx(Fe,{variant:"danger",size:"sm",onClick:()=>E(D.identifier),children:r.manageCollaborators.remove})]},D.identifier)})})]}),y&&c.jsx("p",{className:Ie.error,role:"alert",children:y}),b&&c.jsx("p",{className:Ie.success,role:"status",children:r.manageCollaborators.saveSuccess})]}),c.jsxs("div",{className:Ie.footer,children:[c.jsx(Fe,{variant:"ghost",onClick:t,disabled:w,children:r.manageCollaborators.cancel}),c.jsx(Fe,{variant:"primary",isLoading:w,onClick:N,children:r.manageCollaborators.save})]})]})};async function f0(e){return(await Ne.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function h0(e,t){var s;const n=((s=(await Ne.post(`/action/dialcode/v1/reserve/${e}`,{request:{dialcodes:{count:t,qrCodeSpec:{errorCorrectionLevel:"H"}}}})).data)==null?void 0:s.result)??{};return{processId:n.processId??"",reservedDialcodes:n.reservedDialcodes??{}}}async function p0(e){var n;const r=((n=(await Ne.get(`/action/dialcode/v1/process/status/${e}`)).data)==null?void 0:n.result)??{status:"PENDING"};return{...r,status:r.status==="PENDING"?"in-process":r.status}}const m0="_topbar_zj8wk_1",g0="_left_zj8wk_15",y0="_right_zj8wk_23",v0="_backBtn_zj8wk_30",b0="_title_zj8wk_49",w0="_statusChip_zj8wk_61",C0="_savedIndicator_zj8wk_73",S0="_unsaved_zj8wk_83",x0="_iconBtn_zj8wk_88",_0="_iconBtnLabel_zj8wk_115",T0="_qrDropdown_zj8wk_119",E0="_qrMenu_zj8wk_123",I0="_reviewBtns_zj8wk_158",O0="_sourcingBtns_zj8wk_167",A0="_modalOverlay_zj8wk_176",D0="_sbOverlay_zj8wk_186",N0="_sbModal_zj8wk_196",R0="_sbModalHeader_zj8wk_207",j0="_sbModalTitle_zj8wk_215",k0="_sbModalClose_zj8wk_222",L0="_sbModalBody_zj8wk_235",P0="_sbLabel_zj8wk_242",F0="_sbTextarea_zj8wk_249",M0="_sbError_zj8wk_266",B0="_sbModalFooter_zj8wk_273",ue={topbar:m0,left:g0,right:y0,backBtn:v0,title:b0,statusChip:w0,savedIndicator:C0,unsaved:S0,iconBtn:x0,iconBtnLabel:_0,qrDropdown:T0,qrMenu:E0,reviewBtns:I0,sourcingBtns:O0,modalOverlay:A0,sbOverlay:D0,sbModal:N0,sbModalHeader:R0,sbModalTitle:j0,sbModalClose:k0,sbModalBody:L0,sbLabel:P0,sbTextarea:F0,sbError:M0,sbModalFooter:B0};function $0(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function q0(e,t){return typeof e=="string"&&e.trim().length>0?e.trim():t}const U0=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:a})=>{const o=le(),[l,u]=m.useState(""),f=e.toLowerCase().replace(/\s+/g,"-");return c.jsx("div",{className:ue.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${f}-title`,children:c.jsxs("div",{className:ue.sbModal,children:[c.jsxs("div",{className:ue.sbModalHeader,children:[c.jsx("span",{id:`${f}-title`,className:ue.sbModalTitle,children:e}),c.jsx("button",{className:ue.sbModalClose,onClick:a,"aria-label":o.reviewCommentModal.closeAriaLabel,type:"button",children:"×"})]}),c.jsxs("div",{className:ue.sbModalBody,children:[c.jsxs("label",{className:ue.sbLabel,htmlFor:`${f}-comment`,children:[t," ",c.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),c.jsx("textarea",{id:`${f}-comment`,className:ue.sbTextarea,placeholder:r,value:l,onChange:d=>u(d.target.value),rows:4,required:!0,"aria-required":"true"}),l.trim().length===0&&c.jsx("p",{className:ue.sbError,children:o.reviewCommentModal.fillCommentsError})]}),c.jsxs("div",{className:ue.sbModalFooter,children:[c.jsx(Fe,{variant:"ghost",onClick:a,children:o.reviewCommentModal.cancelButton}),c.jsx(Fe,{variant:s,onClick:()=>i(l.trim()),disabled:l.trim().length===0,children:n})]})]})})},z0=({onConfirm:e,onCancel:t})=>{const r=le(),[n,s]=m.useState(!1);return c.jsx("div",{className:ue.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:c.jsxs("div",{className:ue.sbModal,children:[c.jsxs("div",{className:ue.sbModalHeader,children:[c.jsx("span",{id:"review-confirm-title",className:ue.sbModalTitle,children:r.confirmReviewModal.title}),c.jsx("button",{className:ue.sbModalClose,onClick:t,"aria-label":r.confirmReviewModal.closeAriaLabel,type:"button",children:"×"})]}),c.jsx("div",{className:ue.sbModalBody,children:c.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:1.55},children:[c.jsx("input",{type:"checkbox",checked:n,onChange:i=>s(i.target.checked),style:{marginTop:2}}),c.jsxs("span",{children:[r.confirmReviewModal.agreementTextPart1," ",c.jsx("a",{className:"sb-color-primary",style:{fontWeight:600},href:"https://creativecommons.org/licenses",target:"_blank",rel:"noreferrer",children:r.confirmReviewModal.creativeCommonsLinkText})," ",r.confirmReviewModal.agreementTextPart2," ",c.jsx("strong",{children:r.confirmReviewModal.contentPolicyText}),r.confirmReviewModal.agreementTextPart3]})]})}),c.jsxs("div",{className:ue.sbModalFooter,children:[c.jsx(Fe,{variant:"ghost",onClick:t,children:r.confirmReviewModal.cancelButton}),c.jsx(Fe,{variant:"primary",onClick:e,disabled:!n,children:r.confirmReviewModal.submitButton})]})]})})},V0=({onConfirm:e,onCancel:t})=>{const r=le(),[n,s]=m.useState(""),i=parseInt(n,10),a=!isNaN(i)&&i>=2&&i<=250;return c.jsx("div",{className:ue.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:c.jsxs("div",{className:ue.sbModal,children:[c.jsxs("div",{className:ue.sbModalHeader,children:[c.jsx("span",{id:"genqr-title",className:ue.sbModalTitle,children:r.generateQRModal.title}),c.jsx("button",{className:ue.sbModalClose,onClick:t,"aria-label":r.generateQRModal.closeAriaLabel,type:"button",children:"×"})]}),c.jsxs("div",{className:ue.sbModalBody,children:[c.jsxs("label",{className:ue.sbLabel,htmlFor:"qr-count",children:[r.generateQRModal.numberOfCodesLabel," ",c.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),c.jsx("input",{id:"qr-count",type:"number",min:2,max:250,className:ue.sbTextarea,style:{resize:"none",height:"40px"},placeholder:r.generateQRModal.countPlaceholder,value:n,onChange:o=>s(o.target.value)}),n&&!a&&c.jsx("p",{className:ue.sbError,children:r.generateQRModal.countRangeError})]}),c.jsxs("div",{className:ue.sbModalFooter,children:[c.jsx(Fe,{variant:"ghost",onClick:t,children:r.generateQRModal.cancelButton}),c.jsx(Fe,{variant:"primary",onClick:()=>e(i),disabled:!a,children:r.generateQRModal.generateButton})]})]})})},H0=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var ie,fe;const a=le(),l=Oe(J=>J.treeData)[0],u=(l==null?void 0:l.name)??a.contextualEditor.untitledPlaceholder,f=q0(((ie=l==null?void 0:l.metadata)==null?void 0:ie.status)??(l==null?void 0:l.status),a.topbar.draftStatusFallback),d=ce(J=>{var se,je,Te,$e;return((je=(se=J.editorConfig)==null?void 0:se.context)==null?void 0:je.contentId)??(($e=(Te=J.editorConfig)==null?void 0:Te.context)==null?void 0:$e.identifier)??""}),{activeModal:g,modalData:p,closeModal:w,openModal:h}=vv(),y=ce(J=>J.buttonLoaders),v=ce(J=>J.categoryMeta),b=!v||v.schemaDefaults.generateDIALCodes!=="No",[C,S]=m.useState(!1),[_,E]=m.useState(!1),[N,R]=m.useState(!1),P=m.useRef(null),[B,D]=m.useState(!1);m.useEffect(()=>{if(!N)return;const J=se=>{var je;(je=P.current)!=null&&je.contains(se.target)||R(!1)};return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[N]);const[j,M]=m.useState(!1),[k,L]=m.useState(!1),{updateNode:z}=Oe(),X=(fe=l==null?void 0:l.metadata)==null?void 0:fe.qrCodeProcessId,ye=m.useCallback(async J=>{if(d){D(!1),M(!0);try{const{processId:se,reservedDialcodes:je}=await h0(d,J);se&&l&&z(l.id,{qrCodeProcessId:se,reservedDialcodes:je}),Ee.success(a.topbar.qrGenerationStartedToast)}catch{Ee.error(a.topbar.qrGenerationFailedToast)}finally{M(!1)}}},[d,l,z,a]),_e=m.useCallback(async()=>{if(!X){Ee.error(a.topbar.qrCodesNotGeneratedToast);return}L(!0);try{const J=await p0(X);if(J.status==="in-process"){Ee(a.topbar.qrGenerationInProgressToast,{icon:c.jsx(rl,{size:16})});return}const se=J.url;if(!se){Ee.error(a.topbar.qrCodesNotReadyToast);return}const je=await fetch(se).then(Ue=>Ue.blob()),Te=await new Promise(Ue=>{const Ze=new FileReader;Ze.onloadend=()=>Ue(Ze.result),Ze.readAsDataURL(je)}),$e=(l==null?void 0:l.metadata)??{},Ve=Ue=>Array.isArray(Ue)?Ue.join("_"):typeof Ue=="string"?Ue:"",qe=[d,Ve($e.medium),Ve($e.gradeLevel),Ve($e.subject)].filter(Boolean),re=new Date().toISOString().replace(/[:.]/g,"-"),He=`${qe.join("_")}_${re}.zip`,ze=document.createElement("a");ze.href=Te,ze.download=He,ze.style.display="none",document.body.appendChild(ze),ze.click(),document.body.removeChild(ze),Ee.success(a.topbar.qrCodesDownloadedToast)}catch{Ee.error(a.topbar.qrCodesDownloadFailedToast)}finally{L(!1)}},[X,l,d,a]),we=e==="edit",de=e==="review",Q=e==="sourcingreview",ne=e==="read",te=m.useCallback((J,se)=>{i({action:J,data:se})},[i]),q=m.useCallback(()=>{w(),te("publish")},[w,te]),V=m.useCallback((J,se)=>{const je=p==null?void 0:p.action;w(),je==="approve"?te("sourcingApprove",{comment:J,score:se}):te("reject",{comment:J})},[w,te,p]);return c.jsxs(c.Fragment,{children:[c.jsxs("header",{className:ue.topbar,role:"banner",children:[c.jsxs("div",{className:ue.left,children:[c.jsx("button",{className:ue.backBtn,onClick:()=>te("back"),"aria-label":a.topbar.backAriaLabel,type:"button",children:c.jsx(Ay,{size:18})}),c.jsx("h1",{className:ue.title,title:u,children:u}),c.jsx("span",{className:`sbx-chip ${ue.statusChip}`,"aria-label":`${a.topbar.statusAriaLabelPrefix} ${f}`,children:f})]}),c.jsxs("div",{className:ue.right,children:[c.jsx(hS,{}),t?c.jsx("span",{className:ue.savedIndicator,"aria-live":"polite",children:a.topbar.savingIndicator}):r&&we?c.jsx("span",{className:`${ue.savedIndicator} ${ue.unsaved}`,"aria-live":"polite",children:a.topbar.unsavedIndicator}):n?c.jsxs("span",{className:ue.savedIndicator,"aria-live":"polite",children:[c.jsx(Wn,{size:14,"aria-hidden":"true"}),a.topbar.savedIndicatorPrefix," ",$0(n)]}):null,!ne&&!de&&!Q&&f!=="Review"&&c.jsx("span",{title:s?void 0:a.topbar.fillRequiredFieldsTooltip,children:c.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>te("saveCollection"),disabled:!s,children:a.topbar.saveAsDraftButton})}),we&&c.jsxs(c.Fragment,{children:[c.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>E(!0),disabled:y.saveCollection,isLoading:y.saveCollection,children:[c.jsx(Ky,{size:14,"aria-hidden":"true"})," ",a.topbar.sendForReviewButton]}),c.jsx("button",{className:ue.iconBtn,onClick:()=>h("manageCollaborators"),"aria-label":a.topbar.collaboratorsLabel,title:a.topbar.collaboratorsLabel,type:"button",children:c.jsx(tv,{size:16,"aria-hidden":"true"})}),b&&c.jsxs("div",{className:ue.qrDropdown,ref:P,children:[c.jsxs("button",{className:ue.iconBtn,onClick:()=>R(J=>!J),"aria-label":a.topbar.qrCodesLabel,title:a.topbar.qrCodesLabel,type:"button","aria-haspopup":"true","aria-expanded":N,children:[c.jsx(ic,{size:16,"aria-hidden":"true"}),c.jsx("span",{className:ue.iconBtnLabel,children:a.topbar.qrCodesLabel}),c.jsx(Kn,{size:14,style:{marginLeft:2},"aria-hidden":"true"})]}),N&&c.jsxs("div",{className:ue.qrMenu,role:"menu",children:[c.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{R(!1),D(!0)},disabled:j,children:[c.jsx(ic,{size:14}),j?a.topbar.generatingEllipsis:a.topbar.generateQrCodesMenuItem]}),c.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{R(!1),_e()},disabled:k||!X,children:[c.jsx(Py,{size:14}),k?a.topbar.downloadingEllipsis:a.topbar.downloadQrCodesMenuItem]})]})]})]}),de&&c.jsxs("div",{className:ue.reviewBtns,children:[c.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>h("publishChecklist"),disabled:y.publishCollection,isLoading:y.publishCollection,children:[c.jsx(af,{size:14,"aria-hidden":"true"})," ",a.topbar.publishButton]}),c.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>S(!0),disabled:y.rejectCollection,isLoading:y.rejectCollection,children:[c.jsx(ac,{size:14,"aria-hidden":"true"})," ",a.topbar.requestForChangesButton]})]}),Q&&c.jsxs("div",{className:ue.sourcingBtns,children:[c.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>h("qualityParams",{action:"approve"}),children:[c.jsx(Yy,{size:14,"aria-hidden":"true"})," ",a.topbar.approveButton]}),c.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>h("qualityParams",{action:"reject"}),children:[c.jsx(ac,{size:14,"aria-hidden":"true"})," ",a.topbar.requestForChangesButton]})]})]})]}),g==="publishChecklist"&&c.jsx(IS,{contentId:d,onConfirm:q,onCancel:w}),g==="qualityParams"&&c.jsx(OS,{contentId:d,action:(p==null?void 0:p.action)??"reject",onConfirm:V,onCancel:w}),g==="manageCollaborators"&&c.jsx("div",{className:ue.modalOverlay,role:"dialog","aria-modal":"true",children:c.jsx(d0,{contentId:d,onClose:w})}),_&&c.jsx(z0,{onConfirm:()=>{E(!1),te("sendForReview")},onCancel:()=>E(!1)}),C&&c.jsx(U0,{titleText:a.topbar.requestChangesTitle,labelText:a.topbar.changesRequestedLabel,placeholderText:a.topbar.describeChangesPlaceholder,submitLabel:a.topbar.requestForChangesButton,submitVariant:"primary",onConfirm:J=>{S(!1),te("reject",{comment:J})},onCancel:()=>S(!1)}),B&&c.jsx(V0,{onConfirm:ye,onCancel:()=>D(!1)})]})},Q0=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>{const s=le();return Br.createPortal(c.jsx("div",{className:ke.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:c.jsxs("div",{className:ke.modal,children:[c.jsxs("div",{className:ke.modalHeader,children:[c.jsx("span",{id:"unsaved-title",children:s.unsavedChangesModal.title}),c.jsx("button",{className:ke.modalHeaderClose,onClick:r,"aria-label":s.unsavedChangesModal.closeAriaLabel,disabled:n,children:"×"})]}),c.jsx("div",{className:ke.modalBody,children:c.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:s.unsavedChangesModal.bodyMessage})}),c.jsxs("div",{className:ke.modalFooter,children:[c.jsx(Fe,{variant:"ghost",onClick:r,disabled:n,children:s.unsavedChangesModal.cancelButton}),c.jsx(Fe,{variant:"danger",onClick:t,disabled:n,children:s.unsavedChangesModal.discardButton}),c.jsx(Fe,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:s.unsavedChangesModal.saveButton})]})]})}),document.body)};var G0=ll();const Wf=m.createContext(null);function Rt(){const e=m.useContext(Wf);if(e===null)throw new Error("No Tree Api Provided");return e}const Kf=m.createContext(null);function W0(){const e=m.useContext(Kf);if(e===null)throw new Error("Provide a NodesContext");return e}const Yf=m.createContext(null);function K0(){const e=m.useContext(Yf);if(e===null)throw new Error("Provide a DnDContext");return e}const Zf=m.createContext(0);function Xf(){m.useContext(Zf)}function vi(e,t,r){return Math.max(Math.min(e,r),t)}function Jf(e){return e&&e.isLeaf}function eh(e){return e&&e.isInternal&&!e.isOpen}function th(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const rh=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},nh=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function yl(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=yl(r,t);if(n)return n}return null}function Bi(e,t){if(t(e),e.children)for(let r of e.children)Bi(r,t)}function sh(e){const t=ah(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=Y0(t,n);break}r==null||r.focus()}function ih(e){const t=ah(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=Z0(t,n);break}r==null||r.focus()}function Y0(e,t){return t+1<e.length?e[t+1]:e[0]}function Z0(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function ah(e){return Array.from(document.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')).filter(t=>t===e||!e.contains(t))}function ps(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function _n(e){return typeof e=="string"?e:e.id}function X0(e,...t){if(e)return e(...t)}function oh(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function lh(e){var t,r;const n=e.focusedNode;return n?n.isOpen?0:n.parent?n.childIndex+1:0:(r=(t=e.root.children)===null||t===void 0?void 0:t.length)!==null&&r!==void 0?r:0}function ch(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const J0=Object.freeze(Object.defineProperty({__proto__:null,access:ps,bound:vi,dfs:yl,focusNextElement:sh,focusPrevElement:ih,getInsertIndex:lh,getInsertParentId:ch,identify:_n,indexOf:nh,isClosed:eh,isDescendant:rh,isItem:Jf,isOpenWithEmptyChildren:th,safeRun:X0,waitFor:oh,walk:Bi},Symbol.toStringTag,{value:"Module"})),eT={display:"flex",alignItems:"center",zIndex:1},tT={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},rT={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},nT=m.memo(function({top:t,left:r,indent:n}){const s={position:"absolute",pointerEvents:"none",top:t-2+"px",left:r+"px",right:n+"px"};return c.jsxs("div",{style:Object.assign(Object.assign({},eT),s),children:[c.jsx("div",{style:Object.assign({},rT)}),c.jsx("div",{style:Object.assign({},tT)})]})});function sT({node:e,attrs:t,innerRef:r,children:n}){return c.jsx("div",Object.assign({},t,{ref:r,onFocus:s=>s.stopPropagation(),onClick:e.handleClick,children:n}))}function iT(e){return c.jsxs("div",{ref:e.dragHandle,style:e.style,children:[c.jsx("span",{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?"🌳":e.node.isOpen?"🗁":"🗀"})," ",e.node.isEditing?c.jsx(oT,Object.assign({},e)):c.jsx(aT,Object.assign({},e))]})}function aT(e){return c.jsx(c.Fragment,{children:c.jsx("span",{children:e.node.data.name})})}function oT({node:e}){const t=m.useRef();return m.useEffect(()=>{var r,n;(r=t.current)===null||r===void 0||r.focus(),(n=t.current)===null||n===void 0||n.select()},[]),c.jsx("input",{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:r=>{var n;r.key==="Escape"&&e.reset(),r.key==="Enter"&&e.submit(((n=t.current)===null||n===void 0?void 0:n.value)||"")}})}const As="__REACT_ARBORIST_INTERNAL_ROOT__";function jc(e){var t;function r(i,a,o){const l=e.accessId(i),u=new Ds({tree:e,data:i,level:a,parent:o,id:l,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),f=e.accessChildren(i);return f&&(u.children=f.map(d=>r(d,a+1,u))),u}const n=new Ds({tree:e,id:As,data:{id:As},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),s=(t=e.props.data)!==null&&t!==void 0?t:[];return n.children=s.map(i=>r(i,0,n)),n}class Ds{constructor(t){this.handleClick=r=>{(r.metaKey||r.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():r.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=t.tree,this.id=t.id,this.data=t.data,this.level=t.level,this.children=t.children,this.parent=t.parent,this.isDraggable=t.isDraggable,this.rowIndex=t.rowIndex}get isRoot(){return this.id===As}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return this.isLeaf?!1:this.tree.isOpen(this.id)}get isClosed(){return this.isLeaf?!1:!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var t;return this.isSelected&&!(!((t=this.prev)===null||t===void 0)&&t.isSelected)}get isSelectedEnd(){var t;return this.isSelected&&!(!((t=this.next)===null||t===void 0)&&t.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(t=>t.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var t,r;const n=this.childIndex;return(r=(t=this.parent)===null||t===void 0?void 0:t.children[n+1])!==null&&r!==void 0?r:null}isAncestorOf(t){if(!t)return!1;let r=t;for(;r;){if(r.id===this.id)return!0;r=r.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(t){this.tree.submit(this,t)}reset(){this.tree.reset()}clone(){return new Ds(Object.assign({},this))}edit(){return this.tree.edit(this)}}function Aa(e){return{type:"EDIT",id:e}}function lT(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function gn(e){return{type:"FOCUS",id:e}}function cT(){return{type:"TREE_BLUR"}}function uT(e={id:null,treeFocused:!1},t){return t.type==="FOCUS"?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):t.type==="TREE_BLUR"?Object.assign(Object.assign({},e),{treeFocused:!1}):e}const Ao={open(e,t){return{type:"VISIBILITY_OPEN",id:e,filtered:t}},close(e,t){return{type:"VISIBILITY_CLOSE",id:e,filtered:t}},toggle(e,t){return{type:"VISIBILITY_TOGGLE",id:e,filtered:t}},clear(e){return{type:"VISIBILITY_CLEAR",filtered:e}}};function kc(e={},t){if(t.type==="VISIBILITY_OPEN")return Object.assign(Object.assign({},e),{[t.id]:!0});if(t.type==="VISIBILITY_CLOSE")return Object.assign(Object.assign({},e),{[t.id]:!1});if(t.type==="VISIBILITY_TOGGLE"){const r=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!r})}else return t.type==="VISIBILITY_CLEAR"?{}:e}function dT(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:kc(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:kc(e.unfiltered,t)}):e}const zn=e=>{var t;return{nodes:{open:{filtered:{},unfiltered:(t=e==null?void 0:e.initialOpenState)!==null&&t!==void 0?t:{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:"none"},dragId:null,dragIds:[],parentId:null,index:-1}}},Tr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:_n(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(_n)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(_n)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:_n(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:_n(e)})};function fT(e=zn().nodes.selection,t){const r=e.ids;switch(t.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},e),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},e),{ids:new Set([t.id])});case"SELECTION_ADD":return t.ids.length===0?e:(t.ids.forEach(n=>r.add(n)),Object.assign(Object.assign({},e),{ids:new Set(r)}));case"SELECTION_REMOVE":return t.ids.length===0?e:(t.ids.forEach(n=>r.delete(n)),Object.assign(Object.assign({},e),{ids:new Set(r)}));case"SELECTION_SET":return Object.assign(Object.assign({},e),{ids:t.ids,mostRecent:t.mostRecent,anchor:t.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},e),{mostRecent:t.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},e),{anchor:t.id});default:return e}}const Vn={cursor(e){return{type:"DND_CURSOR",cursor:e}},dragStart(e,t){return{type:"DND_DRAG_START",id:e,dragIds:t}},dragEnd(){return{type:"DND_DRAG_END"}},hovering(e,t){return{type:"DND_HOVERING",parentId:e,index:t}}};function hT(e=zn().dnd,t){switch(t.type){case"DND_CURSOR":return Object.assign(Object.assign({},e),{cursor:t.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},e),{dragId:t.id,dragIds:t.dragIds});case"DND_DRAG_END":return zn().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const pT={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},mT=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},gT=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function uh({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return c.jsxs(yT,{isDragging:s,children:[c.jsx(vT,{offset:e,children:c.jsx(wT,{id:r,dragIds:n})}),c.jsx(bT,{mouse:t,count:n.length})]})}const yT=m.memo(function(t){return t.isDragging?c.jsx("div",{style:pT,children:t.children}):null});function vT(e){return c.jsx("div",{className:"row preview",style:mT(e.offset),children:e.children})}function bT(e){const{count:t,mouse:r}=e;return t>1?c.jsx("div",{className:"selected-count",style:gT(r),children:t}):null}const wT=m.memo(function(t){const r=Rt(),n=r.get(t.id);return n?c.jsx(r.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*r.indent,opacity:.2,background:"transparent"},tree:r}):null});function Do(){return Do=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Do.apply(null,arguments)}function Lc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function No(e,t){return No=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},No(e,t)}function CT(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,No(e,t)}var Pc=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function ST(e,t){return!!(e===t||Pc(e)&&Pc(t))}function xT(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!ST(e[r],t[r]))return!1;return!0}function Da(e,t){t===void 0&&(t=xT);var r,n=[],s,i=!1;function a(){for(var o=[],l=0;l<arguments.length;l++)o[l]=arguments[l];return i&&r===this&&t(o,n)||(s=e.apply(this,o),i=!0,r=this,n=o),s}return a}var _T=typeof performance=="object"&&typeof performance.now=="function",Fc=_T?function(){return performance.now()}:function(){return Date.now()};function Mc(e){cancelAnimationFrame(e.id)}function TT(e,t){var r=Fc();function n(){Fc()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var Na=-1;function Bc(e){if(e===void 0&&(e=!1),Na===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Na=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Na}var yn=null;function $c(e){if(e===void 0&&(e=!1),yn===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),s=n.style;return s.width="100px",s.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?yn="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?yn="negative":yn="positive-ascending"),document.body.removeChild(t),yn}return yn}process.env.NODE_ENV;var ET=150,IT=function(t,r){return t},bi=null,wi=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(bi=new WeakSet,wi=new WeakSet);function dh(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,a=e.getStartIndexForOffset,o=e.getStopIndexForStartIndex,l=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,f=e.validateProps;return t=function(d){CT(g,d);function g(w){var h;return h=d.call(this,w)||this,h._instanceProps=l(h.props,Lc(h)),h._outerRef=void 0,h._resetIsScrollingTimeoutId=null,h.state={instance:Lc(h),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof h.props.initialScrollOffset=="number"?h.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},h._callOnItemsRendered=void 0,h._callOnItemsRendered=Da(function(y,v,b,C){return h.props.onItemsRendered({overscanStartIndex:y,overscanStopIndex:v,visibleStartIndex:b,visibleStopIndex:C})}),h._callOnScroll=void 0,h._callOnScroll=Da(function(y,v,b){return h.props.onScroll({scrollDirection:y,scrollOffset:v,scrollUpdateWasRequested:b})}),h._getItemStyle=void 0,h._getItemStyle=function(y){var v=h.props,b=v.direction,C=v.itemSize,S=v.layout,_=h._getItemStyleCache(u&&C,u&&S,u&&b),E;if(_.hasOwnProperty(y))E=_[y];else{var N=r(h.props,y,h._instanceProps),R=s(h.props,y,h._instanceProps),P=b==="horizontal"||S==="horizontal",B=b==="rtl",D=P?N:0;_[y]=E={position:"absolute",left:B?void 0:D,right:B?D:void 0,top:P?0:N,height:P?"100%":R,width:P?R:"100%"}}return E},h._getItemStyleCache=void 0,h._getItemStyleCache=Da(function(y,v,b){return{}}),h._onScrollHorizontal=function(y){var v=y.currentTarget,b=v.clientWidth,C=v.scrollLeft,S=v.scrollWidth;h.setState(function(_){if(_.scrollOffset===C)return null;var E=h.props.direction,N=C;if(E==="rtl")switch($c()){case"negative":N=-C;break;case"positive-descending":N=S-b-C;break}return N=Math.max(0,Math.min(N,S-b)),{isScrolling:!0,scrollDirection:_.scrollOffset<N?"forward":"backward",scrollOffset:N,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._onScrollVertical=function(y){var v=y.currentTarget,b=v.clientHeight,C=v.scrollHeight,S=v.scrollTop;h.setState(function(_){if(_.scrollOffset===S)return null;var E=Math.max(0,Math.min(S,C-b));return{isScrolling:!0,scrollDirection:_.scrollOffset<E?"forward":"backward",scrollOffset:E,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._outerRefSetter=function(y){var v=h.props.outerRef;h._outerRef=y,typeof v=="function"?v(y):v!=null&&typeof v=="object"&&v.hasOwnProperty("current")&&(v.current=y)},h._resetIsScrollingDebounced=function(){h._resetIsScrollingTimeoutId!==null&&Mc(h._resetIsScrollingTimeoutId),h._resetIsScrollingTimeoutId=TT(h._resetIsScrolling,ET)},h._resetIsScrolling=function(){h._resetIsScrollingTimeoutId=null,h.setState({isScrolling:!1},function(){h._getItemStyleCache(-1,null)})},h}g.getDerivedStateFromProps=function(h,y){return OT(h,y),f(h),null};var p=g.prototype;return p.scrollTo=function(h){h=Math.max(0,h),this.setState(function(y){return y.scrollOffset===h?null:{scrollDirection:y.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},p.scrollToItem=function(h,y){y===void 0&&(y="auto");var v=this.props,b=v.itemCount,C=v.layout,S=this.state.scrollOffset;h=Math.max(0,Math.min(h,b-1));var _=0;if(this._outerRef){var E=this._outerRef;C==="vertical"?_=E.scrollWidth>E.clientWidth?Bc():0:_=E.scrollHeight>E.clientHeight?Bc():0}this.scrollTo(i(this.props,h,y,S,this._instanceProps,_))},p.componentDidMount=function(){var h=this.props,y=h.direction,v=h.initialScrollOffset,b=h.layout;if(typeof v=="number"&&this._outerRef!=null){var C=this._outerRef;y==="horizontal"||b==="horizontal"?C.scrollLeft=v:C.scrollTop=v}this._callPropsCallbacks()},p.componentDidUpdate=function(){var h=this.props,y=h.direction,v=h.layout,b=this.state,C=b.scrollOffset,S=b.scrollUpdateWasRequested;if(S&&this._outerRef!=null){var _=this._outerRef;if(y==="horizontal"||v==="horizontal")if(y==="rtl")switch($c()){case"negative":_.scrollLeft=-C;break;case"positive-ascending":_.scrollLeft=C;break;default:var E=_.clientWidth,N=_.scrollWidth;_.scrollLeft=N-E-C;break}else _.scrollLeft=C;else _.scrollTop=C}this._callPropsCallbacks()},p.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Mc(this._resetIsScrollingTimeoutId)},p.render=function(){var h=this.props,y=h.children,v=h.className,b=h.direction,C=h.height,S=h.innerRef,_=h.innerElementType,E=h.innerTagName,N=h.itemCount,R=h.itemData,P=h.itemKey,B=P===void 0?IT:P,D=h.layout,j=h.outerElementType,M=h.outerTagName,k=h.style,L=h.useIsScrolling,z=h.width,X=this.state.isScrolling,ye=b==="horizontal"||D==="horizontal",_e=ye?this._onScrollHorizontal:this._onScrollVertical,we=this._getRangeToRender(),de=we[0],Q=we[1],ne=[];if(N>0)for(var te=de;te<=Q;te++)ne.push(m.createElement(y,{data:R,key:B(te,R),index:te,isScrolling:L?X:void 0,style:this._getItemStyle(te)}));var q=n(this.props,this._instanceProps);return m.createElement(j||M||"div",{className:v,onScroll:_e,ref:this._outerRefSetter,style:Do({position:"relative",height:C,width:z,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},k)},m.createElement(_||E||"div",{children:ne,ref:S,style:{height:ye?"100%":q,pointerEvents:X?"none":void 0,width:ye?q:"100%"}}))},p._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var h=this.props.itemCount;if(h>0){var y=this._getRangeToRender(),v=y[0],b=y[1],C=y[2],S=y[3];this._callOnItemsRendered(v,b,C,S)}}if(typeof this.props.onScroll=="function"){var _=this.state,E=_.scrollDirection,N=_.scrollOffset,R=_.scrollUpdateWasRequested;this._callOnScroll(E,N,R)}},p._getRangeToRender=function(){var h=this.props,y=h.itemCount,v=h.overscanCount,b=this.state,C=b.isScrolling,S=b.scrollDirection,_=b.scrollOffset;if(y===0)return[0,0,0,0];var E=a(this.props,_,this._instanceProps),N=o(this.props,E,_,this._instanceProps),R=!C||S==="backward"?Math.max(1,v):1,P=!C||S==="forward"?Math.max(1,v):1;return[Math.max(0,E-R),Math.max(0,Math.min(y-1,N+P)),E,N]},g}(m.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var OT=function(t,r){var n=t.children,s=t.direction,i=t.height,a=t.layout,o=t.innerTagName,l=t.outerTagName,u=t.width,f=r.instance;if(process.env.NODE_ENV!=="production"){(o!=null||l!=null)&&wi&&!wi.has(f)&&(wi.add(f),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var d=s==="horizontal"||a==="horizontal";switch(s){case"horizontal":case"vertical":bi&&!bi.has(f)&&(bi.add(f),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+s+'" was specified.'))}switch(a){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+a+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(d&&typeof u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" was specified.'));if(!d&&typeof i!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(i===null?"null":typeof i)+'" was specified.'))}},AT=50,Tn=function(t,r,n){var s=t,i=s.itemSize,a=n.itemMetadataMap,o=n.lastMeasuredIndex;if(r>o){var l=0;if(o>=0){var u=a[o];l=u.offset+u.size}for(var f=o+1;f<=r;f++){var d=i(f);a[f]={offset:l,size:d},l+=d}n.lastMeasuredIndex=r}return a[r]},DT=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,a=i>0?s[i].offset:0;return a>=n?fh(t,r,i,0,n):NT(t,r,Math.max(0,i),n)},fh=function(t,r,n,s,i){for(;s<=n;){var a=s+Math.floor((n-s)/2),o=Tn(t,a,r).offset;if(o===i)return a;o<i?s=a+1:o>i&&(n=a-1)}return s>0?s-1:0},NT=function(t,r,n,s){for(var i=t.itemCount,a=1;n<i&&Tn(t,n,r).offset<s;)n+=a,a*=2;return fh(t,r,Math.min(n,i-1),Math.floor(n/2),s)},qc=function(t,r){var n=t.itemCount,s=r.itemMetadataMap,i=r.estimatedItemSize,a=r.lastMeasuredIndex,o=0;if(a>=n&&(a=n-1),a>=0){var l=s[a];o=l.offset+l.size}var u=n-a-1,f=u*i;return o+f},RT=dh({getItemOffset:function(t,r,n){return Tn(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:qc,getOffsetForIndexAndAlignment:function(t,r,n,s,i,a){var o=t.direction,l=t.height,u=t.layout,f=t.width,d=o==="horizontal"||u==="horizontal",g=d?f:l,p=Tn(t,r,i),w=qc(t,i),h=Math.max(0,Math.min(w-g,p.offset)),y=Math.max(0,p.offset-g+p.size+a);switch(n==="smart"&&(s>=y-g&&s<=h+g?n="auto":n="center"),n){case"start":return h;case"end":return y;case"center":return Math.round(y+(h-y)/2);case"auto":default:return s>=y&&s<=h?s:s<y?y:h}},getStartIndexForOffset:function(t,r,n){return DT(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,a=t.height,o=t.itemCount,l=t.layout,u=t.width,f=i==="horizontal"||l==="horizontal",d=f?u:a,g=Tn(t,r,s),p=n+d,w=g.offset+g.size,h=r;h<o-1&&w<p;)h++,w+=Tn(t,h,s).size;return h},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||AT,lastMeasuredIndex:-1};return r.resetAfterIndex=function(a,o){o===void 0&&(o=!0),i.lastMeasuredIndex=Math.min(i.lastMeasuredIndex,a-1),r._getItemStyleCache(-1),o&&r.forceUpdate()},i},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="function")throw Error('An invalid "itemSize" prop has been specified. Value should be a function. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}}),jT=dh({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,s,i,a){var o=t.direction,l=t.height,u=t.itemCount,f=t.itemSize,d=t.layout,g=t.width,p=o==="horizontal"||d==="horizontal",w=p?g:l,h=Math.max(0,u*f-w),y=Math.min(h,r*f),v=Math.max(0,r*f-w+f+a);switch(n==="smart"&&(s>=v-w&&s<=y+w?n="auto":n="center"),n){case"start":return y;case"end":return v;case"center":{var b=Math.round(v+(y-v)/2);return b<Math.ceil(w/2)?0:b>h+Math.floor(w/2)?h:b}case"auto":default:return s>=v&&s<=y?s:s<v?v:y}},getStartIndexForOffset:function(t,r){var n=t.itemCount,s=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/s)))},getStopIndexForStartIndex:function(t,r,n){var s=t.direction,i=t.height,a=t.itemCount,o=t.itemSize,l=t.layout,u=t.width,f=s==="horizontal"||l==="horizontal",d=r*o,g=f?u:i,p=Math.ceil((g+n-d)/o);return Math.max(0,Math.min(a-1,r+p-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function kT(){var e,t;const r=Rt(),s=K0().cursor;if(!s||s.type!=="line")return null;const i=r.indent,a=r.rowTopPosition(s.index)+((t=(e=r.props.padding)!==null&&e!==void 0?e:r.props.paddingTop)!==null&&t!==void 0?t:0),o=i*s.level,l=r.renderCursor;return c.jsx(l,{top:a,left:o,indent:i})}var LT=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r};const PT=m.forwardRef(function(t,r){const{children:n}=t,s=LT(t,["children"]),i=Rt();return c.jsxs("div",Object.assign({ref:r},s,{onClick:a=>{a.currentTarget===a.target&&i.deselectAll()},children:[c.jsx(FT,{}),n]}))}),FT=()=>{const e=Rt();return c.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:c.jsx(kT,{})})};var MT=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r};const BT=m.forwardRef(function(t,r){var n,s,i,a,{style:o}=t,l=MT(t,["style"]);const u=Rt(),f=(s=(n=u.props.padding)!==null&&n!==void 0?n:u.props.paddingTop)!==null&&s!==void 0?s:0,d=(a=(i=u.props.padding)!==null&&i!==void 0?i:u.props.paddingBottom)!==null&&a!==void 0?a:0;return c.jsx("div",Object.assign({ref:r,style:Object.assign(Object.assign({},o),{height:`${parseFloat(o.height)+f+d}px`})},l))});var hh=m.createContext({dragDropManager:void 0}),Gt;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Gt||(Gt={}));function he(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];if(process.env.NODE_ENV!=="production"&&t===void 0)throw new Error("invariant requires an error message argument");if(!e){var i;if(t===void 0)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;i=new Error(t.replace(/%s/g,function(){return n[a++]})),i.name="Invariant Violation"}throw i.framesToPop=1,i}}var vl="dnd-core/INIT_COORDS",ia="dnd-core/BEGIN_DRAG",bl="dnd-core/PUBLISH_DRAG_SOURCE",aa="dnd-core/HOVER",oa="dnd-core/DROP",la="dnd-core/END_DRAG";function Uc(e,t){return{type:vl,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function Ci(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ci=function(r){return typeof r}:Ci=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ci(e)}function $T(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function qT(e,t){return e.filter(function(r){return r!==t})}function ph(e){return Ci(e)==="object"}function UT(e,t){var r=new Map,n=function(a){r.set(a,r.has(a)?r.get(a)+1:1)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i,a){i===1&&s.push(a)}),s}function zT(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var VT={type:vl,payload:{clientOffset:null,sourceClientOffset:null}};function HT(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},s=n.publishSource,i=s===void 0?!0:s,a=n.clientOffset,o=n.getSourceClientOffset,l=e.getMonitor(),u=e.getRegistry();e.dispatch(Uc(a)),QT(r,l,u);var f=KT(r,l);if(f===null){e.dispatch(VT);return}var d=null;if(a){if(!o)throw new Error("getSourceClientOffset must be defined");GT(o),d=o(f)}e.dispatch(Uc(a,d));var g=u.getSource(f),p=g.beginDrag(l,f);if(p!=null){WT(p),u.pinSource(f);var w=u.getSourceType(f);return{type:ia,payload:{itemType:w,item:p,sourceId:f,clientOffset:a||null,sourceClientOffset:d||null,isSourcePublic:!!i}}}}}function QT(e,t,r){he(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){he(r.getSource(n),"Expected sourceIds to be registered.")})}function GT(e){he(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function WT(e){he(ph(e),"Item must be an object.")}function KT(e,t){for(var r=null,n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}function YT(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:bl}}}function Ro(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function ZT(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;XT(r);var i=r.slice(0),a=e.getMonitor(),o=e.getRegistry();JT(i,a,o);var l=a.getItemType();return eE(i,o,l),tE(i,a,o),{type:aa,payload:{targetIds:i,clientOffset:s||null}}}}function XT(e){he(Array.isArray(e),"Expected targetIds to be an array.")}function JT(e,t,r){he(t.isDragging(),"Cannot call hover while not dragging."),he(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];he(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);he(i,"Expected targetIds to be registered.")}}function eE(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);Ro(i,r)||e.splice(n,1)}}function tE(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function zc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Vc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zc(Object(r),!0).forEach(function(n){rE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function rE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nE(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();sE(n);var i=oE(n);i.forEach(function(a,o){var l=iE(a,o,s,n),u={type:oa,payload:{dropResult:Vc(Vc({},r),l)}};e.dispatch(u)})}}function sE(e){he(e.isDragging(),"Cannot call drop while not dragging."),he(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function iE(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return aE(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function aE(e){he(typeof e>"u"||ph(e),"Drop result must either be an object or undefined.")}function oE(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function lE(e){return function(){var r=e.getMonitor(),n=e.getRegistry();cE(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:la}}}function cE(e){he(e.isDragging(),"Cannot call endDrag while not dragging.")}function uE(e){return{beginDrag:HT(e),publishDragSource:YT(e),hover:ZT(e),drop:nE(e),endDrag:lE(e)}}function dE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function hE(e,t,r){return t&&fE(e.prototype,t),e}function is(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var pE=function(){function e(t,r){var n=this;dE(this,e),is(this,"store",void 0),is(this,"monitor",void 0),is(this,"backend",void 0),is(this,"isSetUp",!1),is(this,"handleRefCountChange",function(){var s=n.store.getState().refCount>0;n.backend&&(s&&!n.isSetUp?(n.backend.setup(),n.isSetUp=!0):!s&&n.isSetUp&&(n.backend.teardown(),n.isSetUp=!1))}),this.store=t,this.monitor=r,t.subscribe(this.handleRefCountChange)}return hE(e,[{key:"receiveBackend",value:function(r){this.backend=r}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var r=this,n=this.store.dispatch;function s(a){return function(){for(var o=arguments.length,l=new Array(o),u=0;u<o;u++)l[u]=arguments[u];var f=a.apply(r,l);typeof f<"u"&&n(f)}}var i=uE(this);return Object.keys(i).reduce(function(a,o){var l=i[o];return a[o]=s(l),a},{})}},{key:"dispatch",value:function(r){this.store.dispatch(r)}}]),e}();function Ut(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Hc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Qc=function(){return Math.random().toString(36).substring(7).split("").join(".")},Gc={INIT:"@@redux/INIT"+Qc(),REPLACE:"@@redux/REPLACE"+Qc()};function mE(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function gE(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(bE(e))return"date";if(vE(e))return"error";var r=yE(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}function yE(e){return typeof e.constructor=="function"?e.constructor.name:null}function vE(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function bE(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function vn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=gE(e)),t}function mh(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?Ut(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?Ut(1):"Expected the enhancer to be a function. Instead, received: '"+vn(r)+"'");return r(mh)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Ut(2):"Expected the root reducer to be a function. Instead, received: '"+vn(e)+"'");var s=e,i=t,a=[],o=a,l=!1;function u(){o===a&&(o=a.slice())}function f(){if(l)throw new Error(process.env.NODE_ENV==="production"?Ut(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function d(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Ut(4):"Expected the listener to be a function. Instead, received: '"+vn(h)+"'");if(l)throw new Error(process.env.NODE_ENV==="production"?Ut(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var y=!0;return u(),o.push(h),function(){if(y){if(l)throw new Error(process.env.NODE_ENV==="production"?Ut(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");y=!1,u();var b=o.indexOf(h);o.splice(b,1),a=null}}}function g(h){if(!mE(h))throw new Error(process.env.NODE_ENV==="production"?Ut(7):"Actions must be plain objects. Instead, the actual type was: '"+vn(h)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof h.type>"u")throw new Error(process.env.NODE_ENV==="production"?Ut(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(l)throw new Error(process.env.NODE_ENV==="production"?Ut(9):"Reducers may not dispatch actions.");try{l=!0,i=s(i,h)}finally{l=!1}for(var y=a=o,v=0;v<y.length;v++){var b=y[v];b()}return h}function p(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Ut(10):"Expected the nextReducer to be a function. Instead, received: '"+vn(h));s=h,g({type:Gc.REPLACE})}function w(){var h,y=d;return h={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?Ut(11):"Expected the observer to be an object. Instead, received: '"+vn(b)+"'");function C(){b.next&&b.next(f())}C();var S=y(C);return{unsubscribe:S}}},h[Hc]=function(){return this},h}return g({type:Gc.INIT}),n={dispatch:g,subscribe:d,getState:f,replaceReducer:p},n[Hc]=w,n}var wE=function(t,r){return t===r};function CE(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function SE(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:wE;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}function Wc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Kc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Wc(Object(r),!0).forEach(function(n){xE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function xE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Yc={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function _E(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Yc,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case vl:case ia:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case aa:return CE(e.clientOffset,r.clientOffset)?e:Kc(Kc({},e),{},{clientOffset:r.clientOffset});case la:case oa:return Yc;default:return e}}var wl="dnd-core/ADD_SOURCE",Cl="dnd-core/ADD_TARGET",Sl="dnd-core/REMOVE_SOURCE",ca="dnd-core/REMOVE_TARGET";function TE(e){return{type:wl,payload:{sourceId:e}}}function EE(e){return{type:Cl,payload:{targetId:e}}}function IE(e){return{type:Sl,payload:{sourceId:e}}}function OE(e){return{type:ca,payload:{targetId:e}}}function Zc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function zt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Zc(Object(r),!0).forEach(function(n){AE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function AE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var DE={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function NE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:DE,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case ia:return zt(zt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case bl:return zt(zt({},e),{},{isSourcePublic:!0});case aa:return zt(zt({},e),{},{targetIds:r.targetIds});case ca:return e.targetIds.indexOf(r.targetId)===-1?e:zt(zt({},e),{},{targetIds:qT(e.targetIds,r.targetId)});case oa:return zt(zt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case la:return zt(zt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function RE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case wl:case Cl:return e+1;case Sl:case ca:return e-1;default:return e}}var $i=[],xl=[];$i.__IS_NONE__=!0;xl.__IS_ALL__=!0;function jE(e,t){if(e===$i)return!1;if(e===xl||typeof t>"u")return!0;var r=zT(t,e);return r.length>0}function kE(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case aa:break;case wl:case Cl:case ca:case Sl:return $i;case ia:case bl:case la:case oa:default:return xl}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,a=UT(n,i),o=a.length>0||!SE(n,i);if(!o)return $i;var l=i[i.length-1],u=n[n.length-1];return l!==u&&(l&&a.push(l),u&&a.push(u)),a}function LE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Xc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Jc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Xc(Object(r),!0).forEach(function(n){PE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function PE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function FE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:kE(e.dirtyHandlerIds,{type:t.type,payload:Jc(Jc({},t.payload),{},{prevTargetIds:$T(e,"dragOperation.targetIds",[])})}),dragOffset:_E(e.dragOffset,t),refCount:RE(e.refCount,t),dragOperation:NE(e.dragOperation,t),stateId:LE(e.stateId)}}function ME(e,t){return{x:e.x+t.x,y:e.y+t.y}}function gh(e,t){return{x:e.x-t.x,y:e.y-t.y}}function BE(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:gh(ME(t,n),r)}function $E(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:gh(t,r)}function qE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function UE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function zE(e,t,r){return t&&UE(e.prototype,t),e}function eu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var VE=function(){function e(t,r){qE(this,e),eu(this,"store",void 0),eu(this,"registry",void 0),this.store=t,this.registry=r}return zE(e,[{key:"subscribeToStateChange",value:function(r){var n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0},i=s.handlerIds;he(typeof r=="function","listener must be a function."),he(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var a=this.store.getState().stateId,o=function(){var u=n.store.getState(),f=u.stateId;try{var d=f===a||f===a+1&&!jE(u.dirtyHandlerIds,i);d||r()}finally{a=f}};return this.store.subscribe(o)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;he(typeof r=="function","listener must be a function.");var s=this.store.getState().dragOffset,i=function(){var o=n.store.getState().dragOffset;o!==s&&(s=o,r())};return this.store.subscribe(i)}},{key:"canDragSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r);return he(n,"Expected to find a valid source. sourceId=".concat(r)),this.isDragging()?!1:n.canDrag(this,r)}},{key:"canDropOnTarget",value:function(r){if(!r)return!1;var n=this.registry.getTarget(r);if(he(n,"Expected to find a valid target. targetId=".concat(r)),!this.isDragging()||this.didDrop())return!1;var s=this.registry.getTargetType(r),i=this.getItemType();return Ro(s,i)&&n.canDrop(this,r)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r,!0);if(he(n,"Expected to find a valid source. sourceId=".concat(r)),!this.isDragging()||!this.isSourcePublic())return!1;var s=this.registry.getSourceType(r),i=this.getItemType();return s!==i?!1:n.isDragging(this,r)}},{key:"isOverTarget",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!r)return!1;var s=n.shallow;if(!this.isDragging())return!1;var i=this.registry.getTargetType(r),a=this.getItemType();if(a&&!Ro(i,a))return!1;var o=this.getTargetIds();if(!o.length)return!1;var l=o.indexOf(r);return s?l===o.length-1:l>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return BE(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return $E(this.store.getState().dragOffset)}}]),e}(),HE=0;function QE(){return HE++}function Si(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Si=function(r){return typeof r}:Si=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Si(e)}function GE(e){he(typeof e.canDrag=="function","Expected canDrag to be a function."),he(typeof e.beginDrag=="function","Expected beginDrag to be a function."),he(typeof e.endDrag=="function","Expected endDrag to be a function.")}function WE(e){he(typeof e.canDrop=="function","Expected canDrop to be a function."),he(typeof e.hover=="function","Expected hover to be a function."),he(typeof e.drop=="function","Expected beginDrag to be a function.")}function jo(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return jo(r,!1)});return}he(typeof e=="string"||Si(e)==="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const tu=typeof global<"u"?global:self,yh=tu.MutationObserver||tu.WebKitMutationObserver;function vh(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function KE(e){let t=1;const r=new yh(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const YE=typeof yh=="function"?KE:vh;class ZE{enqueueTask(t){const{queue:r,requestFlush:n}=this;r.length||(n(),this.flushing=!0),r[r.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const r=this.index;if(this.index++,t[r].call(),this.index>this.capacity){for(let n=0,s=t.length-this.index;n<s;n++)t[n]=t[n+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=YE(this.flush),this.requestErrorThrow=vh(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class XE{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,r){this.onError=t,this.release=r,this.task=null}}class JE{create(t){const r=this.freeTasks,n=r.length?r.pop():new XE(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const bh=new ZE,e1=new JE(bh.registerPendingError);function t1(e){bh.enqueueTask(e1.create(e))}function r1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s1(e,t,r){return t&&n1(e.prototype,t),e}function bn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i1(e,t){return c1(e)||l1(e,t)||o1(e,t)||a1()}function a1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
497
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
498
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y1(e,t){if(e){if(typeof e=="string")return iu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return iu(e,t)}}function iu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v1(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,a,o;try{for(r=r.call(e);!(s=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));s=!0);}catch(l){i=!0,o=l}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw o}}return n}}function b1(e){if(Array.isArray(e))return e}function w1(e,t){if(e==null)return{};var r=C1(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function C1(e,t){if(e==null)return{};var r={},n=Object.keys(e),s,i;for(i=0;i<n.length;i++)s=n[i],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}var au=0,xi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),S1=m.memo(function(t){var r=t.children,n=w1(t,p1),s=x1(n),i=m1(s,2),a=i[0],o=i[1];return m.useEffect(function(){if(o){var l=wh();return++au,function(){--au===0&&(l[xi]=null)}}},[]),c.jsx(hh.Provider,Object.assign({value:a},{children:r}),void 0)});function x1(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=_1(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function _1(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:wh(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[xi]||(s[xi]={dragDropManager:f1(e,t,r,n)}),s[xi]}function wh(){return typeof global<"u"?global:window}function T1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function I1(e,t,r){return t&&E1(e.prototype,t),e}function ou(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ra=!1,ja=!1,O1=function(){function e(t){T1(this,e),ou(this,"internalMonitor",void 0),ou(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return I1(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){he(!Ra,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Ra=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Ra=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;he(!ja,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return ja=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{ja=!1}}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"isDraggingSource",value:function(r){return this.internalMonitor.isDraggingSource(r)}},{key:"isOverTarget",value:function(r,n){return this.internalMonitor.isOverTarget(r,n)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(r){return this.internalMonitor.subscribeToOffsetChange(r)}},{key:"canDragSource",value:function(r){return this.internalMonitor.canDragSource(r)}},{key:"canDropOnTarget",value:function(r){return this.internalMonitor.canDropOnTarget(r)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function A1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function N1(e,t,r){return t&&D1(e.prototype,t),e}function lu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ka=!1,R1=function(){function e(t){A1(this,e),lu(this,"internalMonitor",void 0),lu(this,"targetId",null),this.internalMonitor=t.getMonitor()}return N1(e,[{key:"receiveHandlerId",value:function(r){this.targetId=r}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;he(!ka,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return ka=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{ka=!1}}},{key:"isOver",value:function(r){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,r):!1}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function j1(e){if(typeof e.type!="string"){var t=e.type.displayName||e.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(t," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}}function k1(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!m.isValidElement(t)){var n=t;return e(n,r),n}var s=t;j1(s);var i=r?function(a){return e(a,r)}:e;return L1(s,i)}}function Ch(e){var t={};return Object.keys(e).forEach(function(r){var n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{var s=k1(n);t[r]=function(){return s}}}),t}function cu(e,t){typeof e=="function"?e(t):e.current=t}function L1(e,t){var r=e.ref;return he(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?m.cloneElement(e,{ref:function(s){cu(r,s),cu(t,s)}}):m.cloneElement(e,{ref:t})}function _i(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_i=function(r){return typeof r}:_i=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_i(e)}function ko(e){return e!==null&&_i(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Lo(e,t,r,n){var s=void 0;if(s!==void 0)return!!s;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var o=Object.prototype.hasOwnProperty.bind(t),l=0;l<i.length;l++){var u=i[l];if(!o(u))return!1;var f=e[u],d=t[u];if(s=void 0,s===!1||s===void 0&&f!==d)return!1}return!0}function P1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function M1(e,t,r){return t&&F1(e.prototype,t),e}function mt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var B1=function(){function e(t){var r=this;P1(this,e),mt(this,"hooks",Ch({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,ko(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,ko(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),mt(this,"handlerId",null),mt(this,"dragSourceRef",null),mt(this,"dragSourceNode",void 0),mt(this,"dragSourceOptionsInternal",null),mt(this,"dragSourceUnsubscribe",void 0),mt(this,"dragPreviewRef",null),mt(this,"dragPreviewNode",void 0),mt(this,"dragPreviewOptionsInternal",null),mt(this,"dragPreviewUnsubscribe",void 0),mt(this,"lastConnectedHandlerId",null),mt(this,"lastConnectedDragSource",null),mt(this,"lastConnectedDragSourceOptions",null),mt(this,"lastConnectedDragPreview",null),mt(this,"lastConnectedDragPreviewOptions",null),mt(this,"backend",void 0),this.backend=t}return M1(e,[{key:"receiveHandlerId",value:function(r){this.handlerId!==r&&(this.handlerId=r,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(r){this.dragSourceOptionsInternal=r}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(r){this.dragPreviewOptionsInternal=r}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var r=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();if(n&&this.disconnectDragSource(),!!this.handlerId){if(!r){this.lastConnectedDragSource=r;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=r,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,r,this.dragSourceOptions))}}},{key:"reconnectDragPreview",value:function(){var r=this.dragPreview,n=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(n&&this.disconnectDragPreview(),!!this.handlerId){if(!r){this.lastConnectedDragPreview=r;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=r,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,r,this.dragPreviewOptions))}}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!Lo(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!Lo(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}]),e}();function $1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function q1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function U1(e,t,r){return t&&q1(e.prototype,t),e}function ir(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var z1=function(){function e(t){var r=this;$1(this,e),ir(this,"hooks",Ch({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,ko(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),ir(this,"handlerId",null),ir(this,"dropTargetRef",null),ir(this,"dropTargetNode",void 0),ir(this,"dropTargetOptionsInternal",null),ir(this,"unsubscribeDropTarget",void 0),ir(this,"lastConnectedHandlerId",null),ir(this,"lastConnectedDropTarget",null),ir(this,"lastConnectedDropTargetOptions",null),ir(this,"backend",void 0),this.backend=t}return U1(e,[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var r=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();r&&this.disconnectDropTarget();var n=this.dropTarget;if(this.handlerId){if(!n){this.lastConnectedDropTarget=n;return}r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions))}}},{key:"receiveHandlerId",value:function(r){r!==this.handlerId&&(this.handlerId=r,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(r){this.dropTargetOptionsInternal=r}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!Lo(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}]),e}();function V1(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function H1(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var fn=typeof window<"u"?m.useLayoutEffect:m.useEffect;function Ti(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ti=function(r){return typeof r}:Ti=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ti(e)}function Q1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function W1(e,t,r){return t&&G1(e.prototype,t),e}function La(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var K1=function(){function e(t,r,n){Q1(this,e),La(this,"spec",void 0),La(this,"monitor",void 0),La(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return W1(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return Ti(n.item)==="object"?i=n.item:typeof n.item=="function"?i=n.item(s):i={},(r=i)!==null&&r!==void 0?r:null}},{key:"canDrag",value:function(){var r=this.spec,n=this.monitor;return typeof r.canDrag=="boolean"?r.canDrag:typeof r.canDrag=="function"?r.canDrag(n):!0}},{key:"isDragging",value:function(r,n){var s=this.spec,i=this.monitor,a=s.isDragging;return a?a(i):n===r.getSourceId()}},{key:"endDrag",value:function(){var r=this.spec,n=this.monitor,s=this.connector,i=r.end;i&&i(n.getItem(),n),s.reconnect()}}]),e}();function Y1(e,t,r){var n=m.useMemo(function(){return new K1(e,t,r)},[t,r]);return m.useEffect(function(){n.spec=e},[e]),n}function hn(){var e=m.useContext(hh),t=e.dragDropManager;return he(t!=null,"Expected drag drop context"),t}function Z1(e){return m.useMemo(function(){var t=e.type;return he(t!=null,"spec.type must be defined"),t},[e])}function X1(e,t){return rI(e)||tI(e,t)||eI(e,t)||J1()}function J1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
499
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
500
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
501
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
502
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
503
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
504
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
505
|
-
`)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),ri(wn,Nh,{exposeProperties:{text:function(t,r){return Pa(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),wn);function lO(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function uO(e,t,r){return t&&cO(e.prototype,t),e}function bu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var dO=function(){function e(t){lO(this,e),bu(this,"item",void 0),bu(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return uO(e,[{key:"initializeExposedProperties",value:function(){var r=this;Object.keys(this.config.exposeProperties).forEach(function(n){Object.defineProperty(r.item,n,{configurable:!0,enumerable:!0,get:function(){return console.warn(`Browser doesn't allow reading "`.concat(n,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(r){var n=this;if(r){var s={};Object.keys(this.config.exposeProperties).forEach(function(i){s[i]={value:n.config.exposeProperties[i](r,n.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,s)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(r,n){return n===r.getSourceId()}},{key:"endDrag",value:function(){}}]),e}();function fO(e,t){var r=new dO(Fo[e]);return r.loadDataTransfer(t),r}function Fa(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(Fo).filter(function(r){var n=Fo[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function hO(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function mO(e,t,r){return t&&pO(e.prototype,t),e}function Ma(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var gO=function(){function e(t,r){hO(this,e),Ma(this,"ownerDocument",null),Ma(this,"globalContext",void 0),Ma(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return mO(e,[{key:"window",get:function(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}},{key:"document",get:function(){var r;return(r=this.globalContext)!==null&&r!==void 0&&r.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var r;return((r=this.optionsArgs)===null||r===void 0?void 0:r.rootElement)||this.window}}]),e}();function wu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Cu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?wu(Object(r),!0).forEach(function(n){be(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function yO(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function bO(e,t,r){return t&&vO(e.prototype,t),e}function be(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var wO=function(){function e(t,r,n){var s=this;yO(this,e),be(this,"options",void 0),be(this,"actions",void 0),be(this,"monitor",void 0),be(this,"registry",void 0),be(this,"enterLeaveCounter",void 0),be(this,"sourcePreviewNodes",new Map),be(this,"sourcePreviewNodeOptions",new Map),be(this,"sourceNodes",new Map),be(this,"sourceNodeOptions",new Map),be(this,"dragStartSourceIds",null),be(this,"dropTargetIds",[]),be(this,"dragEnterTargetIds",[]),be(this,"currentNativeSource",null),be(this,"currentNativeHandle",null),be(this,"currentDragSourceNode",null),be(this,"altKeyPressed",!1),be(this,"mouseMoveTimeoutTimer",null),be(this,"asyncEndDragFrameId",null),be(this,"dragOverTargetIds",null),be(this,"lastClientOffset",null),be(this,"hoverRafId",null),be(this,"getSourceClientOffset",function(i){var a=s.sourceNodes.get(i);return a&&Oh(a)||null}),be(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),be(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),be(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),be(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var a=s.dragStartSourceIds;s.dragStartSourceIds=null;var o=ti(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(a||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:o});var l=i.dataTransfer,u=Fa(l);if(s.monitor.isDragging()){if(l&&typeof l.setDragImage=="function"){var f=s.monitor.getSourceId(),d=s.sourceNodes.get(f),g=s.sourcePreviewNodes.get(f)||d;if(g){var p=s.getCurrentSourcePreviewNodeOptions(),w=p.anchorX,h=p.anchorY,y=p.offsetX,v=p.offsetY,b={anchorX:w,anchorY:h},C={offsetX:y,offsetY:v},S=oO(d,g,o,b,C);l.setDragImage(g,S.x,S.y)}}try{l==null||l.setData("application/json",{})}catch{}s.setCurrentDragSourceNode(i.target);var _=s.getCurrentSourcePreviewNodeOptions(),E=_.captureDraggingState;E?s.actions.publishDragSource():setTimeout(function(){return s.actions.publishDragSource()},0)}else if(u)s.beginDragNativeItem(u);else{if(l&&!l.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}}}),be(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var a=s.enterLeaveCounter.enter(i.target);if(!(!a||s.monitor.isDragging())){var o=i.dataTransfer,l=Fa(o);l&&s.beginDragNativeItem(l,o)}}),be(this,"handleTopDragEnter",function(i){var a=s.dragEnterTargetIds;if(s.dragEnterTargetIds=[],!!s.monitor.isDragging()){s.altKeyPressed=i.altKey,a.length>0&&s.actions.hover(a,{clientOffset:ti(i)});var o=a.some(function(l){return s.monitor.canDropOnTarget(l)});o&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),be(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),be(this,"handleTopDragOver",function(i){var a=s.dragOverTargetIds;if(s.dragOverTargetIds=[],!s.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}s.altKeyPressed=i.altKey,s.lastClientOffset=ti(i),s.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(s.hoverRafId=requestAnimationFrame(function(){s.monitor.isDragging()&&s.actions.hover(a||[],{clientOffset:s.lastClientOffset}),s.hoverRafId=null}));var o=(a||[]).some(function(l){return s.monitor.canDropOnTarget(l)});o?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect())):s.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))}),be(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var a=s.enterLeaveCounter.leave(i.target);a&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),be(this,"handleTopDropCapture",function(i){if(s.dropTargetIds=[],s.isDraggingNativeItem()){var a;i.preventDefault(),(a=s.currentNativeSource)===null||a===void 0||a.loadDataTransfer(i.dataTransfer)}else Fa(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),be(this,"handleTopDrop",function(i){var a=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(a,{clientOffset:ti(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleSelectStart",function(i){var a=i.target;typeof a.dragDrop=="function"&&(a.tagName==="INPUT"||a.tagName==="SELECT"||a.tagName==="TEXTAREA"||a.isContentEditable||(i.preventDefault(),a.dragDrop()))}),this.options=new gO(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new JI(this.isNodeInDocument)}return bO(e,[{key:"profile",value:function(){var r,n;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((r=this.dragStartSourceIds)===null||r===void 0?void 0:r.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((n=this.dragOverTargetIds)===null||n===void 0?void 0:n.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var r=this.rootElement;if(r!==void 0){if(r.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");r.__isReactDndBackendSetUp=!0,this.addEventListeners(r)}}},{key:"teardown",value:function(){var r=this.rootElement;if(r!==void 0&&(r.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var n;(n=this.window)===null||n===void 0||n.cancelAnimationFrame(this.asyncEndDragFrameId)}}},{key:"connectDragPreview",value:function(r,n,s){var i=this;return this.sourcePreviewNodeOptions.set(r,s),this.sourcePreviewNodes.set(r,n),function(){i.sourcePreviewNodes.delete(r),i.sourcePreviewNodeOptions.delete(r)}}},{key:"connectDragSource",value:function(r,n,s){var i=this;this.sourceNodes.set(r,n),this.sourceNodeOptions.set(r,s);var a=function(u){return i.handleDragStart(u,r)},o=function(u){return i.handleSelectStart(u)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",a),n.addEventListener("selectstart",o),function(){i.sourceNodes.delete(r),i.sourceNodeOptions.delete(r),n.removeEventListener("dragstart",a),n.removeEventListener("selectstart",o),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(r,n){var s=this,i=function(u){return s.handleDragEnter(u,r)},a=function(u){return s.handleDragOver(u,r)},o=function(u){return s.handleDrop(u,r)};return n.addEventListener("dragenter",i),n.addEventListener("dragover",a),n.addEventListener("drop",o),function(){n.removeEventListener("dragenter",i),n.removeEventListener("dragover",a),n.removeEventListener("drop",o)}}},{key:"addEventListeners",value:function(r){r.addEventListener&&(r.addEventListener("dragstart",this.handleTopDragStart),r.addEventListener("dragstart",this.handleTopDragStartCapture,!0),r.addEventListener("dragend",this.handleTopDragEndCapture,!0),r.addEventListener("dragenter",this.handleTopDragEnter),r.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),r.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),r.addEventListener("dragover",this.handleTopDragOver),r.addEventListener("dragover",this.handleTopDragOverCapture,!0),r.addEventListener("drop",this.handleTopDrop),r.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(r){r.removeEventListener&&(r.removeEventListener("dragstart",this.handleTopDragStart),r.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),r.removeEventListener("dragend",this.handleTopDragEndCapture,!0),r.removeEventListener("dragenter",this.handleTopDragEnter),r.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),r.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),r.removeEventListener("dragover",this.handleTopDragOver),r.removeEventListener("dragover",this.handleTopDragOverCapture,!0),r.removeEventListener("drop",this.handleTopDrop),r.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var r=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(r);return Cu({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var r=this.monitor.getSourceId(),n=this.sourcePreviewNodeOptions.get(r);return Cu({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(vu).some(function(n){return vu[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=fO(r,n),this.currentNativeHandle=this.registry.addSource(r,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(r){var n=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=r;var s=1e3;this.mouseMoveTimeoutTimer=setTimeout(function(){var i;return(i=n.rootElement)===null||i===void 0?void 0:i.addEventListener("mousemove",n.endDragIfSourceWasRemovedFromDOM,!0)},s)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var r;(r=this.window)===null||r===void 0||r.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(r,n){r.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}},{key:"handleDragEnter",value:function(r,n){this.dragEnterTargetIds.unshift(n)}},{key:"handleDragOver",value:function(r,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}},{key:"handleDrop",value:function(r,n){this.dropTargetIds.unshift(n)}}]),e}(),ni;function CO(){return ni||(ni=new Image,ni.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),ni}var SO=function(t,r,n){return new wO(t,r,n)};function xO(e,t){return typeof e=="function"?e(t):e??"NODE"}function _O(e){return e.isDraggable&&!e.isEditing}function TO(e){const t=Rt(),r=t.selectedIds,[n,s,i]=EI(()=>({canDrag:()=>_O(e),type:xO(t.props.dragType,e),item:()=>{const a=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(Vn.dragStart(e.id,a)),{id:e.id,dragIds:a,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Vn.dragEnd())}}),[r,e,t.props.dragType]);return m.useEffect(()=>{i(CO())},[i]),s}function EO(e,t){const r=e.getBoundingClientRect(),n=t.x-Math.round(r.x),s=t.y-Math.round(r.y),i=r.height,a=s<i/2,o=!a,l=i/4,u=s>l&&s<i-l;return{x:n,inTopHalf:a,inBottomHalf:o,inMiddle:u,atTop:!u&&a,atBottom:!u&&o}}function IO(e,t,r,n){return e?e.isInternal?n.atTop?[t,e]:n.inMiddle?[e,e]:[e,r]:n.inTopHalf?[t,e]:[e,r]:[t,null]}function si(e,t){return{parentId:e||null,index:t}}function Cn(e,t){return{type:"line",index:e,level:t}}function OO(e){return{type:"highlight",id:e}}function Ba(e,t){var r;let n=e;for(;n.parent&&n.level>t;)n=n.parent;const s=((r=n.parent)===null||r===void 0?void 0:r.id)||null,i=nh(n)+1;return{parentId:s,index:i}}function jh(e){var t;const r=EO(e.element,e.offset),n=e.indent,s=Math.round(Math.max(0,r.x-n)/n),{node:i,nextNode:a,prevNode:o}=e,[l,u]=IO(i,o,a,r);if(i&&i.isInternal&&r.inMiddle)return{drop:si(i.id,null),cursor:OO(i.id)};if(!l)return{drop:si((t=u==null?void 0:u.parent)===null||t===void 0?void 0:t.id,0),cursor:Cn(0,0)};if(Jf(l)){const f=vi(s,(u==null?void 0:u.level)||0,l.level);return{drop:Ba(l,f),cursor:Cn(l.rowIndex+1,f)}}if(eh(l)){const f=vi(s,(u==null?void 0:u.level)||0,l.level);return{drop:Ba(l,f),cursor:Cn(l.rowIndex+1,f)}}if(th(l)){const f=vi(s,0,l.level+1);return f>l.level?{drop:si(l.id,0),cursor:Cn(l.rowIndex+1,f)}:{drop:Ba(l,f),cursor:Cn(l.rowIndex+1,f)}}return{drop:si(l==null?void 0:l.id,0),cursor:Cn(l.rowIndex+1,l.level+1)}}function AO(e,t){const r=Rt(),[n,s]=Th(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,a)=>{const o=a.getClientOffset();if(!e.current||!o)return;const{cursor:l,drop:u}=jh({element:e.current,offset:o,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});u&&r.dispatch(Vn.hovering(u.parentId,u.index)),a.canDrop()?l&&r.showCursor(l):r.hideCursor()},drop:(i,a)=>{if(!a.canDrop())return null;r.drop()}}),[t,e.current,r.props]);return s}function DO(e){const t=Rt(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return m.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const Su=m.memo(function({index:t,style:r}){Xf(),W0();const n=Rt(),s=DO(t),i=m.useRef(null),a=TO(s),o=AO(i,s),l=m.useCallback(h=>{i.current=h,o(h)},[o]),u=n.indent*s.level,f=m.useMemo(()=>({paddingLeft:u}),[u]),d=m.useMemo(()=>{var h,y;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((y=(h=n.props.padding)!==null&&h!==void 0?h:n.props.paddingTop)!==null&&y!==void 0?y:0),minWidth:"max-content"})},[r,n.props.padding,n.props.paddingTop]),g={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:d,tabIndex:-1,className:n.props.rowClassName};m.useEffect(()=>{var h;!s.isEditing&&s.isFocused&&((h=i.current)===null||h===void 0||h.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,i.current]);const p=n.renderNode,w=n.renderRow;return c.jsx(w,{node:s,innerRef:l,attrs:g,children:c.jsx(p,{node:s,tree:n,style:f,dragHandle:a})})});let $a="",xu=null;function kh(){Xf();const e=Rt();return c.jsx("div",{role:"tree","aria-label":e.props["aria-label"],"aria-labelledby":e.props["aria-labelledby"],"aria-multiselectable":!e.props.disableMultiSelection||void 0,style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{var r;if(e.isEditing)return;if(t.key==="Backspace"){if(!e.props.onDelete)return;const s=Array.from(e.selectedIds);if(s.length>1){let i=e.mostRecentNode;for(;i&&i.isSelected;)i=i.nextSibling;i||(i=e.lastNode),e.focus(i,{scroll:!1}),e.delete(Array.from(s))}else{const i=e.focusedNode;if(i){const a=i.nextSibling,o=i.parent;e.focus(a||o,{scroll:!1}),e.delete(i)}}return}if(t.key==="Tab"&&!t.shiftKey){t.preventDefault(),sh(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),ih(t.currentTarget);return}if(t.key==="ArrowDown"){t.preventDefault();const s=e.nextNode;if(t.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}else if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.firstNode);return}}if(t.key==="ArrowUp"){t.preventDefault();const s=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.lastNode);return}}if(t.key==="ArrowRight"){const s=e.focusedNode;if(!s)return;s.isInternal&&s.isOpen?e.focus(e.nextNode):s.isInternal&&e.open(s.id);return}if(t.key==="ArrowLeft"){const s=e.focusedNode;if(!s||s.isRoot)return;s.isInternal&&s.isOpen?e.close(s.id):!((r=s.parent)===null||r===void 0)&&r.isRoot||e.focus(s.parent);return}if(t.key==="a"&&(t.metaKey||t.ctrlKey)&&!e.props.disableMultiSelection){t.preventDefault(),e.selectAll();return}if(t.key==="a"&&!t.metaKey&&!t.ctrlKey&&e.props.onCreate){e.createLeaf();return}if(t.key==="A"&&!t.metaKey&&!t.ctrlKey){if(!e.props.onCreate)return;e.createInternal();return}if(t.key==="Home"){t.preventDefault(),e.focus(e.firstNode);return}if(t.key==="End"){t.preventDefault(),e.focus(e.lastNode);return}if(t.key==="Enter"){const s=e.focusedNode;if(!s||!s.isEditable||!e.props.onRename)return;setTimeout(()=>{s&&e.edit(s)});return}if(t.key===" "){t.preventDefault();const s=e.focusedNode;if(!s)return;s.isLeaf?(s.select(),s.activate()):s.toggle();return}if(t.key==="*"){const s=e.focusedNode;if(!s)return;e.openSiblings(s);return}if(t.key==="PageUp"){t.preventDefault(),e.pageUp();return}t.key==="PageDown"&&(t.preventDefault(),e.pageDown()),clearTimeout(xu),$a+=t.key,xu=setTimeout(()=>{$a=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith($a):!1});n&&e.focus(n.id)},children:c.jsx(NO,{})})}function NO(){var e,t;const r=Rt(),n={className:r.props.className,outerRef:r.listEl,itemCount:r.visibleNodes.length,height:r.height,width:r.width,overscanCount:r.overscanCount,itemKey:s=>{var i;return((i=r.visibleNodes[s])===null||i===void 0?void 0:i.id)||s},outerElementType:(e=r.props.outerElementType)!==null&&e!==void 0?e:PT,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:BT,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?c.jsx(RT,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:Su})):c.jsx(jT,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:Su}))}function _u(e){return e.isFiltered?jO(e.root,e.isMatch.bind(e)):RO(e.root)}function RO(e){const t=[];function r(n){var s;n.level>=0&&t.push(n),n.isOpen&&((s=n.children)===null||s===void 0||s.forEach(r))}return r(e),t.forEach(Lh),t}function jO(e,t){const r={},n=[];function s(a){if(!a.isRoot&&t(a)){r[a.id]=!0;let l=a.parent;for(;l;)r[l.id]=!0,l=l.parent}if(a.children)for(let l of a.children)s(l)}function i(a){var o;a.level>=0&&r[a.id]&&n.push(a),a.isOpen&&((o=a.children)===null||o===void 0||o.forEach(i))}return s(e),i(e),n.forEach(Lh),n}function Lh(e,t){e.rowIndex=t}const Tu=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var qa=function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function o(f){try{u(n.next(f))}catch(d){a(d)}}function l(f){try{u(n.throw(f))}catch(d){a(d)}}function u(f){f.done?i(f.value):s(f.value).then(o,l)}u((n=n.apply(e,t||[])).next())})};const{safeRun:gt}=J0;class ws{constructor(t,r,n,s){this.store=t,this.props=r,this.list=n,this.listEl=s,this.visibleStartIndex=0,this.visibleStopIndex=0,this.rowOffsets=null,this.rowHeightAt=i=>{const a=this.props.rowHeight;if(typeof a=="function"){const o=this.at(i);return o?a(o):this.rowHeight}return a??24},this.rowTopPosition=i=>{if(typeof this.props.rowHeight!="function")return i*this.rowHeight;const a=this.getRowOffsets(),o=Math.max(0,Math.min(i,a.length-1));return a[o]},this.redrawList=(i=0)=>{this.rowOffsets=null;const a=this.list.current;a&&"resetAfterIndex"in a&&a.resetAfterIndex(Math.max(0,i))},this.root=jc(this),this.visibleNodes=_u(this),this.idToIndex=Tu(this.visibleNodes)}update(t){this.props=t,this.root=jc(this),this.visibleNodes=_u(this),this.idToIndex=Tu(this.visibleNodes),this.rowOffsets=null;const r=this.list.current;r&&"resetAfterIndex"in r&&r.resetAfterIndex(0,!1)}dispatch(t){return this.store.dispatch(t)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var t;return(t=this.props.width)!==null&&t!==void 0?t:300}get height(){var t;return(t=this.props.height)!==null&&t!==void 0?t:500}get indent(){var t;return(t=this.props.indent)!==null&&t!==void 0?t:24}get rowHeight(){return typeof this.props.rowHeight=="number"?this.props.rowHeight:24}getRowOffsets(){if(this.rowOffsets)return this.rowOffsets;const t=[0];for(let r=0;r<this.visibleNodes.length;r++)t.push(t[r]+this.rowHeightAt(r));return this.rowOffsets=t,t}get overscanCount(){var t;return(t=this.props.overscanCount)!==null&&t!==void 0?t:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var t;const r=(t=this.props.searchMatch)!==null&&t!==void 0?t:(n,s)=>JSON.stringify(Object.values(n.data)).toLocaleLowerCase().includes(s.toLocaleLowerCase());return n=>r(n,this.searchTerm)}accessChildren(t){var r;const n=this.props.childrenAccessor||"children";return(r=ps(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=ps(t,r);if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}identify(t){if(typeof t=="string")return t;if(t instanceof Ds)return t.id;const r=this.props.idAccessor||"id";return ps(t,r)}identifyNull(t){return t==null?null:this.identify(t)}get firstNode(){var t;return(t=this.visibleNodes[0])!==null&&t!==void 0?t:null}get lastNode(){var t;return(t=this.visibleNodes[this.visibleNodes.length-1])!==null&&t!==void 0?t:null}get focusedNode(){var t;return(t=this.get(this.state.nodes.focus.id))!==null&&t!==void 0?t:null}get mostRecentNode(){var t;return(t=this.get(this.state.nodes.selection.mostRecent))!==null&&t!==void 0?t:null}get nextNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t+1)}get prevNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t-1)}get(t){return t&&t in this.idToIndex&&this.visibleNodes[this.idToIndex[t]]||null}at(t){return this.visibleNodes[t]||null}nodesBetween(t,r){var n;if(t===null||r===null)return[];const s=(n=this.indexOf(t))!==null&&n!==void 0?n:0,i=this.indexOf(r);if(i===null)return[];const a=Math.min(s,i),o=Math.max(s,i);return this.visibleNodes.slice(a,o+1)}indexOf(t){const r=this.identifyNull(t);return r?this.idToIndex[r]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return qa(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?ch(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:lh(this),a=(n=t.type)!==null&&n!==void 0?n:"leaf",o=yield gt(this.props.onCreate,{type:a,parentId:s,index:i,parentNode:this.get(s)});o&&(this.focus(o),setTimeout(()=>{this.edit(o).then(()=>{this.select(o),this.activate(o)})}))})}delete(t){return qa(this,void 0,void 0,function*(){if(!t)return;const n=(Array.isArray(t)?t:[t]).map(a=>this.identify(a)),s=n.map(a=>this.get(a)).filter(a=>!!a),i=s.length?Math.min(...s.map(a=>{var o;return(o=a.rowIndex)!==null&&o!==void 0?o:0})):0;yield gt(this.props.onDelete,{nodes:s,ids:n}),this.redrawList(i)})}edit(t){var r,n;const s=this.identify(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(s),this.dispatch(Aa(s)),this.redrawList((n=(r=this.get(s))===null||r===void 0?void 0:r.rowIndex)!==null&&n!==void 0?n:0),new Promise(i=>{ws.editPromise=i})}submit(t,r){return qa(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield gt(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(Aa(null)),this.resolveEdit({cancelled:!1,value:r}),this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(Aa(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&>(this.props.onActivate,r)}resolveEdit(t){const r=ws.editPromise;r&&r(t),ws.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let t=[];for(let r of Array.from(this.selectedIds)){const n=this.get(r);n&&t.push(n)}return t}focus(t,r={}){t&&(this.props.selectionFollowsFocus?this.select(t):(this.dispatch(gn(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&>(this.props.onFocus,this.focusedNode)))}pageUp(){var t,r;const n=this.visibleStartIndex,i=this.visibleStopIndex-n;let a=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;a>n?a=n:a=Math.max(n-i,0),this.focus(this.at(a))}pageDown(){var t,r;const n=this.visibleStartIndex,s=this.visibleStopIndex,i=s-n;let a=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;a<s?a=s:a=Math.min(a+i,this.visibleNodes.length-1),this.focus(this.at(a))}select(t,r={}){var n;if(!t)return;const s=r.focus!==!1,i=this.identify(t);s&&this.dispatch(gn(i)),!((n=this.get(i))===null||n===void 0)&&n.isSelectable&&this.setSelection({ids:[i],anchor:i,mostRecent:i}),this.scrollTo(i,r.align),this.focusedNode&&s&>(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(Tr.remove(r)),gt(this.props.onSelect,this.selectedNodes)}selectMulti(t,r={}){const n=this.get(this.identifyNull(t));if(!n)return;const s=r.focus!==!1;s&&this.dispatch(gn(n.id)),n.isSelectable&&(this.dispatch(Tr.add(n.id)),this.dispatch(Tr.anchor(n.id)),this.dispatch(Tr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&>(this.props.onFocus,this.focusedNode),gt(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(gn(n)),!((r=this.get(n))===null||r===void 0)&&r.isSelectable){const{anchor:s,mostRecent:i}=this.state.nodes.selection,a=this.filterSelectableNodes(this.nodesBetween(s,this.identifyNull(n)));this.dispatch(Tr.remove(this.nodesBetween(s,i))),this.dispatch(Tr.add(a)),this.dispatch(Tr.mostRecent(n))}this.scrollTo(n),this.focusedNode&>(this.props.onFocus,this.focusedNode),gt(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null})}selectAll(){var t,r,n;const s=this.filterSelectableNodes(Object.keys(this.idToIndex));this.setSelection({ids:s,anchor:(t=s[0])!==null&&t!==void 0?t:null,mostRecent:(r=s[s.length-1])!==null&&r!==void 0?r:null}),this.dispatch(gn((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&>(this.props.onFocus,this.focusedNode)}filterSelectableNodes(t){return t.map(r=>this.get(this.identify(r))).filter(r=>!!r&&r.isSelectable)}setSelection(t){var r;const n=new Set((r=t.ids)===null||r===void 0?void 0:r.map(a=>this.identify(a))),s=this.identifyNull(t.anchor),i=this.identifyNull(t.mostRecent);this.dispatch(Tr.set({ids:n,anchor:s,mostRecent:i})),gt(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:t}=this.state.dnd;switch(t.type){case"highlight":return t.id;default:return null}}get cursorOverFolder(){return this.state.dnd.cursor.type==="highlight"}get dragNodes(){return this.state.dnd.dragIds.map(t=>this.get(t)).filter(t=>!!t)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){var t;if(this.isFiltered)return!1;const r=(t=this.get(this.state.dnd.parentId))!==null&&t!==void 0?t:this.root,n=this.dragNodes,s=this.props.disableDrop;for(const i of n)if(!i||!r||i.isInternal&&rh(r,i))return!1;return typeof s=="function"?!s({parentNode:r,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof s=="string"?!r.data[s]:typeof s=="boolean"?!s:!0}drop(){const{parentId:t,index:r,dragIds:n}=this.state.dnd;gt(this.props.onMove,{dragIds:n,parentId:t===As?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Vn.cursor({type:"none"}))}showCursor(t){this.dispatch(Vn.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(Ao.open(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),gt(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(Ao.close(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),gt(this.props.onToggle,i))}toggle(t){const r=this.identifyNull(t);if(r)return this.isOpen(r)?this.close(r):this.open(r)}openParents(t){const r=this.identifyNull(t);if(!r)return;const n=yl(this.root,r);let s=n==null?void 0:n.parent;for(;s;)this.open(s.id,!1),s=s.parent;this.redrawList()}openSiblings(t){const r=t.parent;if(!r)this.toggle(t.id);else if(r.children){const n=t.isOpen;for(let s of r.children)s.isInternal&&(n?this.close(s.id,!1):this.open(s.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){Bi(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Bi(this.root,t=>{t.isInternal&&this.close(t.id,!1)}),this.redrawList()}scrollTo(t,r="smart"){if(!t)return;const n=this.identify(t);return this.openParents(n),oh(()=>n in this.idToIndex).then(()=>{var s;const i=this.idToIndex[n];i!==void 0&&((s=this.list.current)===null||s===void 0||s.scrollToItem(i,r))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var t;return!!(!((t=this.props.searchTerm)===null||t===void 0)&&t.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(t){return t?this.state.nodes.selection.ids.has(t):!1}isOpen(t){var r,n,s;if(!t)return!1;if(t===As)return!0;const i=(r=this.props.openByDefault)!==null&&r!==void 0?r:!0;return this.isFiltered?(n=this.state.nodes.open.filtered[t])!==null&&n!==void 0?n:!0:(s=this.state.nodes.open.unfiltered[t])!==null&&s!==void 0?s:i}isEditable(t){return this.isActionPossible(t,this.props.disableEdit)}isDraggable(t){return this.isActionPossible(t,this.props.disableDrag)}isSelectable(t){return this.isActionPossible(t,this.props.disableSelect)}isActionPossible(t,r=()=>!1){return!ps(t,r)}isDragging(t){const r=this.identifyNull(t);return r?this.state.nodes.drag.id===r:!1}isFocused(t){return this.hasFocus&&this.state.nodes.focus.id===t}isMatch(t){return this.matchFn(t)}willReceiveDrop(t){const r=this.identifyNull(t);if(!r)return!1;const{destinationParentId:n,destinationIndex:s}=this.state.nodes.drag;return r===n&&s===null}onFocus(){const t=this.focusedNode||this.firstNode;t&&this.dispatch(gn(t.id))}onBlur(){this.dispatch(cT())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||kh}get renderRow(){return this.props.renderRow||sT}get renderNode(){return this.props.children||iT}get renderDragPreview(){return this.props.renderDragPreview||uh}get renderCursor(){return this.props.renderCursor||nT}}function yt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var kO=typeof Symbol=="function"&&Symbol.observable||"@@observable",Eu=kO,Ua=()=>Math.random().toString(36).substring(7).split("").join("."),LO={INIT:`@@redux/INIT${Ua()}`,REPLACE:`@@redux/REPLACE${Ua()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ua()}`},cn=LO;function Ph(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function PO(e){if(e===void 0)return"undefined";if(e===null)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(BO(e))return"date";if(MO(e))return"error";const r=FO(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function FO(e){return typeof e.constructor=="function"?e.constructor.name:null}function MO(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function BO(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Or(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=PO(e)),t}function Fh(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?yt(2):`Expected the root reducer to be a function. Instead, received: '${Or(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?yt(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?yt(1):`Expected the enhancer to be a function. Instead, received: '${Or(r)}'`);return r(Fh)(e,t)}let n=e,s=t,i=new Map,a=i,o=0,l=!1;function u(){a===i&&(a=new Map,i.forEach((y,v)=>{a.set(v,y)}))}function f(){if(l)throw new Error(process.env.NODE_ENV==="production"?yt(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return s}function d(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?yt(4):`Expected the listener to be a function. Instead, received: '${Or(y)}'`);if(l)throw new Error(process.env.NODE_ENV==="production"?yt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");let v=!0;u();const b=o++;return a.set(b,y),function(){if(v){if(l)throw new Error(process.env.NODE_ENV==="production"?yt(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");v=!1,u(),a.delete(b),i=null}}}function g(y){if(!Ph(y))throw new Error(process.env.NODE_ENV==="production"?yt(7):`Actions must be plain objects. Instead, the actual type was: '${Or(y)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(typeof y.type>"u")throw new Error(process.env.NODE_ENV==="production"?yt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof y.type!="string")throw new Error(process.env.NODE_ENV==="production"?yt(17):`Action "type" property must be a string. Instead, the actual type was: '${Or(y.type)}'. Value was: '${y.type}' (stringified)`);if(l)throw new Error(process.env.NODE_ENV==="production"?yt(9):"Reducers may not dispatch actions.");try{l=!0,s=n(s,y)}finally{l=!1}return(i=a).forEach(b=>{b()}),y}function p(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?yt(10):`Expected the nextReducer to be a function. Instead, received: '${Or(y)}`);n=y,g({type:cn.REPLACE})}function w(){const y=d;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(process.env.NODE_ENV==="production"?yt(11):`Expected the observer to be an object. Instead, received: '${Or(v)}'`);function b(){const S=v;S.next&&S.next(f())}return b(),{unsubscribe:y(b)}},[Eu](){return this}}}return g({type:cn.INIT}),{dispatch:g,subscribe:d,getState:f,replaceReducer:p,[Eu]:w}}function Iu(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function $O(e,t,r,n){const s=Object.keys(t),i=r&&r.type===cn.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(s.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!Ph(e))return`The ${i} has unexpected type of "${Or(e)}". Expected argument to be an object with the following keys: "${s.join('", "')}"`;const a=Object.keys(e).filter(o=>!t.hasOwnProperty(o)&&!n[o]);if(a.forEach(o=>{n[o]=!0}),!(r&&r.type===cn.REPLACE)&&a.length>0)return`Unexpected ${a.length>1?"keys":"key"} "${a.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${s.join('", "')}". Unexpected keys will be ignored.`}function qO(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:cn.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?yt(12):`The slice reducer for key "${t}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:cn.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?yt(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${cn.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function Ou(e){const t=Object.keys(e),r={};for(let a=0;a<t.length;a++){const o=t[a];process.env.NODE_ENV!=="production"&&typeof e[o]>"u"&&Iu(`No reducer provided for key "${o}"`),typeof e[o]=="function"&&(r[o]=e[o])}const n=Object.keys(r);let s;process.env.NODE_ENV!=="production"&&(s={});let i;try{qO(r)}catch(a){i=a}return function(o={},l){if(i)throw i;if(process.env.NODE_ENV!=="production"){const d=$O(o,r,l,s);d&&Iu(d)}let u=!1;const f={};for(let d=0;d<n.length;d++){const g=n[d],p=r[g],w=o[g],h=p(w,l);if(typeof h>"u"){const y=l&&l.type;throw new Error(process.env.NODE_ENV==="production"?yt(14):`When called with an action of type ${y?`"${String(y)}"`:"(unknown type)"}, the slice reducer for key "${g}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}f[g]=h,u=u||h!==w}return u=u||n.length!==Object.keys(o).length,u?f:o}}function UO(e=zn().nodes.drag,t){switch(t.type){case"DND_DRAG_START":return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}const zO=Ou({nodes:Ou({focus:uT,edit:lT,open:dT,selection:fT,drag:UO}),dnd:hT}),VO=zn();function HO({treeProps:e,imperativeHandle:t,children:r}){const n=m.useRef(null),s=m.useRef(null),i=m.useRef(Fh(zO,zn(e))),a=G0.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>VO),o=m.useMemo(()=>new ws(i.current,e,n,s),[]),l=m.useRef(0);return m.useMemo(()=>{l.current+=1,o.update(e)},Object.values(e)),m.useMemo(()=>{l.current+=1,o.update(o.props)},[a.nodes.open]),m.useImperativeHandle(t,()=>o),m.useEffect(()=>{o.props.selection?o.select(o.props.selection,{focus:!1}):o.deselectAll()},[o.props.selection]),m.useEffect(()=>{o.props.searchTerm||i.current.dispatch(Ao.clear(!0))},[o.props.searchTerm]),c.jsx(Wf.Provider,{value:o,children:c.jsx(Zf.Provider,{value:l.current,children:c.jsx(Kf.Provider,{value:a.nodes,children:c.jsx(Yf.Provider,{value:a.dnd,children:c.jsx(S1,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||SO,options:{rootElement:o.props.dndRootElement||void 0}},{children:r}))})})})})}function QO(){const e=Rt(),[,t]=Th(()=>({accept:"NODE",canDrop:(r,n)=>n.isOver({shallow:!0})?e.canDrop():!1,hover:(r,n)=>{if(!n.isOver({shallow:!0}))return;const s=n.getClientOffset();if(!e.listEl.current||!s)return;const{cursor:i,drop:a}=jh({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});a&&e.dispatch(Vn.hovering(a.parentId,a.index)),n.canDrop()?i&&e.showCursor(i):e.hideCursor()},drop:(r,n)=>{if(!n.isOver({shallow:!0})||!n.canDrop())return null;e.drop()}}),[e]);t(e.listEl)}function GO(e){return QO(),e.children}function WO(){const t=Rt().props.renderContainer||kh;return c.jsx(c.Fragment,{children:c.jsx(t,{})})}function KO(){const e=Rt(),{offset:t,mouse:r,item:n,isDragging:s}=GI(a=>({offset:a.getSourceClientOffset(),mouse:a.getClientOffset(),item:a.getItem(),isDragging:a.isDragging()})),i=e.props.renderDragPreview||uh;return c.jsx(i,{offset:t,mouse:r,id:(n==null?void 0:n.id)||null,dragIds:(n==null?void 0:n.dragIds)||[],isDragging:s})}function YO(e={}){var t,r;const n=(t=e.idAccessor)!==null&&t!==void 0?t:"id",s=(r=e.childrenAccessor)!==null&&r!==void 0?r:"children";return{getId:typeof n=="function"?n:i=>i[n],getChildren:typeof s=="function"?s:i=>i[s],childrenKey:typeof s=="string"?s:"children"}}class ZO{constructor(t,r={}){this.accessors=YO(r),this.root=XO(t,this.accessors)}get data(){var t,r;return(r=(t=this.root.children)===null||t===void 0?void 0:t.map(n=>n.data))!==null&&r!==void 0?r:[]}create(t){const r=t.parentId?this.find(t.parentId):this.root;if(!r)return null;r.addChild(t.data,t.index)}move(t){const r=this.find(t.id),n=t.parentId?this.find(t.parentId):this.root;!r||!n||(n.addChild(r.data,t.index),r.drop())}update(t){const r=this.find(t.id);r&&r.update(t.changes)}drop(t){const r=this.find(t.id);r&&r.drop()}find(t,r=this.root){if(!r)return null;if(r.id===t)return r;if(r.children){for(let n of r.children){const s=this.find(t,n);if(s)return s}return null}return null}}function XO(e,t){const r=new Mh({},null,t,"ROOT");return r.children=e.map(n=>_l(n,r,t)),r}function _l(e,t,r){const n=new Mh(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>_l(i,n,r))),n}class Mh{constructor(t,r,n,s){this.data=t,this.parent=r,this.accessors=n,this.id=s??n.getId(t)}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(t,r){var n,s;const i=_l(t,this,this.accessors);this.children=(n=this.children)!==null&&n!==void 0?n:[],this.children.splice(r,0,i);const a=this.accessors.childrenKey,o=this.data;o[a]=(s=o[a])!==null&&s!==void 0?s:[],o[a].splice(r,0,t)}removeChild(t){var r,n;(r=this.children)===null||r===void 0||r.splice(t,1),(n=this.data[this.accessors.childrenKey])===null||n===void 0||n.splice(t,1)}update(t){if(this.hasParent()){const r=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),t),r),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let JO=0;function eA(e,t={}){const[r,n]=m.useState(e),s=t.idAccessor,i=t.childrenAccessor,a=m.useMemo(()=>new ZO(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),o=w=>{for(const h of w.dragIds)a.move({id:h,parentId:w.parentId,index:w.index});n(a.data)},l=({name:w,id:h})=>{a.update({id:h,changes:{name:w}}),n(a.data)},u=typeof s=="string"?s:"id",f=typeof i=="string"?i:"children";return[r,{onMove:o,onRename:l,onCreate:({parentId:w,index:h,type:y})=>{if(typeof s=="function")throw new Error("React Arborist => initialData can't create nodes when idAccessor is a function: the generated id can't be written under a key the accessor reads. Use a string idAccessor, or the controlled `data` prop with your own onCreate.");if(y==="internal"&&typeof i=="function")throw new Error("React Arborist => initialData can't create folder nodes when childrenAccessor is a function: the new children array can't be written under a key the accessor reads. Use a string childrenAccessor, or the controlled `data` prop with your own onCreate.");const v={[u]:`simple-tree-id-${JO++}`,name:""};return y==="internal"&&(v[f]=[]),a.create({parentId:w,index:h,data:v}),n(a.data),v},onDelete:w=>{w.ids.forEach(h=>a.drop({id:h})),n(a.data)}}]}function tA(e){if(e.initialData&&e.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw new Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
|
|
506
|
-
Use the data prop if you want to provide your own handlers.`);if(e.initialData){const[t,r]=eA(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function rA(e,t){const r=tA(e);return c.jsxs(HO,{treeProps:r,imperativeHandle:t,children:[c.jsx(GO,{children:c.jsx(WO,{})}),c.jsx(KO,{})]})}const nA=m.forwardRef(rA);function Tl(){return Oe(e=>{var n;const t=e.treeData[0];return(((n=t==null?void 0:t.metadata)==null?void 0:n.status)??(t==null?void 0:t.status)??"Draft").toLowerCase()==="draft"})}function sA(){return Oe(e=>{var s;if(!e.selectedNodeId)return!1;const t=(s=e.treeData[0])==null?void 0:s.id,r=i=>{var a;for(const o of i){if(o.id===e.selectedNodeId)return o;if((a=o.children)!=null&&a.length){const l=r(o.children);if(l)return l}}},n=r(e.treeData);return!!(n!=null&&n.isFolder)&&n.id!==t})}const Au={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},Du={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},Nu=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],iA=[{label:"All",value:"all"},{label:"Course Assessment",value:"Course Assessment"},{label:"eTextbook",value:"eTextbook"},{label:"Exam Question",value:"Exam Question"},{label:"Explanation Content",value:"Explanation Content"},{label:"Learning Resource",value:"Learning Resource"},{label:"Practice Question Set",value:"Practice Question Set"},{label:"SCORM Content",value:"SCORM Content"},{label:"Teacher Resource",value:"Teacher Resource"}];function aA(e){const t=[e.mimeType??"",e.primaryCategory??"",e.contentType??""].join(" ").toLowerCase();return t.includes("video")?"video":t.includes("pdf")||t.includes("epub")?"pdf":t.includes("h5p")?"h5p":t.includes("scorm")?"scorm":t.includes("audio")||t.includes("mp3")?"audio":t.includes("quiz")||t.includes("question")||t.includes("ecml")?"quiz":"default"}function ua(e){const t=aA(e);return{key:t,color:Au[t]??Au.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:Du[t]??Du.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const oA="_row_i3qt2_1",lA="_grip_i3qt2_16",cA="_menuBtn_i3qt2_19",uA="_selected_i3qt2_23",dA="_title_i3qt2_28",fA="_dropTarget_i3qt2_33",hA="_toggle_i3qt2_50",pA="_ctIcon_i3qt2_65",mA="_folderIcon_i3qt2_77",gA="_renameInput_i3qt2_92",yA="_dropHere_i3qt2_101",vA="_menuWrap_i3qt2_111",bA="_menu_i3qt2_19",wA="_dangerItem_i3qt2_163",Ot={row:oA,grip:lA,menuBtn:cA,selected:uA,title:dA,dropTarget:fA,toggle:hA,ctIcon:pA,folderIcon:mA,renameInput:gA,dropHere:yA,menuWrap:vA,menu:bA,dangerItem:wA},CA={video:ol,pdf:ta,h5p:nl,scorm:il,audio:sl,quiz:tl,default:Yn},SA=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=m.useState(!1),[a,o]=m.useState(!1),[l,u]=m.useState(e.data.name),f=m.useRef(null),d=le(),g=n==="edit",p=Tl(),w=ua(e.data),h=CA[w.key]??Yn,y=e.isSelected,v=e.level===0,b=e.data.isFolder??(e.children&&e.children.length>0),C=v?Ry:b?My:h;m.useEffect(()=>{if(!s)return;const E=N=>{var R;(R=f.current)!=null&&R.contains(N.target)||i(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[s]);const S=m.useCallback(()=>{l.trim()&&e.submit(l.trim()),o(!1)},[l,e]),_=m.useCallback(E=>{E.key==="Enter"&&S(),E.key==="Escape"&&(u(e.data.name),o(!1))},[S,e.data.name]);return c.jsxs("div",{className:[Ot.row,y?Ot.selected:"",e.state.isOver&&b?Ot.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":b?"true":void 0,role:"treeitem","aria-selected":y,"aria-expanded":b?!e.isClosed:void 0,children:[g&&c.jsx("span",{ref:r,className:Ot.grip,"aria-hidden":"true",children:c.jsx(cf,{size:14})}),c.jsx("button",{className:Ot.toggle,onClick:E=>{E.stopPropagation(),e.toggle()},"aria-label":e.isClosed?d.treeNode.expandAriaLabel:d.treeNode.collapseAriaLabel,style:{visibility:b?"visible":"hidden"},children:e.isClosed?c.jsx(sf,{size:14}):c.jsx(Kn,{size:14})}),c.jsx("span",{className:`${Ot.ctIcon} ${v||b?Ot.folderIcon:w.bgClass}`,"aria-hidden":"true",children:c.jsx(C,{size:12})}),a?c.jsx("input",{className:Ot.renameInput,value:l,autoFocus:!0,onChange:E=>u(E.target.value),onBlur:S,onKeyDown:_,onClick:E=>E.stopPropagation()}):c.jsx("span",{className:Ot.title,title:e.data.name,onDoubleClick:()=>g&&o(!0),children:e.data.name.length>25?`${e.data.name.slice(0,25)}...`:e.data.name}),e.state.isOver&&b&&c.jsx("span",{className:Ot.dropHere,"aria-hidden":"true",children:d.treeNode.dropHereLabel}),g&&c.jsxs("div",{className:Ot.menuWrap,ref:f,children:[c.jsx("button",{className:Ot.menuBtn,onClick:E=>{E.stopPropagation(),i(N=>!N)},"aria-label":d.treeNode.nodeOptionsAriaLabel,children:c.jsx(of,{size:14})}),s&&c.jsxs("div",{className:Ot.menu,role:"menu",children:[c.jsxs("button",{role:"menuitem",onClick:()=>{o(!0),i(!1)},children:[c.jsx(Hy,{size:13})," ",d.treeNode.renameMenuItem]}),b&&p&&c.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[c.jsx(lf,{size:13})," ",d.treeNode.addSubunitMenuItem]}),e.data.parent&&p&&c.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[c.jsx(Us,{size:13})," ",d.treeNode.addSiblingMenuItem]}),c.jsxs("button",{role:"menuitem",className:Ot.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[c.jsx(al,{size:13})," ",d.treeNode.deleteMenuItem]})]})]})]})};async function xA(e,t){var i,a;const n=((i=(await Ne.post(`/action/content/v3/upload/url/${e}?type=hierarchy`,{request:{content:{fileName:t}}})).data)==null?void 0:i.result)??{},s=((a=n.content)==null?void 0:a.preSignedURL)??n.pre_signed_url??n.preSignedUrl;if(!s)throw new Error("Could not obtain an upload URL");return s}async function _A(e,t){const r=await fetch(e,{method:"PUT",headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"text/csv"},body:t});if(!r.ok)throw new Error(`Blob upload failed (${r.status})`);return e.split("?")[0]}async function TA(e,t){var o;const r=await xA(e,t.name),n=await _A(r,t),s=new FormData;return s.append("fileUrl",n),s.append("mimeType",t.type||"text/csv"),{processId:(((o=(await Ne.post(`/action/collection/v1/import/${e}`,s)).data)==null?void 0:o.result)??{}).processId??""}}async function EA(e){var r;return((r=(await Ne.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function Bh(e){var n,s,i;const r=(i=(s=(n=(await Ne.get(`/action/collection/v1/export/${e}`)).data)==null?void 0:n.result)==null?void 0:s.collection)==null?void 0:i.tocUrl;if(!r)throw new Error("No export URL returned");return r}async function IA(e){return Bh(e)}const OA="_container_jr3ij_1",AA="_header_jr3ij_13",DA="_title_jr3ij_22",NA="_closeBtn_jr3ij_29",RA="_body_jr3ij_45",jA="_dropZone_jr3ij_54",kA="_dragOver_jr3ij_67",LA="_hasFile_jr3ij_72",PA="_hiddenInput_jr3ij_78",FA="_fileInfo_jr3ij_82",MA="_fileIcon_jr3ij_89",BA="_fileName_jr3ij_93",$A="_fileSize_jr3ij_100",qA="_dropHint_jr3ij_105",UA="_dropIcon_jr3ij_112",zA="_dropText_jr3ij_117",VA="_dropSubtext_jr3ij_124",HA="_sampleLink_jr3ij_130",QA="_statusBar_jr3ij_145",GA="_status_uploading_jr3ij_154",WA="_status_processing_jr3ij_154",KA="_status_done_jr3ij_159",YA="_status_error_jr3ij_164",ZA="_successDetail_jr3ij_170",XA="_spinner_jr3ij_175",JA="_spin_jr3ij_175",eD="_errorMsg_jr3ij_191",tD="_failedSection_jr3ij_197",rD="_failedTitle_jr3ij_203",nD="_tableWrap_jr3ij_213",sD="_failedTable_jr3ij_219",iD="_reasonCell_jr3ij_244",aD="_footer_jr3ij_248",Re={container:OA,header:AA,title:DA,closeBtn:NA,body:RA,dropZone:jA,dragOver:kA,hasFile:LA,hiddenInput:PA,fileInfo:FA,fileIcon:MA,fileName:BA,fileSize:$A,dropHint:qA,dropIcon:UA,dropText:zA,dropSubtext:VA,sampleLink:HA,statusBar:QA,status_uploading:GA,status_processing:WA,status_done:KA,status_error:YA,successDetail:ZA,spinner:XA,spin:JA,errorMsg:eD,failedSection:tD,failedTitle:rD,tableWrap:nD,failedTable:sD,reasonCell:iD,footer:aD},oD=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const s=le(),[i,a]=m.useState(null),[o,l]=m.useState(!1),[u,f]=m.useState("idle"),[d,g]=m.useState(""),[p,w]=m.useState([]),[h,y]=m.useState(null),v=m.useRef(null),b=m.useRef(null),C=m.useCallback(()=>{b.current!==null&&(clearInterval(b.current),b.current=null)},[]);m.useEffect(()=>()=>C(),[C]);const S=D=>D.name.toLowerCase().endsWith(".csv")?D.size>50*1024*1024?(g(s.csvUpload.fileTooLarge),!1):!0:(g(s.csvUpload.invalidFileType),!1),_=m.useCallback(D=>{g(""),w([]),y(null),f("idle"),S(D)&&a(D)},[]),E=m.useCallback(D=>{D.preventDefault(),l(!1);const j=D.dataTransfer.files[0];j&&_(j)},[_]),N=m.useCallback(D=>{var M;const j=(M=D.target.files)==null?void 0:M[0];j&&_(j),D.target.value=""},[_]),R=m.useCallback(async()=>{try{const D=await IA(e),j=document.createElement("a");j.href=D,j.download="sample_hierarchy.csv",j.target="_blank",j.click()}catch{g(s.csvUpload.downloadSampleFailed)}},[e,s.csvUpload.downloadSampleFailed]),P=m.useCallback(async()=>{if(i){f("uploading"),g(""),w([]);try{const{processId:D}=await TA(e,i);if(!D){f("done"),y(null),setTimeout(t,1500);return}f("processing"),b.current=setInterval(async()=>{try{const j=await EA(D);j.status==="COMPLETED"?(C(),f("done"),y(j.successCount??null),j.failedRecords&&j.failedRecords.length>0?w(j.failedRecords):setTimeout(t,1500)):j.status==="FAILED"&&(C(),f("error"),g(s.csvUpload.processingFailed),j.failedRecords&&w(j.failedRecords))}catch{C(),f("error"),g(s.csvUpload.connectionLost)}},2e3)}catch{f("error"),g(s.csvUpload.uploadFailed)}}},[e,i,t,C,s.csvUpload.processingFailed,s.csvUpload.connectionLost,s.csvUpload.uploadFailed]),B={idle:"",uploading:s.csvUpload.statusUploading,processing:s.csvUpload.statusProcessing,done:s.csvUpload.statusDone,error:s.csvUpload.statusError};return c.jsxs("div",{className:Re.container,children:[c.jsxs("div",{className:Re.header,children:[c.jsx("h2",{className:Re.title,children:n==="update"?s.csvUpload.titleUpdate:s.csvUpload.titleCreate}),c.jsx("button",{className:Re.closeBtn,onClick:r,"aria-label":s.csvUpload.closeAriaLabel,children:c.jsx(Cr,{size:18})})]}),c.jsxs("div",{className:Re.body,children:[c.jsxs("div",{className:`${Re.dropZone} ${o?Re.dragOver:""} ${i?Re.hasFile:""}`,onDragEnter:D=>{D.preventDefault(),l(!0)},onDragOver:D=>{D.preventDefault(),l(!0)},onDragLeave:D=>{D.preventDefault(),l(!1)},onDrop:E,onClick:()=>{var D;return(D=v.current)==null?void 0:D.click()},role:"button",tabIndex:0,"aria-label":s.csvUpload.dropZoneAriaLabel,onKeyDown:D=>{var j;return D.key==="Enter"&&((j=v.current)==null?void 0:j.click())},children:[c.jsx("input",{ref:v,type:"file",accept:".csv",className:Re.hiddenInput,onChange:N,"aria-hidden":"true"}),i?c.jsxs("div",{className:Re.fileInfo,children:[c.jsx(ta,{size:24,className:Re.fileIcon}),c.jsx("span",{className:Re.fileName,children:i.name}),c.jsxs("span",{className:Re.fileSize,children:["(",(i.size/1024).toFixed(1)," KB)"]})]}):c.jsxs("div",{className:Re.dropHint,children:[c.jsx(vo,{size:32,className:Re.dropIcon}),c.jsx("p",{className:Re.dropText,children:s.csvUpload.dropText}),c.jsx("p",{className:Re.dropSubtext,children:s.csvUpload.dropSubtext})]})]}),c.jsx("button",{className:Re.sampleLink,onClick:R,type:"button",children:s.csvUpload.downloadSample}),u!=="idle"&&c.jsxs("div",{className:`${Re.statusBar} ${Re[`status_${u}`]}`,role:"status","aria-live":"polite",children:[u==="processing"&&c.jsx("span",{className:Re.spinner,"aria-hidden":"true"}),B[u],u==="done"&&h!==null&&c.jsx("span",{className:Re.successDetail,children:s.csvUpload.itemsImportedSuffix.replace("{count}",String(h))})]}),d&&c.jsx("p",{className:Re.errorMsg,role:"alert",children:d}),p.length>0&&c.jsxs("div",{className:Re.failedSection,children:[c.jsx("h4",{className:Re.failedTitle,children:s.csvUpload.failedRowsTitle.replace("{count}",String(p.length))}),c.jsx("div",{className:Re.tableWrap,children:c.jsxs("table",{className:Re.failedTable,children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:s.csvUpload.rowHeader}),c.jsx("th",{children:s.csvUpload.nameHeader}),c.jsx("th",{children:s.csvUpload.reasonHeader})]})}),c.jsx("tbody",{children:p.map((D,j)=>c.jsxs("tr",{children:[c.jsx("td",{children:D.rowNumber??j+1}),c.jsx("td",{children:D.name??"—"}),c.jsx("td",{className:Re.reasonCell,children:D.reason??s.csvUpload.unknownError})]},j))})]})})]})]}),c.jsxs("div",{className:Re.footer,children:[c.jsx(Fe,{variant:"ghost",onClick:r,disabled:u==="uploading"||u==="processing",children:s.csvUpload.cancel}),c.jsx(Fe,{variant:"primary",isLoading:u==="uploading"||u==="processing",disabled:!i||u==="done",onClick:P,children:u==="done"?s.csvUpload.uploaded:s.csvUpload.upload})]})]})},lD="_container_1y30m_1",cD="_header_1y30m_8",uD="_headerActions_1y30m_19",dD="_iconBtn_1y30m_25",fD="_menuWrap_1y30m_43",hD="_dropdownMenu_1y30m_47",pD="_treeWrapper_1y30m_79",mD="_csvModal_1y30m_95",gD="_footer_1y30m_105",ar={container:lD,header:cD,headerActions:uD,iconBtn:dD,menuWrap:fD,dropdownMenu:hD,treeWrapper:pD,csvModal:mD,footer:gD},yD=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var de;const n=le(),s=m.useRef(null),i=m.useRef(null),a=m.useRef(null),[o,l]=m.useState(400),[u,f]=m.useState(!1),[d,g]=m.useState(!1),[p,w]=m.useState("create"),{treeData:h,selectedNodeId:y,selectNode:v,addNode:b,deleteNode:C,reorderChildren:S,moveNode:_,setTreeData:E}=Oe(),N=e==="edit",R=Tl(),P=N&&R,B=(((de=h[0])==null?void 0:de.children)??[]).some(Q=>Q.isFolder),D=ce(Q=>{var ne,te,q,V;return((te=(ne=Q.editorConfig)==null?void 0:ne.context)==null?void 0:te.contentId)??((V=(q=Q.editorConfig)==null?void 0:q.context)==null?void 0:V.identifier)??""}),j=ce(Q=>{var te,q;const ne=(q=(te=Q.categoryMeta)==null?void 0:te.sourcingSettings)==null?void 0:q.collection;return(ne==null?void 0:ne.enableBulkUpload)!==!1});m.useEffect(()=>{const Q=i.current;if(!Q)return;const ne=new ResizeObserver(()=>{l(Q.clientHeight||400)});return ne.observe(Q),l(Q.clientHeight||400),()=>ne.disconnect()},[]),m.useEffect(()=>{if(!u)return;const Q=ne=>{var te;(te=a.current)!=null&&te.contains(ne.target)||f(!1)};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[u]);const M=m.useCallback(Q=>{Q.length>0&&v(Q[0].data.id)},[v]),k=m.useCallback(({parentId:Q,index:ne,dragIds:te})=>{if(!Q)return;const q=te[0],V=Mo(h,q);if(!V)return;const ie=V.parent;if(ie===Q){const fe=Mo(h,Q);if(!(fe!=null&&fe.children))return;const J=fe.children.findIndex(se=>se.id===q);if(J<0)return;S(Q,J,ne>J?ne-1:ne)}else _(q,ie??"",Q)},[h,S,_]),L=m.useCallback(({ids:Q})=>{Q.forEach(ne=>C(ne))},[C]),z=m.useCallback(({parentId:Q})=>{var q;const ne=Q??((q=h[0])==null?void 0:q.id)??"";if(!ne)return{id:crypto.randomUUID()};const te=b(ne,"unit");return te?{id:te}:(Ee.error(n.outlineTree.maxDepthReachedToast),{id:crypto.randomUUID()})},[b,h,n]),X=m.useCallback(()=>{var ne;const Q=(ne=h[0])==null?void 0:ne.id;Q&&(b(Q,"unit")||Ee.error(n.outlineTree.maxDepthReachedToast))},[h,b,n]),ye=m.useCallback(()=>{y&&(b(y,"subunit")||Ee.error(n.outlineTree.maxDepthReachedToast))},[y,b,n]),_e=m.useCallback(async()=>{if(f(!1),!!D)try{const Q=await Bh(D),ne=await fetch(Q).then(V=>V.blob()),te=URL.createObjectURL(ne),q=document.createElement("a");q.href=te,q.download=`${D}-folders.csv`,q.style.display="none",document.body.appendChild(q),q.click(),document.body.removeChild(q),URL.revokeObjectURL(te)}catch{Ee.error(n.outlineTree.downloadCsvFailedToast)}},[D,n]),we=m.useCallback(async()=>{if(g(!1),!!D)try{const{rootNode:Q}=await Gf(D);E([Q]),Ee.success(n.outlineTree.outlineRefreshedToast)}catch{Ee.error(n.outlineTree.outlineRefreshFailedToast)}},[D,E,n]);return c.jsxs("div",{className:ar.container,children:[c.jsx("div",{className:ar.header,children:c.jsxs("div",{className:ar.headerActions,children:[N&&c.jsxs("div",{className:ar.menuWrap,ref:a,children:[c.jsx("button",{type:"button",className:ar.iconBtn,onClick:()=>f(Q=>!Q),"aria-label":n.outlineTree.moreOptionsAriaLabel,title:n.outlineTree.moreOptionsTitle,"aria-haspopup":"true","aria-expanded":u,children:c.jsx(of,{size:15})}),u&&c.jsx("div",{className:ar.dropdownMenu,role:"menu",children:j&&c.jsxs(c.Fragment,{children:[c.jsx("button",{role:"menuitem",type:"button",disabled:B,title:B?n.outlineTree.foldersExistTitle:void 0,onClick:()=>{f(!1),w("create"),g(!0)},children:n.outlineTree.createFoldersCsvButton}),c.jsx("button",{role:"menuitem",type:"button",disabled:!B,title:B?void 0:n.outlineTree.noFoldersYetTitle,onClick:_e,children:n.outlineTree.downloadFoldersCsvButton}),c.jsx("button",{role:"menuitem",type:"button",disabled:!B,title:B?void 0:n.outlineTree.noFoldersYetTitle,onClick:()=>{f(!1),w("update"),g(!0)},children:n.outlineTree.updateFoldersCsvButton})]})})]}),r&&c.jsx("button",{type:"button",className:ar.iconBtn,onClick:r,"aria-label":t?n.outlineTree.expandOutlineAriaLabel:n.outlineTree.collapseOutlineAriaLabel,title:t?n.outlineTree.expandOutlineAriaLabel:n.outlineTree.collapseOutlineAriaLabel,children:t?c.jsx(zy,{size:15}):c.jsx(Uy,{size:15})})]})}),c.jsx("div",{className:ar.treeWrapper,ref:i,children:c.jsx(nA,{ref:s,data:h,idAccessor:"id",childrenAccessor:"children",onSelect:M,onMove:N?k:void 0,onDelete:N?L:void 0,onCreate:N?z:void 0,disableEdit:!N,disableDrop:!N,selection:y??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:Q=>c.jsx(SA,{...Q,editorMode:e})})}),N&&c.jsxs("div",{className:ar.footer,children:[c.jsxs(Fe,{variant:"ghost",size:"sm",onClick:X,disabled:!P,children:[c.jsx(Us,{size:14})," ",n.outlineTree.addUnitButton]}),c.jsxs(Fe,{variant:"ghost",size:"sm",onClick:ye,disabled:!P||!y,children:[c.jsx(lf,{size:14})," ",n.outlineTree.addSubunitButton]})]}),d&&c.jsx("div",{className:ar.csvModal,children:c.jsx(oD,{contentId:D,mode:p,onComplete:we,onClose:()=>g(!1)})})]})};function Mo(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Mo(r.children,t);if(n)return n}}}const vD="_breadcrumb_zd1aj_1",bD="_crumb_zd1aj_10",wD="_sep_zd1aj_26",CD="_current_zd1aj_31",os={breadcrumb:vD,crumb:bD,sep:wD,current:CD},SD=({crumbs:e})=>{const t=Oe(n=>n.selectNode),r=le();return e.length?c.jsxs("nav",{className:os.breadcrumb,"aria-label":r.breadcrumb.nodePathAriaLabel,children:[c.jsx("button",{className:os.crumb,onClick:()=>t(e[0].id),"aria-label":r.breadcrumb.homeAriaLabel,children:c.jsx($y,{size:13})}),e.map((n,s)=>c.jsxs(m.Fragment,{children:[c.jsx(sf,{size:13,className:os.sep}),s<e.length-1?c.jsx("button",{className:os.crumb,onClick:()=>t(n.id),children:n.name}):c.jsx("span",{className:os.current,children:n.name})]},n.id))]}):null},xD="_tabBar_qhks1_1",_D="_tab_qhks1_1",TD="_active_qhks1_29",ED="_error_qhks1_35",ID="_errorDot_qhks1_39",ls={tabBar:xD,tab:_D,active:TD,error:ED,errorDot:ID},OD=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=le(),i=[{id:"details",label:s.tabBar.detailsTab},{id:"audience",label:s.tabBar.audienceCurriculumTab},{id:"licensing",label:s.tabBar.licensingTab}],a=n?i.filter(o=>n.includes(o.id)):i;return c.jsx("div",{className:ls.tabBar,role:"tablist","aria-label":s.tabBar.metadataSectionsAriaLabel,children:a.map(o=>c.jsxs("button",{role:"tab","aria-selected":e===o.id,"aria-controls":`panel-${o.id}`,className:[ls.tab,e===o.id?ls.active:"",r.includes(o.id)?ls.error:""].join(" "),onClick:()=>t(o.id),children:[o.label,r.includes(o.id)&&c.jsx("span",{className:ls.errorDot,"aria-label":s.tabBar.hasErrorsAriaLabel})]},o.id))})};var Ws=e=>e.type==="checkbox",Yr=e=>e instanceof Date,ut=e=>e==null;const $h=e=>typeof e=="object";var We=e=>!ut(e)&&!Array.isArray(e)&&$h(e)&&!Yr(e),Bo=e=>We(e)&&e.target?Ws(e.target)?e.target.checked:e.target.value:e,qh=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Uh=e=>{const t=e.constructor&&e.constructor.prototype;return We(t)&&t.hasOwnProperty("isPrototypeOf")},da=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ke(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(da&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(We(e)&&Uh(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Ke(e[s]));return n}const Dr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Xt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Yt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},za="form",zh="root",Vh=["__proto__","constructor","prototype"];var Ks=e=>/^\w*$/.test(e),Be=e=>e===void 0,fa=e=>e.split(/[.[\]'"]/g).filter(Boolean),W=(e,t,r)=>{if(!t||!We(e))return r;const n=Ks(t)?[t]:fa(t);if(n.some(i=>Vh.includes(i)))return r;const s=n.reduce((i,a)=>ut(i)?void 0:i[a],e);return Be(s)||s===e?Be(e[t])?r:e[t]:s},Ft=e=>typeof e=="boolean",bt=e=>typeof e=="function",Le=(e,t,r)=>{let n=-1;const s=Ks(t)?[t]:fa(t),i=s.length,a=i-1;for(;++n<i;){const o=s[n];let l=r;if(n!==a){const u=e[o];l=We(u)||Array.isArray(u)?u:isNaN(+s[n+1])?{}:[]}if(Vh.includes(o))return;e[o]=l,e=e[o]}};const El=m.createContext(null);El.displayName="HookFormControlContext";const Il=()=>m.useContext(El);var Hh=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const a=i;return t._proxyFormState[a]!==Xt.all&&(t._proxyFormState[a]=!n||Xt.all),r&&(r[a]=!0),e[a]}});return s};const Ol=da?m.useLayoutEffect:m.useEffect;function AD(e){const t=Il(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[a,o]=m.useState(()=>({...r._formState,defaultValues:r._defaultValues})),l=m.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ol(()=>r._subscribe({name:s,formState:l.current,exact:i,callback:u=>{!n&&o({...r._formState,...u,defaultValues:r._defaultValues})}}),[s,n,i]),m.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),m.useMemo(()=>Hh(a,r,l.current,!1),[a,r])}var wt=e=>typeof e=="string",$o=(e,t,r,n,s)=>wt(e)?(n&&t.watch.add(e),W(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),W(r,i))):(n&&(t.watchAll=!0),r),qo=e=>ut(e)||!$h(e);const Ru=(e,t)=>t.length===0&&!Array.isArray(e)&&!Uh(e);function Mt(e,t,r=new WeakMap){if(e===t)return!0;if(qo(e)||qo(t))return Object.is(e,t);if(Yr(e)&&Yr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(Ru(e,n)||Ru(t,s))return Object.is(e,t);const i=r.get(e);if(i&&i.has(t))return!0;i?i.add(t):r.set(e,new WeakSet([t]));for(const a of n){const o=e[a];if(!(a in t))return!1;if(a!=="ref"){const l=t[a];if(Yr(o)&&Yr(l)||(We(o)||Array.isArray(o))&&(We(l)||Array.isArray(l))?!Mt(o,l,r):!Object.is(o,l))return!1}}return!0}function DD(e){const t=Il(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:a,compute:o}=e||{},l=m.useRef(s),u=m.useRef(o),f=m.useRef(void 0),d=m.useRef(r),g=m.useRef(n);u.current=o;const[p,w]=m.useState(()=>{const S=r._getWatch(n,l.current);return u.current?u.current(S):S}),h=m.useCallback(S=>{const _=$o(n,r._names,S||r._formValues,!1,l.current);return u.current?u.current(_):_},[r._formValues,r._names,n]),y=m.useCallback(S=>{if(!i){const _=$o(n,r._names,S||r._formValues,!1,l.current);if(u.current){const E=u.current(_);Mt(E,f.current)||(w(E),f.current=E)}else w(_)}},[r._formValues,r._names,i,n]);Ol(()=>((d.current!==r||!Mt(g.current,n))&&(d.current=r,g.current=n,y()),r._subscribe({name:n,formState:{values:!0},exact:a,callback:S=>{y(S.values)}})),[r,a,n,y]),m.useEffect(()=>r._removeUnmounted());const v=d.current!==r,b=g.current,C=m.useMemo(()=>{if(i)return null;const S=!v&&!Mt(b,n);return v||S?h():null},[i,v,n,b,h]);return C!==null?C:p}function ha(e){const t=Il(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:a,exact:o=!0}=e,l=qh(s._names.array,r),u=m.useMemo(()=>W(s._formValues,r,W(s._defaultValues,r,a)),[s,r,a]),f=DD({control:s,name:r,defaultValue:u,exact:o}),d=AD({control:s,name:r,exact:o}),g=m.useRef(e),p=m.useRef(null),w=m.useRef(s.register(r,{...e.rules,value:f,...Ft(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const h=m.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!W(d.errors,r)},isDirty:{enumerable:!0,get:()=>!!W(d.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!W(d.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!W(d.validatingFields,r)},error:{enumerable:!0,get:()=>W(d.errors,r)}}),[d,r]),y=m.useCallback(S=>{const _=Bo(S);return W(s._fields,r)||(w.current=s.register(r,{...g.current.rules,value:_})),w.current.onChange({target:{value:Bo(S),name:r},type:Dr.CHANGE})},[r,s]),v=m.useCallback(()=>w.current.onBlur({target:{value:W(s._formValues,r),name:r},type:Dr.BLUR}),[r,s._formValues]),b=m.useCallback(S=>{S&&(p.current={focus:()=>bt(S.focus)&&S.focus(),select:()=>bt(S.select)&&S.select(),setCustomValidity:E=>bt(S.setCustomValidity)&&S.setCustomValidity(E),reportValidity:()=>bt(S.reportValidity)&&S.reportValidity()});const _=W(s._fields,r);_&&_._f&&S&&(_._f.ref=p.current)},[s._fields,r]),C=m.useMemo(()=>({name:r,value:f,...Ft(n)||d.disabled?{disabled:d.disabled||n}:{},onChange:y,onBlur:v,ref:b}),[r,n,d.disabled,y,v,b,f]);return m.useEffect(()=>{const S=s._options.shouldUnregister||i;s.register(r,{...g.current.rules,...Ft(g.current.disabled)?{disabled:g.current.disabled}:{}});const _=(E,N)=>{const R=W(s._fields,E);R&&R._f&&(R._f.mount=N)};if(_(r,!0),S){const E=Ke(W(i?s._defaultValues:s._options.values||s._defaultValues,r,W(s._options.defaultValues,r,g.current.defaultValue)));Le(s._defaultValues,r,E),Be(W(s._formValues,r))&&Le(s._formValues,r,E)}if(!l&&s.register(r),p.current){const E=W(s._fields,r);E&&E._f&&(E._f.ref=p.current)}return()=>{(l?S&&!s._state.action:S)?s.unregister(r):_(r,!1)}},[r,s,l,i]),m.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),m.useMemo(()=>({field:C,formState:d,fieldState:h}),[C,d,h])}const Al=m.createContext(null);Al.displayName="HookFormContext";const rr=()=>m.useContext(Al),ND=({children:e,watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:a,setValues:o,trigger:l,formState:u,resetField:f,reset:d,handleSubmit:g,unregister:p,control:w,register:h,setFocus:y,subscribe:v})=>{const b=m.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:a,setValues:o,trigger:l,formState:u,resetField:f,reset:d,handleSubmit:g,unregister:p,control:w,register:h,setFocus:y,subscribe:v}),[i,w,u,n,r,g,h,d,f,s,y,a,o,v,l,p,t]);return m.createElement(Al.Provider,{value:b},m.createElement(El.Provider,{value:b.control},e))};var RD=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Qh=e=>Array.isArray(e)?e.filter(Boolean):[],Ei=e=>Array.isArray(e)?e:[e],ju=()=>{let e=[];return{get observers(){return e},next:s=>{for(const i of e)i.next&&i.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(i=>i!==s)}}),unsubscribe:()=>{e=[]}}};function Gh(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&We(s)&&i){const a=Gh(s,i);We(a)&&(r[n]=a)}else e[n]&&(r[n]=i)}return r}var it=e=>We(e)&&!Object.keys(e).length,Dl=e=>e.type==="file",qi=e=>{if(!da)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Wh=e=>e.type==="select-multiple",Nl=e=>e.type==="radio",jD=e=>Nl(e)||Ws(e),Va=e=>qi(e)&&e.isConnected;function kD(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(ut(e)){e=void 0;break}e=e[t[n]],n++}return e}function LD(e){for(const t in e)if(e.hasOwnProperty(t)&&!Be(e[t]))return!1;return!0}function Je(e,t){if(wt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Ks(t)?[t]:fa(t),n=r.length===1?e:kD(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(We(n)&&it(n)||Array.isArray(n)&&LD(n))&&Je(e,r.slice(0,-1)),e}var PD=e=>{for(const t in e)if(bt(e[t]))return!0;return!1};function Kh(e){return Array.isArray(e)||We(e)&&!PD(e)}function Uo(e,t={}){for(const r in e){const n=e[r];Kh(n)?(t[r]=Array.isArray(n)?[]:{},Uo(n,t[r])):Be(n)||(t[r]=!0)}return t}function zo(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>zo(r));return t.some(r=>r!==void 0)?t:void 0}if(We(e)){const t={};for(const r in e){const n=zo(e[r]);Be(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function Qr(e,t,r){r||(r=Uo(t));for(const n in e){const s=e[n];if(Kh(s))Be(t)||qo(r[n])?r[n]=Uo(s,Array.isArray(s)?[]:{}):Qr(s,ut(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!Mt(s,i)}}return zo(r)||{}}const ku={value:!1,isValid:!1},Lu={value:!0,isValid:!0};var Yh=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Be(e[0].attributes.value)?Be(e[0].value)||e[0].value===""?Lu:{value:e[0].value,isValid:!0}:Lu:ku}return ku},Zh=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Be(e)?e:t?e===""?NaN:e&&+e:r&&wt(e)?new Date(e):n?n(e):e;const Pu={isValid:!1,value:null};var Xh=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Pu):Pu;function Fu(e){const t=e.ref;return Dl(t)?t.files:Nl(t)?Xh(e.refs).value:Wh(t)?[...t.selectedOptions].map(({value:r})=>r):Ws(t)?Yh(e.refs).value:Zh(Be(t.value)?e.ref.value:t.value,e)}var FD=(e,t,r,n)=>{const s={};for(const i of e){const a=W(t,i);a&&Le(s,i,a._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Ui=e=>e instanceof RegExp,cs=e=>Be(e)?e:Ui(e)?e.source:We(e)?Ui(e.value)?e.value.source:e.value:e,Mu=e=>({isOnSubmit:!e||e===Xt.onSubmit,isOnBlur:e===Xt.onBlur,isOnChange:e===Xt.onChange,isOnAll:e===Xt.all,isOnTouch:e===Xt.onTouched});const Bu="AsyncFunction";var MD=e=>!!e&&!!e.validate&&!!(bt(e.validate)&&e.validate.constructor.name===Bu||We(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Bu)),BD=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ha=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const Cs=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=W(e,s);if(i){const{_f:a,...o}=i;if(a){if(a.refs&&a.refs[0]&&t(a.refs[0],s)&&!n)return!0;if(a.ref&&t(a.ref,a.name)&&!n)return!0;if(Cs(o,t))break}else if(We(o)&&Cs(o,t))break}}};function $u(e,t,r){const n=W(e,r);if(n||Ks(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),a=W(t,i),o=W(e,i);if(a&&!Array.isArray(a)&&r!==i)return{name:r};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};s.pop()}return{name:r}}var $D=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return it(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(a=>t[a]===(!n||Xt.all))},qD=(e,t,r)=>!e||!t||e===t||Ei(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),UD=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,zD=(e,t)=>!Qh(W(e,t)).length&&Je(e,t),qu=(e,t,r)=>{const n=W(e,r),s=Array.isArray(n)?n:[];return Le(s,zh,t[r]),Le(e,r,s),e};function Uu(e,t,r="validate"){if(wt(e)||Array.isArray(e)&&e.every(wt)||Ft(e)&&!e)return{type:r,message:wt(e)?e:"",ref:t}}var Sn=e=>We(e)&&!Ui(e)?e:{value:e,message:""},zu=async(e,t,r,n,s,i)=>{const{ref:a,refs:o,required:l,maxLength:u,minLength:f,min:d,max:g,pattern:p,validate:w,name:h,valueAsNumber:y,mount:v}=e._f,b=W(r,h);if(!v||t.has(h))return{};const C=o?o[0]:a,S=j=>{if(s&&C.reportValidity){const M=Ft(j)?"":j||"";o?o.forEach(k=>k.setCustomValidity(M)):C.setCustomValidity(M),C.reportValidity()}},_={},E=Nl(a),N=Ws(a),R=E||N,P=(y||Dl(a))&&Be(a.value)&&Be(b)||qi(a)&&a.value===""||b===""||Array.isArray(b)&&!b.length,B=RD.bind(null,h,n,_),D=(j,M,k,L=Yt.maxLength,z=Yt.minLength)=>{const X=j?M:k;_[h]={type:j?L:z,message:X,ref:a,...B(j?L:z,X)}};if(i?!Array.isArray(b)||!b.length:l&&(!R&&(P||ut(b))||Ft(b)&&!b||N&&!Yh(o).isValid||E&&!Xh(o).isValid)){const{value:j,message:M}=wt(l)?{value:!!l,message:l}:Sn(l);if(j&&(_[h]={type:Yt.required,message:M,ref:C,...B(Yt.required,M)},!n))return S(M),_}if(!P&&(!ut(d)||!ut(g))){let j,M;const k=Sn(g),L=Sn(d);if(!ut(b)&&!isNaN(b)){const z=a.valueAsNumber||b&&+b;ut(k.value)||(j=z>k.value),ut(L.value)||(M=z<L.value)}else{const z=a.valueAsDate||new Date(b),X=we=>new Date(new Date().toDateString()+" "+we),ye=a.type=="time",_e=a.type=="week";wt(k.value)&&b&&(j=ye?X(b)>X(k.value):_e?b>k.value:z>new Date(k.value)),wt(L.value)&&b&&(M=ye?X(b)<X(L.value):_e?b<L.value:z<new Date(L.value))}if((j||M)&&(D(!!j,k.message,L.message,Yt.max,Yt.min),!n))return S(_[h].message),_}if((u||f)&&!P&&(wt(b)||i&&Array.isArray(b))){const j=Sn(u),M=Sn(f),k=!ut(j.value)&&b.length>+j.value,L=!ut(M.value)&&b.length<+M.value;if((k||L)&&(D(k,j.message,M.message),!n))return S(_[h].message),_}if(p&&!P&&wt(b)){const{value:j,message:M}=Sn(p);if(Ui(j)&&!b.match(j)&&(_[h]={type:Yt.pattern,message:M,ref:a,...B(Yt.pattern,M)},!n))return S(M),_}if(w){if(bt(w)){const j=await w(b,r),M=Uu(j,C);if(M&&(_[h]={...M,...B(Yt.validate,M.message)},!n))return S(M.message),_}else if(We(w)){let j={};for(const M in w){if(!it(j)&&!n)break;const k=Uu(await w[M](b,r),C,M);k&&(j={...k,...B(M,k.message)},S(k.message),n&&(_[h]=j))}if(!it(j)&&(_[h]={ref:C,...j},!n))return _}}return S(!0),_};const VD={mode:Xt.onSubmit,reValidateMode:Xt.onChange,shouldFocusError:!0},Jh={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function HD(e={}){let t={...VD,...e},r={...Ke(Jh),isLoading:bt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=We(t.defaultValues)||We(t.values)?Ke(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Ke(s),a={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},l,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...f};let g={...d};const p={array:ju(),state:ju()},w=t.criteriaMode===Xt.all,h=x=>O=>{clearTimeout(u),u=setTimeout(x,O)},y=async x=>{if(!a.keepIsValid&&!t.disabled&&(d.isValid||g.isValid||x)){let O;t.resolver?(O=it((await B()).errors),v()):O=await M({fields:n,onlyCheckValid:!0,eventType:Dr.VALID}),O!==r.isValid&&p.state.next({isValid:O})}},v=(x,O)=>{!t.disabled&&(d.isValidating||d.validatingFields||g.isValidating||g.validatingFields)&&((x||Array.from(o.mount)).forEach(A=>{A&&(O?Le(r.validatingFields,A,O):Je(r.validatingFields,A))}),p.state.next({validatingFields:r.validatingFields,isValidating:!it(r.validatingFields)}))},b=()=>{r.dirtyFields=Qr(s,i)},C=(x,O=[],A,U,$=!0,G=!0)=>{if(U&&A&&!t.disabled){if(a.action=!0,G&&Array.isArray(W(n,x))){const H=A(W(n,x),U.argA,U.argB);$&&Le(n,x,H)}if(G&&Array.isArray(W(r.errors,x))){const H=A(W(r.errors,x),U.argA,U.argB);$&&Le(r.errors,x,H),zD(r.errors,x)}if((d.touchedFields||g.touchedFields)&&G&&Array.isArray(W(r.touchedFields,x))){const H=A(W(r.touchedFields,x),U.argA,U.argB);$&&Le(r.touchedFields,x,H)}(d.dirtyFields||g.dirtyFields)&&b(),p.state.next({name:x,isDirty:L(x,O),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Le(i,x,O)},S=(x,O)=>{Le(r.errors,x,O),r.errors={...r.errors},p.state.next({errors:r.errors})},_=x=>{r.errors=x,p.state.next({errors:r.errors,isValid:!1})},E=x=>{const O=Ks(x)?[x]:fa(x);let A=i,U=s;for(let $=0;$<O.length-1;$++){const G=O[$];if(A=ut(A)?A:A[G],U=ut(U)?U:U[G],A===null&&U!==null)return!0}return!1},N=(x,O,A,U)=>{const $=W(n,x);if($){if(E(x))return;const G=Be(W(i,x)),H=W(i,x,Be(A)?W(s,x):A);Be(H)||U&&U.defaultChecked||O?Le(i,x,O?H:Fu($._f)):ye(x,H),a.mount&&!a.action&&(y(),G&&r.isDirty&&(d.isDirty||g.isDirty)&&(L()||(r.isDirty=!1,p.state.next({...r}))),e.shouldUnregister&&G&&!Be(W(i,x))&&Ha(x,o)&&(a.watch=!0))}},R=(x,O,A,U,$)=>{let G=!1,H=!1;const ee={name:x};if(!t.disabled){if(!A||U){(d.isDirty||g.isDirty)&&(H=r.isDirty,r.isDirty=ee.isDirty=L(),G=H!==ee.isDirty);const ge=Mt(W(s,x),O);H=!!W(r.dirtyFields,x),ge!==r.isDirty?r.dirtyFields=Qr(s,i):ge?Je(r.dirtyFields,x):Le(r.dirtyFields,x,!0),ee.dirtyFields=r.dirtyFields,G=G||(d.dirtyFields||g.dirtyFields)&&H!==!ge}if(A){const ge=W(r.touchedFields,x);ge||(Le(r.touchedFields,x,A),ee.touchedFields=r.touchedFields,G=G||(d.touchedFields||g.touchedFields)&&ge!==A)}G&&$&&p.state.next(ee)}return G?ee:{}},P=(x,O,A,U)=>{const $=W(r.errors,x),G=(d.isValid||g.isValid)&&Ft(O)&&r.isValid!==O;if(t.delayError&&A?(l=h(()=>S(x,A)),l(t.delayError)):(clearTimeout(u),l=null,A?Le(r.errors,x,A):Je(r.errors,x),r.errors={...r.errors}),(A?!Mt($,A):$)||!it(U)||G){const H={...U,...G&&Ft(O)?{isValid:O}:{},errors:r.errors,name:x};r={...r,...H},p.state.next(H)}},B=async x=>(v(x,!0),await t.resolver(i,t.context,FD(x||o.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),D=async x=>{const{errors:O}=await B(x);if(v(x),x){for(const A of x){const U=W(O,A);U?o.array.has(A)&&We(U)&&!Object.keys(U).some($=>!Number.isNaN(Number($)))?qu(r.errors,{[A]:U},A):Le(r.errors,A,U):Je(r.errors,A)}r.errors={...r.errors}}else r.errors=O;return O},j=async({name:x,eventType:O})=>{if(e.validate){const A=await e.validate({formValues:i,formState:r,name:x,eventType:O});if(We(A))for(const U in A){const $=A[U];$&&J(`${za}.${U}`,{message:wt($.message)?$.message:"",type:$.type||Yt.validate})}else wt(A)||!A?J(za,{message:A||"",type:Yt.validate}):fe(za);return A}return!0},M=async({fields:x,onlyCheckValid:O,name:A,eventType:U,context:$={valid:!0,runRootValidation:!1}})=>{if(e.validate&&($.runRootValidation=!0,!await j({name:A,eventType:U})&&($.valid=!1,O)))return $.valid;for(const G in x){const H=x[G];if(H){const{_f:ee,...ge}=H;if(ee){const Qe=o.array.has(ee.name),Et=H._f&&MD(H._f),It=d.validatingFields||d.isValidating||g.validatingFields||g.isValidating;Et&&It&&v([ee.name],!0);const pr=await zu(H,o.disabled,i,w,t.shouldUseNativeValidation&&!O,Qe);if(Et&&It&&v([ee.name]),pr[ee.name]&&($.valid=!1,O)||(!O&&(W(pr,ee.name)?Qe?qu(r.errors,pr,ee.name):Le(r.errors,ee.name,pr[ee.name]):Je(r.errors,ee.name)),e.shouldUseNativeValidation&&pr[ee.name]))break}!it(ge)&&await M({context:$,onlyCheckValid:O,fields:ge,name:G,eventType:U})}}return $.valid},k=()=>{for(const x of o.unMount){const O=W(n,x);O&&(O._f.refs?O._f.refs.every(A=>!Va(A)):!Va(O._f.ref))&&$e(x)}o.unMount=new Set},L=(x,O)=>!t.disabled&&(x&&O&&Le(i,x,O),!Mt(V(),s)),z=(x,O,A)=>$o(x,o,{...a.mount?i:Be(O)?s:wt(x)?{[x]:O}:O},A,O),X=x=>Qh(W(a.mount?i:s,x,t.shouldUnregister?W(s,x,[]):[])),ye=(x,O,A={},U=!1)=>{const $=W(n,x);let G=O;if($){const H=$._f;H&&(!H.disabled&&Le(i,x,Zh(O,H)),G=qi(H.ref)&&ut(O)?"":O,Wh(H.ref)?[...H.ref.options].forEach(ee=>ee.selected=G.includes(ee.value)):H.refs?Ws(H.ref)?H.refs.forEach(ee=>{(!ee.defaultChecked||!ee.disabled)&&(Array.isArray(G)?ee.checked=!!G.find(ge=>ge===ee.value):ee.checked=G===ee.value||!!G)}):H.refs.forEach(ee=>ee.checked=ee.value===G):Dl(H.ref)?H.ref.value="":(H.ref.value=G,H.ref.type||p.state.next({name:x,values:U?i:Ke(i)})))}(A.shouldDirty||A.shouldTouch)&&R(x,G,A.shouldTouch,A.shouldDirty,!0),A.shouldValidate&&q(x)},_e=(x,O,A,U=!1)=>{for(const $ in O){if(!O.hasOwnProperty($))return;const G=O[$],H=x+"."+$,ee=W(n,H);(o.array.has(x)||We(G)||ee&&!ee._f)&&!Yr(G)?_e(H,G,A,U):ye(H,G,A,U)}},we=(x,O,A,U)=>{const $=W(n,x),G=o.array.has(x),H=U?O:Ke(O),ee=W(i,x),ge=Mt(ee,H);if(ge||Le(i,x,H),G)p.array.next({name:x,values:U?i:Ke(i)}),(d.isDirty||d.dirtyFields||g.isDirty||g.dirtyFields)&&A.shouldDirty&&(b(),p.state.next({name:x,dirtyFields:r.dirtyFields,isDirty:L(x,H)}));else{const Qe=Array.isArray(H)&&!H.length||it(H);!$||$._f||ut(H)||Qe?ye(x,H,A,U):_e(x,H,A,U)}if(!ge){const Qe=Ha(x,o),Et=U?i:Ke(i);p.state.next({...Qe&&r,name:a.mount||Qe?x:void 0,values:Et})}},de=(x,O,A={})=>we(x,O,A,!1),Q=(x,O={})=>{const A=bt(x)?x(i):x;if(!Mt(i,A)){i={...i,...A};for(const U of o.mount)we(U,W(A,U),O,!0);p.state.next({...r,name:void 0,type:void 0,values:i}),O.shouldValidate&&y()}},ne=async x=>{a.mount=!0;const O=x.target;let A=O.name,U=!0;const $=W(n,A),G=ge=>{U=Number.isNaN(ge)||Yr(ge)&&isNaN(ge.getTime())||Mt(ge,W(i,A,ge))},H=Mu(t.mode),ee=Mu(t.reValidateMode);if($){let ge,Qe;const Et=O.type?Fu($._f):Bo(x),It=x.type===Dr.BLUR||x.type===Dr.FOCUS_OUT,pr=!BD($._f)&&!e.validate&&!t.resolver&&!W(r.errors,A)&&!$._f.deps||UD(It,W(r.touchedFields,A),r.isSubmitted,ee,H),Jn=Ha(A,o,It);Le(i,A,Et),It?(!O||!O.readOnly)&&($._f.onBlur&&$._f.onBlur(x),l&&l(0)):$._f.onChange&&$._f.onChange(x);const zr=R(A,Et,It),rt=!it(zr)||Jn;if(!It&&p.state.next({name:A,type:x.type,values:Ke(i)}),pr)return(d.isValid||g.isValid)&&(t.mode==="onBlur"?It&&y():It||y()),rt&&p.state.next({name:A,...Jn?{}:zr});if(!t.resolver&&e.validate&&await j({name:A,eventType:x.type}),!It&&Jn&&p.state.next({...r}),t.resolver){const{errors:ht}=await B([A]);if(v([A]),G(Et),!U){!it(zr)&&p.state.next(zr);return}const xt=$u(r.errors,n,A),Wt=$u(ht,n,xt.name||A);ge=Wt.error,A=Wt.name,Qe=it(ht)}else v([A],!0),ge=(await zu($,o.disabled,i,w,t.shouldUseNativeValidation))[A],v([A]),G(Et),U&&(ge?Qe=!1:(d.isValid||g.isValid)&&(Qe=await M({fields:n,onlyCheckValid:!0,name:A,eventType:x.type})));U&&($._f.deps&&(!Array.isArray($._f.deps)||$._f.deps.length>0)&&q($._f.deps),P(A,Qe,ge,zr))}},te=(x,O)=>{if(W(r.errors,O)&&x.focus)return x.focus(),1},q=async(x,O={})=>{let A,U;const $=Ei(x);if(t.resolver){const G=await D(Be(x)?x:$);A=it(G),U=x?!$.some(H=>W(G,H)):A}else x?(U=(await Promise.all($.map(async G=>{const H=W(n,G);return await M({fields:H&&H._f?{[G]:H}:H,eventType:Dr.TRIGGER})}))).every(Boolean),!(!U&&!r.isValid)&&y()):U=A=await M({fields:n,name:x,eventType:Dr.TRIGGER});return p.state.next({...!wt(x)||(d.isValid||g.isValid)&&A!==r.isValid?{}:{name:x},...t.resolver||!x?{isValid:A}:{},errors:r.errors}),O.shouldFocus&&!U&&Cs(n,te,x?$:o.mount),U},V=(x,O)=>{let A={...a.mount?i:s};return O&&(A=Gh(O.dirtyFields?r.dirtyFields:r.touchedFields,A)),Be(x)?A:wt(x)?W(A,x):x.map(U=>W(A,U))},ie=(x,O)=>({invalid:!!W((O||r).errors,x),isDirty:!!W((O||r).dirtyFields,x),error:W((O||r).errors,x),isValidating:!!W(r.validatingFields,x),isTouched:!!W((O||r).touchedFields,x)}),fe=x=>{const O=x?Ei(x):void 0;O==null||O.forEach(A=>Je(r.errors,A)),O?O.forEach(A=>{p.state.next({name:A,errors:r.errors})}):p.state.next({errors:{}})},J=(x,O,A)=>{const U=(W(n,x,{_f:{}})._f||{}).ref,$=W(r.errors,x)||{},{ref:G,message:H,type:ee,...ge}=$;Le(r.errors,x,{...ge,...O,ref:U}),p.state.next({name:x,errors:r.errors,isValid:!1}),A&&A.shouldFocus&&U&&U.focus&&U.focus()},se=(x,O)=>bt(x)?p.state.subscribe({next:A=>"values"in A&&x(A.values||z(void 0,O),A)}):z(x,O,!0),je=x=>p.state.subscribe({next:O=>{if(qD(x.name,O.name,x.exact)&&$D(O,x.formState||d,K,x.reRenderRoot)){const A={...i};x.callback({values:A,...r,...O,defaultValues:s})}}}).unsubscribe,Te=x=>(a.mount=!0,g={...g,...x.formState},je({...x,formState:{...f,...x.formState}})),$e=(x,O={})=>{for(const A of x?Ei(x):o.mount)o.mount.delete(A),o.array.delete(A),O.keepValue||(Je(n,A),Je(i,A)),!O.keepError&&Je(r.errors,A),!O.keepDirty&&Je(r.dirtyFields,A),!O.keepTouched&&Je(r.touchedFields,A),!O.keepIsValidating&&Je(r.validatingFields,A),!t.shouldUnregister&&!O.keepDefaultValue&&Je(s,A);p.state.next({values:Ke(i)}),p.state.next({...r,...O.keepDirty?{isDirty:L()}:{}}),!O.keepIsValid&&y()},Ve=({disabled:x,name:O})=>{if(Ft(x)&&a.mount||x||o.disabled.has(O)){const $=o.disabled.has(O)!==!!x;x?o.disabled.add(O):o.disabled.delete(O),$&&a.mount&&!a.action&&y()}},qe=(x,O={})=>{let A=W(n,x);const U=Ft(O.disabled)||Ft(t.disabled),$=!o.registerName.has(x)&&A&&A._f&&!A._f.mount;return Le(n,x,{...A||{},_f:{...A&&A._f?A._f:{ref:{name:x}},name:x,mount:!0,...O}}),o.mount.add(x),A&&!$?Ve({disabled:Ft(O.disabled)?O.disabled:t.disabled,name:x}):N(x,!0,O.value),{...U?{disabled:O.disabled||t.disabled}:{},...t.progressive?{required:!!O.required,min:cs(O.min),max:cs(O.max),minLength:cs(O.minLength),maxLength:cs(O.maxLength),pattern:cs(O.pattern)}:{},name:x,onChange:ne,onBlur:ne,ref:G=>{if(G){o.registerName.add(x),qe(x,O),o.registerName.delete(x),A=W(n,x);const H=Be(G.value)&&G.querySelectorAll&&G.querySelectorAll("input,select,textarea")[0]||G,ee=jD(H),ge=A._f.refs||[];if(ee?ge.find(Qe=>Qe===H):H===A._f.ref)return;Le(n,x,{_f:{...A._f,...ee?{refs:[...ge.filter(Va),H,...Array.isArray(W(s,x))?[{}]:[]],ref:{type:H.type,name:x}}:{ref:H}}}),N(x,!1,void 0,H)}else A=W(n,x,{}),A._f&&(A._f.mount=!1),(t.shouldUnregister||O.shouldUnregister)&&!(qh(o.array,x)&&a.action)&&o.unMount.add(x)}}},re=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&Cs(n,te,o.mount),He=x=>{Ft(x)&&(p.state.next({disabled:x}),Cs(n,(O,A)=>{const U=W(n,A);U&&(O.disabled=U._f.disabled||x,Array.isArray(U._f.refs)&&U._f.refs.forEach($=>{$.disabled=U._f.disabled||x}))},0,!1))},ze=(x,O)=>async A=>{let U;A&&(A.preventDefault&&A.preventDefault(),A.persist&&A.persist());let $=Ke(i);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:G,values:H}=await B();v(),r.errors=G,$=Ke(H)}else await M({fields:n,eventType:Dr.SUBMIT});if(o.disabled.size)for(const G of o.disabled)Je($,G);if(Je(r.errors,zh),it(r.errors)){p.state.next({errors:{}});try{await x($,A)}catch(G){U=G}}else O&&await O({...r.errors},A),re(),setTimeout(re);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:it(r.errors)&&!U,submitCount:r.submitCount+1,errors:r.errors}),U)throw U},Ue=(x,O={})=>{W(n,x)&&(Be(O.defaultValue)?de(x,Ke(W(s,x))):(de(x,O.defaultValue),Le(s,x,Ke(O.defaultValue))),O.keepTouched||Je(r.touchedFields,x),O.keepDirty||(Je(r.dirtyFields,x),r.isDirty=O.defaultValue?L(x,Ke(W(s,x))):L()),O.keepError||(Je(r.errors,x),d.isValid&&y()),p.state.next({...r}))},Ze=(x,O={})=>{const A=x?Ke(x):s,U=Ke(A),$=it(x),G=U;if(O.keepDefaultValues||(s=A),!O.keepValues){if(O.keepDirtyValues){const H=new Set([...o.mount,...Object.keys(Qr(s,i))]);for(const ee of Array.from(H)){const ge=W(r.dirtyFields,ee),Qe=W(i,ee),Et=W(G,ee);ge&&!Be(Qe)?Le(G,ee,Qe):!ge&&!Be(Et)&&de(ee,Et)}}else{if(da&&Be(x))for(const H of o.mount){const ee=W(n,H);if(ee&&ee._f){const ge=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(qi(ge)){const Qe=ge.closest("form");if(Qe){Qe.reset();break}}}}if(O.keepFieldsRef)for(const H of o.mount)de(H,W(G,H));else n={}}if(t.shouldUnregister){if(i=O.keepDefaultValues?Ke(s):{},O.keepFieldsRef)for(const H of o.mount)Le(i,H,W(G,H))}else i=Ke(G);p.array.next({values:{...G}}),p.state.next({values:{...G}})}o={mount:O.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!d.isValid||!!O.keepIsValid||!!O.keepDirtyValues||!t.shouldUnregister&&!it(G),a.watch=!!t.shouldUnregister,a.keepIsValid=!!O.keepIsValid,a.action=!1,O.keepErrors||(r.errors={}),p.state.next({submitCount:O.keepSubmitCount?r.submitCount:0,isDirty:$?!1:O.keepDirty?r.isDirty:O.keepValues?L():!!(O.keepDefaultValues&&!Mt(x,s)),isSubmitted:O.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:$?{}:O.keepDirtyValues?O.keepDefaultValues&&i?Qr(s,i):r.dirtyFields:O.keepDefaultValues&&x?Qr(s,x):O.keepDirty?r.dirtyFields:{},touchedFields:O.keepTouched?r.touchedFields:{},errors:O.keepErrors?r.errors:{},isSubmitSuccessful:O.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Bt=(x,O)=>Ze(bt(x)?x(i):x,{...t.resetOptions,...O}),St=(x,O={})=>{const A=W(n,x),U=A&&A._f;if(U){const $=U.refs?U.refs[0]:U.ref;$.focus&&setTimeout(()=>{$.focus(),O.shouldSelect&&bt($.select)&&$.select()})}},K=x=>{r={...r,...x}},$t={control:{register:qe,unregister:$e,getFieldState:ie,handleSubmit:ze,setError:J,_subscribe:je,_runSchema:B,_updateIsValidating:v,_focusError:re,_getWatch:z,_getDirty:L,_setValid:y,_setFieldArray:C,_setDisabledField:Ve,_setErrors:_,_getFieldArray:X,_reset:Ze,_resetDefaultValues:()=>bt(t.defaultValues)&&t.defaultValues().then(x=>{Bt(x,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:k,_disableForm:He,_subjects:p,_proxyFormState:d,get _fields(){return n},get _formValues(){return i},get _state(){return a},set _state(x){a=x},get _defaultValues(){return s},get _names(){return o},set _names(x){o=x},get _formState(){return r},get _options(){return t},set _options(x){t={...t,...x}}},subscribe:Te,trigger:q,register:qe,handleSubmit:ze,watch:se,setValue:de,setValues:Q,getValues:V,reset:Bt,resetField:Ue,resetDefaultValues:(x,O={})=>{if(s=Ke(x),!O.keepDirty){const A=Qr(s,i);r.dirtyFields=A,r.isDirty=!it(A)}O.keepIsValid||y(),p.state.next({...r,defaultValues:s})},clearErrors:fe,unregister:$e,setError:J,setFocus:St,getFieldState:ie};return{...$t,formControl:$t}}function QD(e={}){const t=m.useRef(void 0),r=m.useRef(void 0),n=m.useRef(e.formControl),[s,i]=m.useState(()=>({...Ke(Jh),isLoading:bt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:bt(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&n.current!==e.formControl)if(n.current=e.formControl,e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!bt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=HD(e);t.current={...l,formState:s}}const a=t.current.control;return a._options=e,Ol(()=>{const o=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState,defaultValues:a._defaultValues}),reRenderRoot:!0});return i(l=>({...l,isReady:!0})),a._formState.isReady=!0,o},[a]),m.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),m.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),m.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),m.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),m.useEffect(()=>{if(a._proxyFormState.isDirty){const o=a._getDirty();o!==s.isDirty&&a._subjects.state.next({isDirty:o})}},[a,s.isDirty]),m.useEffect(()=>{var o;e.values&&!Mt(e.values,r.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),!((o=a._options.resetOptions)===null||o===void 0)&&o.keepIsValid||a._setValid(),r.current=e.values,i(l=>({...l}))):a._resetDefaultValues()},[a,e.values]),m.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=m.useMemo(()=>Hh(s,a),[a,s]),t.current}async function Vu(e){var r,n;return(n=(r=(await Ne.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}async function GD(e){var r,n;return((n=(r=(await Ne.post("/action/composite/v3/search",{request:{filters:{objectType:"Framework",status:["Live"],...e.type?{type:e.type}:{},...e.identifier?{identifier:e.identifier}:{},...e.channel?{channel:e.channel}:{},...e.systemDefault?{systemDefault:e.systemDefault}:{}}}})).data)==null?void 0:r.result)==null?void 0:n.Framework)??[]}function ep(e,t){const r=$n({queryKey:["framework",e],queryFn:()=>Vu(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=$n({queryKey:["framework",n],queryFn:()=>Vu(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}function WD(e,t,r){const n=e??[],s=new Set(n.map(f=>f.type).filter(Boolean)),i=(t??[]).filter(f=>!s.has(f)),{data:a}=$n({queryKey:["framework-search",i.sort().join(","),r],queryFn:()=>GD({type:i,systemDefault:"Yes"}),enabled:i.length>0,staleTime:10*60*1e3}),o=t&&t.length?n.filter(f=>f.type&&t.includes(f.type)):n,l=[...(a??[]).map(f=>({label:f.name,value:f.identifier})),...o.map(f=>({label:f.name,value:f.identifier}))],u=new Set;return l.filter(f=>u.has(f.value)?!1:(u.add(f.value),!0))}async function KD(e){var r,n;return(n=(r=(await Ne.get(`/api/channel/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.channel}function YD(e){var r,n,s,i,a,o;const t=$n({queryKey:["channel",e],queryFn:()=>KD(e),enabled:!!e,staleTime:6e5});return{identifier:((r=t.data)==null?void 0:r.identifier)??e??"",name:(n=t.data)==null?void 0:n.name,frameworks:(s=t.data)==null?void 0:s.frameworks,collectionAdditionalCategories:(i=t.data)==null?void 0:i.collectionAdditionalCategories,contentAdditionalCategories:(a=t.data)==null?void 0:a.contentAdditionalCategories,defaultLicense:(o=t.data)==null?void 0:o.defaultLicense,isLoading:t.isLoading}}function ZD(e){const{data:t}=$n({queryKey:["user","read",e],enabled:!!e,staleTime:1/0,queryFn:()=>A_(e)});return t&&([t.firstName,t.lastName].filter(Boolean).join(" ").trim()||t.userName)||void 0}const XD={"First Section":{title:"Basic Information",description:"Core details that define the content identity."},"Second Section":{title:"Categorisation",description:"Category and type classification for the content."},"Third Section":{title:"Categorisation",description:"Category and type classification for the content."},"Organisation Framework Terms":{title:"Curriculum",description:"Framework-aligned categorisation."},"Target Framework Terms":{title:"Target Audience",description:"Curriculum alignment for the intended learners."},"Fourth Section":{title:"Licensing & Attribution",description:"Copyright and usage rights information."},"Sixth Section":{title:"Licensing & Attribution",description:"Copyright and usage rights information."}},JD=new Set(["review","read","sourcingreview","orgreview"]),ii={"First Section":"details","Second Section":"details","Third Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing","Sixth Section":"licensing"},eN={Categorisation:"Second Section","Basic Information":"First Section","Licensing & Attribution":"Fourth Section",Curriculum:"Organisation Framework Terms","Target Audience":"Target Framework Terms"},tN={name:"details",description:"details",keywords:"details",appIcon:"details",primaryCategory:"details",additionalCategories:"details",board:"details",boardIds:"details",subject:"details",subjectIds:"details",medium:"details",framework:"details",topicsIds:"details",topic:"details",dialcodeRequired:"details",dialcodes:"details",audience:"audience",targetBoardIds:"audience",targetMediumIds:"audience",targetGradeLevelIds:"audience",targetSubjectIds:"audience",gradeLevel:"audience",creator:"licensing",author:"licensing",attributions:"licensing",license:"licensing",copyright:"licensing",copyrightYear:"licensing"},Rl={board:"board",boardIds:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},tp=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function rp(e,t,r,n,s={}){if(!(e!=null&&e.length))return mN(t,n,r);const i=new Map;for(const o of e){const l=o.code;l&&!i.has(l)&&i.set(l,o)}const a=new Set;return e.filter(o=>{if(n&&(o.code==="dialCode"||o.code==="dialcode")||o.visible===!1)return!1;const l=o.code;return a.has(l)?!1:(a.add(l),!0)}).map(o=>{const l=o.code??"",u=lN(o),f=cN(o,r,t,i,s),d=t[l],g=nN(l,np(d,u),u,t,s),p={code:l,label:o.label??l,inputType:u,required:!!(o.required===!0||Array.isArray(o.validations)&&o.validations.some(w=>w.type==="required")),editable:rN(l,o.editable!==!1,s),placeholder:o.placeholder,maxLength:o.maxLength,options:aN(f,g,u,r),depends:o.depends,tab:oN(o),section:o.section,defaultValue:o.defaultValue??o.default,currentValue:g};if(l==="dialcodes"){const w=t.dialcodeRequired==="Yes";return{...p,required:w,visible:w}}return p})}function rN(e,t,r){var i;const n=r.editorMode??"edit";if(!JD.has(n))return t!==!1;const s=(i=r.editableFields)==null?void 0:i[n];return!!(s&&s.includes(e))}function nN(e,t,r,n,s){const i=t==null||t===""||Array.isArray(t)&&t.length===0;switch(e){case"license":return i?s.defaultLicense??"":t;case"copyright":return i&&s.channelName?s.channelName:t;case"copyrightYear":return i?String(new Date().getFullYear()):t;case"author":case"creator":return i&&s.userFullName?s.userFullName:t;case"instructions":{const a=n.instructions;return a&&typeof a=="object"&&!Array.isArray(a)?a.default??"":typeof t=="object"&&t!==null?"":t}case"maxTime":case"warningTime":{if(!i)return t;const a=n.timeLimits,o=a==null?void 0:a[e];return o!=null&&o!==""?sN(Number(o)):t}default:return t}}function sN(e){if(!Number.isFinite(e)||e<0)return"";const t=Math.floor(e%60),r=Math.floor(e/60%60),n=Math.floor(e/3600),s=i=>String(i).padStart(2,"0");return n>0?`${s(n)}:${s(r)}:${s(t)}`:`${s(r)}:${s(t)}`}function iN(e){var n,s,i;const t=new Map,r=a=>a==null?void 0:a.forEach(o=>{o.identifier&&t.set(o.identifier,o.name),o.name&&t.set(o.name,o.name)});return(s=(n=e.organisationFramework)==null?void 0:n.categories)==null||s.forEach(a=>r(a.terms)),(i=e.targetFrameworks)==null||i.forEach(a=>{var o;return(o=a.categories)==null?void 0:o.forEach(l=>r(l.terms))}),t}function aN(e,t,r,n){if(r!=="select"&&r!=="multiselect"&&r!=="radio")return e;const s=Array.isArray(t)?t:t!=null&&t!==""?[t]:[];if(!s.length)return e;const i=e?[...e]:[],a=new Set(i.map(l=>l.value)),o=iN(n);for(const l of s){const u=String(l);a.has(u)||(i.push({label:o.get(u)??u,value:u}),a.add(u))}return i}function oN(e){const t=e.section;if(t){if(ii[t])return ii[t];const n=eN[t];if(n&&ii[n])return ii[n]}const r=e.code??"";return tN[r]??"details"}function np(e,t){const r=new Set(["multiselect","chips","keywords","tagsinput"]),n=new Set(["select","text","textarea","radio","datepicker","datetime","license"]);return r.has(t)?Array.isArray(e)?e:e!=null&&e!==""?[e]:[]:n.has(t)?Array.isArray(e)?e[0]??"":e??"":e}function lN(e){const t=(e.inputType??e.dataType??"").toLowerCase(),n=(e.dataType??"").toLowerCase()==="list";return t==="select"?"select":t==="framework"||t==="frameworkcategoryselect"?n?"multiselect":"select":t==="topicselector"?"chips":t==="multiselect"||t==="multi-select"?"multiselect":t==="keywords"||e.code==="keywords"||e.code==="topic"||e.code==="topicsIds"?"chips":t==="radio"?"radio":e.code==="appIcon"||t==="appicon"?"appIcon":t==="textarea"||e.code==="description"?"textarea":t==="datepicker"||t==="date"?"datepicker":t==="datetime"||t==="datetime-local"?"datetime":t==="tagsinput"?"tagsinput":t==="nestedselect"||t==="nested-select"?n?"multiselect":"select":t==="license"?"license":t==="dialcode"||t==="dial-code"?"dialcode":"text"}function cN(e,t,r,n,s){const i=e.code??"";if(i==="maxQuestions"){const u=s.childCount??0;if(u>0)return Array.from({length:u},(f,d)=>({label:String(d+1),value:String(d+1)}))}const a=e.range;if(Array.isArray(a)&&a.length)return typeof a[0]=="string"?a.map(u=>({label:u,value:u})):a.map(u=>({label:u.name,value:u.identifier}));const o=e.enum;if(o!=null&&o.length)return o.map(u=>({label:u,value:u}));if(i==="framework")return t.orgFrameworks;if(i==="additionalCategories"){const f=(s.objectType??"")==="QuestionSet"?s.contentAdditionalCategories??s.collectionAdditionalCategories:s.collectionAdditionalCategories??s.contentAdditionalCategories,d=(f&&f.length?f:s.contextAdditionalCategories)??t.channelAdditionalCategories;return d!=null&&d.length?hN(d).map(g=>({label:g,value:g})):void 0}const l=e.sourceCategory??Rl[i];if(l)return sp(i,l,e,t,r,n)}function uN(e,t){return tp.has(e)||t.output==="identifier"||typeof t.section=="string"&&t.section.includes("Target")}function dN(e,t){return tp.has(e)||typeof t.section=="string"&&t.section.includes("Target")}function Qa(e,t,r){var i,a,o,l,u;const n=(a=(i=e.organisationFramework)==null?void 0:i.categories)==null?void 0:a.find(f=>f.code===t),s=(u=(l=(o=e.targetFrameworks)==null?void 0:o[0])==null?void 0:l.categories)==null?void 0:u.find(f=>f.code===t);return r?(s==null?void 0:s.terms)??(n==null?void 0:n.terms)??[]:(n==null?void 0:n.terms)??(s==null?void 0:s.terms)??[]}function fN(e){const t=new Set,r=[];for(const n of e){const s=n.identifier??n.name;s&&!t.has(s)&&(t.add(s),r.push(n))}return r}function hN(e){return Array.from(new Set(e))}function pN(e){return Array.isArray(e)?e:e!=null&&e!==""?[e]:[]}function sp(e,t,r,n,s,i){const a=uN(e,r),o=dN(e,r),l=h=>({label:h.name,value:a?h.identifier:h.name}),u=r.depends;if(!(u!=null&&u.length))return Qa(n,t,o).map(l);const f=u.flatMap(h=>pN(s[h])).map(String);if(!f.length)return[];const d=[];for(const h of u){const y=i.get(h),v=(y==null?void 0:y.sourceCategory)??Rl[h]??h;d.push(...Qa(n,v,o))}const p=d.filter(h=>f.includes(String(h.name))||f.includes(String(h.identifier))||f.includes(String(h.code))).flatMap(h=>h.associations??[]).filter(h=>String(h.category??"").toLowerCase()===t.toLowerCase()),w=fN(p);return w.length?w.map(l):Qa(n,t,o).map(l)}function us(e,t){const r=Rl[e];if(r)return sp(e,r,{},t,{},new Map)}function ct(e,t,r){return np(e[t],r)}function mN(e,t,r){var s;const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:ct(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:ct(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:ct(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:ct(e,"primaryCategory","select")},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:ct(e,"additionalCategories","multiselect"),options:(s=r.channelAdditionalCategories)==null?void 0:s.map(i=>({label:i,value:i}))},{code:"framework",label:"Course Type",inputType:"select",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:r.orgFrameworks,currentValue:ct(e,"framework","select")},{code:"subjectIds",label:"Subjects covered",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:us("subjectIds",r),currentValue:ct(e,"subjectIds","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",currentValue:ct(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:us("targetBoardIds",r),currentValue:ct(e,"targetBoardIds","select")},{code:"targetMediumIds",label:"Medium(s) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetBoardIds"],options:us("targetMediumIds",r),currentValue:ct(e,"targetMediumIds","multiselect")},{code:"targetGradeLevelIds",label:"Class(es) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetMediumIds"],options:us("targetGradeLevelIds",r),currentValue:ct(e,"targetGradeLevelIds","multiselect")},{code:"targetSubjectIds",label:"Subject(s) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetGradeLevelIds"],options:us("targetSubjectIds",r),currentValue:ct(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ct(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ct(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ct(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ct(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ct(e,"license","select")})),n}const gN=["allowECM","levels","setPeriod","instances"];function ip(e){const t={};return e.forEach((r,n)=>{t[`L${n+1}`]={label:r}}),t}function yN(e,t={}){const r={...e};for(const i of gN)delete r[i];const n=e.levels;Array.isArray(n)&&n.length&&(r.outcomeDeclaration={levels:ip(n)});const s=e.instances;return s!=null&&s!==""&&(r.instances={label:s}),t.isReview&&(r.name===void 0||r.name===null||r.name==="")&&t.nodeTitle&&(r.name=t.nodeTitle),r}function vN(e,t){return e==="allowECM"||e==="setPeriod"?null:e==="levels"?{outcomeDeclaration:{levels:Array.isArray(t)?ip(t):{}}}:e==="instances"?{instances:t!=null&&t!==""?{label:t}:""}:{[e]:t}}function bN(e,t){const{watch:r,setValue:n}=e,s=m.useRef(!1);m.useEffect(()=>{const i=r((a,{name:o})=>{var l;if(!(!o||s.current)){s.current=!0;try{const u=new Set([o]);let f=!0;for(;f;){f=!1;for(const d of t)u.has(d.code)||(l=d.depends)!=null&&l.some(g=>u.has(g))&&(n(d.code,d.inputType==="multiselect"||d.inputType==="chips"?[]:"",{shouldDirty:!0}),u.add(d.code),f=!0)}}finally{s.current=!1}}});return()=>i.unsubscribe()},[r,n,t])}const wN="_section_ylgu8_1",CN="_header_ylgu8_11",SN="_title_ylgu8_17",xN="_description_ylgu8_24",_N="_divider_ylgu8_30",TN="_fields_ylgu8_36",xn={section:wN,header:CN,title:SN,description:xN,divider:_N,fields:TN},EN=({title:e,description:t,children:r})=>c.jsxs("div",{className:xn.section,children:[c.jsxs("div",{className:xn.header,children:[c.jsx("h3",{className:xn.title,children:e}),t&&c.jsx("p",{className:xn.description,children:t})]}),c.jsx("hr",{className:xn.divider}),c.jsx("div",{className:xn.fields,children:r})]}),IN="_field_1s288_1",ON="_fullWidth_1s288_7",AN="_label_1s288_11",DN="_required_1s288_19",NN="_input_1s288_24",RN="_textarea_1s288_45",jN="_inputError_1s288_50",kN="_error_1s288_54",LN="_selectBtn_1s288_59",PN="_selectOpen_1s288_83",FN="_placeholder_1s288_87",MN="_selectedVal_1s288_91",BN="_chevronUp_1s288_95",$N="_dropdown_1s288_100",qN="_option_1s288_116",UN="_optionSelected_1s288_134",zN="_noOpts_1s288_139",VN="_chipGroup_1s288_146",HN="_chipInput_1s288_158",QN="_addChipBtn_1s288_167",GN="_radioGroup_1s288_184",WN="_radioLabel_1s288_191",KN="_iconWrap_1s288_199",YN="_iconPreview_1s288_214",ZN="_iconPlaceholder_1s288_220",XN="_removeIconBtn_1s288_233",JN="_tagChip_1s288_252",eR="_tagChipRemove_1s288_264",tR="_nestedSelectRow_1s288_278",rR="_dialcodeRow_1s288_287",nR="_validateBtn_1s288_293",sR="_dialcodeValid_1s288_315",iR="_dialcodeSpinner_1s288_325",F={field:IN,fullWidth:ON,label:AN,required:DN,input:NN,textarea:RN,inputError:jN,error:kN,selectBtn:LN,selectOpen:PN,placeholder:FN,selectedVal:MN,chevronUp:BN,dropdown:$N,option:qN,optionSelected:UN,noOpts:zN,chipGroup:VN,chipInput:HN,addChipBtn:QN,radioGroup:GN,radioLabel:WN,iconWrap:KN,iconPreview:YN,iconPlaceholder:ZN,removeIconBtn:XN,tagChip:JN,tagChipRemove:eR,nestedSelectRow:tR,dialcodeRow:rR,validateBtn:nR,dialcodeValid:sR,dialcodeSpinner:iR},Hu=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:a})=>{const o=le(),{register:l,formState:{errors:u}}=rr(),f=u[e],d={required:r?o.textField.requiredError.replace("{field}",t):!1,maxLength:i?{value:i,message:o.textField.maxLengthError.replace("{max}",String(i))}:void 0};return c.jsxs("div",{className:[F.field,s?F.fullWidth:""].join(" "),children:[c.jsxs("label",{className:F.label,htmlFor:e,children:[t,r&&c.jsx("span",{className:F.required,children:"*"})]}),s?c.jsx("textarea",{id:e,className:[F.input,F.textarea,f?F.inputError:""].join(" "),disabled:n,placeholder:a,rows:3,...l(e,d)}):c.jsx("input",{id:e,type:"text",className:[F.input,f?F.inputError:""].join(" "),disabled:n,placeholder:a,...l(e,d)}),f&&c.jsx("span",{className:F.error,children:String(f.message)})]})},aR=({name:e,label:t,options:r,required:n,disabled:s})=>{var y;const i=le(),[a,o]=m.useState(!1),l=m.useRef(null),{register:u,watch:f,setValue:d,formState:{errors:g}}=rr(),p=f(e),w=((y=r.find(v=>v.value===p))==null?void 0:y.label)??i.selectField.selectPlaceholder,h=g[e];return m.useEffect(()=>{if(!a)return;const v=b=>{var C;(C=l.current)!=null&&C.contains(b.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[a]),c.jsxs("div",{className:F.field,ref:l,style:{position:"relative"},children:[c.jsxs("label",{className:F.label,children:[t,n&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsx("input",{type:"hidden",...u(e,{required:n?i.selectField.requiredError.replace("{field}",t):!1})}),c.jsxs("button",{type:"button",disabled:s,className:[F.selectBtn,h?F.inputError:"",a?F.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[c.jsx("span",{className:p?F.selectedVal:F.placeholder,children:w}),c.jsx(Kn,{size:14,className:a?F.chevronUp:""})]}),a&&c.jsxs("div",{className:F.dropdown,children:[r.map(v=>c.jsxs("button",{type:"button",className:[F.option,p===v.value?F.optionSelected:""].join(" "),onClick:()=>{d(e,v.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[c.jsx("span",{children:v.label}),p===v.value&&c.jsx(Wn,{size:13})]},v.value)),!r.length&&c.jsx("span",{className:F.noOpts,children:i.selectField.noOptionsMessage})]}),h&&c.jsx("span",{className:F.error,children:String(h.message)})]})},oR=({name:e,label:t,options:r,required:n,disabled:s})=>{const i=le(),[a,o]=m.useState(!1),l=m.useRef(null),{register:u,watch:f,setValue:d,formState:{errors:g}}=rr(),p=f(e)??[],w=g[e],h=p.length?`${p.length} ${i.multiSelectField.selectedCountSuffix}`:i.multiSelectField.selectPlaceholder;m.useEffect(()=>{if(!a)return;const v=b=>{var C;(C=l.current)!=null&&C.contains(b.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[a]);const y=v=>{const b=p.includes(v)?p.filter(C=>C!==v):[...p,v];d(e,b,{shouldDirty:!0,shouldValidate:!0})};return c.jsxs("div",{className:F.field,ref:l,style:{position:"relative"},children:[c.jsxs("label",{className:F.label,children:[t,n&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsx("input",{type:"hidden",...u(e,{required:n?i.multiSelectField.requiredError.replace("{field}",t):!1})}),c.jsxs("button",{type:"button",disabled:s,className:[F.selectBtn,w?F.inputError:"",a?F.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[c.jsx("span",{className:p.length?F.selectedVal:F.placeholder,children:h}),c.jsx(Kn,{size:14,className:a?F.chevronUp:""})]}),a&&c.jsxs("div",{className:F.dropdown,children:[r.map(v=>c.jsxs("button",{type:"button",className:[F.option,p.includes(v.value)?F.optionSelected:""].join(" "),onClick:()=>y(v.value),children:[c.jsx(Wn,{size:13,style:{opacity:p.includes(v.value)?1:0}}),c.jsx("span",{children:v.label})]},v.value)),!r.length&&c.jsx("span",{className:F.noOpts,children:i.multiSelectField.noOptionsMessage})]}),w&&c.jsx("span",{className:F.error,children:String(w.message)})]})},lR=({name:e,label:t,required:r,disabled:n,placeholder:s})=>{const i=le(),a=s??i.chipGroupField.addPlaceholder,[o,l]=m.useState(""),[u,f]=m.useState(!1),d=m.useRef(null),{watch:g,setValue:p,formState:{errors:w}}=rr(),h=g(e)??[],y=w[e],v=()=>{const C=o.trim();C&&!h.includes(C)&&p(e,[...h,C],{shouldDirty:!0}),l(""),f(!1)},b=C=>p(e,h.filter(S=>S!==C),{shouldDirty:!0});return c.jsxs("div",{className:[F.field,F.fullWidth].join(" "),children:[c.jsxs("label",{className:F.label,children:[t,r&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsxs("div",{className:F.chipGroup,children:[h.map(C=>c.jsxs("span",{className:"sbx-chip filled",children:[C,!n&&c.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>b(C),"aria-label":`Remove ${C}`,children:"×"})]},C)),!n&&(u?c.jsx("input",{ref:d,autoFocus:!0,className:F.chipInput,value:o,onChange:C=>l(C.target.value),onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),v()),C.key==="Escape"&&(l(""),f(!1))},onBlur:v,placeholder:a}):c.jsxs("button",{type:"button",className:F.addChipBtn,onClick:()=>{f(!0),setTimeout(()=>{var C;return(C=d.current)==null?void 0:C.focus()},50)},children:[c.jsx(Us,{size:12})," ",i.chipGroupField.addButtonLabel]}))]}),y&&c.jsx("span",{className:F.error,children:String(y.message)})]})},cR=({name:e,label:t,options:r,required:n,disabled:s})=>{const i=le(),{register:a,formState:{errors:o}}=rr(),l=o[e];return c.jsxs("div",{className:F.field,children:[c.jsxs("label",{className:F.label,children:[t,n&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsx("div",{className:F.radioGroup,children:r.map(u=>c.jsxs("label",{className:F.radioLabel,children:[c.jsx("input",{type:"radio",value:u.value,disabled:s,...a(e,{required:n?i.radioField.requiredError.replace("{field}",t):!1})}),u.label]},u.value))}),l&&c.jsx("span",{className:F.error,children:String(l.message)})]})};async function uR(e,t,r,n){var a,o;const i=(o=(a=(await Ne.post("/action/asset/v1/create",{request:{asset:{primaryCategory:"asset",language:["English"],code:crypto.randomUUID(),name:e,mediaType:"image",mimeType:t,createdBy:r,creator:null,channel:n,keywords:""}}})).data)==null?void 0:a.result)==null?void 0:o.node_id;if(!i)throw new Error("Asset creation failed: no node_id returned");return i}async function dR(e,t){var s,i;const n=(i=(s=(await Ne.post(`/action/content/v3/upload/url/${e}`,{request:{content:{fileName:t}}})).data)==null?void 0:s.result)==null?void 0:i.pre_signed_url;if(!n)throw new Error("Pre-signed URL fetch failed");return n}async function fR(e,t,r={}){const n=await fetch(e,{method:"PUT",body:t,headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"application/octet-stream",...r}});if(!n.ok)throw new Error(`Blob upload failed: ${n.status} ${n.statusText}`)}async function hR(e,t,r){var a,o;const n=new FormData;n.append("fileUrl",t),n.append("mimeType",r);const i=(o=(a=(await Ne.post(`/action/asset/v1/upload/${e}`,n,{params:{enctype:"multipart/form-data",processData:!1,contentType:!1,cache:!1}})).data)==null?void 0:a.result)==null?void 0:o.content_url;if(!i)throw new Error("Asset finalize failed: no content_url returned");return i}const pR="_overlay_ga6eh_1",mR="_modal_ga6eh_12",gR="_header_ga6eh_24",yR="_title_ga6eh_33",vR="_closeBtn_ga6eh_39",bR="_tabs_ga6eh_57",wR="_tab_ga6eh_57",CR="_activeTab_ga6eh_83",SR="_body_ga6eh_88",xR="_searchWrap_ga6eh_99",_R="_searchIcon_ga6eh_104",TR="_searchInput_ga6eh_113",ER="_grid_ga6eh_132",IR="_imgCell_ga6eh_148",OR="_imgCellSelected_ga6eh_166",AR="_thumb_ga6eh_171",DR="_noThumb_ga6eh_177",NR="_checkBadge_ga6eh_183",RR="_loadMoreBtn_ga6eh_198",jR="_loadingRow_ga6eh_220",kR="_empty_ga6eh_230",LR="_spinner_ga6eh_237",PR="_uploadArea_ga6eh_247",FR="_dropZone_ga6eh_256",MR="_uploadIcon_ga6eh_277",BR="_dropText_ga6eh_281",$R="_dropSubtext_ga6eh_288",qR="_uploadPreview_ga6eh_294",UR="_hiddenInput_ga6eh_301",zR="_fileName_ga6eh_305",VR="_errorText_ga6eh_311",HR="_footer_ga6eh_318",QR="_cancelBtn_ga6eh_328",GR="_confirmBtn_ga6eh_345",me={overlay:pR,modal:mR,header:gR,title:yR,closeBtn:vR,tabs:bR,tab:wR,activeTab:CR,body:SR,searchWrap:xR,searchIcon:_R,searchInput:TR,grid:ER,imgCell:IR,imgCellSelected:OR,thumb:AR,noThumb:DR,checkBadge:NR,loadMoreBtn:RR,loadingRow:jR,empty:kR,spinner:LR,uploadArea:PR,dropZone:FR,uploadIcon:MR,dropText:BR,dropSubtext:$R,uploadPreview:qR,hiddenInput:UR,fileName:zR,errorText:VR,footer:HR,cancelBtn:QR,confirmBtn:GR},Qu=18,ap=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const s=le(),[i,a]=m.useState("my"),[o,l]=m.useState(""),[u,f]=m.useState([]),[d,g]=m.useState(0),[p,w]=m.useState(!1),[h,y]=m.useState(null),[v,b]=m.useState(0),[C,S]=m.useState(null),[_,E]=m.useState(""),[N,R]=m.useState(!1),[P,B]=m.useState(""),D=m.useRef(null),j=ce(q=>{var V,ie;return((ie=(V=q.editorConfig)==null?void 0:V.context)==null?void 0:ie.channel)??""}),M=ce(q=>{var V,ie;return((ie=(V=q.editorConfig)==null?void 0:V.context)==null?void 0:ie.uid)??""}),k=ce(q=>{var V,ie,fe;return((fe=(ie=(V=q.editorConfig)==null?void 0:V.context)==null?void 0:ie.cloudStorage)==null?void 0:fe.presigned_headers)??{}}),L=ce(q=>{var V,ie,fe;return((fe=(ie=(V=q.editorConfig)==null?void 0:V.config)==null?void 0:ie.assetConfig)==null?void 0:fe.size)??1*1024*1024}),z=ce(q=>{var V,ie,fe;return((fe=(ie=(V=q.editorConfig)==null?void 0:V.config)==null?void 0:ie.assetConfig)==null?void 0:fe.accepted)??"image/png,image/jpeg"}),X=m.useCallback(async(q,V,ie=!1)=>{var fe;w(!0);try{const J={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};i==="my"&&M&&(J.createdBy=M),j&&(J.channel=j);const je=((fe=(await Ne.post("/action/composite/v3/search",{request:{filters:J,query:q,limit:Qu,offset:V,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:fe.result)??{},Te=je.content??[];g(je.count??0),f($e=>ie?[...$e,...Te]:Te)}catch{}finally{w(!1)}},[i,M,j]);m.useEffect(()=>{i!=="upload"&&(f([]),b(0),X(o,0))},[i]);const ye=m.useRef(),_e=q=>{l(q),clearTimeout(ye.current),ye.current=setTimeout(()=>{f([]),b(0),X(q,0)},400)},we=()=>{const q=v+Qu;b(q),X(o,q,!0)},de=()=>{const q=(h==null?void 0:h.artifactUrl)??(h==null?void 0:h.appIcon)??(h==null?void 0:h.downloadUrl)??"";q&&r(q)};m.useEffect(()=>()=>{_&&URL.revokeObjectURL(_)},[_]);const Q=q=>{var fe;const V=(fe=q.target.files)==null?void 0:fe[0];if(q.target.value="",!V)return;const ie=z.split(",").map(J=>J.trim());if(!ie.includes(V.type)){const J=ie.map(se=>se.replace("image/","").toUpperCase()).join(", ");B(s.appIconPickerModal.invalidFileTypeError.replace("{types}",J));return}if(V.size>L){const J=(L/1048576).toFixed(0);B(s.appIconPickerModal.fileTooLargeError.replace("{size}",J));return}_&&URL.revokeObjectURL(_),S(V),E(URL.createObjectURL(V)),B("")},ne=async()=>{if(C){R(!0),B("");try{const q=await uR(C.name.split(".").slice(0,-1).join(".")||C.name,C.type,M,j),V=await dR(q,C.name);await fR(V,C,k);const ie=V.split("?")[0],fe=await hR(q,ie,C.type);r(fe)}catch(q){B(q instanceof Error?q.message:s.appIconPickerModal.uploadFailedError)}finally{R(!1)}}},te=u.length<d;return c.jsx("div",{className:me.overlay,role:"dialog","aria-modal":"true","aria-label":s.appIconPickerModal.dialogAriaLabel,children:c.jsxs("div",{className:me.modal,children:[c.jsxs("div",{className:me.header,children:[c.jsx("span",{className:me.title,children:s.appIconPickerModal.title}),c.jsx("button",{className:me.closeBtn,onClick:n,"aria-label":s.appIconPickerModal.closeAriaLabel,children:c.jsx(Cr,{size:18})})]}),c.jsxs("div",{className:me.tabs,role:"tablist",children:[c.jsx("button",{role:"tab","aria-selected":i==="my",className:`${me.tab} ${i==="my"?me.activeTab:""}`,onClick:()=>a("my"),children:s.appIconPickerModal.myImagesTab}),c.jsx("button",{role:"tab","aria-selected":i==="all",className:`${me.tab} ${i==="all"?me.activeTab:""}`,onClick:()=>a("all"),children:s.appIconPickerModal.allImagesTab}),c.jsxs("button",{role:"tab","aria-selected":i==="upload",className:`${me.tab} ${i==="upload"?me.activeTab:""}`,onClick:()=>a("upload"),children:[c.jsx(vo,{size:13,style:{marginRight:4}}),s.appIconPickerModal.uploadTab]})]}),c.jsx("div",{className:me.body,children:i!=="upload"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:me.searchWrap,children:[c.jsx(yo,{size:14,className:me.searchIcon}),c.jsx("input",{type:"search",className:me.searchInput,placeholder:s.appIconPickerModal.searchPlaceholder,value:o,onChange:q=>_e(q.target.value)})]}),p&&u.length===0?c.jsxs("div",{className:me.loadingRow,children:[c.jsx(hi,{size:20,className:me.spinner}),c.jsx("span",{children:s.appIconPickerModal.loadingText})]}):u.length===0?c.jsx("div",{className:me.empty,children:s.appIconPickerModal.noImagesFound}):c.jsx("div",{className:me.grid,children:u.map(q=>{const V=q.appIcon??q.artifactUrl??q.downloadUrl??"",ie=(h==null?void 0:h.identifier)===q.identifier;return c.jsxs("button",{type:"button",className:`${me.imgCell} ${ie?me.imgCellSelected:""}`,onClick:()=>y(q),title:q.name,children:[V?c.jsx("img",{src:V,alt:q.name,className:me.thumb}):c.jsx("div",{className:me.noThumb,children:s.appIconPickerModal.noThumbnailText}),ie&&c.jsx("div",{className:me.checkBadge,children:c.jsx(Wn,{size:12})})]},q.identifier)})}),te&&!p&&c.jsx("button",{className:me.loadMoreBtn,onClick:we,children:s.appIconPickerModal.loadMoreButton}),p&&u.length>0&&c.jsx("div",{className:me.loadingRow,children:c.jsx(hi,{size:16,className:me.spinner})})]}):c.jsxs("div",{className:me.uploadArea,children:[c.jsx("div",{className:me.dropZone,onClick:()=>{var q;return(q=D.current)==null?void 0:q.click()},onDragOver:q=>q.preventDefault(),onDrop:q=>{q.preventDefault();const V=q.dataTransfer.files[0];V&&Q({target:{files:[V],value:""}})},children:_?c.jsx("img",{src:_,alt:s.appIconPickerModal.previewAlt,className:me.uploadPreview}):c.jsxs(c.Fragment,{children:[c.jsx(vo,{size:32,className:me.uploadIcon}),c.jsx("p",{className:me.dropText,children:s.appIconPickerModal.dropZoneText}),c.jsx("p",{className:me.dropSubtext,children:s.appIconPickerModal.acceptedTypesInfo.replace("{types}",z.split(",").map(q=>q.replace("image/","").toUpperCase()).join(", ")).replace("{size}",(L/(1024*1024)).toFixed(0))})]})}),c.jsx("input",{ref:D,type:"file",accept:z,className:me.hiddenInput,onChange:Q}),C&&c.jsx("p",{className:me.fileName,children:C.name}),P&&c.jsx("p",{className:me.errorText,children:P})]})}),c.jsxs("div",{className:me.footer,children:[c.jsx("button",{className:me.cancelBtn,onClick:n,children:s.appIconPickerModal.cancelButton}),i==="upload"?c.jsx("button",{className:me.confirmBtn,disabled:!C||N,onClick:ne,children:N?c.jsxs(c.Fragment,{children:[c.jsx(hi,{size:14,className:me.spinner})," ",s.appIconPickerModal.uploadingText]}):s.appIconPickerModal.uploadAndUseButton}):c.jsx("button",{className:me.confirmBtn,disabled:!h,onClick:de,children:s.appIconPickerModal.useSelectedButton})]})]})})},WR=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const i=le(),[a,o]=m.useState(!1),{watch:l,setValue:u,register:f,formState:{errors:d}}=rr(),g=l(e),p=d[e],w=y=>{u(e,y,{shouldDirty:!0,shouldValidate:!0}),o(!1)},h=()=>{u(e,"",{shouldDirty:!0,shouldValidate:!0})};return c.jsxs("div",{className:F.field,children:[c.jsxs("label",{className:F.label,children:[t,n&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsx("input",{type:"hidden",...f(e,{required:n?i.appIconField.requiredError.replace("{field}",t):!1})}),c.jsx("div",{className:F.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":i.appIconField.selectIconAriaLabel,onClick:()=>!s&&o(!0),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&!s&&o(!0)},children:g?c.jsx("img",{src:g,alt:i.appIconField.iconAlt,className:F.iconPreview}):c.jsxs("div",{className:F.iconPlaceholder,children:[c.jsx(uf,{size:20}),c.jsx("span",{children:i.appIconField.selectIconLabel})]})}),g&&!s&&c.jsxs("button",{type:"button",className:F.removeIconBtn,onClick:h,"aria-label":i.appIconField.removeIconAriaLabel,children:[c.jsx(al,{size:13}),c.jsx("span",{children:i.appIconField.removeLabel})]}),p&&c.jsx("span",{className:F.error,children:String(p.message)}),a&&c.jsx(ap,{nodeId:r,currentValue:g,onSelect:w,onClose:()=>o(!1)})]})},KR=({name:e,label:t,required:r,disabled:n})=>{const s=le(),{control:i}=rr(),{field:a,fieldState:{error:o}}=ha({name:e,control:i,rules:{required:r?s.dateTimeField.requiredError.replace("{field}",t):!1}});return c.jsxs("div",{className:F.field,children:[c.jsxs("label",{className:F.label,htmlFor:e,children:[t,r&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsx("input",{id:e,type:"datetime-local",className:[F.input,o?F.inputError:""].join(" "),disabled:n,value:a.value??"",onChange:a.onChange,onBlur:a.onBlur,ref:a.ref}),o&&c.jsx("span",{className:F.error,children:String(o.message)})]})},YR=({name:e,label:t,required:r,disabled:n})=>{const s=le(),{control:i}=rr(),{field:a,fieldState:{error:o}}=ha({name:e,control:i,rules:{required:r?s.keywordSuggestField.requiredError.replace("{field}",t):!1},defaultValue:[]}),[l,u]=m.useState(""),f=m.useRef(null),d=a.value??[],g=y=>{const v=y.trim();!v||d.includes(v)||a.onChange([...d,v])},p=y=>{a.onChange(d.filter(v=>v!==y))},w=y=>{y.key==="Enter"||y.key===","?(y.preventDefault(),g(l),u("")):y.key==="Backspace"&&l===""&&d.length>0&&p(d[d.length-1])},h=()=>{l.trim()&&(g(l),u("")),a.onBlur()};return c.jsxs("div",{className:[F.field,F.fullWidth].join(" "),children:[c.jsxs("label",{className:F.label,children:[t,r&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsxs("div",{className:[F.chipGroup,o?F.inputError:""].join(" "),onClick:()=>{var y;return!n&&((y=f.current)==null?void 0:y.focus())},style:{cursor:n?"not-allowed":"text"},children:[d.map(y=>c.jsxs("span",{className:F.tagChip,children:[y,!n&&c.jsx("button",{type:"button",className:F.tagChipRemove,onClick:v=>{v.stopPropagation(),p(y)},"aria-label":`Remove ${y}`,children:c.jsx(Cr,{size:11})})]},y)),!n&&c.jsx("input",{ref:f,className:F.chipInput,value:l,onChange:y=>u(y.target.value),onKeyDown:w,onBlur:h,placeholder:d.length===0?s.keywordSuggestField.inputPlaceholder:"",style:{flexGrow:1,minWidth:120}})]}),o&&c.jsx("span",{className:F.error,children:String(o.message)})]})},ZR=({name:e,label:t,levels:r,required:n,disabled:s})=>{const i=le(),{control:a}=rr(),{field:o,fieldState:{error:l}}=ha({name:e,control:a,rules:{required:n?i.nestedSelectField.requiredError.replace("{field}",t):!1},defaultValue:{}}),u=o.value??{},f=(d,g,p)=>{const w={};for(let h=0;h<g;h++)w[r[h].code]=u[r[h].code]??"";w[d]=p;for(let h=g+1;h<r.length;h++)w[r[h].code]="";o.onChange(w)};return c.jsxs("div",{className:[F.field,F.fullWidth].join(" "),children:[c.jsxs("label",{className:F.label,children:[t,n&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsx("div",{className:F.nestedSelectRow,children:r.map((d,g)=>{const p=g>0&&!u[r[g-1].code];return c.jsxs("div",{className:F.field,style:{flex:1},children:[c.jsx("label",{className:F.label,htmlFor:`${e}_${d.code}`,children:d.label}),c.jsxs("select",{id:`${e}_${d.code}`,className:[F.input,l?F.inputError:""].join(" "),disabled:s||p,value:u[d.code]??"",onChange:w=>f(d.code,g,w.target.value),onBlur:o.onBlur,children:[c.jsx("option",{value:"",children:i.nestedSelectField.selectPlaceholder}),d.options.map(w=>c.jsx("option",{value:w.value,children:w.label},w.value))]})]},d.code)})}),l&&c.jsx("span",{className:F.error,children:String(l.message)})]})},Gu=[{label:"CC BY 4.0",value:"CC BY 4.0"},{label:"CC BY-SA 4.0",value:"CC BY-SA 4.0"},{label:"CC BY-NC 4.0",value:"CC BY-NC 4.0"},{label:"CC BY-NC-SA 4.0",value:"CC BY-NC-SA 4.0"},{label:"CC BY-ND 4.0",value:"CC BY-ND 4.0"},{label:"CC0 1.0 (Public Domain)",value:"CC0 1.0"}],XR=({name:e,label:t,required:r,disabled:n})=>{const s=le(),[i,a]=m.useState(!1),o=m.useRef(null),{register:l,watch:u,setValue:f,formState:{errors:d}}=rr(),g=u(e),p=Gu.find(y=>y.value===g),w=(p==null?void 0:p.label)??s.licenseSelectField.selectPlaceholder,h=d[e];return m.useEffect(()=>{if(!i)return;const y=v=>{var b;(b=o.current)!=null&&b.contains(v.target)||a(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),c.jsxs("div",{className:F.field,ref:o,style:{position:"relative"},children:[c.jsxs("label",{className:F.label,children:[t,r&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsx("input",{type:"hidden",...l(e,{required:r?s.licenseSelectField.requiredError.replace("{field}",t):!1})}),c.jsxs("button",{type:"button",disabled:n,className:[F.selectBtn,h?F.inputError:"",i?F.selectOpen:""].join(" "),onClick:()=>a(y=>!y),"aria-haspopup":"listbox","aria-expanded":i,children:[c.jsx("span",{className:g?F.selectedVal:F.placeholder,children:w}),c.jsx(Kn,{size:14,className:i?F.chevronUp:""})]}),i&&c.jsx("div",{className:F.dropdown,role:"listbox",children:Gu.map(y=>c.jsxs("button",{type:"button",role:"option","aria-selected":g===y.value,className:[F.option,g===y.value?F.optionSelected:""].join(" "),onClick:()=>{f(e,y.value,{shouldDirty:!0,shouldValidate:!0}),a(!1)},children:[c.jsx("span",{children:y.label}),g===y.value&&c.jsx(Wn,{size:13})]},y.value))}),h&&c.jsx("span",{className:F.error,children:String(h.message)})]})},JR=({name:e,label:t,required:r,disabled:n})=>{const s=le(),{control:i}=rr(),{field:a,fieldState:{error:o}}=ha({name:e,control:i,rules:{required:r?s.dialcodeInputField.requiredError.replace("{field}",t):!1},defaultValue:""}),[l,u]=m.useState("idle"),[f,d]=m.useState(""),g=async()=>{const w=(a.value??"").trim();if(!w){u("invalid"),d(s.dialcodeInputField.enterCodeMessage);return}u("loading"),d("");try{const h=await f0(w),y=h==null?void 0:h.result,v=y==null?void 0:y.dialcodes;Array.isArray(v)&&v.length>0?(u("valid"),d(s.dialcodeInputField.validMessage)):(u("invalid"),d(s.dialcodeInputField.notFoundMessage))}catch{u("invalid"),d(s.dialcodeInputField.validationFailedMessage)}},p=()=>l==="loading"?c.jsx(hi,{size:16,className:F.dialcodeSpinner}):l==="valid"?c.jsx(af,{size:16,color:"var(--sbx-success, #2e7d32)"}):l==="invalid"?c.jsx(ky,{size:16,color:"var(--sbx-error)"}):null;return c.jsxs("div",{className:F.field,children:[c.jsxs("label",{className:F.label,htmlFor:e,children:[t,r&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsxs("div",{className:F.dialcodeRow,children:[c.jsx("input",{id:e,type:"text",className:[F.input,o?F.inputError:""].join(" "),disabled:n,value:a.value??"",onChange:w=>{a.onChange(w),u("idle"),d("")},onBlur:a.onBlur,ref:a.ref,placeholder:s.dialcodeInputField.placeholderExample,style:{flex:1}}),c.jsx("button",{type:"button",className:F.validateBtn,onClick:g,disabled:n||l==="loading","aria-label":s.dialcodeInputField.validateAriaLabel,children:l==="loading"?s.dialcodeInputField.validatingLabel:s.dialcodeInputField.validateButtonLabel}),p()]}),o&&c.jsx("span",{className:F.error,children:String(o.message)}),!o&&f&&c.jsx("span",{className:l==="valid"?F.dialcodeValid:F.error,children:f})]})},ej="_form_szqex_1",tj="_ungrouped_szqex_7",rj="_noFields_szqex_18",Ga={form:ej,ungrouped:tj,noFields:rj},nj=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:a})=>{var Ve,qe,re,He,ze,Ue,Ze,Bt,St;const o=le(),l=ce(K=>K.editorConfig),u=ce(K=>K.rootFormConfig),f=ce(K=>K.unitFormConfig),d=ce(K=>K.categoryMeta),g=ce(K=>K.contentFramework),p=ce(K=>K.contentTargetFWIds),{organisationFramework:w,targetFrameworks:h,isLoading:y}=ep(g??((Ve=l==null?void 0:l.context)==null?void 0:Ve.framework),p??((qe=l==null?void 0:l.context)==null?void 0:qe.targetFWIds)),{frameworks:v,collectionAdditionalCategories:b,contentAdditionalCategories:C,defaultLicense:S,name:_}=YD((re=l==null?void 0:l.context)==null?void 0:re.channel),E=ZD(((He=l==null?void 0:l.context)==null?void 0:He.userId)??((ze=l==null?void 0:l.context)==null?void 0:ze.uid)),N=WD(v,(Ue=d==null?void 0:d.frameworkMetadata)==null?void 0:Ue.orgFWType,(Ze=l==null?void 0:l.context)==null?void 0:Ze.channel),R={organisationFramework:w,targetFrameworks:h,orgFrameworks:N,channelAdditionalCategories:b},P=Oe(K=>K.selectedNodeId),B=Oe(K=>K.treeData),D=Oe(K=>K.treeCache),j=P?D[P]??{}:{},M={...e,...j},k=m.useMemo(()=>{var pe;if(!P)return 0;const K=[...B];for(;K.length;){const ve=K.shift();if(ve.id===P)return((pe=ve.children)==null?void 0:pe.length)??0;ve.children&&K.push(...ve.children)}return 0},[B,P]),L=(l==null?void 0:l.config)??{},z=(l==null?void 0:l.context)??{},X={editorMode:s,editableFields:L.editableFields,objectType:L.objectType,setDefaultCopyRight:L.setDefaultCopyRight===!0,defaultLicense:z.defaultLicense??S,contextAdditionalCategories:z.additionalCategories,userFullName:((Bt=z.user)==null?void 0:Bt.fullName)??E,channelName:_,collectionAdditionalCategories:b,contentAdditionalCategories:C,childCount:k},ye=r?u:f,_e=ye||(((St=l==null?void 0:l.config.hierarchy)==null?void 0:St.formConfig)??[]),we=rp(_e,M,R,r,X),de=we.filter(K=>K.tab===t&&K.inputType!=="appIcon"&&K.visible!==!1),Q=QD({mode:"onChange",defaultValues:Object.fromEntries(we.map(K=>{const pe=["multiselect","chips","keywords","tagsinput"],ve=["nestedselect"];return pe.includes(K.inputType)?[K.code,K.currentValue??K.defaultValue??[]]:ve.includes(K.inputType)?[K.code,K.currentValue??K.defaultValue??{}]:[K.code,K.currentValue??K.defaultValue??""]}))});bN(Q,we);const{updateNode:ne}=Oe(),te=m.useRef(we);te.current=we;const q=m.useRef(P);q.current=P;const V=m.useRef(i);V.current=i;const ie=m.useRef(a);ie.current=a;const fe=m.useRef(typeof M.shuffle=="boolean"?M.shuffle:void 0),J=m.useRef(M.name??"");J.current=M.name??"";const se=m.useRef(s);se.current=s;const je=["review","read","sourcingreview","orgreview"];m.useEffect(()=>{const K=q.current;if(K){const pe=Object.fromEntries(te.current.filter(ve=>ve.currentValue!==void 0&&ve.currentValue!==null).map(ve=>[ve.code,ve.currentValue]));Object.keys(pe).length>0&&ne(K,pe)}Q.trigger().then(()=>{const pe=Q.formState.errors,ve=te.current,$t=Array.from(new Set(Object.keys(pe).map(x=>{var O;return(O=ve.find(A=>A.code===x))==null?void 0:O.tab}).filter(Boolean)));ie.current(Object.keys(pe).length===0,$t)})},[]),m.useEffect(()=>{const K=Q.watch((pe,{name:ve})=>{const $t=q.current;if(!$t)return;const x=te.current,O=new Set(x.map($=>$.code));if(ve&&O.has(ve)){let $=Q.getValues(ve);ve==="dialcodes"&&($=Array.isArray($)?$:$?[$]:[]),ve==="shuffle"&&($===!0&&fe.current===!1&&Ee(o.sparkMetaForm.shuffleEnabledMessage,{icon:c.jsx(rl,{size:16})}),fe.current=$);const G=vN(ve,$);G&&(ne($t,G),V.current(G))}else if(!ve){const $=Q.getValues(),G=Object.fromEntries(Object.entries($).filter(([ee])=>O.has(ee))),H=yN(G,{isReview:je.includes(se.current),nodeTitle:J.current});Object.keys(H).length>0&&(ne($t,H),V.current(H))}const A=Q.formState.errors,U=Array.from(new Set(Object.keys(A).map($=>{var G;return(G=x.find(H=>H.code===$))==null?void 0:G.tab}).filter(Boolean)));ie.current(Object.keys(A).length===0,U)});return()=>K.unsubscribe()},[Q]),m.useEffect(()=>{for(const K of["author","creator","copyright","copyrightYear","license"]){const pe=te.current.find($t=>$t.code===K);if(!pe||pe.currentValue===void 0||pe.currentValue===null||pe.currentValue==="")continue;const ve=Q.getValues(K);(ve==null||ve==="")&&Q.setValue(K,pe.currentValue,{shouldDirty:!1})}},[E,_,Q]);const Te=de.reduce((K,pe)=>{const ve=K[K.length-1];return ve&&ve.section===pe.section?ve.fields.push(pe):K.push({section:pe.section,fields:[pe]}),K},[]),$e=K=>{const pe={key:K.code,name:K.code,label:K.label,required:K.required,disabled:K.editable===!1};switch(K.inputType){case"textarea":return c.jsx(Hu,{...pe,multiline:!0,maxLength:K.maxLength});case"select":return c.jsx(aR,{...pe,options:K.options??[]});case"multiselect":return c.jsx(oR,{...pe,options:K.options??[]});case"chips":return c.jsx(lR,{...pe});case"radio":return c.jsx(cR,{...pe,options:K.options??[]});case"appIcon":return c.jsx(WR,{...pe,nodeId:P??""});case"datepicker":case"datetime":return c.jsx(KR,{...pe});case"keywords":case"tagsinput":return c.jsx(YR,{...pe});case"nestedselect":return c.jsx(ZR,{...pe,levels:K.levels??[]});case"license":return c.jsx(XR,{...pe});case"dialcode":return c.jsx(JR,{...pe});default:return c.jsx(Hu,{...pe,maxLength:K.maxLength})}};return c.jsx(ND,{...Q,children:c.jsxs("div",{className:Ga.form,children:[Te.map((K,pe)=>{const ve=K.section?XD[K.section]:void 0;return ve?c.jsx(EN,{title:ve.title,description:ve.description,children:K.fields.map($e)},K.section??pe):c.jsx("div",{className:Ga.ungrouped,children:K.fields.map($e)},pe)}),de.length===0&&!y&&c.jsx("p",{className:Ga.noFields,children:o.sparkMetaForm.noFieldsMessage})]})})};function op(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function sj(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function ai(e){return e!==null&&e>=0}function ij(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function aj(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const lp=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=op(t,n,r),a=t[s],o=i[s];return!o||!a?null:{x:o.left-a.left,y:o.top-a.top,scaleX:o.width/a.width,scaleY:o.height/a.height}},oi={scaleX:1,scaleY:1},oj=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:s,rects:i,overIndex:a}=e;const o=(t=i[r])!=null?t:n;if(!o)return null;if(s===r){const u=i[a];return u?{x:0,y:r<a?u.top+u.height-(o.top+o.height):u.top-o.top,...oi}:null}const l=lj(i,s,r);return s>r&&s<=a?{x:0,y:-o.height-l,...oi}:s<r&&s>=a?{x:0,y:o.height+l,...oi}:{x:0,y:0,...oi}};function lj(e,t,r){const n=e[t],s=e[t-1],i=e[t+1];return n?r<t?s?n.top-(s.top+s.height):i?i.top-(n.top+n.height):0:i?i.top-(n.top+n.height):s?n.top-(s.top+s.height):0:0}const cp="Sortable",up=m.createContext({activeIndex:-1,containerId:cp,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:lp,disabled:{draggable:!1,droppable:!1}});function cj(e){let{children:t,id:r,items:n,strategy:s=lp,disabled:i=!1}=e;const{active:a,dragOverlay:o,droppableRects:l,over:u,measureDroppableContainers:f}=rf(),d=$s(cp,r),g=o.rect!==null,p=m.useMemo(()=>n.map(E=>typeof E=="object"&&"id"in E?E.id:E),[n]),w=a!=null,h=a?p.indexOf(a.id):-1,y=u?p.indexOf(u.id):-1,v=m.useRef(p),b=!ij(p,v.current),C=y!==-1&&h===-1||b,S=aj(i);Jt(()=>{b&&w&&f(p)},[b,p,w,f]),m.useEffect(()=>{v.current=p},[p]);const _=m.useMemo(()=>({activeIndex:h,containerId:d,disabled:S,disableTransforms:C,items:p,overIndex:y,useDragOverlay:g,sortedRects:sj(p,l),strategy:s}),[h,d,S.draggable,S.droppable,C,p,y,l,g,s]);return m.createElement(up.Provider,{value:_},t)}const uj=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return op(r,n,s).indexOf(t)},dj=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:i,newIndex:a,previousItems:o,previousContainerId:l,transition:u}=e;return!u||!n||o!==i&&s===a?!1:r?!0:a!==s&&t===l},fj={duration:200,easing:"ease"},dp="transform",hj=qr.Transition.toString({property:dp,duration:0,easing:"linear"}),pj={roleDescription:"sortable"};function mj(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,a]=m.useState(null),o=m.useRef(r);return Jt(()=>{if(!t&&r!==o.current&&n.current){const l=s.current;if(l){const u=Gn(n.current,{ignoreTransform:!0}),f={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(f.x||f.y)&&a(f)}}r!==o.current&&(o.current=r)},[t,r,n,s]),m.useEffect(()=>{i&&a(null)},[i]),i}function gj(e){let{animateLayoutChanges:t=dj,attributes:r,disabled:n,data:s,getNewIndex:i=uj,id:a,strategy:o,resizeObserverConfig:l,transition:u=fj}=e;const{items:f,containerId:d,activeIndex:g,disabled:p,disableTransforms:w,sortedRects:h,overIndex:y,useDragOverlay:v,strategy:b}=m.useContext(up),C=yj(n,p),S=f.indexOf(a),_=m.useMemo(()=>({sortable:{containerId:d,index:S,items:f},...s}),[d,s,S,f]),E=m.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:N,node:R,isOver:P,setNodeRef:B}=fy({id:a,data:_,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...l}}),{active:D,activatorEvent:j,activeNodeRect:M,attributes:k,setNodeRef:L,listeners:z,isDragging:X,over:ye,setActivatorNodeRef:_e,transform:we}=tf({id:a,data:_,attributes:{...pj,...r},disabled:C.draggable}),de=Zm(B,L),Q=!!D,ne=Q&&!w&&ai(g)&&ai(y),te=!v&&X,q=te&&ne?we:null,ie=ne?q??(o??b)({rects:h,activeNodeRect:M,activeIndex:g,overIndex:y,index:S}):null,fe=ai(g)&&ai(y)?i({id:a,items:f,activeIndex:g,overIndex:y}):S,J=D==null?void 0:D.id,se=m.useRef({activeId:J,items:f,newIndex:fe,containerId:d}),je=f!==se.current.items,Te=t({active:D,containerId:d,isDragging:X,isSorting:Q,id:a,index:S,items:f,newIndex:se.current.newIndex,previousItems:se.current.items,previousContainerId:se.current.containerId,transition:u,wasDragging:se.current.activeId!=null}),$e=mj({disabled:!Te,index:S,node:R,rect:N});return m.useEffect(()=>{Q&&se.current.newIndex!==fe&&(se.current.newIndex=fe),d!==se.current.containerId&&(se.current.containerId=d),f!==se.current.items&&(se.current.items=f)},[Q,fe,d,f]),m.useEffect(()=>{if(J===se.current.activeId)return;if(J&&!se.current.activeId){se.current.activeId=J;return}const qe=setTimeout(()=>{se.current.activeId=J},50);return()=>clearTimeout(qe)},[J]),{active:D,activeIndex:g,attributes:k,data:_,rect:N,index:S,newIndex:fe,items:f,isOver:P,isSorting:Q,isDragging:X,listeners:z,node:R,overIndex:y,over:ye,setNodeRef:de,setActivatorNodeRef:_e,setDroppableNodeRef:B,setDraggableNodeRef:L,transform:$e??ie,transition:Ve()};function Ve(){if($e||je&&se.current.newIndex===S)return hj;if(!(te&&!Yi(j)||!u)&&(Q||Te))return qr.Transition.toString({...u,property:dp})}}function yj(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}function zi(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const vj=[xe.Down,xe.Right,xe.Up,xe.Left],bj=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:a,scrollableAncestors:o}}=t;if(vj.includes(e.code)){if(e.preventDefault(),!r||!n)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const g=s.get(d.id);if(g)switch(e.code){case xe.Down:n.top<g.top&&l.push(d);break;case xe.Up:n.top>g.top&&l.push(d);break;case xe.Left:n.left>g.left&&l.push(d);break;case xe.Right:n.left<g.left&&l.push(d);break}});const u=pg({collisionRect:n,droppableRects:s,droppableContainers:l});let f=Md(u,"id");if(f===(a==null?void 0:a.id)&&u.length>1&&(f=u[1].id),f!=null){const d=i.get(r.id),g=i.get(f),p=g?s.get(g.id):null,w=g==null?void 0:g.node.current;if(w&&p&&d&&g){const y=Zi(w).some((E,N)=>o[N]!==E),v=fp(d,g),b=wj(d,g),C=y||!v?{x:0,y:0}:{x:b?n.width-p.width:0,y:b?n.height-p.height:0},S={x:p.left,y:p.top};return C.x&&C.y?S:Es(S,C)}}}};function fp(e,t){return!zi(e)||!zi(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function wj(e,t){return!zi(e)||!zi(t)||!fp(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Cj="_row_11nth_1",Sj="_removeBtn_11nth_14",xj="_grip_11nth_17",_j="_ctIcon_11nth_34",Tj="_info_11nth_38",Ej="_name_11nth_46",Ij="_meta_11nth_55",Vr={row:Cj,removeBtn:Sj,grip:xj,ctIcon:_j,info:Tj,name:Ej,meta:Ij},Oj={video:ol,pdf:ta,h5p:nl,scorm:il,audio:sl,quiz:tl,default:Yn},Aj=({item:e,onRemove:t,isEditable:r})=>{const n=le(),s=ua(e),i=Oj[s.key]??Yn,{attributes:a,listeners:o,setNodeRef:l,transform:u,transition:f,isDragging:d}=gj({id:e.id,disabled:!r}),g={transform:qr.Transform.toString(u),transition:f,opacity:d?.5:1};return c.jsxs("div",{ref:l,style:g,className:Vr.row,role:"listitem",children:[r&&c.jsx("span",{className:Vr.grip,...a,...o,"aria-label":n.contentRow.dragToReorderAriaLabel,children:c.jsx(cf,{size:15})}),c.jsx("span",{className:[`sbx-ct-sq--${s.key}`,Vr.ctIcon].join(" "),"aria-hidden":"true",children:c.jsx(i,{size:14})}),c.jsxs("div",{className:Vr.info,children:[c.jsx("span",{className:Vr.name,title:e.name,children:e.name}),c.jsx("span",{className:Vr.meta,children:s.label})]}),c.jsx("span",{className:`sbx-ct-badge--${s.key}`,children:s.label}),r&&c.jsx("button",{type:"button",className:Vr.removeBtn,onClick:()=>t(e.id),"aria-label":n.contentRow.removeAriaLabel.replace("{name}",e.name),children:c.jsx(Cr,{size:14})})]})},Dj="_container_lzvke_1",Nj="_header_lzvke_7",Rj="_heading_lzvke_13",jj="_count_lzvke_21",kj="_list_lzvke_30",Lj="_emptyState_lzvke_36",Pj="_addRow_lzvke_52",Hr={container:Dj,header:Nj,heading:Rj,count:jj,list:kj,emptyState:Lj,addRow:Pj},Fj=({editorMode:e})=>{const t=le(),{selectedNodeId:r,getChildrenOf:n,reorderChildren:s,deleteNode:i}=Oe(),a=r?n(r):[],o=e==="edit",l=Ld(ho(Xi,{activationConstraint:{distance:5}}),ho(Xo,{coordinateGetter:bj})),u=m.useCallback(d=>{const{active:g,over:p}=d;if(!p||g.id===p.id||!r)return;const w=Oe.getState().getChildrenOf(r),h=w.findIndex(v=>v.id===g.id),y=w.findIndex(v=>v.id===p.id);h<0||y<0||s(r,h,y)},[r,s]),f=m.useCallback(d=>{window.confirm(t.unitContentList.removeConfirm)&&i(d)},[i,t.unitContentList.removeConfirm]);return r?c.jsxs("div",{className:Hr.container,children:[c.jsxs("div",{className:Hr.header,children:[c.jsx("span",{className:Hr.heading,children:t.unitContentList.heading}),c.jsx("span",{className:Hr.count,children:a.length})]}),a.length>0?c.jsx(ef,{sensors:l,collisionDetection:hg,onDragEnd:u,children:c.jsx(cj,{items:a.map(d=>d.id),strategy:oj,children:c.jsx("div",{className:Hr.list,role:"list",children:a.map(d=>c.jsx(Aj,{item:d,onRemove:f,isEditable:o},d.id))})})}):c.jsxs("div",{className:Hr.emptyState,children:[c.jsx("p",{children:t.unitContentList.emptyTitle}),c.jsx("span",{children:t.unitContentList.emptyHint})]}),o&&c.jsxs("button",{className:Hr.addRow,type:"button","aria-label":t.unitContentList.addContentAriaLabel,children:[c.jsx(Us,{size:14})," ",t.unitContentList.addContent]})]}):null},Mj="_dropZone_ijo5w_1",Bj="_active_ijo5w_14",Wu={dropZone:Mj,active:Bj},$j=({isActive:e,label:t,nodeId:r,className:n})=>{const s=le(),i=t??s.dropZone.dropHere;return c.jsx("div",{className:`${Wu.dropZone} ${e?Wu.active:""} ${n??""}`,"data-droppable":e?"true":void 0,"data-node-id":r,"aria-label":i,role:"region",children:c.jsx("span",{children:i})})};async function qj(e){var a;const t={status:["Live"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((a=(await Ne.post("/action/composite/v3/search",{request:{filters:t,query:e.query??"",limit:e.limit??20,offset:e.offset??0,sort_by:e.sortBy??{lastUpdatedOn:"desc"},fields:e.fields??["identifier","name","mimeType","contentType","primaryCategory","appIcon","channel","organisation","pkgVersion"]}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:a.result)??{},s=new Set(["count","facets"]);return{content:Object.entries(n).filter(([o])=>!s.has(o)).flatMap(([,o])=>Array.isArray(o)?o:[]),count:n.count??0}}async function Uj(e){var r,n;return(n=(r=(await Ne.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}const Ku="application/vnd.sunbird.question";function Yu(e){return{cardinality:"single",type:"integer",defaultValue:e.maxScore??1}}function hp(e,t,r){if(!e)return null;if(e.identifier===t)return{question:e,parent:r};for(const n of e.children??[]){const s=hp(n,t,e);if(s)return s}return null}function zj(e,t){const r=hp(e,t);if(!r)return null;const{question:n,parent:s}=r,i={...e,children:[n],childNodes:[t],shuffle:s==null?void 0:s.shuffle,showSolutions:(s==null?void 0:s.showSolutions)??"No",showFeedback:(s==null?void 0:s.showFeedback)??"No"};return(s==null?void 0:s.shuffle)===!0?i.maxScore=1:n.qType==="SA"?delete i.maxScore:n.maxScore!=null&&(i.maxScore=n.maxScore),i}function Vj(e,t){const r=((t==null?void 0:t.enabled)??!0)&&!!e;return $n({queryKey:["quml","questionset",e],enabled:r,queryFn:async()=>{const n=await Qf(e),s=f=>{if(!f)return[];const d=f.mimeType===Ku&&f.identifier?[f.identifier]:[],g=(f.children??[]).flatMap(s);return[...d,...g]},i=s(n),a=new Map;i.length&&(await D_(i)).forEach(d=>{const g=d.identifier;g&&a.set(g,d)});const o=f=>{if(!f)return f;if(f.mimeType===Ku&&f.identifier){const d=a.get(f.identifier)??f,g=d.outcomeDeclaration;return g!=null&&g.maxScore||(d.outcomeDeclaration={...g??{},maxScore:Yu(d)}),d}return Array.isArray(f.children)&&(f.children=f.children.map(d=>o(d))),f},l=o(n),u=l.outcomeDeclaration;return u!=null&&u.maxScore||(l.outcomeDeclaration={...u??{},maxScore:Yu(l)}),l}})}const Zu="/assets/quml-player/sunbird-quml-player.js",Hj="/assets/quml-player/styles.css",Xu="sunbird-quml-player";function Qj(e){const t=e.children??[];return t.length?t.every(n=>n.objectType==="Question")?[e]:t:[]}const nt=class nt{constructor(){ns(this,"eventHandlers",new WeakMap)}loadScript(){return nt.scriptLoaded||customElements.get(Xu)?(nt.scriptLoaded=!0,Promise.resolve()):(nt.scriptLoading||(nt.scriptLoading=new Promise((t,r)=>{const n=document.createElement("script");n.src=Zu,n.setAttribute("data-quml-player-script","true"),n.onload=()=>{nt.scriptLoaded=!0,nt.scriptLoading=void 0,t()},n.onerror=()=>{nt.scriptLoading=void 0,r(new Error(`Failed to load QuML player script: ${Zu}`))},document.body.appendChild(n)})),nt.scriptLoading)}loadStyles(){if(nt.stylesLoaded||document.querySelector('[data-quml-player-styles="true"]')){nt.stylesLoaded=!0;return}const t=document.createElement("link");t.rel="stylesheet",t.href=Hj,t.setAttribute("data-quml-player-styles","true"),document.head.appendChild(t),nt.stylesLoaded=!0}static unloadStyles(){var t;(t=document.querySelector('[data-quml-player-styles="true"]'))==null||t.remove(),nt.stylesLoaded=!1}async createConfig(t,r,n){var i,a,o;return await this.loadScript(),{context:{mode:(n==null?void 0:n.mode)??"play",host:"",pdata:{id:((i=r==null?void 0:r.pdata)==null?void 0:i.id)??"sunbird.portal",ver:((a=r==null?void 0:r.pdata)==null?void 0:a.ver)??"1.0",pid:((o=r==null?void 0:r.pdata)==null?void 0:o.pid)??"sunbird-portal"},contentId:t.identifier??"",sid:(r==null?void 0:r.sid)??"",uid:(r==null?void 0:r.uid)??(r==null?void 0:r.userId)??"",channel:(r==null?void 0:r.channel)??"",did:(r==null?void 0:r.did)??"",tags:(r==null?void 0:r.tags)??[],contextRollup:(n==null?void 0:n.contextRollup)??(r==null?void 0:r.rollup)??{},objectRollup:(n==null?void 0:n.objectRollup)??{},...n!=null&&n.cdata?{cdata:n.cdata}:{}},config:{language:"en"},data:{sections:Qj(t),identifier:t.identifier??""},metadata:t}}createElement(t){this.loadStyles();const r=document.createElement(Xu);return r.setAttribute("player-config",JSON.stringify(t)),r.setAttribute("data-player-id",t.metadata.identifier??"quml"),r}attachEventListeners(t,r,n){this.removeEventListeners(t);const s=a=>r==null?void 0:r(a),i=a=>n==null?void 0:n(a.detail);t.addEventListener("playerEvent",s),t.addEventListener("telemetryEvent",i),this.eventHandlers.set(t,{player:s,telemetry:i})}removeEventListeners(t){const r=this.eventHandlers.get(t);r&&(t.removeEventListener("playerEvent",r.player),t.removeEventListener("telemetryEvent",r.telemetry),this.eventHandlers.delete(t))}};ns(nt,"scriptLoaded",!1),ns(nt,"scriptLoading"),ns(nt,"stylesLoaded",!1);let Vi=nt;const li=new Vi,Gj="_contentPlayerRoot_r6xk8_1",Wj="_flowLayout_r6xk8_9",Kj="_stage_r6xk8_13",Yj="_aspectRatio_r6xk8_16",Zj="_playerHeader_r6xk8_32",Xj="_playerHeaderThumb_r6xk8_46",Jj="_playerHeaderTitle_r6xk8_56",ek="_typeBadge_r6xk8_66",tk="_typeDot_r6xk8_105",rk="_playerFrame_r6xk8_125",nk="_coverOverlay_r6xk8_133",sk="_coverHidden_r6xk8_145",ik="_coverThumb_r6xk8_150",ak="_coverPlayRing_r6xk8_159",ok="_coverPlayIcon_r6xk8_172",lk="_coverLabel_r6xk8_181",ck="_coverSkeleton_r6xk8_187",uk="_playerWrapper_r6xk8_213",dk="_infoStrip_r6xk8_223",fk="_infoChip_r6xk8_239",hk="_infoChipLabel_r6xk8_258",pk="_infoChipIcon_r6xk8_267",mk="_playerError_r6xk8_273",gk="_playerErrorIcon_r6xk8_287",yk="_playerErrorMsg_r6xk8_292",vk="_qumlRoot_r6xk8_299",Pe={contentPlayerRoot:Gj,flowLayout:Wj,stage:Kj,aspectRatio:Yj,playerHeader:Zj,playerHeaderThumb:Xj,playerHeaderTitle:Jj,typeBadge:ek,typeDot:tk,playerFrame:rk,coverOverlay:nk,coverHidden:sk,coverThumb:ik,coverPlayRing:ak,coverPlayIcon:ok,coverLabel:lk,coverSkeleton:ck,playerWrapper:uk,infoStrip:dk,infoChip:fk,infoChipLabel:hk,infoChipIcon:pk,playerError:mk,playerErrorIcon:gk,playerErrorMsg:yk,qumlRoot:vk},bk="application/vnd.sunbird.questionset";function wk(e,t){const r=new Map,n=i=>{for(const a of i)r.set(a.id,a),a.children&&n(a.children)};n(e);let s=r.get(t);for(;s;){if(s.mimeType===bk)return s.identifier;s=s.parent?r.get(s.parent):void 0}return null}const Ck=[{key:"video",mimes:["video/mp4","video/webm","video/ogg"]},{key:"audio",mimes:["audio/mp3","audio/mpeg","audio/ogg","audio/wav"]},{key:"pdf",mimes:["application/pdf"]},{key:"epub",mimes:["application/epub"]},{key:"ecml",mimes:["application/vnd.ekstep.ecml-archive"]},{key:"h5p",mimes:["application/vnd.ekstep.h5p-archive"]},{key:"scorm",mimes:["application/vnd.ekstep.content-collection"]}];function Sk(e){return Ck.find(t=>t.mimes.includes(e))??{key:"other"}}function xk(e,t){switch(e){case"video":return t.contentPlayer.mimeLabelVideo;case"audio":return t.contentPlayer.mimeLabelAudio;case"pdf":return t.contentPlayer.mimeLabelPdf;case"epub":return t.contentPlayer.mimeLabelEpub;case"ecml":return t.contentPlayer.mimeLabelEcml;case"h5p":return t.contentPlayer.mimeLabelH5p;case"scorm":return t.contentPlayer.mimeLabelScorm;default:return t.contentPlayer.mimeLabelOther}}const _k={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},Tk={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},Ek={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},Ik="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function Wa(e){for(const[t,r]of Object.entries(_k))if(r.includes(e))return t;return"default-player"}function Ok(e,t,r){var i;const n=r==null?void 0:r.context,s=t.mimeType??e.mimeType??"";return{context:{mode:"play",partner:[],pdata:{id:((i=n==null?void 0:n.pdata)==null?void 0:i.id)??"sunbird.portal",ver:1,pid:"sunbird-portal"},contentId:e.identifier,sid:(n==null?void 0:n.sid)??"",uid:(n==null?void 0:n.uid)??"",channel:(n==null?void 0:n.channel)??"",did:(n==null?void 0:n.did)??"",timeDiff:0,contextRollup:{},tags:[],app:[(n==null?void 0:n.channel)??""],dims:""},config:{showEndPage:!1,showStartPage:!0,host:"",overlay:{showUser:!1},splash:{text:"",icon:"",bgImage:"",webLink:""},sideMenu:{showDownload:!0,showExit:!1,showShare:!0},apislug:"/action",repos:["/sunbird-plugins/renderer"],plugins:[{id:"org.sunbird.iframeEvent",ver:1,type:"plugin"},{id:"org.sunbird.player.endpage",ver:1.1,type:"plugin"}],enableTelemetryValidation:!1},metadata:t,data:s==="application/vnd.ekstep.ecml-archive"?t.body??{}:{}}}function Ak(e){return document.querySelector(`script[src="${e}"]`)?Promise.resolve():new Promise((t,r)=>{const n=document.createElement("script");n.src=e,n.onload=()=>t(),n.onerror=()=>r(new Error(`Failed to load ${e}`)),document.head.appendChild(n)})}async function Dk(e,t,r=100){await Ak(Tk[t]??""),!customElements.get(e)&&await new Promise((n,s)=>{let i=0;const a=setInterval(()=>{i++,customElements.get(e)?(clearInterval(a),n()):i>=r&&(clearInterval(a),s(new Error(`Custom element <${e}> did not register`)))},100)})}const Nk=[{key:"author",icon:ev},{key:"license",icon:Gy},{key:"language",icon:By},{key:"gradeLevel",icon:Wy},{key:"subject",icon:Ny},{key:"contentType",icon:Xy}];function Rk(e,t){switch(e){case"author":return t.contentPlayer.infoFieldAuthor;case"license":return t.contentPlayer.infoFieldLicense;case"language":return t.contentPlayer.infoFieldLanguage;case"gradeLevel":return t.contentPlayer.infoFieldClass;case"subject":return t.contentPlayer.infoFieldSubject;case"contentType":return t.contentPlayer.infoFieldType;default:return e}}function jk({node:e}){const t=le(),r=e.metadata??{},n=Nk.flatMap(s=>{const i=r[s.key];if(!i)return[];const a=Array.isArray(i)?i.join(", "):String(i);return a?[{...s,label:Rk(s.key,t),val:a}]:[]});return n.length?c.jsx("div",{className:Pe.infoStrip,children:n.map(s=>c.jsxs("div",{className:Pe.infoChip,children:[s.icon&&c.jsx(s.icon,{size:13,className:Pe.infoChipIcon}),c.jsx("span",{className:Pe.infoChipLabel,children:s.label}),s.val]},s.key))}):null}function pp({node:e,hidden:t}){var s;const r=le(),n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return c.jsx("div",{className:`${Pe.coverOverlay} ${t?Pe.coverHidden:""}`,children:n?c.jsxs(c.Fragment,{children:[c.jsx("img",{src:n,alt:e.name,className:Pe.coverThumb}),c.jsx("div",{className:Pe.coverPlayRing,children:c.jsx("div",{className:Pe.coverPlayIcon})}),c.jsx("span",{className:Pe.coverLabel,children:r.contentPlayer.loadingPreview})]}):c.jsx("div",{className:Pe.coverSkeleton})})}function mp({message:e}){return c.jsxs("div",{className:Pe.playerError,children:[c.jsx(Jy,{size:28,className:Pe.playerErrorIcon}),c.jsx("span",{className:Pe.playerErrorMsg,children:e})]})}function kk({mimeType:e}){const t=le(),r=Sk(e);return c.jsxs("span",{className:Pe.typeBadge,"data-type":r.key,children:[c.jsx("span",{className:Pe.typeDot}),xk(r.key,t)]})}const Vo=({node:e,editorMode:t,type:r,singleQuestion:n,layout:s="fill"})=>{var a;if(r==="quml")return c.jsx(Pk,{node:e,editorMode:t,singleQuestion:!!n});const i=e.appIcon??((a=e.metadata)==null?void 0:a.appIcon);return c.jsxs("div",{className:`${Pe.contentPlayerRoot} ${s==="flow"?Pe.flowLayout:""}`,children:[c.jsxs("div",{className:Pe.stage,children:[c.jsxs("div",{className:Pe.playerHeader,children:[i&&c.jsx("img",{src:i,alt:"",className:Pe.playerHeaderThumb}),c.jsx("span",{className:Pe.playerHeaderTitle,children:e.name}),c.jsx(kk,{mimeType:e.mimeType??""})]}),c.jsx(Lk,{node:e})]}),c.jsx(jk,{node:e})]})};function Lk({node:e}){var v;const t=le(),r=ce(b=>b.editorConfig),[n,s]=m.useState(()=>Wa(e.mimeType??"")),[i,a]=m.useState(!1),[o,l]=m.useState(null),[u,f]=m.useState(e.metadata??{}),[d,g]=m.useState(!1),p=m.useRef(null),w=m.useRef(null),h=((v=r==null?void 0:r.config)==null?void 0:v.previewCdnUrl)??Ik;m.useEffect(()=>{let b=!1;return g(!1),a(!1),l(null),f(e.metadata??{}),s(Wa(e.mimeType??"")),Uj(e.identifier).then(C=>{if(b)return;const S={...e.metadata??{},...C};f(S);const _=C.mimeType??e.mimeType??"";s(Wa(_)),g(!0)}).catch(()=>{b||g(!0)}),()=>{b=!0}},[e.identifier]);const y=Ok(e,u,r);return m.useEffect(()=>{if(!d||n!=="default-player")return;const b=p.current;if(!b)return;b.src=h;const C=()=>{try{const _=b.contentWindow;if(typeof(_==null?void 0:_.initializePreview)!="function"){l(t.contentPlayer.previewPlayerUnavailable);return}_.initializePreview(y),setTimeout(()=>a(!0),300)}catch(_){console.error("[ContentPlayer] initializePreview failed",_),l(t.contentPlayer.failedToInitializePlayer)}},S=()=>l(t.contentPlayer.previewPlayerLoadFailed);return b.addEventListener("load",C),b.addEventListener("error",S),()=>{b.removeEventListener("load",C),b.removeEventListener("error",S),b.src=""}},[e.identifier,n,h,d,t]),m.useEffect(()=>{if(!d||n==="default-player")return;const b=w.current;if(!b)return;const C=Ek[n];if(!C)return;const S=y;Dk(C,n).then(()=>{if(!w.current)return;if(!customElements.get(C)){s("default-player");return}const _=document.createElement(C);_.setAttribute("player-config",JSON.stringify(S)),_.addEventListener("playerEvent",()=>{}),_.addEventListener("telemetryEvent",()=>{}),b.innerHTML="",b.appendChild(_),setTimeout(()=>{try{_.playerConfig=S}catch{}a(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${n} script unavailable, falling back to iframe`),s("default-player")})},[e.identifier,n,d]),c.jsxs("div",{className:Pe.aspectRatio,children:[o?c.jsx(mp,{message:o}):c.jsx(pp,{node:e,hidden:i}),n==="default-player"?c.jsx("iframe",{ref:p,id:"contentPlayer",title:e.name,className:Pe.playerFrame,name:"contentPlayer",allowFullScreen:!0}):c.jsx("div",{ref:w,className:Pe.playerFrame})]})}function Pk({node:e,editorMode:t,singleQuestion:r}){const n=le(),s=ce(p=>p.editorConfig),i=Oe(p=>p.treeData),a=m.useRef(null),o=r?wk(i,e.id):e.identifier,{data:l,isLoading:u,error:f}=Vj(o??"",{enabled:!!o}),d=m.useMemo(()=>l?r?zj(l,e.identifier):l:null,[l,r,e.identifier]);m.useEffect(()=>{const p=a.current;if(!p||!d)return;let w=null,h=!1;return(async()=>{try{const y=await li.createConfig(d,s==null?void 0:s.context,{mode:t==="edit"?"edit":"play"});if(h||!a.current)return;const v=li.createElement(y);w=v,li.attachEventListeners(v,b=>console.debug("[QumlPlayer] playerEvent",b.detail),b=>console.debug("[QumlPlayer] telemetryEvent",b)),p.innerHTML="",p.appendChild(v)}catch(y){console.error("[QumlPlayer] failed to initialize",y)}})(),()=>{h=!0,w&&(li.removeEventListeners(w),w.remove()),Vi.unloadStyles()}},[d,s,t,r]);const g=f?`${n.contentPlayer.unableToLoadQuestionset} ${f.message}`:r&&!o?n.contentPlayer.parentQuestionsetNotResolved:r&&l&&!d?n.contentPlayer.questionNotFoundInQuestionset:null;return c.jsxs("div",{className:Pe.qumlRoot,children:[g?c.jsx(mp,{message:g}):u||!d?c.jsx(pp,{node:e,hidden:!1}):null,c.jsx("div",{ref:a,className:Pe.playerWrapper})]})}const Fk="_overlay_ifddx_1",Mk="_modal_ifddx_11",Bk="_header_ifddx_21",$k="_body_ifddx_37",qk="_hint_ifddx_43",Uk="_list_ifddx_49",zk="_item_ifddx_55",Vk="_selected_ifddx_68",Hk="_empty_ifddx_73",Qk="_footer_ifddx_79",Gk="_cancelBtn_ifddx_87",Wk="_moveBtn_ifddx_95",Vt={overlay:Fk,modal:Mk,header:Bk,body:$k,hint:qk,list:Uk,item:zk,selected:Vk,empty:Hk,footer:Qk,cancelBtn:Gk,moveBtn:Wk};function Kk(e,t,r){const n=[],s=i=>{var a;for(const o of i)o.isFolder&&o.id!==r&&o.id!==t&&n.push(o),(a=o.children)!=null&&a.length&&s(o.children)};return s(e),n}const Yk=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var d;const s=le(),{treeData:i,moveNode:a}=Oe(),o=Kk(i,((d=i[0])==null?void 0:d.id)??"",r),[l,u]=m.useState(null),f=()=>{l&&(a(e,r,l),n())};return c.jsx("div",{className:Vt.overlay,role:"dialog","aria-label":s.resourceReorderDialog.dialogAriaLabel,children:c.jsxs("div",{className:Vt.modal,children:[c.jsxs("div",{className:Vt.header,children:[c.jsxs("span",{children:[s.resourceReorderDialog.moveHeaderPrefix,' "',t,'"']}),c.jsx("button",{onClick:n,"aria-label":s.resourceReorderDialog.closeAriaLabel,children:c.jsx(Cr,{size:16})})]}),c.jsxs("div",{className:Vt.body,children:[c.jsx("p",{className:Vt.hint,children:s.resourceReorderDialog.selectUnitHint}),c.jsxs("ul",{className:Vt.list,children:[o.map(g=>c.jsxs("li",{className:`${Vt.item} ${l===g.id?Vt.selected:""}`,onClick:()=>u(g.id),children:[c.jsx(Fy,{size:14}),c.jsx("span",{children:g.name})]},g.id)),o.length===0&&c.jsx("li",{className:Vt.empty,children:s.resourceReorderDialog.noUnitsAvailable})]})]}),c.jsxs("div",{className:Vt.footer,children:[c.jsx("button",{className:Vt.cancelBtn,onClick:n,children:s.resourceReorderDialog.cancelButton}),c.jsx("button",{className:Vt.moveBtn,onClick:f,disabled:!l,children:s.resourceReorderDialog.moveButton})]})]})})},Zk="_overlay_16at9_1",Xk="_modal_16at9_11",Jk="_header_16at9_21",eL="_body_16at9_37",tL="_table_16at9_43",rL="_pageInput_16at9_61",nL="_empty_16at9_68",sL="_footer_16at9_74",iL="_cancelBtn_16at9_82",aL="_saveBtn_16at9_90",or={overlay:Zk,modal:Xk,header:Jk,body:eL,table:tL,pageInput:rL,empty:nL,footer:sL,cancelBtn:iL,saveBtn:aL};function oL(e){const t=[],r=n=>{var s;for(const i of n)!i.isFolder&&(!i.children||i.children.length===0)?t.push(i):(s=i.children)!=null&&s.length&&r(i.children)};return r(e),t}const lL=({onClose:e})=>{const t=le(),{treeData:r,updateNode:n}=Oe(),s=oL(r),[i,a]=m.useState(()=>Object.fromEntries(s.map(l=>{var u;return[l.id,String(((u=l.metadata)==null?void 0:u.pageNumber)??"")]}))),o=m.useCallback(()=>{for(const[l,u]of Object.entries(i))u!==""&&n(l,{pageNumber:parseInt(u,10)||void 0});e()},[i,n,e]);return c.jsx("div",{className:or.overlay,role:"dialog","aria-label":t.assignPageNumber.dialogAriaLabel,children:c.jsxs("div",{className:or.modal,children:[c.jsxs("div",{className:or.header,children:[c.jsx("span",{children:t.assignPageNumber.title}),c.jsx("button",{onClick:e,"aria-label":t.assignPageNumber.closeAriaLabel,children:c.jsx(Cr,{size:16})})]}),c.jsx("div",{className:or.body,children:s.length===0?c.jsx("p",{className:or.empty,children:t.assignPageNumber.emptyState}):c.jsxs("table",{className:or.table,children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:t.assignPageNumber.contentColumnHeader}),c.jsx("th",{children:t.assignPageNumber.pageNumberColumnHeader})]})}),c.jsx("tbody",{children:s.map(l=>c.jsxs("tr",{children:[c.jsx("td",{children:l.name}),c.jsx("td",{children:c.jsx("input",{type:"number",min:1,value:i[l.id]??"",onChange:u=>a(f=>({...f,[l.id]:u.target.value})),className:or.pageInput})})]},l.id))})]})}),c.jsxs("div",{className:or.footer,children:[c.jsx("button",{className:or.cancelBtn,onClick:e,children:t.assignPageNumber.cancelButton}),c.jsxs("button",{className:or.saveBtn,onClick:o,children:[c.jsx(Qy,{size:14})," ",t.assignPageNumber.saveButton]})]})]})})},cL="_container_1a7t2_1",uL="_panelHeader_1a7t2_10",dL="_panelHeaderLeft_1a7t2_19",fL="_panelCollapseBtn_1a7t2_27",hL="_titleRow_1a7t2_46",pL="_field_1a7t2_47",mL="_moveBtn_1a7t2_64",gL="_icon_1a7t2_84",yL="_nameInput_1a7t2_93",vL="_fieldHeader_1a7t2_118",bL="_label_1a7t2_124",wL="_fieldCount_1a7t2_133",CL="_chips_1a7t2_170",SL="_chip_1a7t2_170",xL="_chipRemove_1a7t2_188",_L="_keywordInput_1a7t2_202",TL="_input_1a7t2_207",EL="_addBtn_1a7t2_220",IL="_radioGroup_1a7t2_234",OL="_radioLabel_1a7t2_239",Ge={container:cL,panelHeader:uL,panelHeaderLeft:dL,panelCollapseBtn:fL,titleRow:hL,field:pL,moveBtn:mL,icon:gL,nameInput:yL,fieldHeader:vL,label:bL,fieldCount:wL,chips:CL,chip:SL,chipRemove:xL,keywordInput:_L,input:TL,addBtn:EL,radioGroup:IL,radioLabel:OL},AL=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var j,M;const{updateNode:s,markDirty:i}=Oe(),a=t==="edit",o=ua(e),l=le(),u=ce(k=>k.relationalFormConfig),f=k=>u==null?void 0:u.find(L=>L.code===k),d=k=>!u||!!f(k),g=(k,L)=>{var z;return((z=f(k))==null?void 0:z.label)||L},[p,w]=m.useState(!0),h=((j=e.metadata)==null?void 0:j.relationalMetadata)??{},[y,v]=m.useState(h.name??e.name??""),[b,C]=m.useState(""),[S,_]=m.useState(Array.isArray(h.keywords)?h.keywords:Array.isArray((M=e.metadata)==null?void 0:M.keywords)?e.metadata.keywords:[]),[E,N]=m.useState(!!h.optional);m.useEffect(()=>{var L,z;const k=((L=e.metadata)==null?void 0:L.relationalMetadata)??{};v(k.name??e.name??""),_(Array.isArray(k.keywords)?k.keywords:Array.isArray((z=e.metadata)==null?void 0:z.keywords)?e.metadata.keywords:[]),N(!!k.optional)},[e.id]);const R=()=>{y.trim()&&y!==e.name&&(s(e.id,{name:y.trim()}),i())},P=()=>{const k=b.trim();if(k&&!S.includes(k)){const L=[...S,k];_(L),s(e.id,{keywords:L}),i()}C("")},B=k=>{const L=S.filter(z=>z!==k);_(L),s(e.id,{keywords:L}),i()},D=k=>{N(k),s(e.id,{optional:k}),i()};return c.jsxs("div",{className:Ge.container,children:[c.jsxs("div",{className:Ge.panelHeader,children:[c.jsxs("div",{className:Ge.panelHeaderLeft,children:[c.jsx("span",{className:`sbx-ct-badge--${o.key}`,children:o.label}),a&&c.jsx("button",{type:"button",className:Ge.moveBtn,onClick:r,children:l.contentEditForm.moveToAnotherUnitButton})]}),c.jsx("button",{type:"button",className:Ge.panelCollapseBtn,onClick:()=>w(k=>!k),"aria-expanded":p,"aria-label":p?l.contentEditForm.collapseMetadataPanelAriaLabel:l.contentEditForm.expandMetadataPanelAriaLabel,title:p?l.contentEditForm.collapseTitle:l.contentEditForm.expandTitle,children:p?c.jsx(Kn,{size:15}):c.jsx(jy,{size:15})})]}),p&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:Ge.titleRow,children:[e.appIcon&&c.jsx("img",{src:e.appIcon,alt:l.contentEditForm.iconAlt,className:Ge.icon}),c.jsx("input",{type:"text",className:Ge.nameInput,value:y,disabled:!a,onChange:k=>v(k.target.value),onBlur:R,placeholder:l.contentEditForm.contentNamePlaceholder})]}),d("keywords")&&c.jsxs("div",{className:Ge.field,children:[c.jsx("div",{className:Ge.fieldHeader,children:c.jsxs("label",{className:Ge.label,children:[g("keywords",l.contentEditForm.keywordsLabel),S.length>0&&c.jsx("span",{className:Ge.fieldCount,children:S.length})]})}),S.length>0&&c.jsx("div",{className:Ge.chips,children:S.map(k=>c.jsxs("span",{className:Ge.chip,children:[k,a&&c.jsx("button",{type:"button",className:Ge.chipRemove,onClick:()=>B(k),children:"×"})]},k))}),a&&c.jsxs("div",{className:Ge.keywordInput,children:[c.jsx("input",{type:"text",className:Ge.input,value:b,placeholder:l.contentEditForm.addKeywordPlaceholder,onChange:k=>C(k.target.value),onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),P())}}),c.jsx("button",{type:"button",className:Ge.addBtn,onClick:P,children:l.contentEditForm.addButton})]})]}),d("optional")&&c.jsxs("div",{className:Ge.field,children:[c.jsx("label",{className:Ge.label,children:g("optional",l.contentEditForm.optionalInCollectionLabel)}),c.jsxs("div",{className:Ge.radioGroup,children:[c.jsxs("label",{className:Ge.radioLabel,children:[c.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:E===!0,onChange:()=>D(!0),disabled:!a}),l.contentEditForm.yesOption]}),c.jsxs("label",{className:Ge.radioLabel,children:[c.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:E===!1,onChange:()=>D(!1),disabled:!a}),l.contentEditForm.noOption]})]})]})]}),n]})},DL="_iconBtn_vl14u_1",NL="_editable_vl14u_14",RL="_iconImg_vl14u_26",jL="_placeholder_vl14u_34",kL="_removeBtn_vl14u_41",ds={iconBtn:DL,editable:NL,iconImg:RL,placeholder:jL,removeBtn:kL},LL=({nodeId:e,value:t,editable:r})=>{const[n,s]=m.useState(!1),{updateNode:i,markDirty:a}=Oe(),o=le(),l=f=>{i(e,{appIcon:f}),a(),s(!1)},u=f=>{f.stopPropagation(),i(e,{appIcon:""}),a()};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:[ds.iconBtn,r?ds.editable:""].filter(Boolean).join(" "),role:r?"button":void 0,tabIndex:r?0:-1,"aria-label":r?o.titleAppIcon.selectAppIconAriaLabel:o.titleAppIcon.appIconAriaLabel,onClick:()=>r&&s(!0),onKeyDown:f=>{r&&(f.key==="Enter"||f.key===" ")&&s(!0)},children:[t?c.jsx("img",{src:t,alt:o.titleAppIcon.appIconAlt,className:ds.iconImg}):c.jsx("div",{className:ds.placeholder,children:c.jsx(uf,{size:18})}),t&&r&&c.jsx("button",{type:"button",className:ds.removeBtn,onClick:u,"aria-label":o.titleAppIcon.removeIconAriaLabel,children:c.jsx(al,{size:11})})]}),n&&c.jsx(ap,{nodeId:e,currentValue:t,onSelect:l,onClose:()=>s(!1)})]})},PL="_leafContentLayout_1lchu_1",FL="_container_1lchu_15",ML="_emptyState_1lchu_24",BL="_titleRow_1lchu_34",$L="_nodeTitle_1lchu_50",qL="_formArea_1lchu_72",UL="_contentListArea_1lchu_76",zL="_dropZone_1lchu_81",VL="_reviewComment_1lchu_88",HL="_reviewCommentLabel_1lchu_101",QL="_reviewCommentText_1lchu_107",Kt={leafContentLayout:PL,container:FL,emptyState:ML,titleRow:BL,nodeTitle:$L,formArea:qL,contentListArea:UL,dropZone:zL,reviewComment:VL,reviewCommentLabel:HL,reviewCommentText:QL},GL="application/vnd.sunbird.questionset",gp="application/vnd.sunbird.question",WL=[GL,gp];function Ju(e){var t,r;if(!(!e||e.status!=="Draft"||((t=e.metadata)==null?void 0:t.prevStatus)!=="Review"))return(r=e.metadata)==null?void 0:r.rejectComment}const KL=({editorMode:e,onToolbarEvent:t})=>{var M;const r=le(),[n,s]=m.useState("details"),[i,a]=m.useState([]),[o,l]=m.useState(null),[u,f]=m.useState(!1),d=m.useRef(null),g=m.useRef(),{selectedNodeId:p,breadcrumb:w,activeNodeMeta:h,updateNode:y,treeData:v}=Oe(),b=ce(k=>{var L,z,X,ye;return((z=(L=k.editorConfig)==null?void 0:L.context)==null?void 0:z.contentId)??((ye=(X=k.editorConfig)==null?void 0:X.context)==null?void 0:ye.identifier)??""}),C=p?yp(v,p):null,S=!!C&&!C.parent,_=!!(C!=null&&C.isFolder),E=C&&WL.includes(C.mimeType??""),N=(C==null?void 0:C.mimeType)===gp,R=C&&!C.isFolder&&!E&&!S,P=Ju(C)??(S?Ju(v[0]):void 0),B=m.useCallback(()=>{const k=d.current;if(!k||!p)return;const L=k.innerText.trim();clearTimeout(g.current),g.current=setTimeout(()=>{y(p,{name:L})},600)},[p,y]),D=m.useCallback(k=>{t({action:"onFormValueChange",data:k})},[t]),j=m.useCallback((k,L)=>{a(L),t({action:"onFormStatusChange",data:{isValid:k,nodeId:p}})},[t,p]);return C?E?c.jsx(Vo,{node:C,editorMode:e,type:"quml",singleQuestion:N}):R?c.jsxs("div",{className:Kt.leafContentLayout,children:[c.jsx(Vo,{node:C,editorMode:e,type:"content",layout:"flow"}),c.jsx(AL,{node:C,editorMode:e,onMoveClick:()=>l(C.identifier),reorderDialog:o?c.jsx(Yk,{resourceId:o,resourceName:C.name,currentUnitId:C.parent??"",onClose:()=>l(null)}):null})]}):c.jsxs("div",{className:Kt.container,children:[c.jsx(SD,{crumbs:w}),P&&c.jsxs("div",{className:Kt.reviewComment,role:"alert",children:[c.jsx("span",{className:Kt.reviewCommentLabel,children:r.contextualEditor.reviewCommentLabel}),c.jsx("span",{className:Kt.reviewCommentText,children:P})]}),c.jsxs("div",{className:Kt.titleRow,children:[S&&p&&c.jsx(LL,{nodeId:p,value:String(C.appIcon??((M=C.metadata)==null?void 0:M.appIcon)??""),editable:e==="edit"}),c.jsx("div",{ref:d,className:Kt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:B,onBlur:B,"data-placeholder":r.contextualEditor.untitledPlaceholder,"aria-label":r.contextualEditor.nodeTitleAriaLabel,children:C.name})]}),c.jsx(OD,{activeTab:n,onChange:k=>s(k),errorTabs:i,visibleTabs:S?void 0:["details"]}),c.jsx("div",{className:Kt.formArea,children:c.jsx(nj,{nodeMetadata:h,activeTab:n,isRoot:S,isFolder:_,editorMode:e,onFormValueChange:D,onFormStatusChange:j},`${p??"none"}:${S?"root":"node"}`)}),(_||S)&&n==="details"&&c.jsx("div",{className:Kt.contentListArea,children:c.jsx(Fj,{editorMode:e})}),c.jsx($j,{isActive:!1,label:r.contextualEditor.dropZoneLabel,nodeId:p??void 0,className:Kt.dropZone}),u&&c.jsx(lL,{contentId:b,onClose:()=>f(!1)})]}):c.jsx("div",{className:Kt.emptyState,children:c.jsx("p",{children:r.contextualEditor.emptyStateMessage})})};function yp(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=yp(r.children,t);if(n)return n}}}const vp=zs((e,t)=>({allContent:[],filteredContent:[],searchQuery:"",activeFilter:"all",advancedFilters:{},isLoading:!1,totalCount:0,offset:0,sortAZ:!1,setContent:(r,n)=>{e({allContent:r,totalCount:n,offset:r.length}),t().applyFilter()},appendContent:(r,n)=>{const i=[...t().allContent,...r];e({allContent:i,totalCount:n,offset:i.length}),t().applyFilter()},setFilter:r=>{e({activeFilter:r}),t().applyFilter()},setSearch:r=>{e({searchQuery:r}),t().applyFilter()},setLoading:r=>e({isLoading:r}),setAdvancedFilters:r=>e({advancedFilters:r}),setOffset:r=>e({offset:r}),setSortAZ:r=>e({sortAZ:r}),applyFilter:()=>{const{allContent:r,activeFilter:n,searchQuery:s}=t();let i=r;if(n&&n!=="all"){const a=n.toLowerCase();i=i.filter(o=>[o.mimeType??"",o.primaryCategory??"",o.contentType??""].join(" ").toLowerCase().includes(a))}if(s&&s.trim()!==""){const a=s.toLowerCase().trim();i=i.filter(o=>(o.name??"").toLowerCase().includes(a))}e({filteredContent:i})}})),YL=20;function bp(){var u;const e=ce(f=>f.editorConfig),t=Oe(f=>f.selectedNodeId),r=Oe(f=>f.treeData),n=m.useCallback(()=>{if(!t||!r.length)return 0;function f(d,g,p=0){var w;for(const h of d){if(h.id===g)return p;if((w=h.children)!=null&&w.length){const y=f(h.children,g,p+1);if(y>=0)return y}}return-1}return Math.max(0,f(r,t))},[t,r])(),s=(u=e==null?void 0:e.config)==null?void 0:u.hierarchy;if(!s)return[...Nu];const i=`level${n}`,a=s[i],o=a==null?void 0:a.children,l=o==null?void 0:o.Content;return l!=null&&l.length?l:[...Nu]}function ZL(){const e=vp(),t=ce(d=>{var g,p;return((p=(g=d.editorConfig)==null?void 0:g.context)==null?void 0:p.channel)??""}),r=bp(),n=m.useRef(),s=m.useCallback(async(d="",g="all",p={},w=!0,h=!1)=>{var y,v,b,C,S;e.setLoading(!0);try{const _={status:["Live"],primaryCategory:g&&g!=="all"?[g]:r};(y=p==null?void 0:p.board)!=null&&y.length&&(_.board=p.board),(v=p==null?void 0:p.medium)!=null&&v.length&&(_.medium=p.medium),(b=p==null?void 0:p.gradeLevel)!=null&&b.length&&(_.gradeLevel=p.gradeLevel),(C=p==null?void 0:p.subject)!=null&&C.length&&(_.subject=p.subject),(S=p==null?void 0:p.primaryCategory)!=null&&S.length&&(_.primaryCategory=p.primaryCategory);const E=w?0:e.offset,{content:N,count:R}=await qj({filters:_,query:d,limit:d?50:YL,offset:E,channel:t||void 0,sortBy:h?{name:"asc"}:{lastUpdatedOn:"desc"}});w?e.setContent(N,R):e.appendContent(N,R)}catch(_){console.error("[useLibrary] load error:",_)}finally{e.setLoading(!1)}},[r,t]);m.useEffect(()=>{s()},[t]);const i=m.useCallback(d=>{e.setSearch(d),clearTimeout(n.current),n.current=setTimeout(()=>s(d,e.activeFilter,e.advancedFilters,!0,e.sortAZ),300)},[e.activeFilter,e.advancedFilters,e.sortAZ,s]),a=m.useCallback(d=>{e.setFilter(d),s(e.searchQuery,d,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,s]),o=m.useCallback(d=>{e.setAdvancedFilters(d),s(e.searchQuery,e.activeFilter,d,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,s]),l=m.useCallback(()=>{const d=!e.sortAZ;e.setSortAZ(d),s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,d)},[e.sortAZ,e.searchQuery,e.activeFilter,e.advancedFilters,s]),u=m.useCallback(()=>{e.isLoading||s(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,s]),f=e.allContent.length<e.totalCount;return{content:e.filteredContent,isLoading:e.isLoading,totalCount:e.totalCount,activeFilter:e.activeFilter,advancedFilters:e.advancedFilters,searchQuery:e.searchQuery,sortAZ:e.sortAZ,hasMore:f,search:i,setFilter:a,applyAdvancedFilters:o,toggleSort:l,loadMore:u,refetch:()=>s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const XL="_card_jzciw_1",JL="_addBtn_jzciw_17",eP="_dragging_jzciw_24",tP="_ctIcon_jzciw_29",rP="_info_jzciw_33",nP="_name_jzciw_41",sP="_meta_jzciw_50",iP="_addBtnMuted_jzciw_78",aP="_added_jzciw_87",oP="_addedBadge_jzciw_96",lr={card:XL,addBtn:JL,dragging:eP,ctIcon:tP,info:rP,name:nP,meta:sP,addBtnMuted:iP,added:aP,addedBadge:oP},lP={video:ol,pdf:ta,h5p:nl,scorm:il,audio:sl,quiz:tl,default:Yn},cP=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var y,v;const i=le(),a=ua(e),o=lP[a.key]??Yn,l=Tl(),u=sA(),f=l&&!s&&u,{attributes:d,listeners:g,setNodeRef:p,isDragging:w}=tf({id:e.identifier,disabled:!n||!l||!u,data:{type:"library-item",item:e}}),h=()=>{r&&r(e)};return c.jsxs("div",{ref:p,className:[lr.card,w?lr.dragging:"",s?lr.added:""].join(" "),"aria-label":e.name,...n?{...d,...g}:{},role:"listitem",onClick:h,children:[c.jsx("span",{className:[`sbx-ct-sq--${a.key}`,lr.ctIcon].join(" "),"aria-hidden":"true",children:c.jsx(o,{size:14})}),c.jsxs("div",{className:lr.info,children:[c.jsx("span",{className:lr.name,title:e.name,children:e.name}),c.jsxs("span",{className:lr.meta,children:[((y=e.organisation)==null?void 0:y[0])??e.channel??"",(v=e.organisation)!=null&&v[0]&&e.primaryCategory?" · ":"",e.primaryCategory??""]})]}),s&&c.jsx("span",{className:lr.addedBadge,"aria-label":i.libraryCard.alreadyAddedAriaLabel,title:i.libraryCard.alreadyAddedTitle,children:c.jsx(Wn,{size:12})}),!s&&n&&c.jsx("button",{type:"button",className:[lr.addBtn,!f&&l?lr.addBtnMuted:""].join(" "),onClick:b=>{b.stopPropagation(),t(e)},disabled:!l,"aria-disabled":!f,"aria-label":i.libraryCard.addItemAriaLabel.replace("{name}",e.name),title:l?u?i.libraryCard.addToUnitTitle:i.libraryCard.selectUnitToAddTitle:i.libraryCard.draftOnlyTitle,children:c.jsx(Us,{size:14})})]})},uP="_chips_xhhaq_1",dP="_chip_xhhaq_1",ed={chips:uP,chip:dP},fP=({filters:e,active:t,onChange:r})=>{const n=le();return c.jsx("div",{className:ed.chips,role:"group","aria-label":n.filterChips.contentTypeFiltersAriaLabel,children:e.map(s=>c.jsx("button",{type:"button",role:"radio","aria-checked":t===s.value,className:["sbx-chip",t===s.value?"filled":"outline",ed.chip].join(" "),onClick:()=>r(s.value),children:s.label},s.value))})},hP="_panel_1cl11_1",pP="_header_1cl11_10",mP="_headerTitle_1cl11_19",gP="_closeBtn_1cl11_25",yP="_body_1cl11_43",vP="_section_1cl11_59",bP="_sectionLabel_1cl11_65",wP="_chips_1cl11_73",CP="_chip_1cl11_73",SP="_active_1cl11_96",xP="_footer_1cl11_102",_P="_resetBtn_1cl11_112",TP="_applyBtn_1cl11_129",at={panel:hP,header:pP,headerTitle:mP,closeBtn:gP,body:yP,section:vP,sectionLabel:bP,chips:wP,chip:CP,active:SP,footer:xP,resetBtn:_P,applyBtn:TP},EP=e=>[{key:"board",label:e.libraryFilterPanel.boardLabel},{key:"medium",label:e.libraryFilterPanel.mediumLabel},{key:"gradeLevel",label:e.libraryFilterPanel.classLabel},{key:"subject",label:e.libraryFilterPanel.subjectLabel}],IP=new Set(["board","medium","gradeLevel","subject","topic"]),OP=({local:e,toggle:t})=>{const r=le(),n=bp();return n.length?c.jsxs("div",{className:at.section,children:[c.jsx("div",{className:at.sectionLabel,children:r.libraryFilterPanel.primaryCategoryLabel}),c.jsx("div",{className:at.chips,children:n.map(s=>c.jsx("button",{type:"button",className:[at.chip,(e.primaryCategory??[]).includes(s)?at.active:""].join(" "),onClick:()=>t("primaryCategory",s),children:s},s))})]}):null},AP=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var y,v;const s=le(),i=ce(b=>b.editorConfig),a=ce(b=>b.searchFormConfig),o=ce(b=>b.contentFramework),l=ce(b=>b.contentTargetFWIds),{organisationFramework:u}=ep(o??((y=i==null?void 0:i.context)==null?void 0:y.framework),l??((v=i==null?void 0:i.context)==null?void 0:v.targetFWIds)),[f,d]=m.useState(t),g=a!=null&&a.length?a.filter(b=>IP.has(b.code)).map(b=>({key:b.code,label:b.label||b.code})):EP(s);m.useEffect(()=>{d(t)},[t]);const p=(b,C)=>{d(S=>{const _=S[b]??[],E=_.includes(C)?_.filter(N=>N!==C):[..._,C];return{...S,[b]:E}})},w=(u==null?void 0:u.categories)??[],h=b=>{var C;return((C=w.find(S=>S.code===b))==null?void 0:C.terms)??[]};return e?c.jsxs("div",{className:at.panel,role:"dialog","aria-label":s.libraryFilterPanel.filterLibraryAriaLabel,"aria-modal":"true",children:[c.jsxs("div",{className:at.header,children:[c.jsx("span",{className:at.headerTitle,children:s.libraryFilterPanel.filtersHeaderTitle}),c.jsx("button",{type:"button",className:at.closeBtn,onClick:n,"aria-label":s.libraryFilterPanel.closeFiltersAriaLabel,children:c.jsx(Cr,{size:16})})]}),c.jsxs("div",{className:at.body,children:[g.map(({key:b,label:C})=>{const S=h(b);return S.length?c.jsxs("div",{className:at.section,children:[c.jsx("div",{className:at.sectionLabel,children:C}),c.jsx("div",{className:at.chips,children:S.slice(0,20).map(_=>c.jsx("button",{type:"button",className:[at.chip,(f[b]??[]).includes(_.name)?at.active:""].join(" "),onClick:()=>p(b,_.name),children:_.name},_.identifier))})]},b):null}),c.jsx(OP,{local:f,toggle:p})]}),c.jsxs("div",{className:at.footer,children:[c.jsx("button",{type:"button",className:at.resetBtn,onClick:()=>d({}),children:s.libraryFilterPanel.resetButton}),c.jsx("button",{type:"button",className:at.applyBtn,onClick:()=>{r(f),n()},children:s.libraryFilterPanel.applyButton})]})]}):null},DP="_header_6qdpu_10",NP="_title_6qdpu_20",RP="_headerActions_6qdpu_31",jP="_iconBtn_6qdpu_38",kP="_playerArea_6qdpu_56",LP="_footer_6qdpu_64",PP="_addBtn_6qdpu_73",FP="_modalOverlay_6qdpu_92",MP="_modalPanel_6qdpu_103",gr={header:DP,title:NP,headerActions:RP,iconBtn:jP,playerArea:kP,footer:LP,addBtn:PP,modalOverlay:FP,modalPanel:MP},BP="application/vnd.sunbird.questionset",$P=({content:e,editorMode:t,onAdd:r,onClose:n})=>{const s=le(),i=t==="edit";if(!e)return null;const a={id:e.identifier,identifier:e.identifier,name:e.name??"",mimeType:e.mimeType,primaryCategory:e.primaryCategory,contentType:e.contentType,appIcon:e.appIcon,status:e.status,isFolder:!1,children:[],metadata:e};return Br.createPortal(c.jsx("div",{className:gr.modalOverlay,role:"dialog","aria-modal":"true","aria-label":s.libraryPreviewPanel.contentPreviewAriaLabel,onClick:n,children:c.jsxs("div",{className:gr.modalPanel,onClick:o=>o.stopPropagation(),children:[c.jsxs("div",{className:gr.header,children:[c.jsx("span",{className:gr.title,title:e.name,children:e.name}),c.jsx("div",{className:gr.headerActions,children:c.jsx("button",{type:"button",className:gr.iconBtn,onClick:n,"aria-label":s.libraryPreviewPanel.closePreviewAriaLabel,children:c.jsx(Cr,{size:16})})})]}),c.jsx("div",{className:gr.playerArea,children:c.jsx(Vo,{node:a,editorMode:"read",type:e.mimeType===BP?"quml":"content"})}),i&&c.jsx("div",{className:gr.footer,children:c.jsx("button",{type:"button",className:gr.addBtn,onClick:()=>r(e),children:s.libraryPreviewPanel.addToUnitButton})})]})}),document.body)},qP="_dock_1lpg0_1",UP="_header_1lpg0_8",zP="_headerLeft_1lpg0_17",VP="_headerTitle_1lpg0_24",HP="_count_1lpg0_30",QP="_searchRow_1lpg0_39",GP="_searchWrap_1lpg0_47",WP="_searchIcon_1lpg0_53",KP="_searchInput_1lpg0_62",YP="_filterToggleBtn_1lpg0_80",ZP="_filterToggleBtnActive_1lpg0_99",XP="_filterBadge_1lpg0_105",JP="_filters_1lpg0_124",eF="_mainArea_1lpg0_134",tF="_sidePanelOverlay_1lpg0_143",rF="_cardList_1lpg0_152",nF="_skeleton_1lpg0_168",sF="_skeletonIcon_1lpg0_178",iF="_skeletonText_1lpg0_186",aF="_skeletonLine_1lpg0_193",oF="_skeletonLineSm_1lpg0_200",lF="_loadMoreBtn_1lpg0_215",cF="_emptyState_1lpg0_240",uF="_collapseBtn_1lpg0_260",Me={dock:qP,header:UP,headerLeft:zP,headerTitle:VP,count:HP,searchRow:QP,searchWrap:GP,searchIcon:WP,searchInput:KP,filterToggleBtn:YP,filterToggleBtnActive:ZP,filterBadge:XP,filters:JP,mainArea:eF,sidePanelOverlay:tF,cardList:rF,skeleton:nF,skeletonIcon:sF,skeletonText:iF,skeletonLine:aF,skeletonLineSm:oF,loadMoreBtn:lF,emptyState:cF,collapseBtn:uF};function dF(e){const t=new Set,r=[...e];for(;r.length>0;){const n=r.shift();n.isFolder||t.add(n.identifier),n.children&&r.push(...n.children)}return t}const fF=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const n=le(),{content:s,isLoading:i,totalCount:a,activeFilter:o,searchQuery:l,sortAZ:u,hasMore:f,search:d,setFilter:g,applyAdvancedFilters:p,toggleSort:w,loadMore:h}=ZL(),{addResource:y,selectedNodeId:v,treeData:b}=Oe(),C=e==="edit",[S,_]=m.useState(!1),[E,N]=m.useState({}),[R,P]=m.useState(null),B=m.useMemo(()=>dF(b),[b]),D=m.useCallback(z=>{var _e;if(!v){Ee.error(n.libraryDock.selectUnitFirstToast);return}const X=(_e=b[0])==null?void 0:_e.id;if(v===X){Ee(n.libraryDock.selectUnitFromOutlineToast,{icon:c.jsx(rl,{size:16}),duration:4e3});return}if(y(z,v)===!1){Ee.error(n.libraryDock.itemAlreadyAddedToast.replace("{name}",z.name));return}Ee.success(n.libraryDock.itemAddedToast.replace("{name}",z.name))},[v,y,b,n]),j=m.useCallback(z=>{N(z),p(z)},[p]),M=m.useCallback(z=>{P(z)},[]),k=m.useCallback(z=>{D(z),P(null)},[D]),L=m.useMemo(()=>Object.values(E).reduce((z,X)=>z+((X==null?void 0:X.length)??0),0),[E]);return c.jsxs("div",{className:Me.dock,children:[c.jsx("div",{className:Me.header,children:c.jsxs("div",{className:Me.headerLeft,children:[c.jsx("button",{type:"button",className:Me.collapseBtn,onClick:r,"aria-label":n.libraryDock.collapseLibraryPanelAriaLabel,title:n.libraryDock.collapseLibraryTitle,children:c.jsx(Vy,{size:15})}),c.jsx(qy,{size:16}),c.jsx("span",{className:Me.headerTitle,children:n.libraryDock.headerTitle}),a>0&&c.jsx("span",{className:Me.count,children:a})]})}),c.jsxs("div",{className:Me.searchRow,children:[c.jsxs("div",{className:Me.searchWrap,children:[c.jsx(yo,{size:14,className:Me.searchIcon}),c.jsx("input",{type:"search",className:Me.searchInput,placeholder:n.libraryDock.searchPlaceholder,value:l,onChange:z=>d(z.target.value),"aria-label":n.libraryDock.searchAriaLabel})]}),c.jsx("button",{type:"button",className:[Me.filterToggleBtn,u?Me.filterToggleBtnActive:""].join(" "),onClick:w,"aria-label":u?n.libraryDock.sortAZAriaLabel:n.libraryDock.sortRecentAriaLabel,title:u?n.libraryDock.sortAZTitle:n.libraryDock.sortRecentTitle,children:u?c.jsx(Dy,{size:15}):c.jsx(Ly,{size:15})}),c.jsxs("button",{type:"button",className:[Me.filterToggleBtn,S?Me.filterToggleBtnActive:""].join(" "),onClick:()=>_(z=>!z),"aria-label":n.libraryDock.toggleAdvancedFiltersAriaLabel,"aria-pressed":S,title:n.libraryDock.advancedFiltersTitle,children:[c.jsx(Zy,{size:15}),L>0&&c.jsx("span",{className:Me.filterBadge,children:L})]})]}),c.jsx("div",{className:Me.filters,children:c.jsx(fP,{filters:iA,active:o,onChange:g})}),c.jsxs("div",{className:Me.mainArea,children:[c.jsx("div",{className:Me.cardList,role:"list","aria-label":n.libraryDock.libraryContentAriaLabel,children:i&&s.length===0?Array.from({length:4}).map((z,X)=>c.jsxs("div",{className:Me.skeleton,"aria-hidden":"true",children:[c.jsx("div",{className:Me.skeletonIcon}),c.jsxs("div",{className:Me.skeletonText,children:[c.jsx("div",{className:Me.skeletonLine}),c.jsx("div",{className:Me.skeletonLineSm})]})]},X)):s.length>0?c.jsxs(c.Fragment,{children:[s.map(z=>c.jsx(cP,{item:z,onAdd:D,onPreview:M,isDraggable:C,isAdded:B.has(z.identifier)},z.identifier)),f&&c.jsx("button",{type:"button",className:Me.loadMoreBtn,onClick:h,disabled:i,"aria-label":n.libraryDock.loadMoreAriaLabel,children:i?n.libraryDock.loadingText:n.libraryDock.loadMoreText})]}):c.jsxs("div",{className:Me.emptyState,children:[c.jsx(yo,{size:24}),c.jsx("p",{children:n.libraryDock.noContentFound}),c.jsx("span",{children:n.libraryDock.tryDifferentSearch})]})}),S&&c.jsx("div",{className:Me.sidePanelOverlay,children:c.jsx(AP,{isOpen:S,filters:E,onApply:j,onClose:()=>_(!1)})}),R&&c.jsx($P,{content:R,editorMode:e,onAdd:k,onClose:()=>P(null)})]})]})};function hF(e,t,r){const n={},s={},i=new Set(["id","isFolder","children","parent","isNew","breadcrumb","title","relationalMetadata","optional"]),a=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","targetFWIds","targetTopicIds","topic","topicsIds"]),o=new Set(["audience","attributions","keywords","language","additionalCategories","medium","gradeLevel","subject","boardIds","mediumIds","gradeLevelIds","subjectIds","targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","dialcodes"]),l=new Set(["copyrightYear","compatibilityLevel","version"]);function u(g,p=!1){const w={};for(const[h,y]of Object.entries(g))if(!i.has(h)&&!(p&&a.has(h)))if(o.has(h))Array.isArray(y)?w[h]=y:y!=null&&y!==""?w[h]=[y]:w[h]=[];else if(l.has(h)){const v=Number(y);isNaN(v)||(w[h]=v)}else w[h]=y;return w}function f(g){var w;const p={};for(const h of g.children??[]){if(h.isFolder)continue;const y=t[h.identifier];if(!y)continue;const{isNew:v,...b}=y;if(Object.keys(b).length===0)continue;const C=((w=h.metadata)==null?void 0:w.relationalMetadata)??{};p[h.identifier]={name:h.name,...C,...b}}return p}function d(g,p){var C,S;const w=g.identifier,h=t[w],y=w.startsWith("temp-")||!!(h!=null&&h.isNew),v=!g.isFolder&&!p;if(p||y||h&&!v){let _;if(y)_={mimeType:"application/vnd.ekstep.content-collection",code:w,contentType:((C=g.metadata)==null?void 0:C.contentType)??"CourseUnit",primaryCategory:((S=g.metadata)==null?void 0:S.primaryCategory)??"Course Unit",name:g.name,visibility:"Parent",channel:r,...u(g.metadata??{})};else if(p){const{isNew:E,...N}=h??{};_={...u(g.metadata??{},!0),...u(N,!1),name:g.name}}else{const{isNew:E,...N}=h??{};_={name:g.name,visibility:"Parent",...u(N,!0)}}n[w]={metadata:_,objectType:g.objectType||(g.isFolder?"Collection":"Content"),root:p,isNew:y}}const b=g.isFolder?f(g):{};s[w]={name:g.name,children:(g.children??[]).map(_=>_.identifier),...Object.keys(b).length>0?{relationalMetadata:b}:{},root:p},(g.children??[]).forEach(_=>d(_,!1))}return e.forEach((g,p)=>d(g,p===0)),{nodesModified:n,hierarchy:s}}function pF(){const[e,t]=m.useState(!1),r=Oe(f=>f.treeCache),n=Oe(f=>f.treeData),s=ce(f=>f.isDirty),i=ce(f=>f.lastSaved),{setIsDirty:a,setLastSaved:o}=ce(),l=ce(f=>f.editorConfig);return{save:m.useCallback(async()=>{if(!l||e)return;const f=l.context.contentId??l.context.identifier??"";if(!f)return;const d=l.context.channel??"",g=l.context.userId??l.context.uid??"";t(!0);try{const{nodesModified:p,hierarchy:w}=hF(n,r,d),{identifiers:h}=await R_(f,p,w,g);h&&Object.keys(h).length>0&&Oe.getState().replaceNodeIds(h);const y=new Date().toISOString();o(y),a(!1)}catch(p){console.error("[useSaveHierarchy] save failed:",p),Ee.error("Failed to save. Please try again.")}finally{t(!1)}},[l,e,n,r,a,o]),isSaving:e,isDirty:s,lastSaved:i}}const mF={};function gF(e){return e==null||e===""||Array.isArray(e)&&e.length===0}function yF(e,t,r,n,s){const i=[],a=(o,l)=>{var u;for(const f of o){const d=l&&!f.parent,g=d?r:f.isFolder?n:null;if(g&&g.length>0){const p={...f.metadata??{},...t[f.id]??{}},h=rp(g,p,mF,d,s).filter(y=>y.required&&y.visible!==!1&&y.inputType!=="appIcon"&&gF(y.currentValue)).map(y=>y.label);h.length>0&&i.push({nodeId:f.id,nodeName:f.name||"Untitled",missing:h})}(u=f.children)!=null&&u.length&&a(f.children,!1)}};return a(e,!0),i}function vF(e){const t=ce(d=>d.editorConfig),r=ce(d=>d.setButtonLoader),n=ce(d=>d.validateAllForms),s=ce(d=>d.rootFormConfig),i=ce(d=>d.unitFormConfig),a=Oe(d=>d.treeData),o=Oe(d=>d.treeCache),l=Oe(d=>d.selectNode),u=m.useCallback(()=>{var h,y,v;const d={editorMode:"edit",objectType:(h=t==null?void 0:t.config)==null?void 0:h.objectType,userFullName:(v=(y=t==null?void 0:t.context)==null?void 0:y.user)==null?void 0:v.fullName},g=yF(a,o,s,i,d);if(g.length===0)return!0;const p=g[0];Ee.error(`"${p.nodeName}": please fill required field${p.missing.length>1?"s":""} — ${p.missing.join(", ")}`);const{setFormStatus:w}=ce.getState();return g.forEach(b=>w(b.nodeId,!1)),l(p.nodeId),!1},[a,o,s,i,t,l]);return{runAction:m.useCallback(async(d,g)=>{var h,y,v,b;const p=((h=t==null?void 0:t.context)==null?void 0:h.contentId)??((y=t==null?void 0:t.context)==null?void 0:y.identifier)??"";if(!p)return Ee.error("No content identifier found."),!1;const w=((v=t==null?void 0:t.context)==null?void 0:v.userId)??((b=t==null?void 0:t.context)==null?void 0:b.uid)??"";try{switch(d){case"sendForReview":return u()?n(a)?(r("saveCollection",!0),await e(),await L_(p),Ee.success("Content sent for review"),!0):(Ee.error("Some units have missing required fields. Please fill them before sending for review."),!1):!1;case"reject":{r("rejectCollection",!0);const C=(g==null?void 0:g.comment)??"";return await P_(p,C),Ee.success("Content rejected and sent back to the author"),!0}case"publish":return u()?n(a)?(r("publishCollection",!0),await e(),await j_(p,w),Ee.success("Content published successfully"),!0):(Ee.error("Some units have missing required fields. Please fill them before publishing."),!1):!1;default:return!1}}catch(C){console.error(`[useToolbarActions] ${d} failed`,C);const S=d==="sendForReview"?"send for review":d==="reject"?"reject":"publish";return Ee.error(`Failed to ${S}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r,u,n,a]),checkRequiredFields:u}}const bF="_shell_90fon_1",wF="_workspace_90fon_8",CF="_sidebarCollapsed_90fon_16",SF="_dockCollapsed_90fon_19",xF="_dock_90fon_19",_F="_outline_90fon_40",TF="_reopenTab_90fon_45",EF="_outlineHidden_90fon_79",IF="_editor_90fon_86",OF="_dockHidden_90fon_101",AF="_dockReopenTab_90fon_108",DF="_dragChip_90fon_133",NF="_dragChipLabel_90fon_148",kt={shell:bF,workspace:wF,sidebarCollapsed:CF,dockCollapsed:SF,dock:xF,outline:_F,reopenTab:TF,outlineHidden:EF,editor:IF,dockHidden:OF,dockReopenTab:AF,dragChip:DF,dragChipLabel:NF},RF=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const s=le(),[i,a]=m.useState(null),[o,l]=m.useState(!1),[u,f]=m.useState(!1),[d,g]=m.useState(!1),{addResource:p,treeData:w}=Oe(),h=ce(L=>L.setFormStatus),[y,v]=m.useState(!0),b=Oe(L=>L.selectedNodeId),{save:C,isSaving:S,isDirty:_,lastSaved:E}=pF(),{runAction:N,checkRequiredFields:R}=vF(C);m.useEffect(()=>{if(!_)return;const L=z=>{z.preventDefault(),z.returnValue=""};return window.addEventListener("beforeunload",L),()=>window.removeEventListener("beforeunload",L)},[_]);const P=Ld(ho(Xi,{activationConstraint:{distance:8}})),B=m.useCallback(L=>{var X;const z=(X=L.active.data.current)==null?void 0:X.item;z&&a(z)},[]),D=m.useCallback(L=>{var de,Q;a(null);const z=(de=L.active.data.current)==null?void 0:de.item;if(!z)return;const X=L.over,ye=(X==null?void 0:X.id)??b??void 0;if(!ye){Ee.error(s.splitBuilderShell.dropOntoUnitError);return}const _e=(Q=w[0])==null?void 0:Q.id;if(ye===_e){Ee.error(s.splitBuilderShell.dropOntoCourseError);return}if(!p(z,ye)){Ee.error(s.splitBuilderShell.alreadyInCollectionError.replace("{name}",z.name));return}r==null||r(z,ye),Ee.success(s.splitBuilderShell.addedToUnitSuccess.replace("{name}",z.name))},[b,p,r,s]),j=m.useCallback(async L=>{if(L.action==="onFormStatusChange"){const{isValid:z,nodeId:X}=L.data??{},ye=z!==!1;v(ye),X&&h(X,ye);return}if(L.action==="back"&&_&&e==="edit"){g(!0);return}if(L.action==="saveCollection"){if(!y){Ee.error(s.splitBuilderShell.fillRequiredMetadataError);return}if(!R())return;await C(),n==null||n(w),t==null||t(L);return}if(L.action==="sendForReview"||L.action==="reject"||L.action==="publish"){await N(L.action,L.data)&&(t==null||t(L));return}t==null||t(L)},[C,N,R,t,n,w,_,y,e,s]),M=m.useCallback(async()=>{if(!R()){g(!1);return}await C(),g(!1),n==null||n(w),t==null||t({action:"back"})},[C,R,n,t,w]),k=m.useCallback(()=>{g(!1),t==null||t({action:"back"})},[t]);return c.jsxs(ef,{sensors:P,onDragStart:B,onDragEnd:D,children:[c.jsxs("div",{className:kt.shell,children:[c.jsx(H0,{editorMode:e,isSaving:S,isDirty:_,lastSaved:E,isFormValid:y,onToolbarEvent:j}),c.jsxs("div",{className:[kt.workspace,o?kt.sidebarCollapsed:"",u?kt.dockCollapsed:""].filter(Boolean).join(" "),children:[c.jsx("aside",{className:[kt.outline,o?kt.outlineHidden:""].join(" "),"aria-label":s.splitBuilderShell.outlineAriaLabel,"aria-hidden":o,children:c.jsx(yD,{editorMode:e,collapsed:o,onToggleCollapse:()=>l(L=>!L)})}),o&&c.jsx("button",{className:kt.reopenTab,onClick:()=>l(!1),title:s.splitBuilderShell.showOutlineTitle,type:"button",children:"›"}),c.jsx("main",{className:kt.editor,role:"main","aria-label":s.splitBuilderShell.editorAriaLabel,children:c.jsx(KL,{editorMode:e,onToolbarEvent:j})}),c.jsx("aside",{className:[kt.dock,u?kt.dockHidden:""].filter(Boolean).join(" "),"aria-label":s.splitBuilderShell.libraryAriaLabel,"aria-hidden":u,children:c.jsx(fF,{editorMode:e,collapsed:u,onToggleCollapse:()=>f(L=>!L)})}),u&&c.jsx("button",{className:kt.dockReopenTab,onClick:()=>f(!1),title:s.splitBuilderShell.showLibraryTitle,type:"button",children:"‹"})]})]}),c.jsx(Ty,{dropAnimation:null,children:i?c.jsx("div",{className:kt.dragChip,children:c.jsx("span",{className:kt.dragChipLabel,children:i.name})}):null}),d&&c.jsx(Q0,{onSave:M,onDiscard:k,onCancel:()=>g(!1),isSaving:S})]})},jF="v1";function kF(e){const t=e.validations,r=t==null?void 0:t.find(s=>s.type==="maxlength"||s.type==="maxLength");if(!r)return e.maxLength;const n=Number(r.value);return Number.isFinite(n)?n:void 0}function td(e,t){var r;return{code:e.code??"",label:e.label??e.name??e.code??"",name:e.name,inputType:e.inputType,dataType:e.dataType,required:e.required===!0||Array.isArray(e.validations)&&e.validations.some(n=>n.type==="required")||String(((r=e.renderingHints)==null?void 0:r.class)??"").includes("required"),editable:e.editable!==!1,visible:e.visible!==!1,placeholder:e.placeholder,maxLength:kF(e),depends:e.depends,sourceCategory:e.sourceCategory,range:e.range,enum:e.enum,default:e.default,defaultValue:e.defaultValue,index:e.index,section:t,output:e.output}}function Er(e){const t=e==null?void 0:e.properties;if(!Array.isArray(t))return[];const r=[];for(const n of t)if(Array.isArray(n.fields)){const s=n.name??void 0,i=n.fields.filter(a=>!!a.code).sort((a,o)=>(a.index??0)-(o.index??0));for(const a of i)r.push(td(a,s))}else n.code&&r.push(td(n));return r}function LF(e){const t=e==null?void 0:e.properties;if(!t)return{};const r={};for(const[n,s]of Object.entries(t))s&&"default"in s&&(r[n]=s.default);return r}async function PF(e,t,r="Collection",n=jF){var u,f;const i=(f=(u=(await Ne.post(`/action/object/category/definition/${n}/read?fields=objectMetadata,forms,name,label`,{request:{objectCategoryDefinition:{objectType:r,name:e,...t?{channel:t}:{}}}})).data)==null?void 0:u.result)==null?void 0:f.objectCategoryDefinition,a=(i==null?void 0:i.forms)??{},o=(i==null?void 0:i.objectMetadata)??{},l=o.config??{};return{rootForm:Er(a.create),unitForm:Er(a.unitMetadata),childForm:Er(a.childMetadata),searchForm:Er(a.search??a.searchConfig),relationalForm:Er(a.relationalMetadata),publishChecklist:Er(a.publishchecklist),reviewChecklist:Er(a.review),rfcChecklist:Er(a.requestforchangeschecklist),schemaDefaults:LF(o.schema),frameworkMetadata:l.frameworkMetadata??{},sourcingSettings:l.sourcingSettings??{}}}function FF({config:e,onError:t}){const[r,n]=m.useState(!0),[s,i]=m.useState(null),[a,o]=m.useState(!1),{setEditorConfig:l,setEditorMode:u,setCategoryDefinition:f,setContentFramework:d}=ce(),{setTreeData:g,selectNode:p}=Oe();return m.useEffect(()=>{let w=!1;async function h(){var y,v;try{n(!0),i(null),e.apiBaseUrl&&zf(e.apiBaseUrl),l(e),u(e.config.mode);const b=e.context.contentId??e.context.identifier??"";if(b){const C=e.config.objectType==="QuestionSet",{rootNode:S}=C?await N_(b):await Gf(b);if(!w&&(g(S?[S]:[]),S)){p(S.id);const P=S.metadata??{},B=P.framework??e.context.framework??null,D=P.targetFWIds??e.context.targetFWIds??null;d(B,D)}const _=e.config.primaryCategory??"Course",E=e.context.channel??"",N=e.config.categoryDefinitionApiVersion??"v1";try{const R=await PF(_,E,e.config.objectType??"Collection",N);if(!w){f(R);const P=((y=R.sourcingSettings)==null?void 0:y.collection)??{},B={};P.maxDepth&&!e.config.maxDepth&&(B.maxDepth=P.maxDepth),P.children&&!e.config.children&&(B.children=P.children),P.hierarchy&&!((v=e.config.hierarchy)!=null&&v.level1)&&(B.hierarchy={...e.config.hierarchy??{},...P.hierarchy}),Object.keys(B).length>0&&l({...e,config:{...e.config,...B}})}}catch{}}w||o(!0)}catch(b){if(!w){const C=b instanceof Error?b:new Error(String(b));i(C),t==null||t(C)}}finally{w||n(!1)}}return h(),()=>{w=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:a}}function MF(){const e=Li(t=>t.setLanguage);m.useEffect(()=>{e(localStorage.getItem(So)||"en",{broadcast:!1});const t=n=>{n.key===So&&n.newValue&&e(n.newValue,{broadcast:!1})},r=n=>{var i;const s=(i=n.detail)==null?void 0:i.lang;s&&e(s,{broadcast:!1})};return window.addEventListener("storage",t),window.addEventListener(xo,r),()=>{window.removeEventListener("storage",t),window.removeEventListener(xo,r)}},[e])}const BF="_root_qcpw6_1",$F="_loadingState_qcpw6_10",qF="_loadingSpinner_qcpw6_20",UF="_errorState_qcpw6_34",ms={root:BF,loadingState:$F,loadingSpinner:qF,errorState:UF},zF=new Kp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});function VF({error:e,onRetry:t}){const r=le();return c.jsxs("div",{className:ms.errorState,children:[c.jsx("h3",{children:r.collectionEditor.errorBoundaryTitle}),c.jsx("p",{children:e.message}),c.jsx("button",{onClick:t,children:r.collectionEditor.retryButton})]})}class HF extends m.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t){var r,n;(n=(r=this.props).onError)==null||n.call(r,t)}render(){return this.state.error?c.jsx(VF,{error:this.state.error,onRetry:()=>this.setState({error:null})}):this.props.children}}function QF(e){MF();const t=le(),{isLoading:r,error:n}=FF({config:e,onError:e.onError}),s=ce(i=>i.editorMode);return r?c.jsxs("div",{className:ms.loadingState,children:[c.jsx("div",{className:ms.loadingSpinner}),c.jsx("p",{children:t.collectionEditor.loadingMessage})]}):n?c.jsxs("div",{className:ms.errorState,children:[c.jsx("h3",{children:t.collectionEditor.loadErrorTitle}),c.jsx("p",{children:n.message})]}):c.jsx("div",{className:`sb-split-builder ${ms.root}`,children:c.jsx(RF,{editorMode:s,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const wp=e=>c.jsx(HF,{onError:e.onError,children:c.jsxs(Zp,{client:zF,children:[c.jsx(QF,{...e}),c.jsx(Ym,{position:"top-right",toastOptions:{duration:3e3}})]})}),Hi=Symbol.for("r2wc.reactRender"),rd=Symbol.for("r2wc.shouldRender"),ci=Symbol.for("r2wc.root");function GF(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function WF(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var nd={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[Hi]()}}),e[Hi]()}};function KF(e,t,r,n={}){var s={isConnected:"isConnected"in HTMLElement.prototype},i=!1,a=function(){var u=Reflect.construct(HTMLElement,arguments,this.constructor);return typeof n.shadow=="string"?u.attachShadow({mode:n.shadow}):n.shadow&&(console.warn('Specifying the "shadow" option as a boolean is deprecated and will be removed in a future version.'),u.attachShadow({mode:"open"})),u},o=Object.create(HTMLElement.prototype);o.constructor=a;var l=new Proxy(o,{has:function(u,f){return f in e.propTypes||f in o},set:function(u,f,d,g){return i&&(s[f]=!0),typeof f=="symbol"||s[f]||f in u?(e.propTypes&&f in e.propTypes&&nd.expando(g,f,d),Reflect.set(u,f,d,g)):(nd.expando(g,f,d),!0)},getOwnPropertyDescriptor:function(u,f){var d=Reflect.getOwnPropertyDescriptor(u,f);if(d)return d;if(f in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return a.prototype=l,o.connectedCallback=function(){this[rd]=!0,this[Hi]()},o.disconnectedCallback=function(){typeof r.createRoot=="function"?this[ci].unmount():r.unmountComponentAtNode(this)},o[Hi]=function(){if(this[rd]===!0){var u={};Object.keys(this).forEach(function(g){s[g]!==!1&&(u[g]=this[g])},this),i=!0;const f=n.shadow?this.shadowRoot:this,d=t.createElement(e,u);typeof r.createRoot=="function"?(this[ci]||(this[ci]=r.createRoot(f)),this[ci].render(d)):r.render(d,f),i=!1}},e.propTypes&&(a.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(u){return GF(u)}):Object.keys(e.propTypes),o.attributeChangedCallback=function(u,f,d){var g=n.dashStyleAttributes?WF(u):u;this[g]=d}),a}var gs={},fs=Br;if(process.env.NODE_ENV==="production")gs.createRoot=fs.createRoot,gs.hydrateRoot=fs.hydrateRoot;else{var ui=fs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;gs.createRoot=function(e,t){ui.usingClientEntryPoint=!0;try{return fs.createRoot(e,t)}finally{ui.usingClientEntryPoint=!1}},gs.hydrateRoot=function(e,t,r){ui.usingClientEntryPoint=!0;try{return fs.hydrateRoot(e,t,r)}finally{ui.usingClientEntryPoint=!1}}}function YF(){if(document.getElementById("sb-ce-react-styles"))return;const e=document.createElement("style");e.id="sb-ce-react-styles",e.textContent="@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');",document.head.insertBefore(e,document.head.firstChild)}function ZF(e="sb-collection-editor"){if(YF(),typeof customElements>"u"||customElements.get(e))return;const t=KF(wp,m,gs,{});customElements.define(e,t)}exports.CollectionEditor=wp;exports.registerCollectionEditor=ZF;exports.setApiBaseUrl=zf;exports.useEditorStore=ce;exports.useLibraryStore=vp;exports.useTreeStore=Oe;
|
|
496
|
+
`+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=dn(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&yi.assertOptions(n,{silentJSONParsing:pt.transitional(pt.boolean),forcedJSONParsing:pt.transitional(pt.boolean),clarifyTimeoutError:pt.transitional(pt.boolean),legacyInterceptorReqResOrdering:pt.transitional(pt.boolean),advertiseZstdAcceptEncoding:pt.transitional(pt.boolean),validateStatusUndefinedResolves:pt.transitional(pt.boolean)},!1),s!=null&&(I.isFunction(s)?r.paramsSerializer={serialize:s}:yi.assertOptions(s,{encode:pt.function,serialize:pt.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),yi.assertOptions(r,{baseUrl:pt.spelling("baseURL"),withXsrfToken:pt.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=i&&I.merge(i.common,i[r.method]);i&&I.forEach(["delete","get","head","post","put","patch","query","common"],w=>{delete i[w]}),r.headers=Ct.concat(a,i);const o=[];let l=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(r)===!1)return;l=l&&h.synchronous;const y=r.transitional||ul;y&&y.legacyInterceptorReqResOrdering?o.unshift(h.fulfilled,h.rejected):o.push(h.fulfilled,h.rejected)});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let f,d=0,g;if(!l){const w=[Ac.bind(this),void 0];for(w.unshift(...o),w.push(...u),g=w.length,f=Promise.resolve(r);d<g;)f=f.then(w[d++],w[d++]);return f}g=o.length;let p=r;for(;d<g;){const w=o[d++],h=o[d++];try{p=w(p)}catch(y){h.call(this,y);break}}try{f=Ac.call(this,p)}catch(w){return Promise.reject(w)}for(d=0,g=u.length;d<g;)f=f.then(u[d++],u[d++]);return f}getUri(t){t=dn(this.defaults,t);const r=Pf(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Nf(r,t.params,t.paramsSerializer)}};I.forEach(["delete","get","head","options"],function(t){ln.prototype[t]=function(r,n){return this.request(dn(n||{},{method:t,url:r,data:n&&I.hasOwnProp(n,"data")?n.data:void 0}))}});I.forEach(["post","put","patch","query"],function(t){function r(n){return function(i,a,o){return this.request(dn(o||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}ln.prototype[t]=r(),t!=="query"&&(ln.prototype[t+"Form"]=r(!0))});let v_=class $f{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const a=new Promise(o=>{n.subscribe(o),i=o}).then(s);return a.cancel=function(){n.unsubscribe(i)},a},t(function(i,a,o){n.reason||(n.reason=new Gs(i,a,o),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new $f(function(s){t=s}),cancel:t}}};function b_(e){return function(r){return e.apply(null,r)}}function w_(e){return I.isObject(e)&&e.isAxiosError===!0}const To={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(To).forEach(([e,t])=>{To[t]=e});function qf(e){const t=new ln(e),r=yf(ln.prototype.request,t);return I.extend(r,ln.prototype,t,{allOwnKeys:!0}),I.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return qf(dn(e,s))},r}const Xe=qf(Qs);Xe.Axios=ln;Xe.CanceledError=Gs;Xe.CancelToken=v_;Xe.isCancel=jf;Xe.VERSION=fl;Xe.toFormData=ra;Xe.AxiosError=Z;Xe.Cancel=Xe.CanceledError;Xe.all=function(t){return Promise.all(t)};Xe.spread=b_;Xe.isAxiosError=w_;Xe.mergeConfig=dn;Xe.AxiosHeaders=Ct;Xe.formToJSON=e=>kf(I.isHTMLForm(e)?new FormData(e):e);Xe.getAdapter=Bf.getAdapter;Xe.HttpStatusCode=To;Xe.default=Xe;const{Axios:KF,AxiosError:YF,CanceledError:ZF,isCancel:XF,CancelToken:JF,VERSION:eM,all:tM,Cancel:rM,isAxiosError:nM,spread:sM,toFormData:iM,AxiosHeaders:aM,HttpStatusCode:oM,formToJSON:lM,getAdapter:cM,mergeConfig:uM,create:dM}=Xe;let Eo="";function Uf(e){Eo=e}const Ne=Xe.create({timeout:3e4});Ne.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>pv),n=(s=t.getState().editorConfig)==null?void 0:s.context;return e.headers=e.headers??{},n!=null&&n.authToken&&(e.headers.Authorization=`Bearer ${n.authToken}`),n!=null&&n.userToken&&(e.headers["X-Authenticated-User-Token"]=n.userToken),n!=null&&n.channel&&(e.headers["X-Channel-Id"]=n.channel),Eo&&(e.baseURL=Eo),e});const zf=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function C_(e,t={}){var l,u,f,d;const n={"organisations.roles":[((l=t.objectType)==null?void 0:l.toLowerCase())==="textbook"?"BOOK_CREATOR":"CONTENT_CREATOR"]};t.rootOrgId&&(n.rootOrgId=[t.rootOrgId]);const s=e.includes("@"),i=/^\d{10,}$/.test(e.trim()),a={filters:n,fields:zf,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():a.query=e,((d=(f=(u=(await Ne.post("/action/user/v1/search",{request:a},{params:{fields:"orgName"},headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:u.result)==null?void 0:f.response)==null?void 0:d.content)??[]}async function S_(e){var r,n,s;return e.length?((s=(n=(r=(await Ne.post("/action/user/v1/search",{request:{filters:{userId:e},fields:zf,limit:e.length}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:r.result)==null?void 0:n.response)==null?void 0:s.content)??[]:[]}async function x_(e){var r,n;return((n=(r=(await Ne.get(`/portal/user/v5/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.response)??{}}const Vf="/portal";async function Hf(e){var n,s,i,a,o,l,u;const t=await Ne.get(`${Vf}/questionset/v2/hierarchy/${e}`,{params:{mode:"edit"}}),r=(s=(n=t.data)==null?void 0:n.result)==null?void 0:s.questionset;if(!r||!r.identifier){const f=((a=(i=t.data)==null?void 0:i.params)==null?void 0:a.errmsg)||((l=(o=t.data)==null?void 0:o.params)==null?void 0:l.err)||((u=t.data)==null?void 0:u.responseCode)||`No questionset returned for "${e}"`;throw new Error(`Unable to load questionset hierarchy: ${f}`)}return r}async function __(e){var r,n;return e.length?((n=(r=(await Ne.post(`${Vf}/question/v2/list`,{request:{search:{identifier:e}}})).data)==null?void 0:r.result)==null?void 0:n.questions)??[]:[]}function pl(e,t){const r=e??{},n=r.identifier??"",s=r.objectType??"",i=r.mimeType??"",a=r.children,o=Array.isArray(a)?a.map(u=>pl(u,n)):[],l=i==="application/vnd.ekstep.content-collection"||s.toLowerCase().includes("unit")||s.toLowerCase().includes("textbook")||s.toLowerCase().includes("collection")||s.toLowerCase().includes("course")||s.toLowerCase().includes("lesson")||r.visibility==="Parent"||i==="application/vnd.sunbird.questionset"&&o.length>0;return{id:n,identifier:n,name:r.name??"Untitled",title:r.name??"Untitled",description:r.description,primaryCategory:r.primaryCategory,mimeType:r.mimeType,objectType:s,contentType:r.contentType,visibility:r.visibility,status:r.status,appIcon:r.appIcon,isFolder:l,children:o,metadata:r,parent:t}}async function Qf(e){var s,i,a,o,l,u,f;const t=await Ne.get(`/action/content/v3/hierarchy/${e}`,{params:{mode:"edit"}}),r=(i=(s=t.data)==null?void 0:s.result)==null?void 0:i.content;if(!r||!r.identifier){const d=((o=(a=t.data)==null?void 0:a.params)==null?void 0:o.errmsg)||((u=(l=t.data)==null?void 0:l.params)==null?void 0:u.err)||((f=t.data)==null?void 0:f.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${d}`)}const n=pl(r);return{content:r,rootNode:n}}async function T_(e){const t=await Hf(e),r=pl(t);return{content:t,rootNode:r}}async function E_(e,t,r,n){var i;return((i=(await Ne.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:i.result)??{}}async function I_(e,t=""){await Ne.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function O_(e){var r,n;return(n=(r=(await Ne.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function A_(e){await Ne.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function D_(e,t){await Ne.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function N_(e,t){await Ne.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const R_="_container_r27rp_1",k_="_header_r27rp_13",j_="_title_r27rp_22",L_="_closeBtn_r27rp_29",P_="_body_r27rp_45",F_="_label_r27rp_54",M_="_searchSection_r27rp_62",B_="_searchRow_r27rp_68",$_="_searchInput_r27rp_74",q_="_searchSpinner_r27rp_89",U_="_resultsList_r27rp_105",z_="_resultItem_r27rp_118",V_="_userInfo_r27rp_133",H_="_userName_r27rp_141",Q_="_userEmail_r27rp_150",G_="_userOrg_r27rp_158",W_="_noResults_r27rp_167",K_="_collabSection_r27rp_174",Y_="_sectionTitle_r27rp_179",Z_="_badge_r27rp_189",X_="_emptyCollab_r27rp_203",J_="_collabList_r27rp_214",e0="_collabItem_r27rp_223",t0="_userAvatar_r27rp_237",r0="_error_r27rp_251",n0="_success_r27rp_257",s0="_footer_r27rp_263",Ie={container:R_,header:k_,title:j_,closeBtn:L_,body:P_,label:F_,searchSection:M_,searchRow:B_,searchInput:$_,searchSpinner:q_,resultsList:U_,resultItem:z_,userInfo:V_,userName:H_,userEmail:Q_,userOrg:G_,noResults:W_,collabSection:K_,sectionTitle:Y_,badge:Z_,emptyCollab:X_,collabList:J_,collabItem:e0,userAvatar:t0,error:r0,success:n0,footer:s0},i0=({contentId:e,onClose:t})=>{var M,$;const r=ce(),n=le(D=>D.editorConfig),s=(M=n==null?void 0:n.context)==null?void 0:M.channel,i=($=n==null?void 0:n.config)==null?void 0:$.objectType,[a,o]=m.useState(""),[l,u]=m.useState([]),[f,d]=m.useState(!1),[g,p]=m.useState([]),[w,h]=m.useState(!1),[y,v]=m.useState(""),[b,C]=m.useState(!1),S=m.useRef(null);m.useEffect(()=>{let D=!1;return(async()=>{try{const j=await O_(e),P=(j==null?void 0:j.collaborators)??[];if(!P.length)return;const k=await S_(P);if(D)return;const L=P.map(z=>k.find(X=>X.identifier===z)??{identifier:z,firstName:z});p(L)}catch{}})(),()=>{D=!0}},[e]),m.useEffect(()=>{S.current&&clearTimeout(S.current);const D=a.trim();if(D.length<2){u([]);return}return S.current=setTimeout(async()=>{d(!0);try{const j=await C_(D,{rootOrgId:s,objectType:i}),P=new Set(g.map(k=>k.identifier));u(j.filter(k=>!P.has(k.identifier)))}catch{u([])}finally{d(!1)}},300),()=>{S.current&&clearTimeout(S.current)}},[a,g,s,i]);const _=m.useCallback(D=>{p(j=>j.find(P=>P.identifier===D.identifier)?j:[...j,D]),u(j=>j.filter(P=>P.identifier!==D.identifier)),C(!1)},[]),E=m.useCallback(D=>{p(j=>j.filter(P=>P.identifier!==D)),C(!1)},[]),N=m.useCallback(async()=>{h(!0),v(""),C(!1);try{await N_(e,g.map(D=>D.identifier)),C(!0)}catch{v(r.manageCollaborators.saveFailed)}finally{h(!1)}},[e,g,r.manageCollaborators.saveFailed]),R=D=>`${D.firstName}${D.lastName?` ${D.lastName}`:""}`;return c.jsxs("div",{className:Ie.container,children:[c.jsxs("div",{className:Ie.header,children:[c.jsx("h2",{className:Ie.title,children:r.manageCollaborators.title}),c.jsx("button",{className:Ie.closeBtn,onClick:t,"aria-label":r.manageCollaborators.closeAriaLabel,children:c.jsx(Cr,{size:18})})]}),c.jsxs("div",{className:Ie.body,children:[c.jsxs("div",{className:Ie.searchSection,children:[c.jsx("label",{className:Ie.label,htmlFor:"collab-search",children:r.manageCollaborators.searchUsersLabel}),c.jsxs("div",{className:Ie.searchRow,children:[c.jsx("input",{id:"collab-search",type:"text",className:Ie.searchInput,placeholder:r.manageCollaborators.searchPlaceholder,value:a,onChange:D=>o(D.target.value)}),f&&c.jsx("span",{className:Ie.searchSpinner,"aria-label":r.manageCollaborators.searchingAriaLabel})]}),l.length>0&&c.jsx("ul",{className:Ie.resultsList,role:"listbox","aria-label":r.manageCollaborators.searchResultsAriaLabel,children:l.map(D=>{var j,P,k,L;return c.jsxs("li",{className:Ie.resultItem,role:"option","aria-selected":"false",children:[c.jsxs("div",{className:Ie.userInfo,children:[c.jsx("span",{className:Ie.userName,children:R(D)}),D.email&&c.jsx("span",{className:Ie.userEmail,children:D.email}),(((P=(j=D.organisations)==null?void 0:j[0])==null?void 0:P.orgName)??D.rootOrgName)&&c.jsx("span",{className:Ie.userOrg,children:((L=(k=D.organisations)==null?void 0:k[0])==null?void 0:L.orgName)??D.rootOrgName})]}),c.jsx(Fe,{variant:"primary",size:"sm",onClick:()=>_(D),children:r.manageCollaborators.add})]},D.identifier)})}),a.trim().length>=2&&!f&&l.length===0&&c.jsx("p",{className:Ie.noResults,children:r.manageCollaborators.noUsersFound})]}),c.jsxs("div",{className:Ie.collabSection,children:[c.jsxs("h3",{className:Ie.sectionTitle,children:[r.manageCollaborators.currentCollaborators,g.length>0&&c.jsx("span",{className:Ie.badge,children:g.length})]}),g.length===0?c.jsx("p",{className:Ie.emptyCollab,children:r.manageCollaborators.noCollaboratorsYet}):c.jsx("ul",{className:Ie.collabList,children:g.map(D=>{var j,P,k,L;return c.jsxs("li",{className:Ie.collabItem,children:[c.jsx("div",{className:Ie.userAvatar,"aria-hidden":"true",children:R(D).charAt(0).toUpperCase()}),c.jsxs("div",{className:Ie.userInfo,children:[c.jsx("span",{className:Ie.userName,children:R(D)}),D.email&&c.jsx("span",{className:Ie.userEmail,children:D.email}),(((P=(j=D.organisations)==null?void 0:j[0])==null?void 0:P.orgName)??D.rootOrgName)&&c.jsx("span",{className:Ie.userOrg,children:((L=(k=D.organisations)==null?void 0:k[0])==null?void 0:L.orgName)??D.rootOrgName})]}),c.jsx(Fe,{variant:"danger",size:"sm",onClick:()=>E(D.identifier),children:r.manageCollaborators.remove})]},D.identifier)})})]}),y&&c.jsx("p",{className:Ie.error,role:"alert",children:y}),b&&c.jsx("p",{className:Ie.success,role:"status",children:r.manageCollaborators.saveSuccess})]}),c.jsxs("div",{className:Ie.footer,children:[c.jsx(Fe,{variant:"ghost",onClick:t,disabled:w,children:r.manageCollaborators.cancel}),c.jsx(Fe,{variant:"primary",isLoading:w,onClick:N,children:r.manageCollaborators.save})]})]})};async function a0(e){return(await Ne.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function o0(e,t){var s;const n=((s=(await Ne.post(`/action/dialcode/v1/reserve/${e}`,{request:{dialcodes:{count:t,qrCodeSpec:{errorCorrectionLevel:"H"}}}})).data)==null?void 0:s.result)??{};return{processId:n.processId??"",reservedDialcodes:n.reservedDialcodes??{}}}async function l0(e){var n;const r=((n=(await Ne.get(`/action/dialcode/v1/process/status/${e}`)).data)==null?void 0:n.result)??{status:"PENDING"};return{...r,status:r.status==="PENDING"?"in-process":r.status}}const c0="_topbar_zj8wk_1",u0="_left_zj8wk_15",d0="_right_zj8wk_23",f0="_backBtn_zj8wk_30",h0="_title_zj8wk_49",p0="_statusChip_zj8wk_61",m0="_savedIndicator_zj8wk_73",g0="_unsaved_zj8wk_83",y0="_iconBtn_zj8wk_88",v0="_iconBtnLabel_zj8wk_115",b0="_qrDropdown_zj8wk_119",w0="_qrMenu_zj8wk_123",C0="_reviewBtns_zj8wk_158",S0="_sourcingBtns_zj8wk_167",x0="_modalOverlay_zj8wk_176",_0="_sbOverlay_zj8wk_186",T0="_sbModal_zj8wk_196",E0="_sbModalHeader_zj8wk_207",I0="_sbModalTitle_zj8wk_215",O0="_sbModalClose_zj8wk_222",A0="_sbModalBody_zj8wk_235",D0="_sbLabel_zj8wk_242",N0="_sbTextarea_zj8wk_249",R0="_sbError_zj8wk_266",k0="_sbModalFooter_zj8wk_273",ue={topbar:c0,left:u0,right:d0,backBtn:f0,title:h0,statusChip:p0,savedIndicator:m0,unsaved:g0,iconBtn:y0,iconBtnLabel:v0,qrDropdown:b0,qrMenu:w0,reviewBtns:C0,sourcingBtns:S0,modalOverlay:x0,sbOverlay:_0,sbModal:T0,sbModalHeader:E0,sbModalTitle:I0,sbModalClose:O0,sbModalBody:A0,sbLabel:D0,sbTextarea:N0,sbError:R0,sbModalFooter:k0};function j0(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function L0(e,t){return typeof e=="string"&&e.trim().length>0?e.trim():t}const P0=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:a})=>{const o=ce(),[l,u]=m.useState(""),f=e.toLowerCase().replace(/\s+/g,"-");return c.jsx("div",{className:ue.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${f}-title`,children:c.jsxs("div",{className:ue.sbModal,children:[c.jsxs("div",{className:ue.sbModalHeader,children:[c.jsx("span",{id:`${f}-title`,className:ue.sbModalTitle,children:e}),c.jsx("button",{className:ue.sbModalClose,onClick:a,"aria-label":o.reviewCommentModal.closeAriaLabel,type:"button",children:"×"})]}),c.jsxs("div",{className:ue.sbModalBody,children:[c.jsxs("label",{className:ue.sbLabel,htmlFor:`${f}-comment`,children:[t," ",c.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),c.jsx("textarea",{id:`${f}-comment`,className:ue.sbTextarea,placeholder:r,value:l,onChange:d=>u(d.target.value),rows:4,required:!0,"aria-required":"true"}),l.trim().length===0&&c.jsx("p",{className:ue.sbError,children:o.reviewCommentModal.fillCommentsError})]}),c.jsxs("div",{className:ue.sbModalFooter,children:[c.jsx(Fe,{variant:"ghost",onClick:a,children:o.reviewCommentModal.cancelButton}),c.jsx(Fe,{variant:s,onClick:()=>i(l.trim()),disabled:l.trim().length===0,children:n})]})]})})},F0=({onConfirm:e,onCancel:t})=>{const r=ce(),[n,s]=m.useState(!1);return c.jsx("div",{className:ue.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:c.jsxs("div",{className:ue.sbModal,children:[c.jsxs("div",{className:ue.sbModalHeader,children:[c.jsx("span",{id:"review-confirm-title",className:ue.sbModalTitle,children:r.confirmReviewModal.title}),c.jsx("button",{className:ue.sbModalClose,onClick:t,"aria-label":r.confirmReviewModal.closeAriaLabel,type:"button",children:"×"})]}),c.jsx("div",{className:ue.sbModalBody,children:c.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:1.55},children:[c.jsx("input",{type:"checkbox",checked:n,onChange:i=>s(i.target.checked),style:{marginTop:2}}),c.jsxs("span",{children:[r.confirmReviewModal.agreementTextPart1," ",c.jsx("a",{className:"sb-color-primary",style:{fontWeight:600},href:"https://creativecommons.org/licenses",target:"_blank",rel:"noreferrer",children:r.confirmReviewModal.creativeCommonsLinkText})," ",r.confirmReviewModal.agreementTextPart2," ",c.jsx("strong",{children:r.confirmReviewModal.contentPolicyText}),r.confirmReviewModal.agreementTextPart3]})]})}),c.jsxs("div",{className:ue.sbModalFooter,children:[c.jsx(Fe,{variant:"ghost",onClick:t,children:r.confirmReviewModal.cancelButton}),c.jsx(Fe,{variant:"primary",onClick:e,disabled:!n,children:r.confirmReviewModal.submitButton})]})]})})},M0=({onConfirm:e,onCancel:t})=>{const r=ce(),[n,s]=m.useState(""),i=parseInt(n,10),a=!isNaN(i)&&i>=2&&i<=250;return c.jsx("div",{className:ue.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:c.jsxs("div",{className:ue.sbModal,children:[c.jsxs("div",{className:ue.sbModalHeader,children:[c.jsx("span",{id:"genqr-title",className:ue.sbModalTitle,children:r.generateQRModal.title}),c.jsx("button",{className:ue.sbModalClose,onClick:t,"aria-label":r.generateQRModal.closeAriaLabel,type:"button",children:"×"})]}),c.jsxs("div",{className:ue.sbModalBody,children:[c.jsxs("label",{className:ue.sbLabel,htmlFor:"qr-count",children:[r.generateQRModal.numberOfCodesLabel," ",c.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),c.jsx("input",{id:"qr-count",type:"number",min:2,max:250,className:ue.sbTextarea,style:{resize:"none",height:"40px"},placeholder:r.generateQRModal.countPlaceholder,value:n,onChange:o=>s(o.target.value)}),n&&!a&&c.jsx("p",{className:ue.sbError,children:r.generateQRModal.countRangeError})]}),c.jsxs("div",{className:ue.sbModalFooter,children:[c.jsx(Fe,{variant:"ghost",onClick:t,children:r.generateQRModal.cancelButton}),c.jsx(Fe,{variant:"primary",onClick:()=>e(i),disabled:!a,children:r.generateQRModal.generateButton})]})]})})},B0=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var ie,fe;const a=ce(),l=Oe(J=>J.treeData)[0],u=(l==null?void 0:l.name)??a.contextualEditor.untitledPlaceholder,f=L0(((ie=l==null?void 0:l.metadata)==null?void 0:ie.status)??(l==null?void 0:l.status),a.topbar.draftStatusFallback),d=le(J=>{var se,ke,Te,$e;return((ke=(se=J.editorConfig)==null?void 0:se.context)==null?void 0:ke.contentId)??(($e=(Te=J.editorConfig)==null?void 0:Te.context)==null?void 0:$e.identifier)??""}),{activeModal:g,modalData:p,closeModal:w,openModal:h}=vv(),y=le(J=>J.buttonLoaders),v=le(J=>J.categoryMeta),b=!v||v.schemaDefaults.generateDIALCodes!=="No",[C,S]=m.useState(!1),[_,E]=m.useState(!1),[N,R]=m.useState(!1),M=m.useRef(null),[$,D]=m.useState(!1);m.useEffect(()=>{if(!N)return;const J=se=>{var ke;(ke=M.current)!=null&&ke.contains(se.target)||R(!1)};return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[N]);const[j,P]=m.useState(!1),[k,L]=m.useState(!1),{updateNode:z}=Oe(),X=(fe=l==null?void 0:l.metadata)==null?void 0:fe.qrCodeProcessId,ye=m.useCallback(async J=>{if(d){D(!1),P(!0);try{const{processId:se,reservedDialcodes:ke}=await o0(d,J);se&&l&&z(l.id,{qrCodeProcessId:se,reservedDialcodes:ke}),Ee.success(a.topbar.qrGenerationStartedToast)}catch{Ee.error(a.topbar.qrGenerationFailedToast)}finally{P(!1)}}},[d,l,z,a]),_e=m.useCallback(async()=>{if(!X){Ee.error(a.topbar.qrCodesNotGeneratedToast);return}L(!0);try{const J=await l0(X);if(J.status==="in-process"){Ee(a.topbar.qrGenerationInProgressToast,{icon:c.jsx(el,{size:16})});return}const se=J.url;if(!se){Ee.error(a.topbar.qrCodesNotReadyToast);return}const ke=await fetch(se).then(Ue=>Ue.blob()),Te=await new Promise(Ue=>{const Ze=new FileReader;Ze.onloadend=()=>Ue(Ze.result),Ze.readAsDataURL(ke)}),$e=(l==null?void 0:l.metadata)??{},Ve=Ue=>Array.isArray(Ue)?Ue.join("_"):typeof Ue=="string"?Ue:"",qe=[d,Ve($e.medium),Ve($e.gradeLevel),Ve($e.subject)].filter(Boolean),re=new Date().toISOString().replace(/[:.]/g,"-"),He=`${qe.join("_")}_${re}.zip`,ze=document.createElement("a");ze.href=Te,ze.download=He,ze.style.display="none",document.body.appendChild(ze),ze.click(),document.body.removeChild(ze),Ee.success(a.topbar.qrCodesDownloadedToast)}catch{Ee.error(a.topbar.qrCodesDownloadFailedToast)}finally{L(!1)}},[X,l,d,a]),we=e==="edit",de=e==="review",Q=e==="sourcingreview",ne=e==="read",te=m.useCallback((J,se)=>{i({action:J,data:se})},[i]),q=m.useCallback(()=>{w(),te("publish")},[w,te]),V=m.useCallback((J,se)=>{const ke=p==null?void 0:p.action;w(),ke==="approve"?te("sourcingApprove",{comment:J,score:se}):te("reject",{comment:J})},[w,te,p]);return c.jsxs(c.Fragment,{children:[c.jsxs("header",{className:ue.topbar,role:"banner",children:[c.jsxs("div",{className:ue.left,children:[c.jsx("button",{className:ue.backBtn,onClick:()=>te("back"),"aria-label":a.topbar.backAriaLabel,type:"button",children:c.jsx(Ay,{size:18})}),c.jsx("h1",{className:ue.title,title:u,children:u}),c.jsx("span",{className:`sbx-chip ${ue.statusChip}`,"aria-label":`${a.topbar.statusAriaLabelPrefix} ${f}`,children:f})]}),c.jsxs("div",{className:ue.right,children:[t?c.jsx("span",{className:ue.savedIndicator,"aria-live":"polite",children:a.topbar.savingIndicator}):r&&we?c.jsx("span",{className:`${ue.savedIndicator} ${ue.unsaved}`,"aria-live":"polite",children:a.topbar.unsavedIndicator}):n?c.jsxs("span",{className:ue.savedIndicator,"aria-live":"polite",children:[c.jsx(Wn,{size:14,"aria-hidden":"true"}),a.topbar.savedIndicatorPrefix," ",j0(n)]}):null,!ne&&!de&&!Q&&f!=="Review"&&c.jsx("span",{title:s?void 0:a.topbar.fillRequiredFieldsTooltip,children:c.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>te("saveCollection"),disabled:!s,children:a.topbar.saveAsDraftButton})}),we&&c.jsxs(c.Fragment,{children:[c.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>E(!0),disabled:y.saveCollection,isLoading:y.saveCollection,children:[c.jsx(Ky,{size:14,"aria-hidden":"true"})," ",a.topbar.sendForReviewButton]}),c.jsx("button",{className:ue.iconBtn,onClick:()=>h("manageCollaborators"),"aria-label":a.topbar.collaboratorsLabel,title:a.topbar.collaboratorsLabel,type:"button",children:c.jsx(tv,{size:16,"aria-hidden":"true"})}),b&&c.jsxs("div",{className:ue.qrDropdown,ref:M,children:[c.jsxs("button",{className:ue.iconBtn,onClick:()=>R(J=>!J),"aria-label":a.topbar.qrCodesLabel,title:a.topbar.qrCodesLabel,type:"button","aria-haspopup":"true","aria-expanded":N,children:[c.jsx(nc,{size:16,"aria-hidden":"true"}),c.jsx("span",{className:ue.iconBtnLabel,children:a.topbar.qrCodesLabel}),c.jsx(Kn,{size:14,style:{marginLeft:2},"aria-hidden":"true"})]}),N&&c.jsxs("div",{className:ue.qrMenu,role:"menu",children:[c.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{R(!1),D(!0)},disabled:j,children:[c.jsx(nc,{size:14}),j?a.topbar.generatingEllipsis:a.topbar.generateQrCodesMenuItem]}),c.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{R(!1),_e()},disabled:k||!X,children:[c.jsx(Py,{size:14}),k?a.topbar.downloadingEllipsis:a.topbar.downloadQrCodesMenuItem]})]})]})]}),de&&c.jsxs("div",{className:ue.reviewBtns,children:[c.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>h("publishChecklist"),disabled:y.publishCollection,isLoading:y.publishCollection,children:[c.jsx(nf,{size:14,"aria-hidden":"true"})," ",a.topbar.publishButton]}),c.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>S(!0),disabled:y.rejectCollection,isLoading:y.rejectCollection,children:[c.jsx(sc,{size:14,"aria-hidden":"true"})," ",a.topbar.requestForChangesButton]})]}),Q&&c.jsxs("div",{className:ue.sourcingBtns,children:[c.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>h("qualityParams",{action:"approve"}),children:[c.jsx(Yy,{size:14,"aria-hidden":"true"})," ",a.topbar.approveButton]}),c.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>h("qualityParams",{action:"reject"}),children:[c.jsx(sc,{size:14,"aria-hidden":"true"})," ",a.topbar.requestForChangesButton]})]})]})]}),g==="publishChecklist"&&c.jsx(CS,{contentId:d,onConfirm:q,onCancel:w}),g==="qualityParams"&&c.jsx(SS,{contentId:d,action:(p==null?void 0:p.action)??"reject",onConfirm:V,onCancel:w}),g==="manageCollaborators"&&c.jsx("div",{className:ue.modalOverlay,role:"dialog","aria-modal":"true",children:c.jsx(i0,{contentId:d,onClose:w})}),_&&c.jsx(F0,{onConfirm:()=>{E(!1),te("sendForReview")},onCancel:()=>E(!1)}),C&&c.jsx(P0,{titleText:a.topbar.requestChangesTitle,labelText:a.topbar.changesRequestedLabel,placeholderText:a.topbar.describeChangesPlaceholder,submitLabel:a.topbar.requestForChangesButton,submitVariant:"primary",onConfirm:J=>{S(!1),te("reject",{comment:J})},onCancel:()=>S(!1)}),$&&c.jsx(M0,{onConfirm:ye,onCancel:()=>D(!1)})]})},$0=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>{const s=ce();return Br.createPortal(c.jsx("div",{className:je.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:c.jsxs("div",{className:je.modal,children:[c.jsxs("div",{className:je.modalHeader,children:[c.jsx("span",{id:"unsaved-title",children:s.unsavedChangesModal.title}),c.jsx("button",{className:je.modalHeaderClose,onClick:r,"aria-label":s.unsavedChangesModal.closeAriaLabel,disabled:n,children:"×"})]}),c.jsx("div",{className:je.modalBody,children:c.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:s.unsavedChangesModal.bodyMessage})}),c.jsxs("div",{className:je.modalFooter,children:[c.jsx(Fe,{variant:"ghost",onClick:r,disabled:n,children:s.unsavedChangesModal.cancelButton}),c.jsx(Fe,{variant:"danger",onClick:t,disabled:n,children:s.unsavedChangesModal.discardButton}),c.jsx(Fe,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:s.unsavedChangesModal.saveButton})]})]})}),document.body)};var q0=al();const Gf=m.createContext(null);function Rt(){const e=m.useContext(Gf);if(e===null)throw new Error("No Tree Api Provided");return e}const Wf=m.createContext(null);function U0(){const e=m.useContext(Wf);if(e===null)throw new Error("Provide a NodesContext");return e}const Kf=m.createContext(null);function z0(){const e=m.useContext(Kf);if(e===null)throw new Error("Provide a DnDContext");return e}const Yf=m.createContext(0);function Zf(){m.useContext(Yf)}function vi(e,t,r){return Math.max(Math.min(e,r),t)}function Xf(e){return e&&e.isLeaf}function Jf(e){return e&&e.isInternal&&!e.isOpen}function eh(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const th=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},rh=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function ml(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=ml(r,t);if(n)return n}return null}function Mi(e,t){if(t(e),e.children)for(let r of e.children)Mi(r,t)}function nh(e){const t=ih(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=V0(t,n);break}r==null||r.focus()}function sh(e){const t=ih(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=H0(t,n);break}r==null||r.focus()}function V0(e,t){return t+1<e.length?e[t+1]:e[0]}function H0(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function ih(e){return Array.from(document.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')).filter(t=>t===e||!e.contains(t))}function ps(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function _n(e){return typeof e=="string"?e:e.id}function Q0(e,...t){if(e)return e(...t)}function ah(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function oh(e){var t,r;const n=e.focusedNode;return n?n.isOpen?0:n.parent?n.childIndex+1:0:(r=(t=e.root.children)===null||t===void 0?void 0:t.length)!==null&&r!==void 0?r:0}function lh(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const G0=Object.freeze(Object.defineProperty({__proto__:null,access:ps,bound:vi,dfs:ml,focusNextElement:nh,focusPrevElement:sh,getInsertIndex:oh,getInsertParentId:lh,identify:_n,indexOf:rh,isClosed:Jf,isDescendant:th,isItem:Xf,isOpenWithEmptyChildren:eh,safeRun:Q0,waitFor:ah,walk:Mi},Symbol.toStringTag,{value:"Module"})),W0={display:"flex",alignItems:"center",zIndex:1},K0={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},Y0={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},Z0=m.memo(function({top:t,left:r,indent:n}){const s={position:"absolute",pointerEvents:"none",top:t-2+"px",left:r+"px",right:n+"px"};return c.jsxs("div",{style:Object.assign(Object.assign({},W0),s),children:[c.jsx("div",{style:Object.assign({},Y0)}),c.jsx("div",{style:Object.assign({},K0)})]})});function X0({node:e,attrs:t,innerRef:r,children:n}){return c.jsx("div",Object.assign({},t,{ref:r,onFocus:s=>s.stopPropagation(),onClick:e.handleClick,children:n}))}function J0(e){return c.jsxs("div",{ref:e.dragHandle,style:e.style,children:[c.jsx("span",{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?"🌳":e.node.isOpen?"🗁":"🗀"})," ",e.node.isEditing?c.jsx(tT,Object.assign({},e)):c.jsx(eT,Object.assign({},e))]})}function eT(e){return c.jsx(c.Fragment,{children:c.jsx("span",{children:e.node.data.name})})}function tT({node:e}){const t=m.useRef();return m.useEffect(()=>{var r,n;(r=t.current)===null||r===void 0||r.focus(),(n=t.current)===null||n===void 0||n.select()},[]),c.jsx("input",{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:r=>{var n;r.key==="Escape"&&e.reset(),r.key==="Enter"&&e.submit(((n=t.current)===null||n===void 0?void 0:n.value)||"")}})}const As="__REACT_ARBORIST_INTERNAL_ROOT__";function Nc(e){var t;function r(i,a,o){const l=e.accessId(i),u=new Ds({tree:e,data:i,level:a,parent:o,id:l,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),f=e.accessChildren(i);return f&&(u.children=f.map(d=>r(d,a+1,u))),u}const n=new Ds({tree:e,id:As,data:{id:As},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),s=(t=e.props.data)!==null&&t!==void 0?t:[];return n.children=s.map(i=>r(i,0,n)),n}class Ds{constructor(t){this.handleClick=r=>{(r.metaKey||r.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():r.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=t.tree,this.id=t.id,this.data=t.data,this.level=t.level,this.children=t.children,this.parent=t.parent,this.isDraggable=t.isDraggable,this.rowIndex=t.rowIndex}get isRoot(){return this.id===As}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return this.isLeaf?!1:this.tree.isOpen(this.id)}get isClosed(){return this.isLeaf?!1:!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var t;return this.isSelected&&!(!((t=this.prev)===null||t===void 0)&&t.isSelected)}get isSelectedEnd(){var t;return this.isSelected&&!(!((t=this.next)===null||t===void 0)&&t.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(t=>t.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var t,r;const n=this.childIndex;return(r=(t=this.parent)===null||t===void 0?void 0:t.children[n+1])!==null&&r!==void 0?r:null}isAncestorOf(t){if(!t)return!1;let r=t;for(;r;){if(r.id===this.id)return!0;r=r.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(t){this.tree.submit(this,t)}reset(){this.tree.reset()}clone(){return new Ds(Object.assign({},this))}edit(){return this.tree.edit(this)}}function Ia(e){return{type:"EDIT",id:e}}function rT(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function gn(e){return{type:"FOCUS",id:e}}function nT(){return{type:"TREE_BLUR"}}function sT(e={id:null,treeFocused:!1},t){return t.type==="FOCUS"?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):t.type==="TREE_BLUR"?Object.assign(Object.assign({},e),{treeFocused:!1}):e}const Io={open(e,t){return{type:"VISIBILITY_OPEN",id:e,filtered:t}},close(e,t){return{type:"VISIBILITY_CLOSE",id:e,filtered:t}},toggle(e,t){return{type:"VISIBILITY_TOGGLE",id:e,filtered:t}},clear(e){return{type:"VISIBILITY_CLEAR",filtered:e}}};function Rc(e={},t){if(t.type==="VISIBILITY_OPEN")return Object.assign(Object.assign({},e),{[t.id]:!0});if(t.type==="VISIBILITY_CLOSE")return Object.assign(Object.assign({},e),{[t.id]:!1});if(t.type==="VISIBILITY_TOGGLE"){const r=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!r})}else return t.type==="VISIBILITY_CLEAR"?{}:e}function iT(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:Rc(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:Rc(e.unfiltered,t)}):e}const zn=e=>{var t;return{nodes:{open:{filtered:{},unfiltered:(t=e==null?void 0:e.initialOpenState)!==null&&t!==void 0?t:{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:"none"},dragId:null,dragIds:[],parentId:null,index:-1}}},Tr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:_n(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(_n)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(_n)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:_n(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:_n(e)})};function aT(e=zn().nodes.selection,t){const r=e.ids;switch(t.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},e),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},e),{ids:new Set([t.id])});case"SELECTION_ADD":return t.ids.length===0?e:(t.ids.forEach(n=>r.add(n)),Object.assign(Object.assign({},e),{ids:new Set(r)}));case"SELECTION_REMOVE":return t.ids.length===0?e:(t.ids.forEach(n=>r.delete(n)),Object.assign(Object.assign({},e),{ids:new Set(r)}));case"SELECTION_SET":return Object.assign(Object.assign({},e),{ids:t.ids,mostRecent:t.mostRecent,anchor:t.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},e),{mostRecent:t.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},e),{anchor:t.id});default:return e}}const Vn={cursor(e){return{type:"DND_CURSOR",cursor:e}},dragStart(e,t){return{type:"DND_DRAG_START",id:e,dragIds:t}},dragEnd(){return{type:"DND_DRAG_END"}},hovering(e,t){return{type:"DND_HOVERING",parentId:e,index:t}}};function oT(e=zn().dnd,t){switch(t.type){case"DND_CURSOR":return Object.assign(Object.assign({},e),{cursor:t.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},e),{dragId:t.id,dragIds:t.dragIds});case"DND_DRAG_END":return zn().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const lT={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},cT=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},uT=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function ch({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return c.jsxs(dT,{isDragging:s,children:[c.jsx(fT,{offset:e,children:c.jsx(pT,{id:r,dragIds:n})}),c.jsx(hT,{mouse:t,count:n.length})]})}const dT=m.memo(function(t){return t.isDragging?c.jsx("div",{style:lT,children:t.children}):null});function fT(e){return c.jsx("div",{className:"row preview",style:cT(e.offset),children:e.children})}function hT(e){const{count:t,mouse:r}=e;return t>1?c.jsx("div",{className:"selected-count",style:uT(r),children:t}):null}const pT=m.memo(function(t){const r=Rt(),n=r.get(t.id);return n?c.jsx(r.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*r.indent,opacity:.2,background:"transparent"},tree:r}):null});function Oo(){return Oo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Oo.apply(null,arguments)}function kc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ao(e,t){return Ao=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ao(e,t)}function mT(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ao(e,t)}var jc=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function gT(e,t){return!!(e===t||jc(e)&&jc(t))}function yT(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!gT(e[r],t[r]))return!1;return!0}function Oa(e,t){t===void 0&&(t=yT);var r,n=[],s,i=!1;function a(){for(var o=[],l=0;l<arguments.length;l++)o[l]=arguments[l];return i&&r===this&&t(o,n)||(s=e.apply(this,o),i=!0,r=this,n=o),s}return a}var vT=typeof performance=="object"&&typeof performance.now=="function",Lc=vT?function(){return performance.now()}:function(){return Date.now()};function Pc(e){cancelAnimationFrame(e.id)}function bT(e,t){var r=Lc();function n(){Lc()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var Aa=-1;function Fc(e){if(e===void 0&&(e=!1),Aa===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Aa=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Aa}var yn=null;function Mc(e){if(e===void 0&&(e=!1),yn===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),s=n.style;return s.width="100px",s.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?yn="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?yn="negative":yn="positive-ascending"),document.body.removeChild(t),yn}return yn}process.env.NODE_ENV;var wT=150,CT=function(t,r){return t},bi=null,wi=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(bi=new WeakSet,wi=new WeakSet);function uh(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,a=e.getStartIndexForOffset,o=e.getStopIndexForStartIndex,l=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,f=e.validateProps;return t=function(d){mT(g,d);function g(w){var h;return h=d.call(this,w)||this,h._instanceProps=l(h.props,kc(h)),h._outerRef=void 0,h._resetIsScrollingTimeoutId=null,h.state={instance:kc(h),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof h.props.initialScrollOffset=="number"?h.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},h._callOnItemsRendered=void 0,h._callOnItemsRendered=Oa(function(y,v,b,C){return h.props.onItemsRendered({overscanStartIndex:y,overscanStopIndex:v,visibleStartIndex:b,visibleStopIndex:C})}),h._callOnScroll=void 0,h._callOnScroll=Oa(function(y,v,b){return h.props.onScroll({scrollDirection:y,scrollOffset:v,scrollUpdateWasRequested:b})}),h._getItemStyle=void 0,h._getItemStyle=function(y){var v=h.props,b=v.direction,C=v.itemSize,S=v.layout,_=h._getItemStyleCache(u&&C,u&&S,u&&b),E;if(_.hasOwnProperty(y))E=_[y];else{var N=r(h.props,y,h._instanceProps),R=s(h.props,y,h._instanceProps),M=b==="horizontal"||S==="horizontal",$=b==="rtl",D=M?N:0;_[y]=E={position:"absolute",left:$?void 0:D,right:$?D:void 0,top:M?0:N,height:M?"100%":R,width:M?R:"100%"}}return E},h._getItemStyleCache=void 0,h._getItemStyleCache=Oa(function(y,v,b){return{}}),h._onScrollHorizontal=function(y){var v=y.currentTarget,b=v.clientWidth,C=v.scrollLeft,S=v.scrollWidth;h.setState(function(_){if(_.scrollOffset===C)return null;var E=h.props.direction,N=C;if(E==="rtl")switch(Mc()){case"negative":N=-C;break;case"positive-descending":N=S-b-C;break}return N=Math.max(0,Math.min(N,S-b)),{isScrolling:!0,scrollDirection:_.scrollOffset<N?"forward":"backward",scrollOffset:N,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._onScrollVertical=function(y){var v=y.currentTarget,b=v.clientHeight,C=v.scrollHeight,S=v.scrollTop;h.setState(function(_){if(_.scrollOffset===S)return null;var E=Math.max(0,Math.min(S,C-b));return{isScrolling:!0,scrollDirection:_.scrollOffset<E?"forward":"backward",scrollOffset:E,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._outerRefSetter=function(y){var v=h.props.outerRef;h._outerRef=y,typeof v=="function"?v(y):v!=null&&typeof v=="object"&&v.hasOwnProperty("current")&&(v.current=y)},h._resetIsScrollingDebounced=function(){h._resetIsScrollingTimeoutId!==null&&Pc(h._resetIsScrollingTimeoutId),h._resetIsScrollingTimeoutId=bT(h._resetIsScrolling,wT)},h._resetIsScrolling=function(){h._resetIsScrollingTimeoutId=null,h.setState({isScrolling:!1},function(){h._getItemStyleCache(-1,null)})},h}g.getDerivedStateFromProps=function(h,y){return ST(h,y),f(h),null};var p=g.prototype;return p.scrollTo=function(h){h=Math.max(0,h),this.setState(function(y){return y.scrollOffset===h?null:{scrollDirection:y.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},p.scrollToItem=function(h,y){y===void 0&&(y="auto");var v=this.props,b=v.itemCount,C=v.layout,S=this.state.scrollOffset;h=Math.max(0,Math.min(h,b-1));var _=0;if(this._outerRef){var E=this._outerRef;C==="vertical"?_=E.scrollWidth>E.clientWidth?Fc():0:_=E.scrollHeight>E.clientHeight?Fc():0}this.scrollTo(i(this.props,h,y,S,this._instanceProps,_))},p.componentDidMount=function(){var h=this.props,y=h.direction,v=h.initialScrollOffset,b=h.layout;if(typeof v=="number"&&this._outerRef!=null){var C=this._outerRef;y==="horizontal"||b==="horizontal"?C.scrollLeft=v:C.scrollTop=v}this._callPropsCallbacks()},p.componentDidUpdate=function(){var h=this.props,y=h.direction,v=h.layout,b=this.state,C=b.scrollOffset,S=b.scrollUpdateWasRequested;if(S&&this._outerRef!=null){var _=this._outerRef;if(y==="horizontal"||v==="horizontal")if(y==="rtl")switch(Mc()){case"negative":_.scrollLeft=-C;break;case"positive-ascending":_.scrollLeft=C;break;default:var E=_.clientWidth,N=_.scrollWidth;_.scrollLeft=N-E-C;break}else _.scrollLeft=C;else _.scrollTop=C}this._callPropsCallbacks()},p.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Pc(this._resetIsScrollingTimeoutId)},p.render=function(){var h=this.props,y=h.children,v=h.className,b=h.direction,C=h.height,S=h.innerRef,_=h.innerElementType,E=h.innerTagName,N=h.itemCount,R=h.itemData,M=h.itemKey,$=M===void 0?CT:M,D=h.layout,j=h.outerElementType,P=h.outerTagName,k=h.style,L=h.useIsScrolling,z=h.width,X=this.state.isScrolling,ye=b==="horizontal"||D==="horizontal",_e=ye?this._onScrollHorizontal:this._onScrollVertical,we=this._getRangeToRender(),de=we[0],Q=we[1],ne=[];if(N>0)for(var te=de;te<=Q;te++)ne.push(m.createElement(y,{data:R,key:$(te,R),index:te,isScrolling:L?X:void 0,style:this._getItemStyle(te)}));var q=n(this.props,this._instanceProps);return m.createElement(j||P||"div",{className:v,onScroll:_e,ref:this._outerRefSetter,style:Oo({position:"relative",height:C,width:z,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},k)},m.createElement(_||E||"div",{children:ne,ref:S,style:{height:ye?"100%":q,pointerEvents:X?"none":void 0,width:ye?q:"100%"}}))},p._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var h=this.props.itemCount;if(h>0){var y=this._getRangeToRender(),v=y[0],b=y[1],C=y[2],S=y[3];this._callOnItemsRendered(v,b,C,S)}}if(typeof this.props.onScroll=="function"){var _=this.state,E=_.scrollDirection,N=_.scrollOffset,R=_.scrollUpdateWasRequested;this._callOnScroll(E,N,R)}},p._getRangeToRender=function(){var h=this.props,y=h.itemCount,v=h.overscanCount,b=this.state,C=b.isScrolling,S=b.scrollDirection,_=b.scrollOffset;if(y===0)return[0,0,0,0];var E=a(this.props,_,this._instanceProps),N=o(this.props,E,_,this._instanceProps),R=!C||S==="backward"?Math.max(1,v):1,M=!C||S==="forward"?Math.max(1,v):1;return[Math.max(0,E-R),Math.max(0,Math.min(y-1,N+M)),E,N]},g}(m.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var ST=function(t,r){var n=t.children,s=t.direction,i=t.height,a=t.layout,o=t.innerTagName,l=t.outerTagName,u=t.width,f=r.instance;if(process.env.NODE_ENV!=="production"){(o!=null||l!=null)&&wi&&!wi.has(f)&&(wi.add(f),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var d=s==="horizontal"||a==="horizontal";switch(s){case"horizontal":case"vertical":bi&&!bi.has(f)&&(bi.add(f),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+s+'" was specified.'))}switch(a){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+a+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(d&&typeof u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" was specified.'));if(!d&&typeof i!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(i===null?"null":typeof i)+'" was specified.'))}},xT=50,Tn=function(t,r,n){var s=t,i=s.itemSize,a=n.itemMetadataMap,o=n.lastMeasuredIndex;if(r>o){var l=0;if(o>=0){var u=a[o];l=u.offset+u.size}for(var f=o+1;f<=r;f++){var d=i(f);a[f]={offset:l,size:d},l+=d}n.lastMeasuredIndex=r}return a[r]},_T=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,a=i>0?s[i].offset:0;return a>=n?dh(t,r,i,0,n):TT(t,r,Math.max(0,i),n)},dh=function(t,r,n,s,i){for(;s<=n;){var a=s+Math.floor((n-s)/2),o=Tn(t,a,r).offset;if(o===i)return a;o<i?s=a+1:o>i&&(n=a-1)}return s>0?s-1:0},TT=function(t,r,n,s){for(var i=t.itemCount,a=1;n<i&&Tn(t,n,r).offset<s;)n+=a,a*=2;return dh(t,r,Math.min(n,i-1),Math.floor(n/2),s)},Bc=function(t,r){var n=t.itemCount,s=r.itemMetadataMap,i=r.estimatedItemSize,a=r.lastMeasuredIndex,o=0;if(a>=n&&(a=n-1),a>=0){var l=s[a];o=l.offset+l.size}var u=n-a-1,f=u*i;return o+f},ET=uh({getItemOffset:function(t,r,n){return Tn(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Bc,getOffsetForIndexAndAlignment:function(t,r,n,s,i,a){var o=t.direction,l=t.height,u=t.layout,f=t.width,d=o==="horizontal"||u==="horizontal",g=d?f:l,p=Tn(t,r,i),w=Bc(t,i),h=Math.max(0,Math.min(w-g,p.offset)),y=Math.max(0,p.offset-g+p.size+a);switch(n==="smart"&&(s>=y-g&&s<=h+g?n="auto":n="center"),n){case"start":return h;case"end":return y;case"center":return Math.round(y+(h-y)/2);case"auto":default:return s>=y&&s<=h?s:s<y?y:h}},getStartIndexForOffset:function(t,r,n){return _T(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,a=t.height,o=t.itemCount,l=t.layout,u=t.width,f=i==="horizontal"||l==="horizontal",d=f?u:a,g=Tn(t,r,s),p=n+d,w=g.offset+g.size,h=r;h<o-1&&w<p;)h++,w+=Tn(t,h,s).size;return h},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||xT,lastMeasuredIndex:-1};return r.resetAfterIndex=function(a,o){o===void 0&&(o=!0),i.lastMeasuredIndex=Math.min(i.lastMeasuredIndex,a-1),r._getItemStyleCache(-1),o&&r.forceUpdate()},i},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="function")throw Error('An invalid "itemSize" prop has been specified. Value should be a function. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}}),IT=uh({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,s,i,a){var o=t.direction,l=t.height,u=t.itemCount,f=t.itemSize,d=t.layout,g=t.width,p=o==="horizontal"||d==="horizontal",w=p?g:l,h=Math.max(0,u*f-w),y=Math.min(h,r*f),v=Math.max(0,r*f-w+f+a);switch(n==="smart"&&(s>=v-w&&s<=y+w?n="auto":n="center"),n){case"start":return y;case"end":return v;case"center":{var b=Math.round(v+(y-v)/2);return b<Math.ceil(w/2)?0:b>h+Math.floor(w/2)?h:b}case"auto":default:return s>=v&&s<=y?s:s<v?v:y}},getStartIndexForOffset:function(t,r){var n=t.itemCount,s=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/s)))},getStopIndexForStartIndex:function(t,r,n){var s=t.direction,i=t.height,a=t.itemCount,o=t.itemSize,l=t.layout,u=t.width,f=s==="horizontal"||l==="horizontal",d=r*o,g=f?u:i,p=Math.ceil((g+n-d)/o);return Math.max(0,Math.min(a-1,r+p-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function OT(){var e,t;const r=Rt(),s=z0().cursor;if(!s||s.type!=="line")return null;const i=r.indent,a=r.rowTopPosition(s.index)+((t=(e=r.props.padding)!==null&&e!==void 0?e:r.props.paddingTop)!==null&&t!==void 0?t:0),o=i*s.level,l=r.renderCursor;return c.jsx(l,{top:a,left:o,indent:i})}var AT=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r};const DT=m.forwardRef(function(t,r){const{children:n}=t,s=AT(t,["children"]),i=Rt();return c.jsxs("div",Object.assign({ref:r},s,{onClick:a=>{a.currentTarget===a.target&&i.deselectAll()},children:[c.jsx(NT,{}),n]}))}),NT=()=>{const e=Rt();return c.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:c.jsx(OT,{})})};var RT=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r};const kT=m.forwardRef(function(t,r){var n,s,i,a,{style:o}=t,l=RT(t,["style"]);const u=Rt(),f=(s=(n=u.props.padding)!==null&&n!==void 0?n:u.props.paddingTop)!==null&&s!==void 0?s:0,d=(a=(i=u.props.padding)!==null&&i!==void 0?i:u.props.paddingBottom)!==null&&a!==void 0?a:0;return c.jsx("div",Object.assign({ref:r,style:Object.assign(Object.assign({},o),{height:`${parseFloat(o.height)+f+d}px`})},l))});var fh=m.createContext({dragDropManager:void 0}),Gt;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Gt||(Gt={}));function he(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];if(process.env.NODE_ENV!=="production"&&t===void 0)throw new Error("invariant requires an error message argument");if(!e){var i;if(t===void 0)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;i=new Error(t.replace(/%s/g,function(){return n[a++]})),i.name="Invariant Violation"}throw i.framesToPop=1,i}}var gl="dnd-core/INIT_COORDS",sa="dnd-core/BEGIN_DRAG",yl="dnd-core/PUBLISH_DRAG_SOURCE",ia="dnd-core/HOVER",aa="dnd-core/DROP",oa="dnd-core/END_DRAG";function $c(e,t){return{type:gl,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function Ci(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ci=function(r){return typeof r}:Ci=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ci(e)}function jT(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function LT(e,t){return e.filter(function(r){return r!==t})}function hh(e){return Ci(e)==="object"}function PT(e,t){var r=new Map,n=function(a){r.set(a,r.has(a)?r.get(a)+1:1)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i,a){i===1&&s.push(a)}),s}function FT(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var MT={type:gl,payload:{clientOffset:null,sourceClientOffset:null}};function BT(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},s=n.publishSource,i=s===void 0?!0:s,a=n.clientOffset,o=n.getSourceClientOffset,l=e.getMonitor(),u=e.getRegistry();e.dispatch($c(a)),$T(r,l,u);var f=zT(r,l);if(f===null){e.dispatch(MT);return}var d=null;if(a){if(!o)throw new Error("getSourceClientOffset must be defined");qT(o),d=o(f)}e.dispatch($c(a,d));var g=u.getSource(f),p=g.beginDrag(l,f);if(p!=null){UT(p),u.pinSource(f);var w=u.getSourceType(f);return{type:sa,payload:{itemType:w,item:p,sourceId:f,clientOffset:a||null,sourceClientOffset:d||null,isSourcePublic:!!i}}}}}function $T(e,t,r){he(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){he(r.getSource(n),"Expected sourceIds to be registered.")})}function qT(e){he(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function UT(e){he(hh(e),"Item must be an object.")}function zT(e,t){for(var r=null,n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}function VT(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:yl}}}function Do(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function HT(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;QT(r);var i=r.slice(0),a=e.getMonitor(),o=e.getRegistry();GT(i,a,o);var l=a.getItemType();return WT(i,o,l),KT(i,a,o),{type:ia,payload:{targetIds:i,clientOffset:s||null}}}}function QT(e){he(Array.isArray(e),"Expected targetIds to be an array.")}function GT(e,t,r){he(t.isDragging(),"Cannot call hover while not dragging."),he(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];he(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);he(i,"Expected targetIds to be registered.")}}function WT(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);Do(i,r)||e.splice(n,1)}}function KT(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function qc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Uc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qc(Object(r),!0).forEach(function(n){YT(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function YT(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ZT(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();XT(n);var i=tE(n);i.forEach(function(a,o){var l=JT(a,o,s,n),u={type:aa,payload:{dropResult:Uc(Uc({},r),l)}};e.dispatch(u)})}}function XT(e){he(e.isDragging(),"Cannot call drop while not dragging."),he(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function JT(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return eE(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function eE(e){he(typeof e>"u"||hh(e),"Drop result must either be an object or undefined.")}function tE(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function rE(e){return function(){var r=e.getMonitor(),n=e.getRegistry();nE(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:oa}}}function nE(e){he(e.isDragging(),"Cannot call endDrag while not dragging.")}function sE(e){return{beginDrag:BT(e),publishDragSource:VT(e),hover:HT(e),drop:ZT(e),endDrag:rE(e)}}function iE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function oE(e,t,r){return t&&aE(e.prototype,t),e}function is(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var lE=function(){function e(t,r){var n=this;iE(this,e),is(this,"store",void 0),is(this,"monitor",void 0),is(this,"backend",void 0),is(this,"isSetUp",!1),is(this,"handleRefCountChange",function(){var s=n.store.getState().refCount>0;n.backend&&(s&&!n.isSetUp?(n.backend.setup(),n.isSetUp=!0):!s&&n.isSetUp&&(n.backend.teardown(),n.isSetUp=!1))}),this.store=t,this.monitor=r,t.subscribe(this.handleRefCountChange)}return oE(e,[{key:"receiveBackend",value:function(r){this.backend=r}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var r=this,n=this.store.dispatch;function s(a){return function(){for(var o=arguments.length,l=new Array(o),u=0;u<o;u++)l[u]=arguments[u];var f=a.apply(r,l);typeof f<"u"&&n(f)}}var i=sE(this);return Object.keys(i).reduce(function(a,o){var l=i[o];return a[o]=s(l),a},{})}},{key:"dispatch",value:function(r){this.store.dispatch(r)}}]),e}();function Ut(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var zc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Vc=function(){return Math.random().toString(36).substring(7).split("").join(".")},Hc={INIT:"@@redux/INIT"+Vc(),REPLACE:"@@redux/REPLACE"+Vc()};function cE(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function uE(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(hE(e))return"date";if(fE(e))return"error";var r=dE(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}function dE(e){return typeof e.constructor=="function"?e.constructor.name:null}function fE(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function hE(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function vn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=uE(e)),t}function ph(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?Ut(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?Ut(1):"Expected the enhancer to be a function. Instead, received: '"+vn(r)+"'");return r(ph)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Ut(2):"Expected the root reducer to be a function. Instead, received: '"+vn(e)+"'");var s=e,i=t,a=[],o=a,l=!1;function u(){o===a&&(o=a.slice())}function f(){if(l)throw new Error(process.env.NODE_ENV==="production"?Ut(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function d(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Ut(4):"Expected the listener to be a function. Instead, received: '"+vn(h)+"'");if(l)throw new Error(process.env.NODE_ENV==="production"?Ut(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var y=!0;return u(),o.push(h),function(){if(y){if(l)throw new Error(process.env.NODE_ENV==="production"?Ut(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");y=!1,u();var b=o.indexOf(h);o.splice(b,1),a=null}}}function g(h){if(!cE(h))throw new Error(process.env.NODE_ENV==="production"?Ut(7):"Actions must be plain objects. Instead, the actual type was: '"+vn(h)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof h.type>"u")throw new Error(process.env.NODE_ENV==="production"?Ut(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(l)throw new Error(process.env.NODE_ENV==="production"?Ut(9):"Reducers may not dispatch actions.");try{l=!0,i=s(i,h)}finally{l=!1}for(var y=a=o,v=0;v<y.length;v++){var b=y[v];b()}return h}function p(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Ut(10):"Expected the nextReducer to be a function. Instead, received: '"+vn(h));s=h,g({type:Hc.REPLACE})}function w(){var h,y=d;return h={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?Ut(11):"Expected the observer to be an object. Instead, received: '"+vn(b)+"'");function C(){b.next&&b.next(f())}C();var S=y(C);return{unsubscribe:S}}},h[zc]=function(){return this},h}return g({type:Hc.INIT}),n={dispatch:g,subscribe:d,getState:f,replaceReducer:p},n[zc]=w,n}var pE=function(t,r){return t===r};function mE(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function gE(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:pE;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}function Qc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Gc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Qc(Object(r),!0).forEach(function(n){yE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function yE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Wc={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function vE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Wc,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case gl:case sa:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case ia:return mE(e.clientOffset,r.clientOffset)?e:Gc(Gc({},e),{},{clientOffset:r.clientOffset});case oa:case aa:return Wc;default:return e}}var vl="dnd-core/ADD_SOURCE",bl="dnd-core/ADD_TARGET",wl="dnd-core/REMOVE_SOURCE",la="dnd-core/REMOVE_TARGET";function bE(e){return{type:vl,payload:{sourceId:e}}}function wE(e){return{type:bl,payload:{targetId:e}}}function CE(e){return{type:wl,payload:{sourceId:e}}}function SE(e){return{type:la,payload:{targetId:e}}}function Kc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function zt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Kc(Object(r),!0).forEach(function(n){xE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function xE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var _E={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function TE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_E,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case sa:return zt(zt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case yl:return zt(zt({},e),{},{isSourcePublic:!0});case ia:return zt(zt({},e),{},{targetIds:r.targetIds});case la:return e.targetIds.indexOf(r.targetId)===-1?e:zt(zt({},e),{},{targetIds:LT(e.targetIds,r.targetId)});case aa:return zt(zt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case oa:return zt(zt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function EE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case vl:case bl:return e+1;case wl:case la:return e-1;default:return e}}var Bi=[],Cl=[];Bi.__IS_NONE__=!0;Cl.__IS_ALL__=!0;function IE(e,t){if(e===Bi)return!1;if(e===Cl||typeof t>"u")return!0;var r=FT(t,e);return r.length>0}function OE(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case ia:break;case vl:case bl:case la:case wl:return Bi;case sa:case yl:case oa:case aa:default:return Cl}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,a=PT(n,i),o=a.length>0||!gE(n,i);if(!o)return Bi;var l=i[i.length-1],u=n[n.length-1];return l!==u&&(l&&a.push(l),u&&a.push(u)),a}function AE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Yc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Zc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Yc(Object(r),!0).forEach(function(n){DE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function DE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function NE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:OE(e.dirtyHandlerIds,{type:t.type,payload:Zc(Zc({},t.payload),{},{prevTargetIds:jT(e,"dragOperation.targetIds",[])})}),dragOffset:vE(e.dragOffset,t),refCount:EE(e.refCount,t),dragOperation:TE(e.dragOperation,t),stateId:AE(e.stateId)}}function RE(e,t){return{x:e.x+t.x,y:e.y+t.y}}function mh(e,t){return{x:e.x-t.x,y:e.y-t.y}}function kE(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:mh(RE(t,n),r)}function jE(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:mh(t,r)}function LE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function PE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function FE(e,t,r){return t&&PE(e.prototype,t),e}function Xc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ME=function(){function e(t,r){LE(this,e),Xc(this,"store",void 0),Xc(this,"registry",void 0),this.store=t,this.registry=r}return FE(e,[{key:"subscribeToStateChange",value:function(r){var n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0},i=s.handlerIds;he(typeof r=="function","listener must be a function."),he(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var a=this.store.getState().stateId,o=function(){var u=n.store.getState(),f=u.stateId;try{var d=f===a||f===a+1&&!IE(u.dirtyHandlerIds,i);d||r()}finally{a=f}};return this.store.subscribe(o)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;he(typeof r=="function","listener must be a function.");var s=this.store.getState().dragOffset,i=function(){var o=n.store.getState().dragOffset;o!==s&&(s=o,r())};return this.store.subscribe(i)}},{key:"canDragSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r);return he(n,"Expected to find a valid source. sourceId=".concat(r)),this.isDragging()?!1:n.canDrag(this,r)}},{key:"canDropOnTarget",value:function(r){if(!r)return!1;var n=this.registry.getTarget(r);if(he(n,"Expected to find a valid target. targetId=".concat(r)),!this.isDragging()||this.didDrop())return!1;var s=this.registry.getTargetType(r),i=this.getItemType();return Do(s,i)&&n.canDrop(this,r)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r,!0);if(he(n,"Expected to find a valid source. sourceId=".concat(r)),!this.isDragging()||!this.isSourcePublic())return!1;var s=this.registry.getSourceType(r),i=this.getItemType();return s!==i?!1:n.isDragging(this,r)}},{key:"isOverTarget",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!r)return!1;var s=n.shallow;if(!this.isDragging())return!1;var i=this.registry.getTargetType(r),a=this.getItemType();if(a&&!Do(i,a))return!1;var o=this.getTargetIds();if(!o.length)return!1;var l=o.indexOf(r);return s?l===o.length-1:l>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return kE(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return jE(this.store.getState().dragOffset)}}]),e}(),BE=0;function $E(){return BE++}function Si(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Si=function(r){return typeof r}:Si=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Si(e)}function qE(e){he(typeof e.canDrag=="function","Expected canDrag to be a function."),he(typeof e.beginDrag=="function","Expected beginDrag to be a function."),he(typeof e.endDrag=="function","Expected endDrag to be a function.")}function UE(e){he(typeof e.canDrop=="function","Expected canDrop to be a function."),he(typeof e.hover=="function","Expected hover to be a function."),he(typeof e.drop=="function","Expected beginDrag to be a function.")}function No(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return No(r,!1)});return}he(typeof e=="string"||Si(e)==="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const Jc=typeof global<"u"?global:self,gh=Jc.MutationObserver||Jc.WebKitMutationObserver;function yh(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function zE(e){let t=1;const r=new gh(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const VE=typeof gh=="function"?zE:yh;class HE{enqueueTask(t){const{queue:r,requestFlush:n}=this;r.length||(n(),this.flushing=!0),r[r.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const r=this.index;if(this.index++,t[r].call(),this.index>this.capacity){for(let n=0,s=t.length-this.index;n<s;n++)t[n]=t[n+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=VE(this.flush),this.requestErrorThrow=yh(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class QE{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,r){this.onError=t,this.release=r,this.task=null}}class GE{create(t){const r=this.freeTasks,n=r.length?r.pop():new QE(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const vh=new HE,WE=new GE(vh.registerPendingError);function KE(e){vh.enqueueTask(WE.create(e))}function YE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ZE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function XE(e,t,r){return t&&ZE(e.prototype,t),e}function bn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function JE(e,t){return n1(e)||r1(e,t)||t1(e,t)||e1()}function e1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
497
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function t1(e,t){if(e){if(typeof e=="string")return eu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eu(e,t)}}function eu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function r1(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,a,o;try{for(r=r.call(e);!(s=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));s=!0);}catch(l){i=!0,o=l}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw o}}return n}}function n1(e){if(Array.isArray(e))return e}function s1(e){var t=$E().toString();switch(e){case Gt.SOURCE:return"S".concat(t);case Gt.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function tu(e){switch(e[0]){case"S":return Gt.SOURCE;case"T":return Gt.TARGET;default:he(!1,"Cannot parse handler ID: ".concat(e))}}function ru(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,a=JE(s.value,2),o=a[1];if(o===t)return!0;n=!!i}while(!n);return!1}var i1=function(){function e(t){YE(this,e),bn(this,"types",new Map),bn(this,"dragSources",new Map),bn(this,"dropTargets",new Map),bn(this,"pinnedSourceId",null),bn(this,"pinnedSource",null),bn(this,"store",void 0),this.store=t}return XE(e,[{key:"addSource",value:function(r,n){No(r),qE(n);var s=this.addHandler(Gt.SOURCE,r,n);return this.store.dispatch(bE(s)),s}},{key:"addTarget",value:function(r,n){No(r,!0),UE(n);var s=this.addHandler(Gt.TARGET,r,n);return this.store.dispatch(wE(s)),s}},{key:"containsHandler",value:function(r){return ru(this.dragSources,r)||ru(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;he(this.isSourceId(r),"Expected a valid source ID.");var s=n&&r===this.pinnedSourceId,i=s?this.pinnedSource:this.dragSources.get(r);return i}},{key:"getTarget",value:function(r){return he(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return he(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return he(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=tu(r);return n===Gt.SOURCE}},{key:"isTargetId",value:function(r){var n=tu(r);return n===Gt.TARGET}},{key:"removeSource",value:function(r){var n=this;he(this.getSource(r),"Expected an existing source."),this.store.dispatch(CE(r)),KE(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){he(this.getTarget(r),"Expected an existing target."),this.store.dispatch(SE(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);he(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){he(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=s1(r);return this.types.set(i,n),r===Gt.SOURCE?this.dragSources.set(i,s):r===Gt.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function a1(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=o1(n),i=new ME(s,new i1(s)),a=new lE(s,i),o=e(a,t,r);return a.receiveBackend(o),a}function o1(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return ph(NE,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var l1=["children"];function c1(e,t){return h1(e)||f1(e,t)||d1(e,t)||u1()}function u1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
498
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function d1(e,t){if(e){if(typeof e=="string")return nu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nu(e,t)}}function nu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f1(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,a,o;try{for(r=r.call(e);!(s=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));s=!0);}catch(l){i=!0,o=l}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw o}}return n}}function h1(e){if(Array.isArray(e))return e}function p1(e,t){if(e==null)return{};var r=m1(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function m1(e,t){if(e==null)return{};var r={},n=Object.keys(e),s,i;for(i=0;i<n.length;i++)s=n[i],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}var su=0,xi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),g1=m.memo(function(t){var r=t.children,n=p1(t,l1),s=y1(n),i=c1(s,2),a=i[0],o=i[1];return m.useEffect(function(){if(o){var l=bh();return++su,function(){--su===0&&(l[xi]=null)}}},[]),c.jsx(fh.Provider,Object.assign({value:a},{children:r}),void 0)});function y1(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=v1(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function v1(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:bh(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[xi]||(s[xi]={dragDropManager:a1(e,t,r,n)}),s[xi]}function bh(){return typeof global<"u"?global:window}function b1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C1(e,t,r){return t&&w1(e.prototype,t),e}function iu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Da=!1,Na=!1,S1=function(){function e(t){b1(this,e),iu(this,"internalMonitor",void 0),iu(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return C1(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){he(!Da,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Da=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Da=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;he(!Na,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Na=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Na=!1}}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"isDraggingSource",value:function(r){return this.internalMonitor.isDraggingSource(r)}},{key:"isOverTarget",value:function(r,n){return this.internalMonitor.isOverTarget(r,n)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(r){return this.internalMonitor.subscribeToOffsetChange(r)}},{key:"canDragSource",value:function(r){return this.internalMonitor.canDragSource(r)}},{key:"canDropOnTarget",value:function(r){return this.internalMonitor.canDropOnTarget(r)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function x1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function T1(e,t,r){return t&&_1(e.prototype,t),e}function au(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ra=!1,E1=function(){function e(t){x1(this,e),au(this,"internalMonitor",void 0),au(this,"targetId",null),this.internalMonitor=t.getMonitor()}return T1(e,[{key:"receiveHandlerId",value:function(r){this.targetId=r}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;he(!Ra,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Ra=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Ra=!1}}},{key:"isOver",value:function(r){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,r):!1}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function I1(e){if(typeof e.type!="string"){var t=e.type.displayName||e.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(t," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}}function O1(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!m.isValidElement(t)){var n=t;return e(n,r),n}var s=t;I1(s);var i=r?function(a){return e(a,r)}:e;return A1(s,i)}}function wh(e){var t={};return Object.keys(e).forEach(function(r){var n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{var s=O1(n);t[r]=function(){return s}}}),t}function ou(e,t){typeof e=="function"?e(t):e.current=t}function A1(e,t){var r=e.ref;return he(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?m.cloneElement(e,{ref:function(s){ou(r,s),ou(t,s)}}):m.cloneElement(e,{ref:t})}function _i(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_i=function(r){return typeof r}:_i=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_i(e)}function Ro(e){return e!==null&&_i(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function ko(e,t,r,n){var s=void 0;if(s!==void 0)return!!s;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var o=Object.prototype.hasOwnProperty.bind(t),l=0;l<i.length;l++){var u=i[l];if(!o(u))return!1;var f=e[u],d=t[u];if(s=void 0,s===!1||s===void 0&&f!==d)return!1}return!0}function D1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function N1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function R1(e,t,r){return t&&N1(e.prototype,t),e}function mt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var k1=function(){function e(t){var r=this;D1(this,e),mt(this,"hooks",wh({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,Ro(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,Ro(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),mt(this,"handlerId",null),mt(this,"dragSourceRef",null),mt(this,"dragSourceNode",void 0),mt(this,"dragSourceOptionsInternal",null),mt(this,"dragSourceUnsubscribe",void 0),mt(this,"dragPreviewRef",null),mt(this,"dragPreviewNode",void 0),mt(this,"dragPreviewOptionsInternal",null),mt(this,"dragPreviewUnsubscribe",void 0),mt(this,"lastConnectedHandlerId",null),mt(this,"lastConnectedDragSource",null),mt(this,"lastConnectedDragSourceOptions",null),mt(this,"lastConnectedDragPreview",null),mt(this,"lastConnectedDragPreviewOptions",null),mt(this,"backend",void 0),this.backend=t}return R1(e,[{key:"receiveHandlerId",value:function(r){this.handlerId!==r&&(this.handlerId=r,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(r){this.dragSourceOptionsInternal=r}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(r){this.dragPreviewOptionsInternal=r}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var r=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();if(n&&this.disconnectDragSource(),!!this.handlerId){if(!r){this.lastConnectedDragSource=r;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=r,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,r,this.dragSourceOptions))}}},{key:"reconnectDragPreview",value:function(){var r=this.dragPreview,n=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(n&&this.disconnectDragPreview(),!!this.handlerId){if(!r){this.lastConnectedDragPreview=r;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=r,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,r,this.dragPreviewOptions))}}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!ko(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!ko(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}]),e}();function j1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function P1(e,t,r){return t&&L1(e.prototype,t),e}function ir(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var F1=function(){function e(t){var r=this;j1(this,e),ir(this,"hooks",wh({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,Ro(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),ir(this,"handlerId",null),ir(this,"dropTargetRef",null),ir(this,"dropTargetNode",void 0),ir(this,"dropTargetOptionsInternal",null),ir(this,"unsubscribeDropTarget",void 0),ir(this,"lastConnectedHandlerId",null),ir(this,"lastConnectedDropTarget",null),ir(this,"lastConnectedDropTargetOptions",null),ir(this,"backend",void 0),this.backend=t}return P1(e,[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var r=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();r&&this.disconnectDropTarget();var n=this.dropTarget;if(this.handlerId){if(!n){this.lastConnectedDropTarget=n;return}r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions))}}},{key:"receiveHandlerId",value:function(r){r!==this.handlerId&&(this.handlerId=r,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(r){this.dropTargetOptionsInternal=r}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!ko(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}]),e}();function M1(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function B1(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var fn=typeof window<"u"?m.useLayoutEffect:m.useEffect;function Ti(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ti=function(r){return typeof r}:Ti=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ti(e)}function $1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function q1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function U1(e,t,r){return t&&q1(e.prototype,t),e}function ka(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var z1=function(){function e(t,r,n){$1(this,e),ka(this,"spec",void 0),ka(this,"monitor",void 0),ka(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return U1(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return Ti(n.item)==="object"?i=n.item:typeof n.item=="function"?i=n.item(s):i={},(r=i)!==null&&r!==void 0?r:null}},{key:"canDrag",value:function(){var r=this.spec,n=this.monitor;return typeof r.canDrag=="boolean"?r.canDrag:typeof r.canDrag=="function"?r.canDrag(n):!0}},{key:"isDragging",value:function(r,n){var s=this.spec,i=this.monitor,a=s.isDragging;return a?a(i):n===r.getSourceId()}},{key:"endDrag",value:function(){var r=this.spec,n=this.monitor,s=this.connector,i=r.end;i&&i(n.getItem(),n),s.reconnect()}}]),e}();function V1(e,t,r){var n=m.useMemo(function(){return new z1(e,t,r)},[t,r]);return m.useEffect(function(){n.spec=e},[e]),n}function hn(){var e=m.useContext(fh),t=e.dragDropManager;return he(t!=null,"Expected drag drop context"),t}function H1(e){return m.useMemo(function(){var t=e.type;return he(t!=null,"spec.type must be defined"),t},[e])}function Q1(e,t){return Y1(e)||K1(e,t)||W1(e,t)||G1()}function G1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
499
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function W1(e,t){if(e){if(typeof e=="string")return lu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return lu(e,t)}}function lu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function K1(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,a,o;try{for(r=r.call(e);!(s=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));s=!0);}catch(l){i=!0,o=l}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw o}}return n}}function Y1(e){if(Array.isArray(e))return e}function Z1(e,t,r){var n=hn(),s=V1(e,t,r),i=H1(e);fn(function(){if(i!=null){var o=B1(i,s,n),l=Q1(o,2),u=l[0],f=l[1];return t.receiveHandlerId(u),r.receiveHandlerId(u),f}},[n,t,r,s,i])}function X1(e){return rI(e)||tI(e)||eI(e)||J1()}function J1(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
500
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eI(e,t){if(e){if(typeof e=="string")return jo(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return jo(e,t)}}function tI(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function rI(e){if(Array.isArray(e))return jo(e)}function jo(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ch(e,t){var r=X1(t||[]);return t==null&&typeof e!="function"&&r.push(e),m.useMemo(function(){return typeof e=="function"?e():e},r)}function nI(){var e=hn();return m.useMemo(function(){return new S1(e)},[e])}function sI(e,t){var r=hn(),n=m.useMemo(function(){return new k1(r.getBackend())},[r]);return fn(function(){return n.dragSourceOptions=e||null,n.reconnect(),function(){return n.disconnectDragSource()}},[n,e]),fn(function(){return n.dragPreviewOptions=t||null,n.reconnect(),function(){return n.disconnectDragPreview()}},[n,t]),n}var iI=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var a=i[s];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r};const aI=cf(iI);function oI(e,t){return dI(e)||uI(e,t)||cI(e,t)||lI()}function lI(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
501
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cI(e,t){if(e){if(typeof e=="string")return cu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return cu(e,t)}}function cu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function uI(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,a,o;try{for(r=r.call(e);!(s=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));s=!0);}catch(l){i=!0,o=l}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw o}}return n}}function dI(e){if(Array.isArray(e))return e}function Sh(e,t,r){var n=m.useState(function(){return t(e)}),s=oI(n,2),i=s[0],a=s[1],o=m.useCallback(function(){var l=t(e);aI(i,l)||(a(l),r&&r())},[i,e,r]);return fn(o),[i,o]}function fI(e,t){return gI(e)||mI(e,t)||pI(e,t)||hI()}function hI(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
502
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pI(e,t){if(e){if(typeof e=="string")return uu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return uu(e,t)}}function uu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function mI(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,a,o;try{for(r=r.call(e);!(s=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));s=!0);}catch(l){i=!0,o=l}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw o}}return n}}function gI(e){if(Array.isArray(e))return e}function yI(e,t,r){var n=Sh(e,t,r),s=fI(n,2),i=s[0],a=s[1];return fn(function(){var l=e.getHandlerId();if(l!=null)return e.subscribeToStateChange(a,{handlerIds:[l]})},[e,a]),i}function xh(e,t,r){return yI(t,e||function(){return{}},function(){return r.reconnect()})}function vI(e){return m.useMemo(function(){return e.hooks.dragSource()},[e])}function bI(e){return m.useMemo(function(){return e.hooks.dragPreview()},[e])}function wI(e,t){var r=Ch(e,t);he(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");var n=nI(),s=sI(r.options,r.previewOptions);return Z1(r,n,s),[xh(r.collect,n,s),vI(s),bI(s)]}function CI(e){var t=e.accept;return m.useMemo(function(){return he(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function SI(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xI(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _I(e,t,r){return t&&xI(e.prototype,t),e}function du(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var TI=function(){function e(t,r){SI(this,e),du(this,"spec",void 0),du(this,"monitor",void 0),this.spec=t,this.monitor=r}return _I(e,[{key:"canDrop",value:function(){var r=this.spec,n=this.monitor;return r.canDrop?r.canDrop(n.getItem(),n):!0}},{key:"hover",value:function(){var r=this.spec,n=this.monitor;r.hover&&r.hover(n.getItem(),n)}},{key:"drop",value:function(){var r=this.spec,n=this.monitor;if(r.drop)return r.drop(n.getItem(),n)}}]),e}();function EI(e,t){var r=m.useMemo(function(){return new TI(e,t)},[t]);return m.useEffect(function(){r.spec=e},[e]),r}function II(e,t){return NI(e)||DI(e,t)||AI(e,t)||OI()}function OI(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
503
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function AI(e,t){if(e){if(typeof e=="string")return fu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fu(e,t)}}function fu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function DI(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,a,o;try{for(r=r.call(e);!(s=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));s=!0);}catch(l){i=!0,o=l}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw o}}return n}}function NI(e){if(Array.isArray(e))return e}function RI(e,t,r){var n=hn(),s=EI(e,t),i=CI(e);fn(function(){var o=M1(i,s,n),l=II(o,2),u=l[0],f=l[1];return t.receiveHandlerId(u),r.receiveHandlerId(u),f},[n,t,s,r,i.map(function(a){return a.toString()}).join("|")])}function kI(){var e=hn();return m.useMemo(function(){return new E1(e)},[e])}function jI(e){var t=hn(),r=m.useMemo(function(){return new F1(t.getBackend())},[t]);return fn(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function LI(e){return m.useMemo(function(){return e.hooks.dropTarget()},[e])}function _h(e,t){var r=Ch(e,t),n=kI(),s=jI(r.options);return RI(r,n,s),[xh(r.collect,n,s),LI(s)]}function PI(e,t){return $I(e)||BI(e,t)||MI(e,t)||FI()}function FI(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
504
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function MI(e,t){if(e){if(typeof e=="string")return hu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return hu(e,t)}}function hu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function BI(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,a,o;try{for(r=r.call(e);!(s=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));s=!0);}catch(l){i=!0,o=l}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw o}}return n}}function $I(e){if(Array.isArray(e))return e}function qI(e){var t=hn(),r=t.getMonitor(),n=Sh(r,e),s=PI(n,2),i=s[0],a=s[1];return m.useEffect(function(){return r.subscribeToOffsetChange(a)}),m.useEffect(function(){return r.subscribeToStateChange(a)}),i}function Th(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function UI(e,t){return e.filter(function(r){return r!==t})}function zI(e,t){var r=new Set,n=function(a){return r.add(a)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i){return s.push(i)}),s}function VI(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function HI(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function QI(e,t,r){return t&&HI(e.prototype,t),e}function pu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var GI=function(){function e(t){VI(this,e),pu(this,"entered",[]),pu(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return QI(e,[{key:"enter",value:function(r){var n=this,s=this.entered.length,i=function(o){return n.isNodeInDocument(o)&&(!o.contains||o.contains(r))};return this.entered=zI(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=UI(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),WI=Th(function(){return/firefox/i.test(navigator.userAgent)}),Eh=Th(function(){return!!window.safari});function KI(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function YI(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ZI(e,t,r){return t&&YI(e.prototype,t),e}function as(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var mu=function(){function e(t,r){KI(this,e),as(this,"xs",void 0),as(this,"ys",void 0),as(this,"c1s",void 0),as(this,"c2s",void 0),as(this,"c3s",void 0);for(var n=t.length,s=[],i=0;i<n;i++)s.push(i);s.sort(function(R,M){return t[R]<t[M]?-1:1});for(var a=[],o=[],l,u,f=0;f<n-1;f++)l=t[f+1]-t[f],u=r[f+1]-r[f],a.push(l),o.push(u/l);for(var d=[o[0]],g=0;g<a.length-1;g++){var p=o[g],w=o[g+1];if(p*w<=0)d.push(0);else{l=a[g];var h=a[g+1],y=l+h;d.push(3*y/((y+h)/p+(y+l)/w))}}d.push(o[o.length-1]);for(var v=[],b=[],C,S=0;S<d.length-1;S++){C=o[S];var _=d[S],E=1/a[S],N=_+d[S+1]-C-C;v.push((C-_-N)*E),b.push(N*E*E)}this.xs=t,this.ys=r,this.c1s=d,this.c2s=v,this.c3s=b}return ZI(e,[{key:"interpolate",value:function(r){var n=this.xs,s=this.ys,i=this.c1s,a=this.c2s,o=this.c3s,l=n.length-1;if(r===n[l])return s[l];for(var u=0,f=o.length-1,d;u<=f;){d=Math.floor(.5*(u+f));var g=n[d];if(g<r)u=d+1;else if(g>r)f=d-1;else return s[d]}l=Math.max(0,f);var p=r-n[l],w=p*p;return s[l]+i[l]*p+a[l]*w+o[l]*p*w}}]),e}(),XI=1;function Ih(e){var t=e.nodeType===XI?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function ti(e){return{x:e.clientX,y:e.clientY}}function JI(e){var t;return e.nodeName==="IMG"&&(WI()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function eO(e,t,r,n){var s=e?t.width:r,i=e?t.height:n;return Eh()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function tO(e,t,r,n,s){var i=JI(t),a=i?e:t,o=Ih(a),l={x:r.x-o.x,y:r.y-o.y},u=e.offsetWidth,f=e.offsetHeight,d=n.anchorX,g=n.anchorY,p=eO(i,t,u,f),w=p.dragPreviewWidth,h=p.dragPreviewHeight,y=function(){var N=new mu([0,.5,1],[l.y,l.y/f*h,l.y+h-f]),R=N.interpolate(g);return Eh()&&i&&(R+=(window.devicePixelRatio-1)*h),R},v=function(){var N=new mu([0,.5,1],[l.x,l.x/u*w,l.x+w-u]);return N.interpolate(d)},b=s.offsetX,C=s.offsetY,S=b===0||b,_=C===0||C;return{x:S?b:v(),y:_?C:y()}}var Oh="__NATIVE_FILE__",Ah="__NATIVE_URL__",Dh="__NATIVE_TEXT__",Nh="__NATIVE_HTML__";const gu=Object.freeze(Object.defineProperty({__proto__:null,FILE:Oh,HTML:Nh,TEXT:Dh,URL:Ah},Symbol.toStringTag,{value:"Module"}));function ja(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var wn;function ri(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Lo=(wn={},ri(wn,Oh,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),ri(wn,Nh,{exposeProperties:{html:function(t,r){return ja(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),ri(wn,Ah,{exposeProperties:{urls:function(t,r){return ja(t,r,"").split(`
|
|
505
|
+
`)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),ri(wn,Dh,{exposeProperties:{text:function(t,r){return ja(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),wn);function rO(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function sO(e,t,r){return t&&nO(e.prototype,t),e}function yu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var iO=function(){function e(t){rO(this,e),yu(this,"item",void 0),yu(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return sO(e,[{key:"initializeExposedProperties",value:function(){var r=this;Object.keys(this.config.exposeProperties).forEach(function(n){Object.defineProperty(r.item,n,{configurable:!0,enumerable:!0,get:function(){return console.warn(`Browser doesn't allow reading "`.concat(n,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(r){var n=this;if(r){var s={};Object.keys(this.config.exposeProperties).forEach(function(i){s[i]={value:n.config.exposeProperties[i](r,n.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,s)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(r,n){return n===r.getSourceId()}},{key:"endDrag",value:function(){}}]),e}();function aO(e,t){var r=new iO(Lo[e]);return r.loadDataTransfer(t),r}function La(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(Lo).filter(function(r){var n=Lo[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function oO(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function cO(e,t,r){return t&&lO(e.prototype,t),e}function Pa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var uO=function(){function e(t,r){oO(this,e),Pa(this,"ownerDocument",null),Pa(this,"globalContext",void 0),Pa(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return cO(e,[{key:"window",get:function(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}},{key:"document",get:function(){var r;return(r=this.globalContext)!==null&&r!==void 0&&r.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var r;return((r=this.optionsArgs)===null||r===void 0?void 0:r.rootElement)||this.window}}]),e}();function vu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function bu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?vu(Object(r),!0).forEach(function(n){be(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function dO(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function hO(e,t,r){return t&&fO(e.prototype,t),e}function be(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var pO=function(){function e(t,r,n){var s=this;dO(this,e),be(this,"options",void 0),be(this,"actions",void 0),be(this,"monitor",void 0),be(this,"registry",void 0),be(this,"enterLeaveCounter",void 0),be(this,"sourcePreviewNodes",new Map),be(this,"sourcePreviewNodeOptions",new Map),be(this,"sourceNodes",new Map),be(this,"sourceNodeOptions",new Map),be(this,"dragStartSourceIds",null),be(this,"dropTargetIds",[]),be(this,"dragEnterTargetIds",[]),be(this,"currentNativeSource",null),be(this,"currentNativeHandle",null),be(this,"currentDragSourceNode",null),be(this,"altKeyPressed",!1),be(this,"mouseMoveTimeoutTimer",null),be(this,"asyncEndDragFrameId",null),be(this,"dragOverTargetIds",null),be(this,"lastClientOffset",null),be(this,"hoverRafId",null),be(this,"getSourceClientOffset",function(i){var a=s.sourceNodes.get(i);return a&&Ih(a)||null}),be(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),be(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),be(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),be(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var a=s.dragStartSourceIds;s.dragStartSourceIds=null;var o=ti(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(a||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:o});var l=i.dataTransfer,u=La(l);if(s.monitor.isDragging()){if(l&&typeof l.setDragImage=="function"){var f=s.monitor.getSourceId(),d=s.sourceNodes.get(f),g=s.sourcePreviewNodes.get(f)||d;if(g){var p=s.getCurrentSourcePreviewNodeOptions(),w=p.anchorX,h=p.anchorY,y=p.offsetX,v=p.offsetY,b={anchorX:w,anchorY:h},C={offsetX:y,offsetY:v},S=tO(d,g,o,b,C);l.setDragImage(g,S.x,S.y)}}try{l==null||l.setData("application/json",{})}catch{}s.setCurrentDragSourceNode(i.target);var _=s.getCurrentSourcePreviewNodeOptions(),E=_.captureDraggingState;E?s.actions.publishDragSource():setTimeout(function(){return s.actions.publishDragSource()},0)}else if(u)s.beginDragNativeItem(u);else{if(l&&!l.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}}}),be(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var a=s.enterLeaveCounter.enter(i.target);if(!(!a||s.monitor.isDragging())){var o=i.dataTransfer,l=La(o);l&&s.beginDragNativeItem(l,o)}}),be(this,"handleTopDragEnter",function(i){var a=s.dragEnterTargetIds;if(s.dragEnterTargetIds=[],!!s.monitor.isDragging()){s.altKeyPressed=i.altKey,a.length>0&&s.actions.hover(a,{clientOffset:ti(i)});var o=a.some(function(l){return s.monitor.canDropOnTarget(l)});o&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),be(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),be(this,"handleTopDragOver",function(i){var a=s.dragOverTargetIds;if(s.dragOverTargetIds=[],!s.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}s.altKeyPressed=i.altKey,s.lastClientOffset=ti(i),s.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(s.hoverRafId=requestAnimationFrame(function(){s.monitor.isDragging()&&s.actions.hover(a||[],{clientOffset:s.lastClientOffset}),s.hoverRafId=null}));var o=(a||[]).some(function(l){return s.monitor.canDropOnTarget(l)});o?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect())):s.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))}),be(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var a=s.enterLeaveCounter.leave(i.target);a&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),be(this,"handleTopDropCapture",function(i){if(s.dropTargetIds=[],s.isDraggingNativeItem()){var a;i.preventDefault(),(a=s.currentNativeSource)===null||a===void 0||a.loadDataTransfer(i.dataTransfer)}else La(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),be(this,"handleTopDrop",function(i){var a=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(a,{clientOffset:ti(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleSelectStart",function(i){var a=i.target;typeof a.dragDrop=="function"&&(a.tagName==="INPUT"||a.tagName==="SELECT"||a.tagName==="TEXTAREA"||a.isContentEditable||(i.preventDefault(),a.dragDrop()))}),this.options=new uO(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new GI(this.isNodeInDocument)}return hO(e,[{key:"profile",value:function(){var r,n;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((r=this.dragStartSourceIds)===null||r===void 0?void 0:r.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((n=this.dragOverTargetIds)===null||n===void 0?void 0:n.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var r=this.rootElement;if(r!==void 0){if(r.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");r.__isReactDndBackendSetUp=!0,this.addEventListeners(r)}}},{key:"teardown",value:function(){var r=this.rootElement;if(r!==void 0&&(r.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var n;(n=this.window)===null||n===void 0||n.cancelAnimationFrame(this.asyncEndDragFrameId)}}},{key:"connectDragPreview",value:function(r,n,s){var i=this;return this.sourcePreviewNodeOptions.set(r,s),this.sourcePreviewNodes.set(r,n),function(){i.sourcePreviewNodes.delete(r),i.sourcePreviewNodeOptions.delete(r)}}},{key:"connectDragSource",value:function(r,n,s){var i=this;this.sourceNodes.set(r,n),this.sourceNodeOptions.set(r,s);var a=function(u){return i.handleDragStart(u,r)},o=function(u){return i.handleSelectStart(u)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",a),n.addEventListener("selectstart",o),function(){i.sourceNodes.delete(r),i.sourceNodeOptions.delete(r),n.removeEventListener("dragstart",a),n.removeEventListener("selectstart",o),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(r,n){var s=this,i=function(u){return s.handleDragEnter(u,r)},a=function(u){return s.handleDragOver(u,r)},o=function(u){return s.handleDrop(u,r)};return n.addEventListener("dragenter",i),n.addEventListener("dragover",a),n.addEventListener("drop",o),function(){n.removeEventListener("dragenter",i),n.removeEventListener("dragover",a),n.removeEventListener("drop",o)}}},{key:"addEventListeners",value:function(r){r.addEventListener&&(r.addEventListener("dragstart",this.handleTopDragStart),r.addEventListener("dragstart",this.handleTopDragStartCapture,!0),r.addEventListener("dragend",this.handleTopDragEndCapture,!0),r.addEventListener("dragenter",this.handleTopDragEnter),r.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),r.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),r.addEventListener("dragover",this.handleTopDragOver),r.addEventListener("dragover",this.handleTopDragOverCapture,!0),r.addEventListener("drop",this.handleTopDrop),r.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(r){r.removeEventListener&&(r.removeEventListener("dragstart",this.handleTopDragStart),r.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),r.removeEventListener("dragend",this.handleTopDragEndCapture,!0),r.removeEventListener("dragenter",this.handleTopDragEnter),r.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),r.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),r.removeEventListener("dragover",this.handleTopDragOver),r.removeEventListener("dragover",this.handleTopDragOverCapture,!0),r.removeEventListener("drop",this.handleTopDrop),r.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var r=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(r);return bu({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var r=this.monitor.getSourceId(),n=this.sourcePreviewNodeOptions.get(r);return bu({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(gu).some(function(n){return gu[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=aO(r,n),this.currentNativeHandle=this.registry.addSource(r,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(r){var n=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=r;var s=1e3;this.mouseMoveTimeoutTimer=setTimeout(function(){var i;return(i=n.rootElement)===null||i===void 0?void 0:i.addEventListener("mousemove",n.endDragIfSourceWasRemovedFromDOM,!0)},s)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var r;(r=this.window)===null||r===void 0||r.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(r,n){r.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}},{key:"handleDragEnter",value:function(r,n){this.dragEnterTargetIds.unshift(n)}},{key:"handleDragOver",value:function(r,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}},{key:"handleDrop",value:function(r,n){this.dropTargetIds.unshift(n)}}]),e}(),ni;function mO(){return ni||(ni=new Image,ni.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),ni}var gO=function(t,r,n){return new pO(t,r,n)};function yO(e,t){return typeof e=="function"?e(t):e??"NODE"}function vO(e){return e.isDraggable&&!e.isEditing}function bO(e){const t=Rt(),r=t.selectedIds,[n,s,i]=wI(()=>({canDrag:()=>vO(e),type:yO(t.props.dragType,e),item:()=>{const a=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(Vn.dragStart(e.id,a)),{id:e.id,dragIds:a,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Vn.dragEnd())}}),[r,e,t.props.dragType]);return m.useEffect(()=>{i(mO())},[i]),s}function wO(e,t){const r=e.getBoundingClientRect(),n=t.x-Math.round(r.x),s=t.y-Math.round(r.y),i=r.height,a=s<i/2,o=!a,l=i/4,u=s>l&&s<i-l;return{x:n,inTopHalf:a,inBottomHalf:o,inMiddle:u,atTop:!u&&a,atBottom:!u&&o}}function CO(e,t,r,n){return e?e.isInternal?n.atTop?[t,e]:n.inMiddle?[e,e]:[e,r]:n.inTopHalf?[t,e]:[e,r]:[t,null]}function si(e,t){return{parentId:e||null,index:t}}function Cn(e,t){return{type:"line",index:e,level:t}}function SO(e){return{type:"highlight",id:e}}function Fa(e,t){var r;let n=e;for(;n.parent&&n.level>t;)n=n.parent;const s=((r=n.parent)===null||r===void 0?void 0:r.id)||null,i=rh(n)+1;return{parentId:s,index:i}}function Rh(e){var t;const r=wO(e.element,e.offset),n=e.indent,s=Math.round(Math.max(0,r.x-n)/n),{node:i,nextNode:a,prevNode:o}=e,[l,u]=CO(i,o,a,r);if(i&&i.isInternal&&r.inMiddle)return{drop:si(i.id,null),cursor:SO(i.id)};if(!l)return{drop:si((t=u==null?void 0:u.parent)===null||t===void 0?void 0:t.id,0),cursor:Cn(0,0)};if(Xf(l)){const f=vi(s,(u==null?void 0:u.level)||0,l.level);return{drop:Fa(l,f),cursor:Cn(l.rowIndex+1,f)}}if(Jf(l)){const f=vi(s,(u==null?void 0:u.level)||0,l.level);return{drop:Fa(l,f),cursor:Cn(l.rowIndex+1,f)}}if(eh(l)){const f=vi(s,0,l.level+1);return f>l.level?{drop:si(l.id,0),cursor:Cn(l.rowIndex+1,f)}:{drop:Fa(l,f),cursor:Cn(l.rowIndex+1,f)}}return{drop:si(l==null?void 0:l.id,0),cursor:Cn(l.rowIndex+1,l.level+1)}}function xO(e,t){const r=Rt(),[n,s]=_h(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,a)=>{const o=a.getClientOffset();if(!e.current||!o)return;const{cursor:l,drop:u}=Rh({element:e.current,offset:o,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});u&&r.dispatch(Vn.hovering(u.parentId,u.index)),a.canDrop()?l&&r.showCursor(l):r.hideCursor()},drop:(i,a)=>{if(!a.canDrop())return null;r.drop()}}),[t,e.current,r.props]);return s}function _O(e){const t=Rt(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return m.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const wu=m.memo(function({index:t,style:r}){Zf(),U0();const n=Rt(),s=_O(t),i=m.useRef(null),a=bO(s),o=xO(i,s),l=m.useCallback(h=>{i.current=h,o(h)},[o]),u=n.indent*s.level,f=m.useMemo(()=>({paddingLeft:u}),[u]),d=m.useMemo(()=>{var h,y;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((y=(h=n.props.padding)!==null&&h!==void 0?h:n.props.paddingTop)!==null&&y!==void 0?y:0),minWidth:"max-content"})},[r,n.props.padding,n.props.paddingTop]),g={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:d,tabIndex:-1,className:n.props.rowClassName};m.useEffect(()=>{var h;!s.isEditing&&s.isFocused&&((h=i.current)===null||h===void 0||h.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,i.current]);const p=n.renderNode,w=n.renderRow;return c.jsx(w,{node:s,innerRef:l,attrs:g,children:c.jsx(p,{node:s,tree:n,style:f,dragHandle:a})})});let Ma="",Cu=null;function kh(){Zf();const e=Rt();return c.jsx("div",{role:"tree","aria-label":e.props["aria-label"],"aria-labelledby":e.props["aria-labelledby"],"aria-multiselectable":!e.props.disableMultiSelection||void 0,style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{var r;if(e.isEditing)return;if(t.key==="Backspace"){if(!e.props.onDelete)return;const s=Array.from(e.selectedIds);if(s.length>1){let i=e.mostRecentNode;for(;i&&i.isSelected;)i=i.nextSibling;i||(i=e.lastNode),e.focus(i,{scroll:!1}),e.delete(Array.from(s))}else{const i=e.focusedNode;if(i){const a=i.nextSibling,o=i.parent;e.focus(a||o,{scroll:!1}),e.delete(i)}}return}if(t.key==="Tab"&&!t.shiftKey){t.preventDefault(),nh(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),sh(t.currentTarget);return}if(t.key==="ArrowDown"){t.preventDefault();const s=e.nextNode;if(t.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}else if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.firstNode);return}}if(t.key==="ArrowUp"){t.preventDefault();const s=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.lastNode);return}}if(t.key==="ArrowRight"){const s=e.focusedNode;if(!s)return;s.isInternal&&s.isOpen?e.focus(e.nextNode):s.isInternal&&e.open(s.id);return}if(t.key==="ArrowLeft"){const s=e.focusedNode;if(!s||s.isRoot)return;s.isInternal&&s.isOpen?e.close(s.id):!((r=s.parent)===null||r===void 0)&&r.isRoot||e.focus(s.parent);return}if(t.key==="a"&&(t.metaKey||t.ctrlKey)&&!e.props.disableMultiSelection){t.preventDefault(),e.selectAll();return}if(t.key==="a"&&!t.metaKey&&!t.ctrlKey&&e.props.onCreate){e.createLeaf();return}if(t.key==="A"&&!t.metaKey&&!t.ctrlKey){if(!e.props.onCreate)return;e.createInternal();return}if(t.key==="Home"){t.preventDefault(),e.focus(e.firstNode);return}if(t.key==="End"){t.preventDefault(),e.focus(e.lastNode);return}if(t.key==="Enter"){const s=e.focusedNode;if(!s||!s.isEditable||!e.props.onRename)return;setTimeout(()=>{s&&e.edit(s)});return}if(t.key===" "){t.preventDefault();const s=e.focusedNode;if(!s)return;s.isLeaf?(s.select(),s.activate()):s.toggle();return}if(t.key==="*"){const s=e.focusedNode;if(!s)return;e.openSiblings(s);return}if(t.key==="PageUp"){t.preventDefault(),e.pageUp();return}t.key==="PageDown"&&(t.preventDefault(),e.pageDown()),clearTimeout(Cu),Ma+=t.key,Cu=setTimeout(()=>{Ma=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(Ma):!1});n&&e.focus(n.id)},children:c.jsx(TO,{})})}function TO(){var e,t;const r=Rt(),n={className:r.props.className,outerRef:r.listEl,itemCount:r.visibleNodes.length,height:r.height,width:r.width,overscanCount:r.overscanCount,itemKey:s=>{var i;return((i=r.visibleNodes[s])===null||i===void 0?void 0:i.id)||s},outerElementType:(e=r.props.outerElementType)!==null&&e!==void 0?e:DT,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:kT,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?c.jsx(ET,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:wu})):c.jsx(IT,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:wu}))}function Su(e){return e.isFiltered?IO(e.root,e.isMatch.bind(e)):EO(e.root)}function EO(e){const t=[];function r(n){var s;n.level>=0&&t.push(n),n.isOpen&&((s=n.children)===null||s===void 0||s.forEach(r))}return r(e),t.forEach(jh),t}function IO(e,t){const r={},n=[];function s(a){if(!a.isRoot&&t(a)){r[a.id]=!0;let l=a.parent;for(;l;)r[l.id]=!0,l=l.parent}if(a.children)for(let l of a.children)s(l)}function i(a){var o;a.level>=0&&r[a.id]&&n.push(a),a.isOpen&&((o=a.children)===null||o===void 0||o.forEach(i))}return s(e),i(e),n.forEach(jh),n}function jh(e,t){e.rowIndex=t}const xu=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var Ba=function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function o(f){try{u(n.next(f))}catch(d){a(d)}}function l(f){try{u(n.throw(f))}catch(d){a(d)}}function u(f){f.done?i(f.value):s(f.value).then(o,l)}u((n=n.apply(e,t||[])).next())})};const{safeRun:gt}=G0;class ws{constructor(t,r,n,s){this.store=t,this.props=r,this.list=n,this.listEl=s,this.visibleStartIndex=0,this.visibleStopIndex=0,this.rowOffsets=null,this.rowHeightAt=i=>{const a=this.props.rowHeight;if(typeof a=="function"){const o=this.at(i);return o?a(o):this.rowHeight}return a??24},this.rowTopPosition=i=>{if(typeof this.props.rowHeight!="function")return i*this.rowHeight;const a=this.getRowOffsets(),o=Math.max(0,Math.min(i,a.length-1));return a[o]},this.redrawList=(i=0)=>{this.rowOffsets=null;const a=this.list.current;a&&"resetAfterIndex"in a&&a.resetAfterIndex(Math.max(0,i))},this.root=Nc(this),this.visibleNodes=Su(this),this.idToIndex=xu(this.visibleNodes)}update(t){this.props=t,this.root=Nc(this),this.visibleNodes=Su(this),this.idToIndex=xu(this.visibleNodes),this.rowOffsets=null;const r=this.list.current;r&&"resetAfterIndex"in r&&r.resetAfterIndex(0,!1)}dispatch(t){return this.store.dispatch(t)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var t;return(t=this.props.width)!==null&&t!==void 0?t:300}get height(){var t;return(t=this.props.height)!==null&&t!==void 0?t:500}get indent(){var t;return(t=this.props.indent)!==null&&t!==void 0?t:24}get rowHeight(){return typeof this.props.rowHeight=="number"?this.props.rowHeight:24}getRowOffsets(){if(this.rowOffsets)return this.rowOffsets;const t=[0];for(let r=0;r<this.visibleNodes.length;r++)t.push(t[r]+this.rowHeightAt(r));return this.rowOffsets=t,t}get overscanCount(){var t;return(t=this.props.overscanCount)!==null&&t!==void 0?t:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var t;const r=(t=this.props.searchMatch)!==null&&t!==void 0?t:(n,s)=>JSON.stringify(Object.values(n.data)).toLocaleLowerCase().includes(s.toLocaleLowerCase());return n=>r(n,this.searchTerm)}accessChildren(t){var r;const n=this.props.childrenAccessor||"children";return(r=ps(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=ps(t,r);if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}identify(t){if(typeof t=="string")return t;if(t instanceof Ds)return t.id;const r=this.props.idAccessor||"id";return ps(t,r)}identifyNull(t){return t==null?null:this.identify(t)}get firstNode(){var t;return(t=this.visibleNodes[0])!==null&&t!==void 0?t:null}get lastNode(){var t;return(t=this.visibleNodes[this.visibleNodes.length-1])!==null&&t!==void 0?t:null}get focusedNode(){var t;return(t=this.get(this.state.nodes.focus.id))!==null&&t!==void 0?t:null}get mostRecentNode(){var t;return(t=this.get(this.state.nodes.selection.mostRecent))!==null&&t!==void 0?t:null}get nextNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t+1)}get prevNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t-1)}get(t){return t&&t in this.idToIndex&&this.visibleNodes[this.idToIndex[t]]||null}at(t){return this.visibleNodes[t]||null}nodesBetween(t,r){var n;if(t===null||r===null)return[];const s=(n=this.indexOf(t))!==null&&n!==void 0?n:0,i=this.indexOf(r);if(i===null)return[];const a=Math.min(s,i),o=Math.max(s,i);return this.visibleNodes.slice(a,o+1)}indexOf(t){const r=this.identifyNull(t);return r?this.idToIndex[r]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return Ba(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?lh(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:oh(this),a=(n=t.type)!==null&&n!==void 0?n:"leaf",o=yield gt(this.props.onCreate,{type:a,parentId:s,index:i,parentNode:this.get(s)});o&&(this.focus(o),setTimeout(()=>{this.edit(o).then(()=>{this.select(o),this.activate(o)})}))})}delete(t){return Ba(this,void 0,void 0,function*(){if(!t)return;const n=(Array.isArray(t)?t:[t]).map(a=>this.identify(a)),s=n.map(a=>this.get(a)).filter(a=>!!a),i=s.length?Math.min(...s.map(a=>{var o;return(o=a.rowIndex)!==null&&o!==void 0?o:0})):0;yield gt(this.props.onDelete,{nodes:s,ids:n}),this.redrawList(i)})}edit(t){var r,n;const s=this.identify(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(s),this.dispatch(Ia(s)),this.redrawList((n=(r=this.get(s))===null||r===void 0?void 0:r.rowIndex)!==null&&n!==void 0?n:0),new Promise(i=>{ws.editPromise=i})}submit(t,r){return Ba(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield gt(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(Ia(null)),this.resolveEdit({cancelled:!1,value:r}),this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(Ia(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&>(this.props.onActivate,r)}resolveEdit(t){const r=ws.editPromise;r&&r(t),ws.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let t=[];for(let r of Array.from(this.selectedIds)){const n=this.get(r);n&&t.push(n)}return t}focus(t,r={}){t&&(this.props.selectionFollowsFocus?this.select(t):(this.dispatch(gn(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&>(this.props.onFocus,this.focusedNode)))}pageUp(){var t,r;const n=this.visibleStartIndex,i=this.visibleStopIndex-n;let a=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;a>n?a=n:a=Math.max(n-i,0),this.focus(this.at(a))}pageDown(){var t,r;const n=this.visibleStartIndex,s=this.visibleStopIndex,i=s-n;let a=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;a<s?a=s:a=Math.min(a+i,this.visibleNodes.length-1),this.focus(this.at(a))}select(t,r={}){var n;if(!t)return;const s=r.focus!==!1,i=this.identify(t);s&&this.dispatch(gn(i)),!((n=this.get(i))===null||n===void 0)&&n.isSelectable&&this.setSelection({ids:[i],anchor:i,mostRecent:i}),this.scrollTo(i,r.align),this.focusedNode&&s&>(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(Tr.remove(r)),gt(this.props.onSelect,this.selectedNodes)}selectMulti(t,r={}){const n=this.get(this.identifyNull(t));if(!n)return;const s=r.focus!==!1;s&&this.dispatch(gn(n.id)),n.isSelectable&&(this.dispatch(Tr.add(n.id)),this.dispatch(Tr.anchor(n.id)),this.dispatch(Tr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&>(this.props.onFocus,this.focusedNode),gt(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(gn(n)),!((r=this.get(n))===null||r===void 0)&&r.isSelectable){const{anchor:s,mostRecent:i}=this.state.nodes.selection,a=this.filterSelectableNodes(this.nodesBetween(s,this.identifyNull(n)));this.dispatch(Tr.remove(this.nodesBetween(s,i))),this.dispatch(Tr.add(a)),this.dispatch(Tr.mostRecent(n))}this.scrollTo(n),this.focusedNode&>(this.props.onFocus,this.focusedNode),gt(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null})}selectAll(){var t,r,n;const s=this.filterSelectableNodes(Object.keys(this.idToIndex));this.setSelection({ids:s,anchor:(t=s[0])!==null&&t!==void 0?t:null,mostRecent:(r=s[s.length-1])!==null&&r!==void 0?r:null}),this.dispatch(gn((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&>(this.props.onFocus,this.focusedNode)}filterSelectableNodes(t){return t.map(r=>this.get(this.identify(r))).filter(r=>!!r&&r.isSelectable)}setSelection(t){var r;const n=new Set((r=t.ids)===null||r===void 0?void 0:r.map(a=>this.identify(a))),s=this.identifyNull(t.anchor),i=this.identifyNull(t.mostRecent);this.dispatch(Tr.set({ids:n,anchor:s,mostRecent:i})),gt(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:t}=this.state.dnd;switch(t.type){case"highlight":return t.id;default:return null}}get cursorOverFolder(){return this.state.dnd.cursor.type==="highlight"}get dragNodes(){return this.state.dnd.dragIds.map(t=>this.get(t)).filter(t=>!!t)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){var t;if(this.isFiltered)return!1;const r=(t=this.get(this.state.dnd.parentId))!==null&&t!==void 0?t:this.root,n=this.dragNodes,s=this.props.disableDrop;for(const i of n)if(!i||!r||i.isInternal&&th(r,i))return!1;return typeof s=="function"?!s({parentNode:r,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof s=="string"?!r.data[s]:typeof s=="boolean"?!s:!0}drop(){const{parentId:t,index:r,dragIds:n}=this.state.dnd;gt(this.props.onMove,{dragIds:n,parentId:t===As?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Vn.cursor({type:"none"}))}showCursor(t){this.dispatch(Vn.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(Io.open(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),gt(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(Io.close(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),gt(this.props.onToggle,i))}toggle(t){const r=this.identifyNull(t);if(r)return this.isOpen(r)?this.close(r):this.open(r)}openParents(t){const r=this.identifyNull(t);if(!r)return;const n=ml(this.root,r);let s=n==null?void 0:n.parent;for(;s;)this.open(s.id,!1),s=s.parent;this.redrawList()}openSiblings(t){const r=t.parent;if(!r)this.toggle(t.id);else if(r.children){const n=t.isOpen;for(let s of r.children)s.isInternal&&(n?this.close(s.id,!1):this.open(s.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){Mi(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Mi(this.root,t=>{t.isInternal&&this.close(t.id,!1)}),this.redrawList()}scrollTo(t,r="smart"){if(!t)return;const n=this.identify(t);return this.openParents(n),ah(()=>n in this.idToIndex).then(()=>{var s;const i=this.idToIndex[n];i!==void 0&&((s=this.list.current)===null||s===void 0||s.scrollToItem(i,r))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var t;return!!(!((t=this.props.searchTerm)===null||t===void 0)&&t.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(t){return t?this.state.nodes.selection.ids.has(t):!1}isOpen(t){var r,n,s;if(!t)return!1;if(t===As)return!0;const i=(r=this.props.openByDefault)!==null&&r!==void 0?r:!0;return this.isFiltered?(n=this.state.nodes.open.filtered[t])!==null&&n!==void 0?n:!0:(s=this.state.nodes.open.unfiltered[t])!==null&&s!==void 0?s:i}isEditable(t){return this.isActionPossible(t,this.props.disableEdit)}isDraggable(t){return this.isActionPossible(t,this.props.disableDrag)}isSelectable(t){return this.isActionPossible(t,this.props.disableSelect)}isActionPossible(t,r=()=>!1){return!ps(t,r)}isDragging(t){const r=this.identifyNull(t);return r?this.state.nodes.drag.id===r:!1}isFocused(t){return this.hasFocus&&this.state.nodes.focus.id===t}isMatch(t){return this.matchFn(t)}willReceiveDrop(t){const r=this.identifyNull(t);if(!r)return!1;const{destinationParentId:n,destinationIndex:s}=this.state.nodes.drag;return r===n&&s===null}onFocus(){const t=this.focusedNode||this.firstNode;t&&this.dispatch(gn(t.id))}onBlur(){this.dispatch(nT())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||kh}get renderRow(){return this.props.renderRow||X0}get renderNode(){return this.props.children||J0}get renderDragPreview(){return this.props.renderDragPreview||ch}get renderCursor(){return this.props.renderCursor||Z0}}function yt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var OO=typeof Symbol=="function"&&Symbol.observable||"@@observable",_u=OO,$a=()=>Math.random().toString(36).substring(7).split("").join("."),AO={INIT:`@@redux/INIT${$a()}`,REPLACE:`@@redux/REPLACE${$a()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${$a()}`},cn=AO;function Lh(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function DO(e){if(e===void 0)return"undefined";if(e===null)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(kO(e))return"date";if(RO(e))return"error";const r=NO(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function NO(e){return typeof e.constructor=="function"?e.constructor.name:null}function RO(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function kO(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Or(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=DO(e)),t}function Ph(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?yt(2):`Expected the root reducer to be a function. Instead, received: '${Or(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?yt(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?yt(1):`Expected the enhancer to be a function. Instead, received: '${Or(r)}'`);return r(Ph)(e,t)}let n=e,s=t,i=new Map,a=i,o=0,l=!1;function u(){a===i&&(a=new Map,i.forEach((y,v)=>{a.set(v,y)}))}function f(){if(l)throw new Error(process.env.NODE_ENV==="production"?yt(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return s}function d(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?yt(4):`Expected the listener to be a function. Instead, received: '${Or(y)}'`);if(l)throw new Error(process.env.NODE_ENV==="production"?yt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");let v=!0;u();const b=o++;return a.set(b,y),function(){if(v){if(l)throw new Error(process.env.NODE_ENV==="production"?yt(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");v=!1,u(),a.delete(b),i=null}}}function g(y){if(!Lh(y))throw new Error(process.env.NODE_ENV==="production"?yt(7):`Actions must be plain objects. Instead, the actual type was: '${Or(y)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(typeof y.type>"u")throw new Error(process.env.NODE_ENV==="production"?yt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof y.type!="string")throw new Error(process.env.NODE_ENV==="production"?yt(17):`Action "type" property must be a string. Instead, the actual type was: '${Or(y.type)}'. Value was: '${y.type}' (stringified)`);if(l)throw new Error(process.env.NODE_ENV==="production"?yt(9):"Reducers may not dispatch actions.");try{l=!0,s=n(s,y)}finally{l=!1}return(i=a).forEach(b=>{b()}),y}function p(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?yt(10):`Expected the nextReducer to be a function. Instead, received: '${Or(y)}`);n=y,g({type:cn.REPLACE})}function w(){const y=d;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(process.env.NODE_ENV==="production"?yt(11):`Expected the observer to be an object. Instead, received: '${Or(v)}'`);function b(){const S=v;S.next&&S.next(f())}return b(),{unsubscribe:y(b)}},[_u](){return this}}}return g({type:cn.INIT}),{dispatch:g,subscribe:d,getState:f,replaceReducer:p,[_u]:w}}function Tu(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function jO(e,t,r,n){const s=Object.keys(t),i=r&&r.type===cn.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(s.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!Lh(e))return`The ${i} has unexpected type of "${Or(e)}". Expected argument to be an object with the following keys: "${s.join('", "')}"`;const a=Object.keys(e).filter(o=>!t.hasOwnProperty(o)&&!n[o]);if(a.forEach(o=>{n[o]=!0}),!(r&&r.type===cn.REPLACE)&&a.length>0)return`Unexpected ${a.length>1?"keys":"key"} "${a.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${s.join('", "')}". Unexpected keys will be ignored.`}function LO(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:cn.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?yt(12):`The slice reducer for key "${t}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:cn.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?yt(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${cn.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function Eu(e){const t=Object.keys(e),r={};for(let a=0;a<t.length;a++){const o=t[a];process.env.NODE_ENV!=="production"&&typeof e[o]>"u"&&Tu(`No reducer provided for key "${o}"`),typeof e[o]=="function"&&(r[o]=e[o])}const n=Object.keys(r);let s;process.env.NODE_ENV!=="production"&&(s={});let i;try{LO(r)}catch(a){i=a}return function(o={},l){if(i)throw i;if(process.env.NODE_ENV!=="production"){const d=jO(o,r,l,s);d&&Tu(d)}let u=!1;const f={};for(let d=0;d<n.length;d++){const g=n[d],p=r[g],w=o[g],h=p(w,l);if(typeof h>"u"){const y=l&&l.type;throw new Error(process.env.NODE_ENV==="production"?yt(14):`When called with an action of type ${y?`"${String(y)}"`:"(unknown type)"}, the slice reducer for key "${g}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}f[g]=h,u=u||h!==w}return u=u||n.length!==Object.keys(o).length,u?f:o}}function PO(e=zn().nodes.drag,t){switch(t.type){case"DND_DRAG_START":return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}const FO=Eu({nodes:Eu({focus:sT,edit:rT,open:iT,selection:aT,drag:PO}),dnd:oT}),MO=zn();function BO({treeProps:e,imperativeHandle:t,children:r}){const n=m.useRef(null),s=m.useRef(null),i=m.useRef(Ph(FO,zn(e))),a=q0.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>MO),o=m.useMemo(()=>new ws(i.current,e,n,s),[]),l=m.useRef(0);return m.useMemo(()=>{l.current+=1,o.update(e)},Object.values(e)),m.useMemo(()=>{l.current+=1,o.update(o.props)},[a.nodes.open]),m.useImperativeHandle(t,()=>o),m.useEffect(()=>{o.props.selection?o.select(o.props.selection,{focus:!1}):o.deselectAll()},[o.props.selection]),m.useEffect(()=>{o.props.searchTerm||i.current.dispatch(Io.clear(!0))},[o.props.searchTerm]),c.jsx(Gf.Provider,{value:o,children:c.jsx(Yf.Provider,{value:l.current,children:c.jsx(Wf.Provider,{value:a.nodes,children:c.jsx(Kf.Provider,{value:a.dnd,children:c.jsx(g1,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||gO,options:{rootElement:o.props.dndRootElement||void 0}},{children:r}))})})})})}function $O(){const e=Rt(),[,t]=_h(()=>({accept:"NODE",canDrop:(r,n)=>n.isOver({shallow:!0})?e.canDrop():!1,hover:(r,n)=>{if(!n.isOver({shallow:!0}))return;const s=n.getClientOffset();if(!e.listEl.current||!s)return;const{cursor:i,drop:a}=Rh({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});a&&e.dispatch(Vn.hovering(a.parentId,a.index)),n.canDrop()?i&&e.showCursor(i):e.hideCursor()},drop:(r,n)=>{if(!n.isOver({shallow:!0})||!n.canDrop())return null;e.drop()}}),[e]);t(e.listEl)}function qO(e){return $O(),e.children}function UO(){const t=Rt().props.renderContainer||kh;return c.jsx(c.Fragment,{children:c.jsx(t,{})})}function zO(){const e=Rt(),{offset:t,mouse:r,item:n,isDragging:s}=qI(a=>({offset:a.getSourceClientOffset(),mouse:a.getClientOffset(),item:a.getItem(),isDragging:a.isDragging()})),i=e.props.renderDragPreview||ch;return c.jsx(i,{offset:t,mouse:r,id:(n==null?void 0:n.id)||null,dragIds:(n==null?void 0:n.dragIds)||[],isDragging:s})}function VO(e={}){var t,r;const n=(t=e.idAccessor)!==null&&t!==void 0?t:"id",s=(r=e.childrenAccessor)!==null&&r!==void 0?r:"children";return{getId:typeof n=="function"?n:i=>i[n],getChildren:typeof s=="function"?s:i=>i[s],childrenKey:typeof s=="string"?s:"children"}}class HO{constructor(t,r={}){this.accessors=VO(r),this.root=QO(t,this.accessors)}get data(){var t,r;return(r=(t=this.root.children)===null||t===void 0?void 0:t.map(n=>n.data))!==null&&r!==void 0?r:[]}create(t){const r=t.parentId?this.find(t.parentId):this.root;if(!r)return null;r.addChild(t.data,t.index)}move(t){const r=this.find(t.id),n=t.parentId?this.find(t.parentId):this.root;!r||!n||(n.addChild(r.data,t.index),r.drop())}update(t){const r=this.find(t.id);r&&r.update(t.changes)}drop(t){const r=this.find(t.id);r&&r.drop()}find(t,r=this.root){if(!r)return null;if(r.id===t)return r;if(r.children){for(let n of r.children){const s=this.find(t,n);if(s)return s}return null}return null}}function QO(e,t){const r=new Fh({},null,t,"ROOT");return r.children=e.map(n=>Sl(n,r,t)),r}function Sl(e,t,r){const n=new Fh(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>Sl(i,n,r))),n}class Fh{constructor(t,r,n,s){this.data=t,this.parent=r,this.accessors=n,this.id=s??n.getId(t)}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(t,r){var n,s;const i=Sl(t,this,this.accessors);this.children=(n=this.children)!==null&&n!==void 0?n:[],this.children.splice(r,0,i);const a=this.accessors.childrenKey,o=this.data;o[a]=(s=o[a])!==null&&s!==void 0?s:[],o[a].splice(r,0,t)}removeChild(t){var r,n;(r=this.children)===null||r===void 0||r.splice(t,1),(n=this.data[this.accessors.childrenKey])===null||n===void 0||n.splice(t,1)}update(t){if(this.hasParent()){const r=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),t),r),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let GO=0;function WO(e,t={}){const[r,n]=m.useState(e),s=t.idAccessor,i=t.childrenAccessor,a=m.useMemo(()=>new HO(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),o=w=>{for(const h of w.dragIds)a.move({id:h,parentId:w.parentId,index:w.index});n(a.data)},l=({name:w,id:h})=>{a.update({id:h,changes:{name:w}}),n(a.data)},u=typeof s=="string"?s:"id",f=typeof i=="string"?i:"children";return[r,{onMove:o,onRename:l,onCreate:({parentId:w,index:h,type:y})=>{if(typeof s=="function")throw new Error("React Arborist => initialData can't create nodes when idAccessor is a function: the generated id can't be written under a key the accessor reads. Use a string idAccessor, or the controlled `data` prop with your own onCreate.");if(y==="internal"&&typeof i=="function")throw new Error("React Arborist => initialData can't create folder nodes when childrenAccessor is a function: the new children array can't be written under a key the accessor reads. Use a string childrenAccessor, or the controlled `data` prop with your own onCreate.");const v={[u]:`simple-tree-id-${GO++}`,name:""};return y==="internal"&&(v[f]=[]),a.create({parentId:w,index:h,data:v}),n(a.data),v},onDelete:w=>{w.ids.forEach(h=>a.drop({id:h})),n(a.data)}}]}function KO(e){if(e.initialData&&e.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw new Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
|
|
506
|
+
Use the data prop if you want to provide your own handlers.`);if(e.initialData){const[t,r]=WO(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function YO(e,t){const r=KO(e);return c.jsxs(BO,{treeProps:r,imperativeHandle:t,children:[c.jsx(qO,{children:c.jsx(UO,{})}),c.jsx(zO,{})]})}const ZO=m.forwardRef(YO);function xl(){return Oe(e=>{var n;const t=e.treeData[0];return(((n=t==null?void 0:t.metadata)==null?void 0:n.status)??(t==null?void 0:t.status)??"Draft").toLowerCase()==="draft"})}function XO(){return Oe(e=>{var s;if(!e.selectedNodeId)return!1;const t=(s=e.treeData[0])==null?void 0:s.id,r=i=>{var a;for(const o of i){if(o.id===e.selectedNodeId)return o;if((a=o.children)!=null&&a.length){const l=r(o.children);if(l)return l}}},n=r(e.treeData);return!!(n!=null&&n.isFolder)&&n.id!==t})}const Iu={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},Ou={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},Au=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],JO=[{label:"All",value:"all"},{label:"Course Assessment",value:"Course Assessment"},{label:"eTextbook",value:"eTextbook"},{label:"Exam Question",value:"Exam Question"},{label:"Explanation Content",value:"Explanation Content"},{label:"Learning Resource",value:"Learning Resource"},{label:"Practice Question Set",value:"Practice Question Set"},{label:"SCORM Content",value:"SCORM Content"},{label:"Teacher Resource",value:"Teacher Resource"}];function eA(e){const t=[e.mimeType??"",e.primaryCategory??"",e.contentType??""].join(" ").toLowerCase();return t.includes("video")?"video":t.includes("pdf")||t.includes("epub")?"pdf":t.includes("h5p")?"h5p":t.includes("scorm")?"scorm":t.includes("audio")||t.includes("mp3")?"audio":t.includes("quiz")||t.includes("question")||t.includes("ecml")?"quiz":"default"}function ca(e){const t=eA(e);return{key:t,color:Iu[t]??Iu.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:Ou[t]??Ou.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const tA="_row_i3qt2_1",rA="_grip_i3qt2_16",nA="_menuBtn_i3qt2_19",sA="_selected_i3qt2_23",iA="_title_i3qt2_28",aA="_dropTarget_i3qt2_33",oA="_toggle_i3qt2_50",lA="_ctIcon_i3qt2_65",cA="_folderIcon_i3qt2_77",uA="_renameInput_i3qt2_92",dA="_dropHere_i3qt2_101",fA="_menuWrap_i3qt2_111",hA="_menu_i3qt2_19",pA="_dangerItem_i3qt2_163",Ot={row:tA,grip:rA,menuBtn:nA,selected:sA,title:iA,dropTarget:aA,toggle:oA,ctIcon:lA,folderIcon:cA,renameInput:uA,dropHere:dA,menuWrap:fA,menu:hA,dangerItem:pA},mA={video:il,pdf:ea,h5p:tl,scorm:nl,audio:rl,quiz:Jo,default:Yn},gA=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=m.useState(!1),[a,o]=m.useState(!1),[l,u]=m.useState(e.data.name),f=m.useRef(null),d=ce(),g=n==="edit",p=xl(),w=ca(e.data),h=mA[w.key]??Yn,y=e.isSelected,v=e.level===0,b=e.data.isFolder??(e.children&&e.children.length>0),C=v?Ry:b?My:h;m.useEffect(()=>{if(!s)return;const E=N=>{var R;(R=f.current)!=null&&R.contains(N.target)||i(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[s]);const S=m.useCallback(()=>{l.trim()&&e.submit(l.trim()),o(!1)},[l,e]),_=m.useCallback(E=>{E.key==="Enter"&&S(),E.key==="Escape"&&(u(e.data.name),o(!1))},[S,e.data.name]);return c.jsxs("div",{className:[Ot.row,y?Ot.selected:"",e.state.isOver&&b?Ot.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":b?"true":void 0,role:"treeitem","aria-selected":y,"aria-expanded":b?!e.isClosed:void 0,children:[g&&c.jsx("span",{ref:r,className:Ot.grip,"aria-hidden":"true",children:c.jsx(of,{size:14})}),c.jsx("button",{className:Ot.toggle,onClick:E=>{E.stopPropagation(),e.toggle()},"aria-label":e.isClosed?d.treeNode.expandAriaLabel:d.treeNode.collapseAriaLabel,style:{visibility:b?"visible":"hidden"},children:e.isClosed?c.jsx(rf,{size:14}):c.jsx(Kn,{size:14})}),c.jsx("span",{className:`${Ot.ctIcon} ${v||b?Ot.folderIcon:w.bgClass}`,"aria-hidden":"true",children:c.jsx(C,{size:12})}),a?c.jsx("input",{className:Ot.renameInput,value:l,autoFocus:!0,onChange:E=>u(E.target.value),onBlur:S,onKeyDown:_,onClick:E=>E.stopPropagation()}):c.jsx("span",{className:Ot.title,title:e.data.name,onDoubleClick:()=>g&&o(!0),children:e.data.name.length>25?`${e.data.name.slice(0,25)}...`:e.data.name}),e.state.isOver&&b&&c.jsx("span",{className:Ot.dropHere,"aria-hidden":"true",children:d.treeNode.dropHereLabel}),g&&c.jsxs("div",{className:Ot.menuWrap,ref:f,children:[c.jsx("button",{className:Ot.menuBtn,onClick:E=>{E.stopPropagation(),i(N=>!N)},"aria-label":d.treeNode.nodeOptionsAriaLabel,children:c.jsx(sf,{size:14})}),s&&c.jsxs("div",{className:Ot.menu,role:"menu",children:[c.jsxs("button",{role:"menuitem",onClick:()=>{o(!0),i(!1)},children:[c.jsx(Hy,{size:13})," ",d.treeNode.renameMenuItem]}),b&&p&&c.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[c.jsx(af,{size:13})," ",d.treeNode.addSubunitMenuItem]}),e.data.parent&&p&&c.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[c.jsx(Us,{size:13})," ",d.treeNode.addSiblingMenuItem]}),c.jsxs("button",{role:"menuitem",className:Ot.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[c.jsx(sl,{size:13})," ",d.treeNode.deleteMenuItem]})]})]})]})};async function yA(e,t){var i,a;const n=((i=(await Ne.post(`/action/content/v3/upload/url/${e}?type=hierarchy`,{request:{content:{fileName:t}}})).data)==null?void 0:i.result)??{},s=((a=n.content)==null?void 0:a.preSignedURL)??n.pre_signed_url??n.preSignedUrl;if(!s)throw new Error("Could not obtain an upload URL");return s}async function vA(e,t){const r=await fetch(e,{method:"PUT",headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"text/csv"},body:t});if(!r.ok)throw new Error(`Blob upload failed (${r.status})`);return e.split("?")[0]}async function bA(e,t){var o;const r=await yA(e,t.name),n=await vA(r,t),s=new FormData;return s.append("fileUrl",n),s.append("mimeType",t.type||"text/csv"),{processId:(((o=(await Ne.post(`/action/collection/v1/import/${e}`,s)).data)==null?void 0:o.result)??{}).processId??""}}async function wA(e){var r;return((r=(await Ne.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function Mh(e){var n,s,i;const r=(i=(s=(n=(await Ne.get(`/action/collection/v1/export/${e}`)).data)==null?void 0:n.result)==null?void 0:s.collection)==null?void 0:i.tocUrl;if(!r)throw new Error("No export URL returned");return r}async function CA(e){return Mh(e)}const SA="_container_jr3ij_1",xA="_header_jr3ij_13",_A="_title_jr3ij_22",TA="_closeBtn_jr3ij_29",EA="_body_jr3ij_45",IA="_dropZone_jr3ij_54",OA="_dragOver_jr3ij_67",AA="_hasFile_jr3ij_72",DA="_hiddenInput_jr3ij_78",NA="_fileInfo_jr3ij_82",RA="_fileIcon_jr3ij_89",kA="_fileName_jr3ij_93",jA="_fileSize_jr3ij_100",LA="_dropHint_jr3ij_105",PA="_dropIcon_jr3ij_112",FA="_dropText_jr3ij_117",MA="_dropSubtext_jr3ij_124",BA="_sampleLink_jr3ij_130",$A="_statusBar_jr3ij_145",qA="_status_uploading_jr3ij_154",UA="_status_processing_jr3ij_154",zA="_status_done_jr3ij_159",VA="_status_error_jr3ij_164",HA="_successDetail_jr3ij_170",QA="_spinner_jr3ij_175",GA="_spin_jr3ij_175",WA="_errorMsg_jr3ij_191",KA="_failedSection_jr3ij_197",YA="_failedTitle_jr3ij_203",ZA="_tableWrap_jr3ij_213",XA="_failedTable_jr3ij_219",JA="_reasonCell_jr3ij_244",eD="_footer_jr3ij_248",Re={container:SA,header:xA,title:_A,closeBtn:TA,body:EA,dropZone:IA,dragOver:OA,hasFile:AA,hiddenInput:DA,fileInfo:NA,fileIcon:RA,fileName:kA,fileSize:jA,dropHint:LA,dropIcon:PA,dropText:FA,dropSubtext:MA,sampleLink:BA,statusBar:$A,status_uploading:qA,status_processing:UA,status_done:zA,status_error:VA,successDetail:HA,spinner:QA,spin:GA,errorMsg:WA,failedSection:KA,failedTitle:YA,tableWrap:ZA,failedTable:XA,reasonCell:JA,footer:eD},tD=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const s=ce(),[i,a]=m.useState(null),[o,l]=m.useState(!1),[u,f]=m.useState("idle"),[d,g]=m.useState(""),[p,w]=m.useState([]),[h,y]=m.useState(null),v=m.useRef(null),b=m.useRef(null),C=m.useCallback(()=>{b.current!==null&&(clearInterval(b.current),b.current=null)},[]);m.useEffect(()=>()=>C(),[C]);const S=D=>D.name.toLowerCase().endsWith(".csv")?D.size>50*1024*1024?(g(s.csvUpload.fileTooLarge),!1):!0:(g(s.csvUpload.invalidFileType),!1),_=m.useCallback(D=>{g(""),w([]),y(null),f("idle"),S(D)&&a(D)},[]),E=m.useCallback(D=>{D.preventDefault(),l(!1);const j=D.dataTransfer.files[0];j&&_(j)},[_]),N=m.useCallback(D=>{var P;const j=(P=D.target.files)==null?void 0:P[0];j&&_(j),D.target.value=""},[_]),R=m.useCallback(async()=>{try{const D=await CA(e),j=document.createElement("a");j.href=D,j.download="sample_hierarchy.csv",j.target="_blank",j.click()}catch{g(s.csvUpload.downloadSampleFailed)}},[e,s.csvUpload.downloadSampleFailed]),M=m.useCallback(async()=>{if(i){f("uploading"),g(""),w([]);try{const{processId:D}=await bA(e,i);if(!D){f("done"),y(null),setTimeout(t,1500);return}f("processing"),b.current=setInterval(async()=>{try{const j=await wA(D);j.status==="COMPLETED"?(C(),f("done"),y(j.successCount??null),j.failedRecords&&j.failedRecords.length>0?w(j.failedRecords):setTimeout(t,1500)):j.status==="FAILED"&&(C(),f("error"),g(s.csvUpload.processingFailed),j.failedRecords&&w(j.failedRecords))}catch{C(),f("error"),g(s.csvUpload.connectionLost)}},2e3)}catch{f("error"),g(s.csvUpload.uploadFailed)}}},[e,i,t,C,s.csvUpload.processingFailed,s.csvUpload.connectionLost,s.csvUpload.uploadFailed]),$={idle:"",uploading:s.csvUpload.statusUploading,processing:s.csvUpload.statusProcessing,done:s.csvUpload.statusDone,error:s.csvUpload.statusError};return c.jsxs("div",{className:Re.container,children:[c.jsxs("div",{className:Re.header,children:[c.jsx("h2",{className:Re.title,children:n==="update"?s.csvUpload.titleUpdate:s.csvUpload.titleCreate}),c.jsx("button",{className:Re.closeBtn,onClick:r,"aria-label":s.csvUpload.closeAriaLabel,children:c.jsx(Cr,{size:18})})]}),c.jsxs("div",{className:Re.body,children:[c.jsxs("div",{className:`${Re.dropZone} ${o?Re.dragOver:""} ${i?Re.hasFile:""}`,onDragEnter:D=>{D.preventDefault(),l(!0)},onDragOver:D=>{D.preventDefault(),l(!0)},onDragLeave:D=>{D.preventDefault(),l(!1)},onDrop:E,onClick:()=>{var D;return(D=v.current)==null?void 0:D.click()},role:"button",tabIndex:0,"aria-label":s.csvUpload.dropZoneAriaLabel,onKeyDown:D=>{var j;return D.key==="Enter"&&((j=v.current)==null?void 0:j.click())},children:[c.jsx("input",{ref:v,type:"file",accept:".csv",className:Re.hiddenInput,onChange:N,"aria-hidden":"true"}),i?c.jsxs("div",{className:Re.fileInfo,children:[c.jsx(ea,{size:24,className:Re.fileIcon}),c.jsx("span",{className:Re.fileName,children:i.name}),c.jsxs("span",{className:Re.fileSize,children:["(",(i.size/1024).toFixed(1)," KB)"]})]}):c.jsxs("div",{className:Re.dropHint,children:[c.jsx(go,{size:32,className:Re.dropIcon}),c.jsx("p",{className:Re.dropText,children:s.csvUpload.dropText}),c.jsx("p",{className:Re.dropSubtext,children:s.csvUpload.dropSubtext})]})]}),c.jsx("button",{className:Re.sampleLink,onClick:R,type:"button",children:s.csvUpload.downloadSample}),u!=="idle"&&c.jsxs("div",{className:`${Re.statusBar} ${Re[`status_${u}`]}`,role:"status","aria-live":"polite",children:[u==="processing"&&c.jsx("span",{className:Re.spinner,"aria-hidden":"true"}),$[u],u==="done"&&h!==null&&c.jsx("span",{className:Re.successDetail,children:s.csvUpload.itemsImportedSuffix.replace("{count}",String(h))})]}),d&&c.jsx("p",{className:Re.errorMsg,role:"alert",children:d}),p.length>0&&c.jsxs("div",{className:Re.failedSection,children:[c.jsx("h4",{className:Re.failedTitle,children:s.csvUpload.failedRowsTitle.replace("{count}",String(p.length))}),c.jsx("div",{className:Re.tableWrap,children:c.jsxs("table",{className:Re.failedTable,children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:s.csvUpload.rowHeader}),c.jsx("th",{children:s.csvUpload.nameHeader}),c.jsx("th",{children:s.csvUpload.reasonHeader})]})}),c.jsx("tbody",{children:p.map((D,j)=>c.jsxs("tr",{children:[c.jsx("td",{children:D.rowNumber??j+1}),c.jsx("td",{children:D.name??"—"}),c.jsx("td",{className:Re.reasonCell,children:D.reason??s.csvUpload.unknownError})]},j))})]})})]})]}),c.jsxs("div",{className:Re.footer,children:[c.jsx(Fe,{variant:"ghost",onClick:r,disabled:u==="uploading"||u==="processing",children:s.csvUpload.cancel}),c.jsx(Fe,{variant:"primary",isLoading:u==="uploading"||u==="processing",disabled:!i||u==="done",onClick:M,children:u==="done"?s.csvUpload.uploaded:s.csvUpload.upload})]})]})},rD="_container_1y30m_1",nD="_header_1y30m_8",sD="_headerActions_1y30m_19",iD="_iconBtn_1y30m_25",aD="_menuWrap_1y30m_43",oD="_dropdownMenu_1y30m_47",lD="_treeWrapper_1y30m_79",cD="_csvModal_1y30m_95",uD="_footer_1y30m_105",ar={container:rD,header:nD,headerActions:sD,iconBtn:iD,menuWrap:aD,dropdownMenu:oD,treeWrapper:lD,csvModal:cD,footer:uD},dD=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var de;const n=ce(),s=m.useRef(null),i=m.useRef(null),a=m.useRef(null),[o,l]=m.useState(400),[u,f]=m.useState(!1),[d,g]=m.useState(!1),[p,w]=m.useState("create"),{treeData:h,selectedNodeId:y,selectNode:v,addNode:b,deleteNode:C,reorderChildren:S,moveNode:_,setTreeData:E}=Oe(),N=e==="edit",R=xl(),M=N&&R,$=(((de=h[0])==null?void 0:de.children)??[]).some(Q=>Q.isFolder),D=le(Q=>{var ne,te,q,V;return((te=(ne=Q.editorConfig)==null?void 0:ne.context)==null?void 0:te.contentId)??((V=(q=Q.editorConfig)==null?void 0:q.context)==null?void 0:V.identifier)??""}),j=le(Q=>{var te,q;const ne=(q=(te=Q.categoryMeta)==null?void 0:te.sourcingSettings)==null?void 0:q.collection;return(ne==null?void 0:ne.enableBulkUpload)!==!1});m.useEffect(()=>{const Q=i.current;if(!Q)return;const ne=new ResizeObserver(()=>{l(Q.clientHeight||400)});return ne.observe(Q),l(Q.clientHeight||400),()=>ne.disconnect()},[]),m.useEffect(()=>{if(!u)return;const Q=ne=>{var te;(te=a.current)!=null&&te.contains(ne.target)||f(!1)};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[u]);const P=m.useCallback(Q=>{Q.length>0&&v(Q[0].data.id)},[v]),k=m.useCallback(({parentId:Q,index:ne,dragIds:te})=>{if(!Q)return;const q=te[0],V=Po(h,q);if(!V)return;const ie=V.parent;if(ie===Q){const fe=Po(h,Q);if(!(fe!=null&&fe.children))return;const J=fe.children.findIndex(se=>se.id===q);if(J<0)return;S(Q,J,ne>J?ne-1:ne)}else _(q,ie??"",Q)},[h,S,_]),L=m.useCallback(({ids:Q})=>{Q.forEach(ne=>C(ne))},[C]),z=m.useCallback(({parentId:Q})=>{var q;const ne=Q??((q=h[0])==null?void 0:q.id)??"";if(!ne)return{id:crypto.randomUUID()};const te=b(ne,"unit");return te?{id:te}:(Ee.error(n.outlineTree.maxDepthReachedToast),{id:crypto.randomUUID()})},[b,h,n]),X=m.useCallback(()=>{var ne;const Q=(ne=h[0])==null?void 0:ne.id;Q&&(b(Q,"unit")||Ee.error(n.outlineTree.maxDepthReachedToast))},[h,b,n]),ye=m.useCallback(()=>{y&&(b(y,"subunit")||Ee.error(n.outlineTree.maxDepthReachedToast))},[y,b,n]),_e=m.useCallback(async()=>{if(f(!1),!!D)try{const Q=await Mh(D),ne=await fetch(Q).then(V=>V.blob()),te=URL.createObjectURL(ne),q=document.createElement("a");q.href=te,q.download=`${D}-folders.csv`,q.style.display="none",document.body.appendChild(q),q.click(),document.body.removeChild(q),URL.revokeObjectURL(te)}catch{Ee.error(n.outlineTree.downloadCsvFailedToast)}},[D,n]),we=m.useCallback(async()=>{if(g(!1),!!D)try{const{rootNode:Q}=await Qf(D);E([Q]),Ee.success(n.outlineTree.outlineRefreshedToast)}catch{Ee.error(n.outlineTree.outlineRefreshFailedToast)}},[D,E,n]);return c.jsxs("div",{className:ar.container,children:[c.jsx("div",{className:ar.header,children:c.jsxs("div",{className:ar.headerActions,children:[N&&c.jsxs("div",{className:ar.menuWrap,ref:a,children:[c.jsx("button",{type:"button",className:ar.iconBtn,onClick:()=>f(Q=>!Q),"aria-label":n.outlineTree.moreOptionsAriaLabel,title:n.outlineTree.moreOptionsTitle,"aria-haspopup":"true","aria-expanded":u,children:c.jsx(sf,{size:15})}),u&&c.jsx("div",{className:ar.dropdownMenu,role:"menu",children:j&&c.jsxs(c.Fragment,{children:[c.jsx("button",{role:"menuitem",type:"button",disabled:$,title:$?n.outlineTree.foldersExistTitle:void 0,onClick:()=>{f(!1),w("create"),g(!0)},children:n.outlineTree.createFoldersCsvButton}),c.jsx("button",{role:"menuitem",type:"button",disabled:!$,title:$?void 0:n.outlineTree.noFoldersYetTitle,onClick:_e,children:n.outlineTree.downloadFoldersCsvButton}),c.jsx("button",{role:"menuitem",type:"button",disabled:!$,title:$?void 0:n.outlineTree.noFoldersYetTitle,onClick:()=>{f(!1),w("update"),g(!0)},children:n.outlineTree.updateFoldersCsvButton})]})})]}),r&&c.jsx("button",{type:"button",className:ar.iconBtn,onClick:r,"aria-label":t?n.outlineTree.expandOutlineAriaLabel:n.outlineTree.collapseOutlineAriaLabel,title:t?n.outlineTree.expandOutlineAriaLabel:n.outlineTree.collapseOutlineAriaLabel,children:t?c.jsx(zy,{size:15}):c.jsx(Uy,{size:15})})]})}),c.jsx("div",{className:ar.treeWrapper,ref:i,children:c.jsx(ZO,{ref:s,data:h,idAccessor:"id",childrenAccessor:"children",onSelect:P,onMove:N?k:void 0,onDelete:N?L:void 0,onCreate:N?z:void 0,disableEdit:!N,disableDrop:!N,selection:y??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:Q=>c.jsx(gA,{...Q,editorMode:e})})}),N&&c.jsxs("div",{className:ar.footer,children:[c.jsxs(Fe,{variant:"ghost",size:"sm",onClick:X,disabled:!M,children:[c.jsx(Us,{size:14})," ",n.outlineTree.addUnitButton]}),c.jsxs(Fe,{variant:"ghost",size:"sm",onClick:ye,disabled:!M||!y,children:[c.jsx(af,{size:14})," ",n.outlineTree.addSubunitButton]})]}),d&&c.jsx("div",{className:ar.csvModal,children:c.jsx(tD,{contentId:D,mode:p,onComplete:we,onClose:()=>g(!1)})})]})};function Po(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Po(r.children,t);if(n)return n}}}const fD="_breadcrumb_zd1aj_1",hD="_crumb_zd1aj_10",pD="_sep_zd1aj_26",mD="_current_zd1aj_31",os={breadcrumb:fD,crumb:hD,sep:pD,current:mD},gD=({crumbs:e})=>{const t=Oe(n=>n.selectNode),r=ce();return e.length?c.jsxs("nav",{className:os.breadcrumb,"aria-label":r.breadcrumb.nodePathAriaLabel,children:[c.jsx("button",{className:os.crumb,onClick:()=>t(e[0].id),"aria-label":r.breadcrumb.homeAriaLabel,children:c.jsx($y,{size:13})}),e.map((n,s)=>c.jsxs(m.Fragment,{children:[c.jsx(rf,{size:13,className:os.sep}),s<e.length-1?c.jsx("button",{className:os.crumb,onClick:()=>t(n.id),children:n.name}):c.jsx("span",{className:os.current,children:n.name})]},n.id))]}):null},yD="_tabBar_qhks1_1",vD="_tab_qhks1_1",bD="_active_qhks1_29",wD="_error_qhks1_35",CD="_errorDot_qhks1_39",ls={tabBar:yD,tab:vD,active:bD,error:wD,errorDot:CD},SD=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=ce(),i=[{id:"details",label:s.tabBar.detailsTab},{id:"audience",label:s.tabBar.audienceCurriculumTab},{id:"licensing",label:s.tabBar.licensingTab}],a=n?i.filter(o=>n.includes(o.id)):i;return c.jsx("div",{className:ls.tabBar,role:"tablist","aria-label":s.tabBar.metadataSectionsAriaLabel,children:a.map(o=>c.jsxs("button",{role:"tab","aria-selected":e===o.id,"aria-controls":`panel-${o.id}`,className:[ls.tab,e===o.id?ls.active:"",r.includes(o.id)?ls.error:""].join(" "),onClick:()=>t(o.id),children:[o.label,r.includes(o.id)&&c.jsx("span",{className:ls.errorDot,"aria-label":s.tabBar.hasErrorsAriaLabel})]},o.id))})};var Ws=e=>e.type==="checkbox",Yr=e=>e instanceof Date,ut=e=>e==null;const Bh=e=>typeof e=="object";var We=e=>!ut(e)&&!Array.isArray(e)&&Bh(e)&&!Yr(e),Fo=e=>We(e)&&e.target?Ws(e.target)?e.target.checked:e.target.value:e,$h=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),qh=e=>{const t=e.constructor&&e.constructor.prototype;return We(t)&&t.hasOwnProperty("isPrototypeOf")},ua=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ke(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(ua&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(We(e)&&qh(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Ke(e[s]));return n}const Dr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Xt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Yt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},qa="form",Uh="root",zh=["__proto__","constructor","prototype"];var Ks=e=>/^\w*$/.test(e),Be=e=>e===void 0,da=e=>e.split(/[.[\]'"]/g).filter(Boolean),W=(e,t,r)=>{if(!t||!We(e))return r;const n=Ks(t)?[t]:da(t);if(n.some(i=>zh.includes(i)))return r;const s=n.reduce((i,a)=>ut(i)?void 0:i[a],e);return Be(s)||s===e?Be(e[t])?r:e[t]:s},Ft=e=>typeof e=="boolean",bt=e=>typeof e=="function",Le=(e,t,r)=>{let n=-1;const s=Ks(t)?[t]:da(t),i=s.length,a=i-1;for(;++n<i;){const o=s[n];let l=r;if(n!==a){const u=e[o];l=We(u)||Array.isArray(u)?u:isNaN(+s[n+1])?{}:[]}if(zh.includes(o))return;e[o]=l,e=e[o]}};const _l=m.createContext(null);_l.displayName="HookFormControlContext";const Tl=()=>m.useContext(_l);var Vh=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const a=i;return t._proxyFormState[a]!==Xt.all&&(t._proxyFormState[a]=!n||Xt.all),r&&(r[a]=!0),e[a]}});return s};const El=ua?m.useLayoutEffect:m.useEffect;function xD(e){const t=Tl(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[a,o]=m.useState(()=>({...r._formState,defaultValues:r._defaultValues})),l=m.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return El(()=>r._subscribe({name:s,formState:l.current,exact:i,callback:u=>{!n&&o({...r._formState,...u,defaultValues:r._defaultValues})}}),[s,n,i]),m.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),m.useMemo(()=>Vh(a,r,l.current,!1),[a,r])}var wt=e=>typeof e=="string",Mo=(e,t,r,n,s)=>wt(e)?(n&&t.watch.add(e),W(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),W(r,i))):(n&&(t.watchAll=!0),r),Bo=e=>ut(e)||!Bh(e);const Du=(e,t)=>t.length===0&&!Array.isArray(e)&&!qh(e);function Mt(e,t,r=new WeakMap){if(e===t)return!0;if(Bo(e)||Bo(t))return Object.is(e,t);if(Yr(e)&&Yr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(Du(e,n)||Du(t,s))return Object.is(e,t);const i=r.get(e);if(i&&i.has(t))return!0;i?i.add(t):r.set(e,new WeakSet([t]));for(const a of n){const o=e[a];if(!(a in t))return!1;if(a!=="ref"){const l=t[a];if(Yr(o)&&Yr(l)||(We(o)||Array.isArray(o))&&(We(l)||Array.isArray(l))?!Mt(o,l,r):!Object.is(o,l))return!1}}return!0}function _D(e){const t=Tl(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:a,compute:o}=e||{},l=m.useRef(s),u=m.useRef(o),f=m.useRef(void 0),d=m.useRef(r),g=m.useRef(n);u.current=o;const[p,w]=m.useState(()=>{const S=r._getWatch(n,l.current);return u.current?u.current(S):S}),h=m.useCallback(S=>{const _=Mo(n,r._names,S||r._formValues,!1,l.current);return u.current?u.current(_):_},[r._formValues,r._names,n]),y=m.useCallback(S=>{if(!i){const _=Mo(n,r._names,S||r._formValues,!1,l.current);if(u.current){const E=u.current(_);Mt(E,f.current)||(w(E),f.current=E)}else w(_)}},[r._formValues,r._names,i,n]);El(()=>((d.current!==r||!Mt(g.current,n))&&(d.current=r,g.current=n,y()),r._subscribe({name:n,formState:{values:!0},exact:a,callback:S=>{y(S.values)}})),[r,a,n,y]),m.useEffect(()=>r._removeUnmounted());const v=d.current!==r,b=g.current,C=m.useMemo(()=>{if(i)return null;const S=!v&&!Mt(b,n);return v||S?h():null},[i,v,n,b,h]);return C!==null?C:p}function fa(e){const t=Tl(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:a,exact:o=!0}=e,l=$h(s._names.array,r),u=m.useMemo(()=>W(s._formValues,r,W(s._defaultValues,r,a)),[s,r,a]),f=_D({control:s,name:r,defaultValue:u,exact:o}),d=xD({control:s,name:r,exact:o}),g=m.useRef(e),p=m.useRef(null),w=m.useRef(s.register(r,{...e.rules,value:f,...Ft(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const h=m.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!W(d.errors,r)},isDirty:{enumerable:!0,get:()=>!!W(d.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!W(d.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!W(d.validatingFields,r)},error:{enumerable:!0,get:()=>W(d.errors,r)}}),[d,r]),y=m.useCallback(S=>{const _=Fo(S);return W(s._fields,r)||(w.current=s.register(r,{...g.current.rules,value:_})),w.current.onChange({target:{value:Fo(S),name:r},type:Dr.CHANGE})},[r,s]),v=m.useCallback(()=>w.current.onBlur({target:{value:W(s._formValues,r),name:r},type:Dr.BLUR}),[r,s._formValues]),b=m.useCallback(S=>{S&&(p.current={focus:()=>bt(S.focus)&&S.focus(),select:()=>bt(S.select)&&S.select(),setCustomValidity:E=>bt(S.setCustomValidity)&&S.setCustomValidity(E),reportValidity:()=>bt(S.reportValidity)&&S.reportValidity()});const _=W(s._fields,r);_&&_._f&&S&&(_._f.ref=p.current)},[s._fields,r]),C=m.useMemo(()=>({name:r,value:f,...Ft(n)||d.disabled?{disabled:d.disabled||n}:{},onChange:y,onBlur:v,ref:b}),[r,n,d.disabled,y,v,b,f]);return m.useEffect(()=>{const S=s._options.shouldUnregister||i;s.register(r,{...g.current.rules,...Ft(g.current.disabled)?{disabled:g.current.disabled}:{}});const _=(E,N)=>{const R=W(s._fields,E);R&&R._f&&(R._f.mount=N)};if(_(r,!0),S){const E=Ke(W(i?s._defaultValues:s._options.values||s._defaultValues,r,W(s._options.defaultValues,r,g.current.defaultValue)));Le(s._defaultValues,r,E),Be(W(s._formValues,r))&&Le(s._formValues,r,E)}if(!l&&s.register(r),p.current){const E=W(s._fields,r);E&&E._f&&(E._f.ref=p.current)}return()=>{(l?S&&!s._state.action:S)?s.unregister(r):_(r,!1)}},[r,s,l,i]),m.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),m.useMemo(()=>({field:C,formState:d,fieldState:h}),[C,d,h])}const Il=m.createContext(null);Il.displayName="HookFormContext";const rr=()=>m.useContext(Il),TD=({children:e,watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:a,setValues:o,trigger:l,formState:u,resetField:f,reset:d,handleSubmit:g,unregister:p,control:w,register:h,setFocus:y,subscribe:v})=>{const b=m.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:a,setValues:o,trigger:l,formState:u,resetField:f,reset:d,handleSubmit:g,unregister:p,control:w,register:h,setFocus:y,subscribe:v}),[i,w,u,n,r,g,h,d,f,s,y,a,o,v,l,p,t]);return m.createElement(Il.Provider,{value:b},m.createElement(_l.Provider,{value:b.control},e))};var ED=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Hh=e=>Array.isArray(e)?e.filter(Boolean):[],Ei=e=>Array.isArray(e)?e:[e],Nu=()=>{let e=[];return{get observers(){return e},next:s=>{for(const i of e)i.next&&i.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(i=>i!==s)}}),unsubscribe:()=>{e=[]}}};function Qh(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&We(s)&&i){const a=Qh(s,i);We(a)&&(r[n]=a)}else e[n]&&(r[n]=i)}return r}var it=e=>We(e)&&!Object.keys(e).length,Ol=e=>e.type==="file",$i=e=>{if(!ua)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Gh=e=>e.type==="select-multiple",Al=e=>e.type==="radio",ID=e=>Al(e)||Ws(e),Ua=e=>$i(e)&&e.isConnected;function OD(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(ut(e)){e=void 0;break}e=e[t[n]],n++}return e}function AD(e){for(const t in e)if(e.hasOwnProperty(t)&&!Be(e[t]))return!1;return!0}function Je(e,t){if(wt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Ks(t)?[t]:da(t),n=r.length===1?e:OD(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(We(n)&&it(n)||Array.isArray(n)&&AD(n))&&Je(e,r.slice(0,-1)),e}var DD=e=>{for(const t in e)if(bt(e[t]))return!0;return!1};function Wh(e){return Array.isArray(e)||We(e)&&!DD(e)}function $o(e,t={}){for(const r in e){const n=e[r];Wh(n)?(t[r]=Array.isArray(n)?[]:{},$o(n,t[r])):Be(n)||(t[r]=!0)}return t}function qo(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>qo(r));return t.some(r=>r!==void 0)?t:void 0}if(We(e)){const t={};for(const r in e){const n=qo(e[r]);Be(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function Qr(e,t,r){r||(r=$o(t));for(const n in e){const s=e[n];if(Wh(s))Be(t)||Bo(r[n])?r[n]=$o(s,Array.isArray(s)?[]:{}):Qr(s,ut(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!Mt(s,i)}}return qo(r)||{}}const Ru={value:!1,isValid:!1},ku={value:!0,isValid:!0};var Kh=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Be(e[0].attributes.value)?Be(e[0].value)||e[0].value===""?ku:{value:e[0].value,isValid:!0}:ku:Ru}return Ru},Yh=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Be(e)?e:t?e===""?NaN:e&&+e:r&&wt(e)?new Date(e):n?n(e):e;const ju={isValid:!1,value:null};var Zh=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,ju):ju;function Lu(e){const t=e.ref;return Ol(t)?t.files:Al(t)?Zh(e.refs).value:Gh(t)?[...t.selectedOptions].map(({value:r})=>r):Ws(t)?Kh(e.refs).value:Yh(Be(t.value)?e.ref.value:t.value,e)}var ND=(e,t,r,n)=>{const s={};for(const i of e){const a=W(t,i);a&&Le(s,i,a._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},qi=e=>e instanceof RegExp,cs=e=>Be(e)?e:qi(e)?e.source:We(e)?qi(e.value)?e.value.source:e.value:e,Pu=e=>({isOnSubmit:!e||e===Xt.onSubmit,isOnBlur:e===Xt.onBlur,isOnChange:e===Xt.onChange,isOnAll:e===Xt.all,isOnTouch:e===Xt.onTouched});const Fu="AsyncFunction";var RD=e=>!!e&&!!e.validate&&!!(bt(e.validate)&&e.validate.constructor.name===Fu||We(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Fu)),kD=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),za=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const Cs=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=W(e,s);if(i){const{_f:a,...o}=i;if(a){if(a.refs&&a.refs[0]&&t(a.refs[0],s)&&!n)return!0;if(a.ref&&t(a.ref,a.name)&&!n)return!0;if(Cs(o,t))break}else if(We(o)&&Cs(o,t))break}}};function Mu(e,t,r){const n=W(e,r);if(n||Ks(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),a=W(t,i),o=W(e,i);if(a&&!Array.isArray(a)&&r!==i)return{name:r};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};s.pop()}return{name:r}}var jD=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return it(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(a=>t[a]===(!n||Xt.all))},LD=(e,t,r)=>!e||!t||e===t||Ei(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),PD=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,FD=(e,t)=>!Hh(W(e,t)).length&&Je(e,t),Bu=(e,t,r)=>{const n=W(e,r),s=Array.isArray(n)?n:[];return Le(s,Uh,t[r]),Le(e,r,s),e};function $u(e,t,r="validate"){if(wt(e)||Array.isArray(e)&&e.every(wt)||Ft(e)&&!e)return{type:r,message:wt(e)?e:"",ref:t}}var Sn=e=>We(e)&&!qi(e)?e:{value:e,message:""},qu=async(e,t,r,n,s,i)=>{const{ref:a,refs:o,required:l,maxLength:u,minLength:f,min:d,max:g,pattern:p,validate:w,name:h,valueAsNumber:y,mount:v}=e._f,b=W(r,h);if(!v||t.has(h))return{};const C=o?o[0]:a,S=j=>{if(s&&C.reportValidity){const P=Ft(j)?"":j||"";o?o.forEach(k=>k.setCustomValidity(P)):C.setCustomValidity(P),C.reportValidity()}},_={},E=Al(a),N=Ws(a),R=E||N,M=(y||Ol(a))&&Be(a.value)&&Be(b)||$i(a)&&a.value===""||b===""||Array.isArray(b)&&!b.length,$=ED.bind(null,h,n,_),D=(j,P,k,L=Yt.maxLength,z=Yt.minLength)=>{const X=j?P:k;_[h]={type:j?L:z,message:X,ref:a,...$(j?L:z,X)}};if(i?!Array.isArray(b)||!b.length:l&&(!R&&(M||ut(b))||Ft(b)&&!b||N&&!Kh(o).isValid||E&&!Zh(o).isValid)){const{value:j,message:P}=wt(l)?{value:!!l,message:l}:Sn(l);if(j&&(_[h]={type:Yt.required,message:P,ref:C,...$(Yt.required,P)},!n))return S(P),_}if(!M&&(!ut(d)||!ut(g))){let j,P;const k=Sn(g),L=Sn(d);if(!ut(b)&&!isNaN(b)){const z=a.valueAsNumber||b&&+b;ut(k.value)||(j=z>k.value),ut(L.value)||(P=z<L.value)}else{const z=a.valueAsDate||new Date(b),X=we=>new Date(new Date().toDateString()+" "+we),ye=a.type=="time",_e=a.type=="week";wt(k.value)&&b&&(j=ye?X(b)>X(k.value):_e?b>k.value:z>new Date(k.value)),wt(L.value)&&b&&(P=ye?X(b)<X(L.value):_e?b<L.value:z<new Date(L.value))}if((j||P)&&(D(!!j,k.message,L.message,Yt.max,Yt.min),!n))return S(_[h].message),_}if((u||f)&&!M&&(wt(b)||i&&Array.isArray(b))){const j=Sn(u),P=Sn(f),k=!ut(j.value)&&b.length>+j.value,L=!ut(P.value)&&b.length<+P.value;if((k||L)&&(D(k,j.message,P.message),!n))return S(_[h].message),_}if(p&&!M&&wt(b)){const{value:j,message:P}=Sn(p);if(qi(j)&&!b.match(j)&&(_[h]={type:Yt.pattern,message:P,ref:a,...$(Yt.pattern,P)},!n))return S(P),_}if(w){if(bt(w)){const j=await w(b,r),P=$u(j,C);if(P&&(_[h]={...P,...$(Yt.validate,P.message)},!n))return S(P.message),_}else if(We(w)){let j={};for(const P in w){if(!it(j)&&!n)break;const k=$u(await w[P](b,r),C,P);k&&(j={...k,...$(P,k.message)},S(k.message),n&&(_[h]=j))}if(!it(j)&&(_[h]={ref:C,...j},!n))return _}}return S(!0),_};const MD={mode:Xt.onSubmit,reValidateMode:Xt.onChange,shouldFocusError:!0},Xh={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function BD(e={}){let t={...MD,...e},r={...Ke(Xh),isLoading:bt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=We(t.defaultValues)||We(t.values)?Ke(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Ke(s),a={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},l,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...f};let g={...d};const p={array:Nu(),state:Nu()},w=t.criteriaMode===Xt.all,h=x=>O=>{clearTimeout(u),u=setTimeout(x,O)},y=async x=>{if(!a.keepIsValid&&!t.disabled&&(d.isValid||g.isValid||x)){let O;t.resolver?(O=it((await $()).errors),v()):O=await P({fields:n,onlyCheckValid:!0,eventType:Dr.VALID}),O!==r.isValid&&p.state.next({isValid:O})}},v=(x,O)=>{!t.disabled&&(d.isValidating||d.validatingFields||g.isValidating||g.validatingFields)&&((x||Array.from(o.mount)).forEach(A=>{A&&(O?Le(r.validatingFields,A,O):Je(r.validatingFields,A))}),p.state.next({validatingFields:r.validatingFields,isValidating:!it(r.validatingFields)}))},b=()=>{r.dirtyFields=Qr(s,i)},C=(x,O=[],A,U,B=!0,G=!0)=>{if(U&&A&&!t.disabled){if(a.action=!0,G&&Array.isArray(W(n,x))){const H=A(W(n,x),U.argA,U.argB);B&&Le(n,x,H)}if(G&&Array.isArray(W(r.errors,x))){const H=A(W(r.errors,x),U.argA,U.argB);B&&Le(r.errors,x,H),FD(r.errors,x)}if((d.touchedFields||g.touchedFields)&&G&&Array.isArray(W(r.touchedFields,x))){const H=A(W(r.touchedFields,x),U.argA,U.argB);B&&Le(r.touchedFields,x,H)}(d.dirtyFields||g.dirtyFields)&&b(),p.state.next({name:x,isDirty:L(x,O),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Le(i,x,O)},S=(x,O)=>{Le(r.errors,x,O),r.errors={...r.errors},p.state.next({errors:r.errors})},_=x=>{r.errors=x,p.state.next({errors:r.errors,isValid:!1})},E=x=>{const O=Ks(x)?[x]:da(x);let A=i,U=s;for(let B=0;B<O.length-1;B++){const G=O[B];if(A=ut(A)?A:A[G],U=ut(U)?U:U[G],A===null&&U!==null)return!0}return!1},N=(x,O,A,U)=>{const B=W(n,x);if(B){if(E(x))return;const G=Be(W(i,x)),H=W(i,x,Be(A)?W(s,x):A);Be(H)||U&&U.defaultChecked||O?Le(i,x,O?H:Lu(B._f)):ye(x,H),a.mount&&!a.action&&(y(),G&&r.isDirty&&(d.isDirty||g.isDirty)&&(L()||(r.isDirty=!1,p.state.next({...r}))),e.shouldUnregister&&G&&!Be(W(i,x))&&za(x,o)&&(a.watch=!0))}},R=(x,O,A,U,B)=>{let G=!1,H=!1;const ee={name:x};if(!t.disabled){if(!A||U){(d.isDirty||g.isDirty)&&(H=r.isDirty,r.isDirty=ee.isDirty=L(),G=H!==ee.isDirty);const ge=Mt(W(s,x),O);H=!!W(r.dirtyFields,x),ge!==r.isDirty?r.dirtyFields=Qr(s,i):ge?Je(r.dirtyFields,x):Le(r.dirtyFields,x,!0),ee.dirtyFields=r.dirtyFields,G=G||(d.dirtyFields||g.dirtyFields)&&H!==!ge}if(A){const ge=W(r.touchedFields,x);ge||(Le(r.touchedFields,x,A),ee.touchedFields=r.touchedFields,G=G||(d.touchedFields||g.touchedFields)&&ge!==A)}G&&B&&p.state.next(ee)}return G?ee:{}},M=(x,O,A,U)=>{const B=W(r.errors,x),G=(d.isValid||g.isValid)&&Ft(O)&&r.isValid!==O;if(t.delayError&&A?(l=h(()=>S(x,A)),l(t.delayError)):(clearTimeout(u),l=null,A?Le(r.errors,x,A):Je(r.errors,x),r.errors={...r.errors}),(A?!Mt(B,A):B)||!it(U)||G){const H={...U,...G&&Ft(O)?{isValid:O}:{},errors:r.errors,name:x};r={...r,...H},p.state.next(H)}},$=async x=>(v(x,!0),await t.resolver(i,t.context,ND(x||o.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),D=async x=>{const{errors:O}=await $(x);if(v(x),x){for(const A of x){const U=W(O,A);U?o.array.has(A)&&We(U)&&!Object.keys(U).some(B=>!Number.isNaN(Number(B)))?Bu(r.errors,{[A]:U},A):Le(r.errors,A,U):Je(r.errors,A)}r.errors={...r.errors}}else r.errors=O;return O},j=async({name:x,eventType:O})=>{if(e.validate){const A=await e.validate({formValues:i,formState:r,name:x,eventType:O});if(We(A))for(const U in A){const B=A[U];B&&J(`${qa}.${U}`,{message:wt(B.message)?B.message:"",type:B.type||Yt.validate})}else wt(A)||!A?J(qa,{message:A||"",type:Yt.validate}):fe(qa);return A}return!0},P=async({fields:x,onlyCheckValid:O,name:A,eventType:U,context:B={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(B.runRootValidation=!0,!await j({name:A,eventType:U})&&(B.valid=!1,O)))return B.valid;for(const G in x){const H=x[G];if(H){const{_f:ee,...ge}=H;if(ee){const Qe=o.array.has(ee.name),Et=H._f&&RD(H._f),It=d.validatingFields||d.isValidating||g.validatingFields||g.isValidating;Et&&It&&v([ee.name],!0);const pr=await qu(H,o.disabled,i,w,t.shouldUseNativeValidation&&!O,Qe);if(Et&&It&&v([ee.name]),pr[ee.name]&&(B.valid=!1,O)||(!O&&(W(pr,ee.name)?Qe?Bu(r.errors,pr,ee.name):Le(r.errors,ee.name,pr[ee.name]):Je(r.errors,ee.name)),e.shouldUseNativeValidation&&pr[ee.name]))break}!it(ge)&&await P({context:B,onlyCheckValid:O,fields:ge,name:G,eventType:U})}}return B.valid},k=()=>{for(const x of o.unMount){const O=W(n,x);O&&(O._f.refs?O._f.refs.every(A=>!Ua(A)):!Ua(O._f.ref))&&$e(x)}o.unMount=new Set},L=(x,O)=>!t.disabled&&(x&&O&&Le(i,x,O),!Mt(V(),s)),z=(x,O,A)=>Mo(x,o,{...a.mount?i:Be(O)?s:wt(x)?{[x]:O}:O},A,O),X=x=>Hh(W(a.mount?i:s,x,t.shouldUnregister?W(s,x,[]):[])),ye=(x,O,A={},U=!1)=>{const B=W(n,x);let G=O;if(B){const H=B._f;H&&(!H.disabled&&Le(i,x,Yh(O,H)),G=$i(H.ref)&&ut(O)?"":O,Gh(H.ref)?[...H.ref.options].forEach(ee=>ee.selected=G.includes(ee.value)):H.refs?Ws(H.ref)?H.refs.forEach(ee=>{(!ee.defaultChecked||!ee.disabled)&&(Array.isArray(G)?ee.checked=!!G.find(ge=>ge===ee.value):ee.checked=G===ee.value||!!G)}):H.refs.forEach(ee=>ee.checked=ee.value===G):Ol(H.ref)?H.ref.value="":(H.ref.value=G,H.ref.type||p.state.next({name:x,values:U?i:Ke(i)})))}(A.shouldDirty||A.shouldTouch)&&R(x,G,A.shouldTouch,A.shouldDirty,!0),A.shouldValidate&&q(x)},_e=(x,O,A,U=!1)=>{for(const B in O){if(!O.hasOwnProperty(B))return;const G=O[B],H=x+"."+B,ee=W(n,H);(o.array.has(x)||We(G)||ee&&!ee._f)&&!Yr(G)?_e(H,G,A,U):ye(H,G,A,U)}},we=(x,O,A,U)=>{const B=W(n,x),G=o.array.has(x),H=U?O:Ke(O),ee=W(i,x),ge=Mt(ee,H);if(ge||Le(i,x,H),G)p.array.next({name:x,values:U?i:Ke(i)}),(d.isDirty||d.dirtyFields||g.isDirty||g.dirtyFields)&&A.shouldDirty&&(b(),p.state.next({name:x,dirtyFields:r.dirtyFields,isDirty:L(x,H)}));else{const Qe=Array.isArray(H)&&!H.length||it(H);!B||B._f||ut(H)||Qe?ye(x,H,A,U):_e(x,H,A,U)}if(!ge){const Qe=za(x,o),Et=U?i:Ke(i);p.state.next({...Qe&&r,name:a.mount||Qe?x:void 0,values:Et})}},de=(x,O,A={})=>we(x,O,A,!1),Q=(x,O={})=>{const A=bt(x)?x(i):x;if(!Mt(i,A)){i={...i,...A};for(const U of o.mount)we(U,W(A,U),O,!0);p.state.next({...r,name:void 0,type:void 0,values:i}),O.shouldValidate&&y()}},ne=async x=>{a.mount=!0;const O=x.target;let A=O.name,U=!0;const B=W(n,A),G=ge=>{U=Number.isNaN(ge)||Yr(ge)&&isNaN(ge.getTime())||Mt(ge,W(i,A,ge))},H=Pu(t.mode),ee=Pu(t.reValidateMode);if(B){let ge,Qe;const Et=O.type?Lu(B._f):Fo(x),It=x.type===Dr.BLUR||x.type===Dr.FOCUS_OUT,pr=!kD(B._f)&&!e.validate&&!t.resolver&&!W(r.errors,A)&&!B._f.deps||PD(It,W(r.touchedFields,A),r.isSubmitted,ee,H),Jn=za(A,o,It);Le(i,A,Et),It?(!O||!O.readOnly)&&(B._f.onBlur&&B._f.onBlur(x),l&&l(0)):B._f.onChange&&B._f.onChange(x);const zr=R(A,Et,It),rt=!it(zr)||Jn;if(!It&&p.state.next({name:A,type:x.type,values:Ke(i)}),pr)return(d.isValid||g.isValid)&&(t.mode==="onBlur"?It&&y():It||y()),rt&&p.state.next({name:A,...Jn?{}:zr});if(!t.resolver&&e.validate&&await j({name:A,eventType:x.type}),!It&&Jn&&p.state.next({...r}),t.resolver){const{errors:ht}=await $([A]);if(v([A]),G(Et),!U){!it(zr)&&p.state.next(zr);return}const xt=Mu(r.errors,n,A),Wt=Mu(ht,n,xt.name||A);ge=Wt.error,A=Wt.name,Qe=it(ht)}else v([A],!0),ge=(await qu(B,o.disabled,i,w,t.shouldUseNativeValidation))[A],v([A]),G(Et),U&&(ge?Qe=!1:(d.isValid||g.isValid)&&(Qe=await P({fields:n,onlyCheckValid:!0,name:A,eventType:x.type})));U&&(B._f.deps&&(!Array.isArray(B._f.deps)||B._f.deps.length>0)&&q(B._f.deps),M(A,Qe,ge,zr))}},te=(x,O)=>{if(W(r.errors,O)&&x.focus)return x.focus(),1},q=async(x,O={})=>{let A,U;const B=Ei(x);if(t.resolver){const G=await D(Be(x)?x:B);A=it(G),U=x?!B.some(H=>W(G,H)):A}else x?(U=(await Promise.all(B.map(async G=>{const H=W(n,G);return await P({fields:H&&H._f?{[G]:H}:H,eventType:Dr.TRIGGER})}))).every(Boolean),!(!U&&!r.isValid)&&y()):U=A=await P({fields:n,name:x,eventType:Dr.TRIGGER});return p.state.next({...!wt(x)||(d.isValid||g.isValid)&&A!==r.isValid?{}:{name:x},...t.resolver||!x?{isValid:A}:{},errors:r.errors}),O.shouldFocus&&!U&&Cs(n,te,x?B:o.mount),U},V=(x,O)=>{let A={...a.mount?i:s};return O&&(A=Qh(O.dirtyFields?r.dirtyFields:r.touchedFields,A)),Be(x)?A:wt(x)?W(A,x):x.map(U=>W(A,U))},ie=(x,O)=>({invalid:!!W((O||r).errors,x),isDirty:!!W((O||r).dirtyFields,x),error:W((O||r).errors,x),isValidating:!!W(r.validatingFields,x),isTouched:!!W((O||r).touchedFields,x)}),fe=x=>{const O=x?Ei(x):void 0;O==null||O.forEach(A=>Je(r.errors,A)),O?O.forEach(A=>{p.state.next({name:A,errors:r.errors})}):p.state.next({errors:{}})},J=(x,O,A)=>{const U=(W(n,x,{_f:{}})._f||{}).ref,B=W(r.errors,x)||{},{ref:G,message:H,type:ee,...ge}=B;Le(r.errors,x,{...ge,...O,ref:U}),p.state.next({name:x,errors:r.errors,isValid:!1}),A&&A.shouldFocus&&U&&U.focus&&U.focus()},se=(x,O)=>bt(x)?p.state.subscribe({next:A=>"values"in A&&x(A.values||z(void 0,O),A)}):z(x,O,!0),ke=x=>p.state.subscribe({next:O=>{if(LD(x.name,O.name,x.exact)&&jD(O,x.formState||d,K,x.reRenderRoot)){const A={...i};x.callback({values:A,...r,...O,defaultValues:s})}}}).unsubscribe,Te=x=>(a.mount=!0,g={...g,...x.formState},ke({...x,formState:{...f,...x.formState}})),$e=(x,O={})=>{for(const A of x?Ei(x):o.mount)o.mount.delete(A),o.array.delete(A),O.keepValue||(Je(n,A),Je(i,A)),!O.keepError&&Je(r.errors,A),!O.keepDirty&&Je(r.dirtyFields,A),!O.keepTouched&&Je(r.touchedFields,A),!O.keepIsValidating&&Je(r.validatingFields,A),!t.shouldUnregister&&!O.keepDefaultValue&&Je(s,A);p.state.next({values:Ke(i)}),p.state.next({...r,...O.keepDirty?{isDirty:L()}:{}}),!O.keepIsValid&&y()},Ve=({disabled:x,name:O})=>{if(Ft(x)&&a.mount||x||o.disabled.has(O)){const B=o.disabled.has(O)!==!!x;x?o.disabled.add(O):o.disabled.delete(O),B&&a.mount&&!a.action&&y()}},qe=(x,O={})=>{let A=W(n,x);const U=Ft(O.disabled)||Ft(t.disabled),B=!o.registerName.has(x)&&A&&A._f&&!A._f.mount;return Le(n,x,{...A||{},_f:{...A&&A._f?A._f:{ref:{name:x}},name:x,mount:!0,...O}}),o.mount.add(x),A&&!B?Ve({disabled:Ft(O.disabled)?O.disabled:t.disabled,name:x}):N(x,!0,O.value),{...U?{disabled:O.disabled||t.disabled}:{},...t.progressive?{required:!!O.required,min:cs(O.min),max:cs(O.max),minLength:cs(O.minLength),maxLength:cs(O.maxLength),pattern:cs(O.pattern)}:{},name:x,onChange:ne,onBlur:ne,ref:G=>{if(G){o.registerName.add(x),qe(x,O),o.registerName.delete(x),A=W(n,x);const H=Be(G.value)&&G.querySelectorAll&&G.querySelectorAll("input,select,textarea")[0]||G,ee=ID(H),ge=A._f.refs||[];if(ee?ge.find(Qe=>Qe===H):H===A._f.ref)return;Le(n,x,{_f:{...A._f,...ee?{refs:[...ge.filter(Ua),H,...Array.isArray(W(s,x))?[{}]:[]],ref:{type:H.type,name:x}}:{ref:H}}}),N(x,!1,void 0,H)}else A=W(n,x,{}),A._f&&(A._f.mount=!1),(t.shouldUnregister||O.shouldUnregister)&&!($h(o.array,x)&&a.action)&&o.unMount.add(x)}}},re=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&Cs(n,te,o.mount),He=x=>{Ft(x)&&(p.state.next({disabled:x}),Cs(n,(O,A)=>{const U=W(n,A);U&&(O.disabled=U._f.disabled||x,Array.isArray(U._f.refs)&&U._f.refs.forEach(B=>{B.disabled=U._f.disabled||x}))},0,!1))},ze=(x,O)=>async A=>{let U;A&&(A.preventDefault&&A.preventDefault(),A.persist&&A.persist());let B=Ke(i);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:G,values:H}=await $();v(),r.errors=G,B=Ke(H)}else await P({fields:n,eventType:Dr.SUBMIT});if(o.disabled.size)for(const G of o.disabled)Je(B,G);if(Je(r.errors,Uh),it(r.errors)){p.state.next({errors:{}});try{await x(B,A)}catch(G){U=G}}else O&&await O({...r.errors},A),re(),setTimeout(re);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:it(r.errors)&&!U,submitCount:r.submitCount+1,errors:r.errors}),U)throw U},Ue=(x,O={})=>{W(n,x)&&(Be(O.defaultValue)?de(x,Ke(W(s,x))):(de(x,O.defaultValue),Le(s,x,Ke(O.defaultValue))),O.keepTouched||Je(r.touchedFields,x),O.keepDirty||(Je(r.dirtyFields,x),r.isDirty=O.defaultValue?L(x,Ke(W(s,x))):L()),O.keepError||(Je(r.errors,x),d.isValid&&y()),p.state.next({...r}))},Ze=(x,O={})=>{const A=x?Ke(x):s,U=Ke(A),B=it(x),G=U;if(O.keepDefaultValues||(s=A),!O.keepValues){if(O.keepDirtyValues){const H=new Set([...o.mount,...Object.keys(Qr(s,i))]);for(const ee of Array.from(H)){const ge=W(r.dirtyFields,ee),Qe=W(i,ee),Et=W(G,ee);ge&&!Be(Qe)?Le(G,ee,Qe):!ge&&!Be(Et)&&de(ee,Et)}}else{if(ua&&Be(x))for(const H of o.mount){const ee=W(n,H);if(ee&&ee._f){const ge=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if($i(ge)){const Qe=ge.closest("form");if(Qe){Qe.reset();break}}}}if(O.keepFieldsRef)for(const H of o.mount)de(H,W(G,H));else n={}}if(t.shouldUnregister){if(i=O.keepDefaultValues?Ke(s):{},O.keepFieldsRef)for(const H of o.mount)Le(i,H,W(G,H))}else i=Ke(G);p.array.next({values:{...G}}),p.state.next({values:{...G}})}o={mount:O.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!d.isValid||!!O.keepIsValid||!!O.keepDirtyValues||!t.shouldUnregister&&!it(G),a.watch=!!t.shouldUnregister,a.keepIsValid=!!O.keepIsValid,a.action=!1,O.keepErrors||(r.errors={}),p.state.next({submitCount:O.keepSubmitCount?r.submitCount:0,isDirty:B?!1:O.keepDirty?r.isDirty:O.keepValues?L():!!(O.keepDefaultValues&&!Mt(x,s)),isSubmitted:O.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:B?{}:O.keepDirtyValues?O.keepDefaultValues&&i?Qr(s,i):r.dirtyFields:O.keepDefaultValues&&x?Qr(s,x):O.keepDirty?r.dirtyFields:{},touchedFields:O.keepTouched?r.touchedFields:{},errors:O.keepErrors?r.errors:{},isSubmitSuccessful:O.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Bt=(x,O)=>Ze(bt(x)?x(i):x,{...t.resetOptions,...O}),St=(x,O={})=>{const A=W(n,x),U=A&&A._f;if(U){const B=U.refs?U.refs[0]:U.ref;B.focus&&setTimeout(()=>{B.focus(),O.shouldSelect&&bt(B.select)&&B.select()})}},K=x=>{r={...r,...x}},$t={control:{register:qe,unregister:$e,getFieldState:ie,handleSubmit:ze,setError:J,_subscribe:ke,_runSchema:$,_updateIsValidating:v,_focusError:re,_getWatch:z,_getDirty:L,_setValid:y,_setFieldArray:C,_setDisabledField:Ve,_setErrors:_,_getFieldArray:X,_reset:Ze,_resetDefaultValues:()=>bt(t.defaultValues)&&t.defaultValues().then(x=>{Bt(x,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:k,_disableForm:He,_subjects:p,_proxyFormState:d,get _fields(){return n},get _formValues(){return i},get _state(){return a},set _state(x){a=x},get _defaultValues(){return s},get _names(){return o},set _names(x){o=x},get _formState(){return r},get _options(){return t},set _options(x){t={...t,...x}}},subscribe:Te,trigger:q,register:qe,handleSubmit:ze,watch:se,setValue:de,setValues:Q,getValues:V,reset:Bt,resetField:Ue,resetDefaultValues:(x,O={})=>{if(s=Ke(x),!O.keepDirty){const A=Qr(s,i);r.dirtyFields=A,r.isDirty=!it(A)}O.keepIsValid||y(),p.state.next({...r,defaultValues:s})},clearErrors:fe,unregister:$e,setError:J,setFocus:St,getFieldState:ie};return{...$t,formControl:$t}}function $D(e={}){const t=m.useRef(void 0),r=m.useRef(void 0),n=m.useRef(e.formControl),[s,i]=m.useState(()=>({...Ke(Xh),isLoading:bt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:bt(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&n.current!==e.formControl)if(n.current=e.formControl,e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!bt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=BD(e);t.current={...l,formState:s}}const a=t.current.control;return a._options=e,El(()=>{const o=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState,defaultValues:a._defaultValues}),reRenderRoot:!0});return i(l=>({...l,isReady:!0})),a._formState.isReady=!0,o},[a]),m.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),m.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),m.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),m.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),m.useEffect(()=>{if(a._proxyFormState.isDirty){const o=a._getDirty();o!==s.isDirty&&a._subjects.state.next({isDirty:o})}},[a,s.isDirty]),m.useEffect(()=>{var o;e.values&&!Mt(e.values,r.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),!((o=a._options.resetOptions)===null||o===void 0)&&o.keepIsValid||a._setValid(),r.current=e.values,i(l=>({...l}))):a._resetDefaultValues()},[a,e.values]),m.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=m.useMemo(()=>Vh(s,a),[a,s]),t.current}async function Uu(e){var r,n;return(n=(r=(await Ne.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}async function qD(e){var r,n;return((n=(r=(await Ne.post("/action/composite/v3/search",{request:{filters:{objectType:"Framework",status:["Live"],...e.type?{type:e.type}:{},...e.identifier?{identifier:e.identifier}:{},...e.channel?{channel:e.channel}:{},...e.systemDefault?{systemDefault:e.systemDefault}:{}}}})).data)==null?void 0:r.result)==null?void 0:n.Framework)??[]}function Jh(e,t){const r=$n({queryKey:["framework",e],queryFn:()=>Uu(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=$n({queryKey:["framework",n],queryFn:()=>Uu(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}function UD(e,t,r){const n=e??[],s=new Set(n.map(f=>f.type).filter(Boolean)),i=(t??[]).filter(f=>!s.has(f)),{data:a}=$n({queryKey:["framework-search",i.sort().join(","),r],queryFn:()=>qD({type:i,systemDefault:"Yes"}),enabled:i.length>0,staleTime:10*60*1e3}),o=t&&t.length?n.filter(f=>f.type&&t.includes(f.type)):n,l=[...(a??[]).map(f=>({label:f.name,value:f.identifier})),...o.map(f=>({label:f.name,value:f.identifier}))],u=new Set;return l.filter(f=>u.has(f.value)?!1:(u.add(f.value),!0))}async function ep(e){var r,n;return(n=(r=(await Ne.get(`/api/channel/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.channel}function zD(e){var r,n,s,i,a,o,l;const t=$n({queryKey:["channel",e],queryFn:()=>ep(e),enabled:!!e,staleTime:6e5});return{identifier:((r=t.data)==null?void 0:r.identifier)??e??"",name:(n=t.data)==null?void 0:n.name,frameworks:(s=t.data)==null?void 0:s.frameworks,collectionAdditionalCategories:(i=t.data)==null?void 0:i.collectionAdditionalCategories,contentAdditionalCategories:(a=t.data)==null?void 0:a.contentAdditionalCategories,defaultLicense:(o=t.data)==null?void 0:o.defaultLicense,defaultFramework:(l=t.data)==null?void 0:l.defaultFramework,isLoading:t.isLoading}}function VD(e){const{data:t}=$n({queryKey:["user","read",e],enabled:!!e,staleTime:1/0,queryFn:()=>x_(e)});return t&&([t.firstName,t.lastName].filter(Boolean).join(" ").trim()||t.userName)||void 0}const HD={"First Section":{title:"Basic Information",description:"Core details that define the content identity."},"Second Section":{title:"Categorisation",description:"Category and type classification for the content."},"Third Section":{title:"Categorisation",description:"Category and type classification for the content."},"Organisation Framework Terms":{title:"Curriculum",description:"Framework-aligned categorisation."},"Target Framework Terms":{title:"Target Audience",description:"Curriculum alignment for the intended learners."},"Fourth Section":{title:"Licensing & Attribution",description:"Copyright and usage rights information."},"Sixth Section":{title:"Licensing & Attribution",description:"Copyright and usage rights information."}},QD=new Set(["review","read","sourcingreview","orgreview"]),ii={"First Section":"details","Second Section":"details","Third Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing","Sixth Section":"licensing"},GD={Categorisation:"Second Section","Basic Information":"First Section","Licensing & Attribution":"Fourth Section",Curriculum:"Organisation Framework Terms","Target Audience":"Target Framework Terms"},WD={name:"details",description:"details",keywords:"details",appIcon:"details",primaryCategory:"details",additionalCategories:"details",board:"details",boardIds:"details",subject:"details",subjectIds:"details",medium:"details",framework:"details",topicsIds:"details",topic:"details",dialcodeRequired:"details",dialcodes:"details",audience:"audience",targetBoardIds:"audience",targetMediumIds:"audience",targetGradeLevelIds:"audience",targetSubjectIds:"audience",gradeLevel:"audience",creator:"licensing",author:"licensing",attributions:"licensing",license:"licensing",copyright:"licensing",copyrightYear:"licensing"},Dl={board:"board",boardIds:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},tp=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function rp(e,t,r,n,s={}){if(!(e!=null&&e.length))return lN(t,n,r);const i=new Map;for(const o of e){const l=o.code;l&&!i.has(l)&&i.set(l,o)}const a=new Set;return e.filter(o=>{if(n&&(o.code==="dialCode"||o.code==="dialcode")||o.visible===!1)return!1;const l=o.code;return a.has(l)?!1:(a.add(l),!0)}).map(o=>{const l=o.code??"",u=tN(o),f=rN(o,r,t,i,s),d=t[l],g=YD(l,np(d,u),u,t,s),p={code:l,label:o.label??l,inputType:u,required:!!(o.required===!0||Array.isArray(o.validations)&&o.validations.some(w=>w.type==="required")),editable:KD(l,o.editable!==!1,s),placeholder:o.placeholder,maxLength:o.maxLength,options:JD(f,g,u,r),depends:o.depends,tab:eN(o),section:o.section,defaultValue:o.defaultValue??o.default,currentValue:g};if(l==="dialcodes"){const w=t.dialcodeRequired==="Yes";return{...p,required:w,visible:w}}return p})}function KD(e,t,r){var i;const n=r.editorMode??"edit";if(!QD.has(n))return t!==!1;const s=(i=r.editableFields)==null?void 0:i[n];return!!(s&&s.includes(e))}function YD(e,t,r,n,s){const i=t==null||t===""||Array.isArray(t)&&t.length===0;switch(e){case"license":return i?s.defaultLicense??"":t;case"copyright":return i&&s.channelName?s.channelName:t;case"copyrightYear":return i?String(new Date().getFullYear()):t;case"author":case"creator":return i&&s.userFullName?s.userFullName:t;case"instructions":{const a=n.instructions;return a&&typeof a=="object"&&!Array.isArray(a)?a.default??"":typeof t=="object"&&t!==null?"":t}case"maxTime":case"warningTime":{if(!i)return t;const a=n.timeLimits,o=a==null?void 0:a[e];return o!=null&&o!==""?ZD(Number(o)):t}default:return t}}function ZD(e){if(!Number.isFinite(e)||e<0)return"";const t=Math.floor(e%60),r=Math.floor(e/60%60),n=Math.floor(e/3600),s=i=>String(i).padStart(2,"0");return n>0?`${s(n)}:${s(r)}:${s(t)}`:`${s(r)}:${s(t)}`}function XD(e){var n,s,i;const t=new Map,r=a=>a==null?void 0:a.forEach(o=>{o.identifier&&t.set(o.identifier,o.name),o.name&&t.set(o.name,o.name)});return(s=(n=e.organisationFramework)==null?void 0:n.categories)==null||s.forEach(a=>r(a.terms)),(i=e.targetFrameworks)==null||i.forEach(a=>{var o;return(o=a.categories)==null?void 0:o.forEach(l=>r(l.terms))}),t}function JD(e,t,r,n){if(r!=="select"&&r!=="multiselect"&&r!=="radio")return e;const s=Array.isArray(t)?t:t!=null&&t!==""?[t]:[];if(!s.length)return e;const i=e?[...e]:[],a=new Set(i.map(l=>l.value)),o=XD(n);for(const l of s){const u=String(l);a.has(u)||(i.push({label:o.get(u)??u,value:u}),a.add(u))}return i}function eN(e){const t=e.section;if(t){if(ii[t])return ii[t];const n=GD[t];if(n&&ii[n])return ii[n]}const r=e.code??"";return WD[r]??"details"}function np(e,t){const r=new Set(["multiselect","chips","keywords","tagsinput"]),n=new Set(["select","text","textarea","radio","datepicker","datetime","license"]);return r.has(t)?Array.isArray(e)?e:e!=null&&e!==""?[e]:[]:n.has(t)?Array.isArray(e)?e[0]??"":e??"":e}function tN(e){const t=(e.inputType??e.dataType??"").toLowerCase(),n=(e.dataType??"").toLowerCase()==="list";return t==="select"?"select":t==="framework"||t==="frameworkcategoryselect"?n?"multiselect":"select":t==="topicselector"?"chips":t==="multiselect"||t==="multi-select"?"multiselect":t==="keywords"||e.code==="keywords"||e.code==="topic"||e.code==="topicsIds"?"chips":t==="radio"?"radio":e.code==="appIcon"||t==="appicon"?"appIcon":t==="textarea"||e.code==="description"?"textarea":t==="datepicker"||t==="date"?"datepicker":t==="datetime"||t==="datetime-local"?"datetime":t==="tagsinput"?"tagsinput":t==="nestedselect"||t==="nested-select"?n?"multiselect":"select":t==="license"?"license":t==="dialcode"||t==="dial-code"?"dialcode":"text"}function rN(e,t,r,n,s){const i=e.code??"";if(i==="maxQuestions"){const u=s.childCount??0;if(u>0)return Array.from({length:u},(f,d)=>({label:String(d+1),value:String(d+1)}))}const a=e.range;if(Array.isArray(a)&&a.length)return typeof a[0]=="string"?a.map(u=>({label:u,value:u})):a.map(u=>({label:u.name,value:u.identifier}));const o=e.enum;if(o!=null&&o.length)return o.map(u=>({label:u,value:u}));if(i==="framework")return t.orgFrameworks;if(i==="additionalCategories"){const f=(s.objectType??"")==="QuestionSet"?s.contentAdditionalCategories??s.collectionAdditionalCategories:s.collectionAdditionalCategories??s.contentAdditionalCategories,d=(f&&f.length?f:s.contextAdditionalCategories)??t.channelAdditionalCategories;return d!=null&&d.length?aN(d).map(g=>({label:g,value:g})):void 0}const l=e.sourceCategory??Dl[i];if(l)return sp(i,l,e,t,r,n)}function nN(e,t){return tp.has(e)||t.output==="identifier"||typeof t.section=="string"&&t.section.includes("Target")}function sN(e,t){return tp.has(e)||typeof t.section=="string"&&t.section.includes("Target")}function Va(e,t,r){var i,a,o,l,u;const n=(a=(i=e.organisationFramework)==null?void 0:i.categories)==null?void 0:a.find(f=>f.code===t),s=(u=(l=(o=e.targetFrameworks)==null?void 0:o[0])==null?void 0:l.categories)==null?void 0:u.find(f=>f.code===t);return r?(s==null?void 0:s.terms)??(n==null?void 0:n.terms)??[]:(n==null?void 0:n.terms)??(s==null?void 0:s.terms)??[]}function iN(e){const t=new Set,r=[];for(const n of e){const s=n.identifier??n.name;s&&!t.has(s)&&(t.add(s),r.push(n))}return r}function aN(e){return Array.from(new Set(e))}function oN(e){return Array.isArray(e)?e:e!=null&&e!==""?[e]:[]}function sp(e,t,r,n,s,i){const a=nN(e,r),o=sN(e,r),l=h=>({label:h.name,value:a?h.identifier:h.name}),u=r.depends;if(!(u!=null&&u.length))return Va(n,t,o).map(l);const f=u.flatMap(h=>oN(s[h])).map(String);if(!f.length)return[];const d=[];for(const h of u){const y=i.get(h),v=(y==null?void 0:y.sourceCategory)??Dl[h]??h;d.push(...Va(n,v,o))}const p=d.filter(h=>f.includes(String(h.name))||f.includes(String(h.identifier))||f.includes(String(h.code))).flatMap(h=>h.associations??[]).filter(h=>String(h.category??"").toLowerCase()===t.toLowerCase()),w=iN(p);return w.length?w.map(l):Va(n,t,o).map(l)}function us(e,t){const r=Dl[e];if(r)return sp(e,r,{},t,{},new Map)}function ct(e,t,r){return np(e[t],r)}function lN(e,t,r){var s;const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:ct(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:ct(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:ct(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:ct(e,"primaryCategory","select")},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:ct(e,"additionalCategories","multiselect"),options:(s=r.channelAdditionalCategories)==null?void 0:s.map(i=>({label:i,value:i}))},{code:"framework",label:"Course Type",inputType:"select",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:r.orgFrameworks,currentValue:ct(e,"framework","select")},{code:"subjectIds",label:"Subjects covered",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:us("subjectIds",r),currentValue:ct(e,"subjectIds","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",currentValue:ct(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:us("targetBoardIds",r),currentValue:ct(e,"targetBoardIds","select")},{code:"targetMediumIds",label:"Medium(s) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetBoardIds"],options:us("targetMediumIds",r),currentValue:ct(e,"targetMediumIds","multiselect")},{code:"targetGradeLevelIds",label:"Class(es) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetMediumIds"],options:us("targetGradeLevelIds",r),currentValue:ct(e,"targetGradeLevelIds","multiselect")},{code:"targetSubjectIds",label:"Subject(s) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetGradeLevelIds"],options:us("targetSubjectIds",r),currentValue:ct(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ct(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ct(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ct(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ct(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ct(e,"license","select")})),n}const cN=["allowECM","levels","setPeriod","instances"];function ip(e){const t={};return e.forEach((r,n)=>{t[`L${n+1}`]={label:r}}),t}function uN(e,t={}){const r={...e};for(const i of cN)delete r[i];const n=e.levels;Array.isArray(n)&&n.length&&(r.outcomeDeclaration={levels:ip(n)});const s=e.instances;return s!=null&&s!==""&&(r.instances={label:s}),t.isReview&&(r.name===void 0||r.name===null||r.name==="")&&t.nodeTitle&&(r.name=t.nodeTitle),r}function dN(e,t){return e==="allowECM"||e==="setPeriod"?null:e==="levels"?{outcomeDeclaration:{levels:Array.isArray(t)?ip(t):{}}}:e==="instances"?{instances:t!=null&&t!==""?{label:t}:""}:{[e]:t}}function fN(e,t){const{watch:r,setValue:n}=e,s=m.useRef(!1);m.useEffect(()=>{const i=r((a,{name:o})=>{var l;if(!(!o||s.current)){s.current=!0;try{const u=new Set([o]);let f=!0;for(;f;){f=!1;for(const d of t)u.has(d.code)||(l=d.depends)!=null&&l.some(g=>u.has(g))&&(n(d.code,d.inputType==="multiselect"||d.inputType==="chips"?[]:"",{shouldDirty:!0}),u.add(d.code),f=!0)}}finally{s.current=!1}}});return()=>i.unsubscribe()},[r,n,t])}const hN="_section_ylgu8_1",pN="_header_ylgu8_11",mN="_title_ylgu8_17",gN="_description_ylgu8_24",yN="_divider_ylgu8_30",vN="_fields_ylgu8_36",xn={section:hN,header:pN,title:mN,description:gN,divider:yN,fields:vN},bN=({title:e,description:t,children:r})=>c.jsxs("div",{className:xn.section,children:[c.jsxs("div",{className:xn.header,children:[c.jsx("h3",{className:xn.title,children:e}),t&&c.jsx("p",{className:xn.description,children:t})]}),c.jsx("hr",{className:xn.divider}),c.jsx("div",{className:xn.fields,children:r})]}),wN="_field_1s288_1",CN="_fullWidth_1s288_7",SN="_label_1s288_11",xN="_required_1s288_19",_N="_input_1s288_24",TN="_textarea_1s288_45",EN="_inputError_1s288_50",IN="_error_1s288_54",ON="_selectBtn_1s288_59",AN="_selectOpen_1s288_83",DN="_placeholder_1s288_87",NN="_selectedVal_1s288_91",RN="_chevronUp_1s288_95",kN="_dropdown_1s288_100",jN="_option_1s288_116",LN="_optionSelected_1s288_134",PN="_noOpts_1s288_139",FN="_chipGroup_1s288_146",MN="_chipInput_1s288_158",BN="_addChipBtn_1s288_167",$N="_radioGroup_1s288_184",qN="_radioLabel_1s288_191",UN="_iconWrap_1s288_199",zN="_iconPreview_1s288_214",VN="_iconPlaceholder_1s288_220",HN="_removeIconBtn_1s288_233",QN="_tagChip_1s288_252",GN="_tagChipRemove_1s288_264",WN="_nestedSelectRow_1s288_278",KN="_dialcodeRow_1s288_287",YN="_validateBtn_1s288_293",ZN="_dialcodeValid_1s288_315",XN="_dialcodeSpinner_1s288_325",F={field:wN,fullWidth:CN,label:SN,required:xN,input:_N,textarea:TN,inputError:EN,error:IN,selectBtn:ON,selectOpen:AN,placeholder:DN,selectedVal:NN,chevronUp:RN,dropdown:kN,option:jN,optionSelected:LN,noOpts:PN,chipGroup:FN,chipInput:MN,addChipBtn:BN,radioGroup:$N,radioLabel:qN,iconWrap:UN,iconPreview:zN,iconPlaceholder:VN,removeIconBtn:HN,tagChip:QN,tagChipRemove:GN,nestedSelectRow:WN,dialcodeRow:KN,validateBtn:YN,dialcodeValid:ZN,dialcodeSpinner:XN},zu=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:a})=>{const o=ce(),{register:l,formState:{errors:u}}=rr(),f=u[e],d={required:r?o.textField.requiredError.replace("{field}",t):!1,maxLength:i?{value:i,message:o.textField.maxLengthError.replace("{max}",String(i))}:void 0};return c.jsxs("div",{className:[F.field,s?F.fullWidth:""].join(" "),children:[c.jsxs("label",{className:F.label,htmlFor:e,children:[t,r&&c.jsx("span",{className:F.required,children:"*"})]}),s?c.jsx("textarea",{id:e,className:[F.input,F.textarea,f?F.inputError:""].join(" "),disabled:n,placeholder:a,rows:3,...l(e,d)}):c.jsx("input",{id:e,type:"text",className:[F.input,f?F.inputError:""].join(" "),disabled:n,placeholder:a,...l(e,d)}),f&&c.jsx("span",{className:F.error,children:String(f.message)})]})},JN=({name:e,label:t,options:r,required:n,disabled:s})=>{var y;const i=ce(),[a,o]=m.useState(!1),l=m.useRef(null),{register:u,watch:f,setValue:d,formState:{errors:g}}=rr(),p=f(e),w=((y=r.find(v=>v.value===p))==null?void 0:y.label)??i.selectField.selectPlaceholder,h=g[e];return m.useEffect(()=>{if(!a)return;const v=b=>{var C;(C=l.current)!=null&&C.contains(b.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[a]),c.jsxs("div",{className:F.field,ref:l,style:{position:"relative"},children:[c.jsxs("label",{className:F.label,children:[t,n&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsx("input",{type:"hidden",...u(e,{required:n?i.selectField.requiredError.replace("{field}",t):!1})}),c.jsxs("button",{type:"button",disabled:s,className:[F.selectBtn,h?F.inputError:"",a?F.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[c.jsx("span",{className:p?F.selectedVal:F.placeholder,children:w}),c.jsx(Kn,{size:14,className:a?F.chevronUp:""})]}),a&&c.jsxs("div",{className:F.dropdown,children:[r.map(v=>c.jsxs("button",{type:"button",className:[F.option,p===v.value?F.optionSelected:""].join(" "),onClick:()=>{d(e,v.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[c.jsx("span",{children:v.label}),p===v.value&&c.jsx(Wn,{size:13})]},v.value)),!r.length&&c.jsx("span",{className:F.noOpts,children:i.selectField.noOptionsMessage})]}),h&&c.jsx("span",{className:F.error,children:String(h.message)})]})},eR=({name:e,label:t,options:r,required:n,disabled:s})=>{const i=ce(),[a,o]=m.useState(!1),l=m.useRef(null),{register:u,watch:f,setValue:d,formState:{errors:g}}=rr(),p=f(e)??[],w=g[e],h=p.length?`${p.length} ${i.multiSelectField.selectedCountSuffix}`:i.multiSelectField.selectPlaceholder;m.useEffect(()=>{if(!a)return;const v=b=>{var C;(C=l.current)!=null&&C.contains(b.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[a]);const y=v=>{const b=p.includes(v)?p.filter(C=>C!==v):[...p,v];d(e,b,{shouldDirty:!0,shouldValidate:!0})};return c.jsxs("div",{className:F.field,ref:l,style:{position:"relative"},children:[c.jsxs("label",{className:F.label,children:[t,n&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsx("input",{type:"hidden",...u(e,{required:n?i.multiSelectField.requiredError.replace("{field}",t):!1})}),c.jsxs("button",{type:"button",disabled:s,className:[F.selectBtn,w?F.inputError:"",a?F.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[c.jsx("span",{className:p.length?F.selectedVal:F.placeholder,children:h}),c.jsx(Kn,{size:14,className:a?F.chevronUp:""})]}),a&&c.jsxs("div",{className:F.dropdown,children:[r.map(v=>c.jsxs("button",{type:"button",className:[F.option,p.includes(v.value)?F.optionSelected:""].join(" "),onClick:()=>y(v.value),children:[c.jsx(Wn,{size:13,style:{opacity:p.includes(v.value)?1:0}}),c.jsx("span",{children:v.label})]},v.value)),!r.length&&c.jsx("span",{className:F.noOpts,children:i.multiSelectField.noOptionsMessage})]}),w&&c.jsx("span",{className:F.error,children:String(w.message)})]})},tR=({name:e,label:t,required:r,disabled:n,placeholder:s})=>{const i=ce(),a=s??i.chipGroupField.addPlaceholder,[o,l]=m.useState(""),[u,f]=m.useState(!1),d=m.useRef(null),{watch:g,setValue:p,formState:{errors:w}}=rr(),h=g(e)??[],y=w[e],v=()=>{const C=o.trim();C&&!h.includes(C)&&p(e,[...h,C],{shouldDirty:!0}),l(""),f(!1)},b=C=>p(e,h.filter(S=>S!==C),{shouldDirty:!0});return c.jsxs("div",{className:[F.field,F.fullWidth].join(" "),children:[c.jsxs("label",{className:F.label,children:[t,r&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsxs("div",{className:F.chipGroup,children:[h.map(C=>c.jsxs("span",{className:"sbx-chip filled",children:[C,!n&&c.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>b(C),"aria-label":`Remove ${C}`,children:"×"})]},C)),!n&&(u?c.jsx("input",{ref:d,autoFocus:!0,className:F.chipInput,value:o,onChange:C=>l(C.target.value),onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),v()),C.key==="Escape"&&(l(""),f(!1))},onBlur:v,placeholder:a}):c.jsxs("button",{type:"button",className:F.addChipBtn,onClick:()=>{f(!0),setTimeout(()=>{var C;return(C=d.current)==null?void 0:C.focus()},50)},children:[c.jsx(Us,{size:12})," ",i.chipGroupField.addButtonLabel]}))]}),y&&c.jsx("span",{className:F.error,children:String(y.message)})]})},rR=({name:e,label:t,options:r,required:n,disabled:s})=>{const i=ce(),{register:a,formState:{errors:o}}=rr(),l=o[e];return c.jsxs("div",{className:F.field,children:[c.jsxs("label",{className:F.label,children:[t,n&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsx("div",{className:F.radioGroup,children:r.map(u=>c.jsxs("label",{className:F.radioLabel,children:[c.jsx("input",{type:"radio",value:u.value,disabled:s,...a(e,{required:n?i.radioField.requiredError.replace("{field}",t):!1})}),u.label]},u.value))}),l&&c.jsx("span",{className:F.error,children:String(l.message)})]})};async function nR(e,t,r,n){var a,o;const i=(o=(a=(await Ne.post("/action/asset/v1/create",{request:{asset:{primaryCategory:"asset",language:["English"],code:crypto.randomUUID(),name:e,mediaType:"image",mimeType:t,createdBy:r,creator:null,channel:n,keywords:""}}})).data)==null?void 0:a.result)==null?void 0:o.node_id;if(!i)throw new Error("Asset creation failed: no node_id returned");return i}async function sR(e,t){var s,i;const n=(i=(s=(await Ne.post(`/action/content/v3/upload/url/${e}`,{request:{content:{fileName:t}}})).data)==null?void 0:s.result)==null?void 0:i.pre_signed_url;if(!n)throw new Error("Pre-signed URL fetch failed");return n}async function iR(e,t,r={}){const n=await fetch(e,{method:"PUT",body:t,headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"application/octet-stream",...r}});if(!n.ok)throw new Error(`Blob upload failed: ${n.status} ${n.statusText}`)}async function aR(e,t,r){var a,o;const n=new FormData;n.append("fileUrl",t),n.append("mimeType",r);const i=(o=(a=(await Ne.post(`/action/asset/v1/upload/${e}`,n,{params:{enctype:"multipart/form-data",processData:!1,contentType:!1,cache:!1}})).data)==null?void 0:a.result)==null?void 0:o.content_url;if(!i)throw new Error("Asset finalize failed: no content_url returned");return i}const oR="_overlay_ga6eh_1",lR="_modal_ga6eh_12",cR="_header_ga6eh_24",uR="_title_ga6eh_33",dR="_closeBtn_ga6eh_39",fR="_tabs_ga6eh_57",hR="_tab_ga6eh_57",pR="_activeTab_ga6eh_83",mR="_body_ga6eh_88",gR="_searchWrap_ga6eh_99",yR="_searchIcon_ga6eh_104",vR="_searchInput_ga6eh_113",bR="_grid_ga6eh_132",wR="_imgCell_ga6eh_148",CR="_imgCellSelected_ga6eh_166",SR="_thumb_ga6eh_171",xR="_noThumb_ga6eh_177",_R="_checkBadge_ga6eh_183",TR="_loadMoreBtn_ga6eh_198",ER="_loadingRow_ga6eh_220",IR="_empty_ga6eh_230",OR="_spinner_ga6eh_237",AR="_uploadArea_ga6eh_247",DR="_dropZone_ga6eh_256",NR="_uploadIcon_ga6eh_277",RR="_dropText_ga6eh_281",kR="_dropSubtext_ga6eh_288",jR="_uploadPreview_ga6eh_294",LR="_hiddenInput_ga6eh_301",PR="_fileName_ga6eh_305",FR="_errorText_ga6eh_311",MR="_footer_ga6eh_318",BR="_cancelBtn_ga6eh_328",$R="_confirmBtn_ga6eh_345",me={overlay:oR,modal:lR,header:cR,title:uR,closeBtn:dR,tabs:fR,tab:hR,activeTab:pR,body:mR,searchWrap:gR,searchIcon:yR,searchInput:vR,grid:bR,imgCell:wR,imgCellSelected:CR,thumb:SR,noThumb:xR,checkBadge:_R,loadMoreBtn:TR,loadingRow:ER,empty:IR,spinner:OR,uploadArea:AR,dropZone:DR,uploadIcon:NR,dropText:RR,dropSubtext:kR,uploadPreview:jR,hiddenInput:LR,fileName:PR,errorText:FR,footer:MR,cancelBtn:BR,confirmBtn:$R},Vu=18,ap=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const s=ce(),[i,a]=m.useState("my"),[o,l]=m.useState(""),[u,f]=m.useState([]),[d,g]=m.useState(0),[p,w]=m.useState(!1),[h,y]=m.useState(null),[v,b]=m.useState(0),[C,S]=m.useState(null),[_,E]=m.useState(""),[N,R]=m.useState(!1),[M,$]=m.useState(""),D=m.useRef(null),j=le(q=>{var V,ie;return((ie=(V=q.editorConfig)==null?void 0:V.context)==null?void 0:ie.channel)??""}),P=le(q=>{var V,ie;return((ie=(V=q.editorConfig)==null?void 0:V.context)==null?void 0:ie.uid)??""}),k=le(q=>{var V,ie,fe;return((fe=(ie=(V=q.editorConfig)==null?void 0:V.context)==null?void 0:ie.cloudStorage)==null?void 0:fe.presigned_headers)??{}}),L=le(q=>{var V,ie,fe;return((fe=(ie=(V=q.editorConfig)==null?void 0:V.config)==null?void 0:ie.assetConfig)==null?void 0:fe.size)??1*1024*1024}),z=le(q=>{var V,ie,fe;return((fe=(ie=(V=q.editorConfig)==null?void 0:V.config)==null?void 0:ie.assetConfig)==null?void 0:fe.accepted)??"image/png,image/jpeg"}),X=m.useCallback(async(q,V,ie=!1)=>{var fe;w(!0);try{const J={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};i==="my"&&P&&(J.createdBy=P),j&&(J.channel=j);const ke=((fe=(await Ne.post("/action/composite/v3/search",{request:{filters:J,query:q,limit:Vu,offset:V,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:fe.result)??{},Te=ke.content??[];g(ke.count??0),f($e=>ie?[...$e,...Te]:Te)}catch{}finally{w(!1)}},[i,P,j]);m.useEffect(()=>{i!=="upload"&&(f([]),b(0),X(o,0))},[i]);const ye=m.useRef(),_e=q=>{l(q),clearTimeout(ye.current),ye.current=setTimeout(()=>{f([]),b(0),X(q,0)},400)},we=()=>{const q=v+Vu;b(q),X(o,q,!0)},de=()=>{const q=(h==null?void 0:h.artifactUrl)??(h==null?void 0:h.appIcon)??(h==null?void 0:h.downloadUrl)??"";q&&r(q)};m.useEffect(()=>()=>{_&&URL.revokeObjectURL(_)},[_]);const Q=q=>{var fe;const V=(fe=q.target.files)==null?void 0:fe[0];if(q.target.value="",!V)return;const ie=z.split(",").map(J=>J.trim());if(!ie.includes(V.type)){const J=ie.map(se=>se.replace("image/","").toUpperCase()).join(", ");$(s.appIconPickerModal.invalidFileTypeError.replace("{types}",J));return}if(V.size>L){const J=(L/1048576).toFixed(0);$(s.appIconPickerModal.fileTooLargeError.replace("{size}",J));return}_&&URL.revokeObjectURL(_),S(V),E(URL.createObjectURL(V)),$("")},ne=async()=>{if(C){R(!0),$("");try{const q=await nR(C.name.split(".").slice(0,-1).join(".")||C.name,C.type,P,j),V=await sR(q,C.name);await iR(V,C,k);const ie=V.split("?")[0],fe=await aR(q,ie,C.type);r(fe)}catch(q){$(q instanceof Error?q.message:s.appIconPickerModal.uploadFailedError)}finally{R(!1)}}},te=u.length<d;return c.jsx("div",{className:me.overlay,role:"dialog","aria-modal":"true","aria-label":s.appIconPickerModal.dialogAriaLabel,children:c.jsxs("div",{className:me.modal,children:[c.jsxs("div",{className:me.header,children:[c.jsx("span",{className:me.title,children:s.appIconPickerModal.title}),c.jsx("button",{className:me.closeBtn,onClick:n,"aria-label":s.appIconPickerModal.closeAriaLabel,children:c.jsx(Cr,{size:18})})]}),c.jsxs("div",{className:me.tabs,role:"tablist",children:[c.jsx("button",{role:"tab","aria-selected":i==="my",className:`${me.tab} ${i==="my"?me.activeTab:""}`,onClick:()=>a("my"),children:s.appIconPickerModal.myImagesTab}),c.jsx("button",{role:"tab","aria-selected":i==="all",className:`${me.tab} ${i==="all"?me.activeTab:""}`,onClick:()=>a("all"),children:s.appIconPickerModal.allImagesTab}),c.jsxs("button",{role:"tab","aria-selected":i==="upload",className:`${me.tab} ${i==="upload"?me.activeTab:""}`,onClick:()=>a("upload"),children:[c.jsx(go,{size:13,style:{marginRight:4}}),s.appIconPickerModal.uploadTab]})]}),c.jsx("div",{className:me.body,children:i!=="upload"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:me.searchWrap,children:[c.jsx(mo,{size:14,className:me.searchIcon}),c.jsx("input",{type:"search",className:me.searchInput,placeholder:s.appIconPickerModal.searchPlaceholder,value:o,onChange:q=>_e(q.target.value)})]}),p&&u.length===0?c.jsxs("div",{className:me.loadingRow,children:[c.jsx(hi,{size:20,className:me.spinner}),c.jsx("span",{children:s.appIconPickerModal.loadingText})]}):u.length===0?c.jsx("div",{className:me.empty,children:s.appIconPickerModal.noImagesFound}):c.jsx("div",{className:me.grid,children:u.map(q=>{const V=q.appIcon??q.artifactUrl??q.downloadUrl??"",ie=(h==null?void 0:h.identifier)===q.identifier;return c.jsxs("button",{type:"button",className:`${me.imgCell} ${ie?me.imgCellSelected:""}`,onClick:()=>y(q),title:q.name,children:[V?c.jsx("img",{src:V,alt:q.name,className:me.thumb}):c.jsx("div",{className:me.noThumb,children:s.appIconPickerModal.noThumbnailText}),ie&&c.jsx("div",{className:me.checkBadge,children:c.jsx(Wn,{size:12})})]},q.identifier)})}),te&&!p&&c.jsx("button",{className:me.loadMoreBtn,onClick:we,children:s.appIconPickerModal.loadMoreButton}),p&&u.length>0&&c.jsx("div",{className:me.loadingRow,children:c.jsx(hi,{size:16,className:me.spinner})})]}):c.jsxs("div",{className:me.uploadArea,children:[c.jsx("div",{className:me.dropZone,onClick:()=>{var q;return(q=D.current)==null?void 0:q.click()},onDragOver:q=>q.preventDefault(),onDrop:q=>{q.preventDefault();const V=q.dataTransfer.files[0];V&&Q({target:{files:[V],value:""}})},children:_?c.jsx("img",{src:_,alt:s.appIconPickerModal.previewAlt,className:me.uploadPreview}):c.jsxs(c.Fragment,{children:[c.jsx(go,{size:32,className:me.uploadIcon}),c.jsx("p",{className:me.dropText,children:s.appIconPickerModal.dropZoneText}),c.jsx("p",{className:me.dropSubtext,children:s.appIconPickerModal.acceptedTypesInfo.replace("{types}",z.split(",").map(q=>q.replace("image/","").toUpperCase()).join(", ")).replace("{size}",(L/(1024*1024)).toFixed(0))})]})}),c.jsx("input",{ref:D,type:"file",accept:z,className:me.hiddenInput,onChange:Q}),C&&c.jsx("p",{className:me.fileName,children:C.name}),M&&c.jsx("p",{className:me.errorText,children:M})]})}),c.jsxs("div",{className:me.footer,children:[c.jsx("button",{className:me.cancelBtn,onClick:n,children:s.appIconPickerModal.cancelButton}),i==="upload"?c.jsx("button",{className:me.confirmBtn,disabled:!C||N,onClick:ne,children:N?c.jsxs(c.Fragment,{children:[c.jsx(hi,{size:14,className:me.spinner})," ",s.appIconPickerModal.uploadingText]}):s.appIconPickerModal.uploadAndUseButton}):c.jsx("button",{className:me.confirmBtn,disabled:!h,onClick:de,children:s.appIconPickerModal.useSelectedButton})]})]})})},qR=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const i=ce(),[a,o]=m.useState(!1),{watch:l,setValue:u,register:f,formState:{errors:d}}=rr(),g=l(e),p=d[e],w=y=>{u(e,y,{shouldDirty:!0,shouldValidate:!0}),o(!1)},h=()=>{u(e,"",{shouldDirty:!0,shouldValidate:!0})};return c.jsxs("div",{className:F.field,children:[c.jsxs("label",{className:F.label,children:[t,n&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsx("input",{type:"hidden",...f(e,{required:n?i.appIconField.requiredError.replace("{field}",t):!1})}),c.jsx("div",{className:F.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":i.appIconField.selectIconAriaLabel,onClick:()=>!s&&o(!0),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&!s&&o(!0)},children:g?c.jsx("img",{src:g,alt:i.appIconField.iconAlt,className:F.iconPreview}):c.jsxs("div",{className:F.iconPlaceholder,children:[c.jsx(lf,{size:20}),c.jsx("span",{children:i.appIconField.selectIconLabel})]})}),g&&!s&&c.jsxs("button",{type:"button",className:F.removeIconBtn,onClick:h,"aria-label":i.appIconField.removeIconAriaLabel,children:[c.jsx(sl,{size:13}),c.jsx("span",{children:i.appIconField.removeLabel})]}),p&&c.jsx("span",{className:F.error,children:String(p.message)}),a&&c.jsx(ap,{nodeId:r,currentValue:g,onSelect:w,onClose:()=>o(!1)})]})},UR=({name:e,label:t,required:r,disabled:n})=>{const s=ce(),{control:i}=rr(),{field:a,fieldState:{error:o}}=fa({name:e,control:i,rules:{required:r?s.dateTimeField.requiredError.replace("{field}",t):!1}});return c.jsxs("div",{className:F.field,children:[c.jsxs("label",{className:F.label,htmlFor:e,children:[t,r&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsx("input",{id:e,type:"datetime-local",className:[F.input,o?F.inputError:""].join(" "),disabled:n,value:a.value??"",onChange:a.onChange,onBlur:a.onBlur,ref:a.ref}),o&&c.jsx("span",{className:F.error,children:String(o.message)})]})},zR=({name:e,label:t,required:r,disabled:n})=>{const s=ce(),{control:i}=rr(),{field:a,fieldState:{error:o}}=fa({name:e,control:i,rules:{required:r?s.keywordSuggestField.requiredError.replace("{field}",t):!1},defaultValue:[]}),[l,u]=m.useState(""),f=m.useRef(null),d=a.value??[],g=y=>{const v=y.trim();!v||d.includes(v)||a.onChange([...d,v])},p=y=>{a.onChange(d.filter(v=>v!==y))},w=y=>{y.key==="Enter"||y.key===","?(y.preventDefault(),g(l),u("")):y.key==="Backspace"&&l===""&&d.length>0&&p(d[d.length-1])},h=()=>{l.trim()&&(g(l),u("")),a.onBlur()};return c.jsxs("div",{className:[F.field,F.fullWidth].join(" "),children:[c.jsxs("label",{className:F.label,children:[t,r&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsxs("div",{className:[F.chipGroup,o?F.inputError:""].join(" "),onClick:()=>{var y;return!n&&((y=f.current)==null?void 0:y.focus())},style:{cursor:n?"not-allowed":"text"},children:[d.map(y=>c.jsxs("span",{className:F.tagChip,children:[y,!n&&c.jsx("button",{type:"button",className:F.tagChipRemove,onClick:v=>{v.stopPropagation(),p(y)},"aria-label":`Remove ${y}`,children:c.jsx(Cr,{size:11})})]},y)),!n&&c.jsx("input",{ref:f,className:F.chipInput,value:l,onChange:y=>u(y.target.value),onKeyDown:w,onBlur:h,placeholder:d.length===0?s.keywordSuggestField.inputPlaceholder:"",style:{flexGrow:1,minWidth:120}})]}),o&&c.jsx("span",{className:F.error,children:String(o.message)})]})},VR=({name:e,label:t,levels:r,required:n,disabled:s})=>{const i=ce(),{control:a}=rr(),{field:o,fieldState:{error:l}}=fa({name:e,control:a,rules:{required:n?i.nestedSelectField.requiredError.replace("{field}",t):!1},defaultValue:{}}),u=o.value??{},f=(d,g,p)=>{const w={};for(let h=0;h<g;h++)w[r[h].code]=u[r[h].code]??"";w[d]=p;for(let h=g+1;h<r.length;h++)w[r[h].code]="";o.onChange(w)};return c.jsxs("div",{className:[F.field,F.fullWidth].join(" "),children:[c.jsxs("label",{className:F.label,children:[t,n&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsx("div",{className:F.nestedSelectRow,children:r.map((d,g)=>{const p=g>0&&!u[r[g-1].code];return c.jsxs("div",{className:F.field,style:{flex:1},children:[c.jsx("label",{className:F.label,htmlFor:`${e}_${d.code}`,children:d.label}),c.jsxs("select",{id:`${e}_${d.code}`,className:[F.input,l?F.inputError:""].join(" "),disabled:s||p,value:u[d.code]??"",onChange:w=>f(d.code,g,w.target.value),onBlur:o.onBlur,children:[c.jsx("option",{value:"",children:i.nestedSelectField.selectPlaceholder}),d.options.map(w=>c.jsx("option",{value:w.value,children:w.label},w.value))]})]},d.code)})}),l&&c.jsx("span",{className:F.error,children:String(l.message)})]})},Hu=[{label:"CC BY 4.0",value:"CC BY 4.0"},{label:"CC BY-SA 4.0",value:"CC BY-SA 4.0"},{label:"CC BY-NC 4.0",value:"CC BY-NC 4.0"},{label:"CC BY-NC-SA 4.0",value:"CC BY-NC-SA 4.0"},{label:"CC BY-ND 4.0",value:"CC BY-ND 4.0"},{label:"CC0 1.0 (Public Domain)",value:"CC0 1.0"}],HR=({name:e,label:t,required:r,disabled:n})=>{const s=ce(),[i,a]=m.useState(!1),o=m.useRef(null),{register:l,watch:u,setValue:f,formState:{errors:d}}=rr(),g=u(e),p=Hu.find(y=>y.value===g),w=(p==null?void 0:p.label)??s.licenseSelectField.selectPlaceholder,h=d[e];return m.useEffect(()=>{if(!i)return;const y=v=>{var b;(b=o.current)!=null&&b.contains(v.target)||a(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),c.jsxs("div",{className:F.field,ref:o,style:{position:"relative"},children:[c.jsxs("label",{className:F.label,children:[t,r&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsx("input",{type:"hidden",...l(e,{required:r?s.licenseSelectField.requiredError.replace("{field}",t):!1})}),c.jsxs("button",{type:"button",disabled:n,className:[F.selectBtn,h?F.inputError:"",i?F.selectOpen:""].join(" "),onClick:()=>a(y=>!y),"aria-haspopup":"listbox","aria-expanded":i,children:[c.jsx("span",{className:g?F.selectedVal:F.placeholder,children:w}),c.jsx(Kn,{size:14,className:i?F.chevronUp:""})]}),i&&c.jsx("div",{className:F.dropdown,role:"listbox",children:Hu.map(y=>c.jsxs("button",{type:"button",role:"option","aria-selected":g===y.value,className:[F.option,g===y.value?F.optionSelected:""].join(" "),onClick:()=>{f(e,y.value,{shouldDirty:!0,shouldValidate:!0}),a(!1)},children:[c.jsx("span",{children:y.label}),g===y.value&&c.jsx(Wn,{size:13})]},y.value))}),h&&c.jsx("span",{className:F.error,children:String(h.message)})]})},QR=({name:e,label:t,required:r,disabled:n})=>{const s=ce(),{control:i}=rr(),{field:a,fieldState:{error:o}}=fa({name:e,control:i,rules:{required:r?s.dialcodeInputField.requiredError.replace("{field}",t):!1},defaultValue:""}),[l,u]=m.useState("idle"),[f,d]=m.useState(""),g=async()=>{const w=(a.value??"").trim();if(!w){u("invalid"),d(s.dialcodeInputField.enterCodeMessage);return}u("loading"),d("");try{const h=await a0(w),y=h==null?void 0:h.result,v=y==null?void 0:y.dialcodes;Array.isArray(v)&&v.length>0?(u("valid"),d(s.dialcodeInputField.validMessage)):(u("invalid"),d(s.dialcodeInputField.notFoundMessage))}catch{u("invalid"),d(s.dialcodeInputField.validationFailedMessage)}},p=()=>l==="loading"?c.jsx(hi,{size:16,className:F.dialcodeSpinner}):l==="valid"?c.jsx(nf,{size:16,color:"var(--sbx-success, #2e7d32)"}):l==="invalid"?c.jsx(jy,{size:16,color:"var(--sbx-error)"}):null;return c.jsxs("div",{className:F.field,children:[c.jsxs("label",{className:F.label,htmlFor:e,children:[t,r&&c.jsx("span",{className:F.required,children:"*"})]}),c.jsxs("div",{className:F.dialcodeRow,children:[c.jsx("input",{id:e,type:"text",className:[F.input,o?F.inputError:""].join(" "),disabled:n,value:a.value??"",onChange:w=>{a.onChange(w),u("idle"),d("")},onBlur:a.onBlur,ref:a.ref,placeholder:s.dialcodeInputField.placeholderExample,style:{flex:1}}),c.jsx("button",{type:"button",className:F.validateBtn,onClick:g,disabled:n||l==="loading","aria-label":s.dialcodeInputField.validateAriaLabel,children:l==="loading"?s.dialcodeInputField.validatingLabel:s.dialcodeInputField.validateButtonLabel}),p()]}),o&&c.jsx("span",{className:F.error,children:String(o.message)}),!o&&f&&c.jsx("span",{className:l==="valid"?F.dialcodeValid:F.error,children:f})]})},GR="_form_szqex_1",WR="_ungrouped_szqex_7",KR="_noFields_szqex_18",Ha={form:GR,ungrouped:WR,noFields:KR},YR=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:a})=>{var Ve,qe,re,He,ze,Ue,Ze,Bt,St;const o=ce(),l=le(K=>K.editorConfig),u=le(K=>K.rootFormConfig),f=le(K=>K.unitFormConfig),d=le(K=>K.categoryMeta),g=le(K=>K.contentFramework),p=le(K=>K.contentTargetFWIds),{organisationFramework:w,targetFrameworks:h,isLoading:y}=Jh(g??((Ve=l==null?void 0:l.context)==null?void 0:Ve.framework),p??((qe=l==null?void 0:l.context)==null?void 0:qe.targetFWIds)),{frameworks:v,collectionAdditionalCategories:b,contentAdditionalCategories:C,defaultLicense:S,name:_}=zD((re=l==null?void 0:l.context)==null?void 0:re.channel),E=VD(((He=l==null?void 0:l.context)==null?void 0:He.userId)??((ze=l==null?void 0:l.context)==null?void 0:ze.uid)),N=UD(v,(Ue=d==null?void 0:d.frameworkMetadata)==null?void 0:Ue.orgFWType,(Ze=l==null?void 0:l.context)==null?void 0:Ze.channel),R={organisationFramework:w,targetFrameworks:h,orgFrameworks:N,channelAdditionalCategories:b},M=Oe(K=>K.selectedNodeId),$=Oe(K=>K.treeData),D=Oe(K=>K.treeCache),j=M?D[M]??{}:{},P={...e,...j},k=m.useMemo(()=>{var pe;if(!M)return 0;const K=[...$];for(;K.length;){const ve=K.shift();if(ve.id===M)return((pe=ve.children)==null?void 0:pe.length)??0;ve.children&&K.push(...ve.children)}return 0},[$,M]),L=(l==null?void 0:l.config)??{},z=(l==null?void 0:l.context)??{},X={editorMode:s,editableFields:L.editableFields,objectType:L.objectType,setDefaultCopyRight:L.setDefaultCopyRight===!0,defaultLicense:z.defaultLicense??S,contextAdditionalCategories:z.additionalCategories,userFullName:((Bt=z.user)==null?void 0:Bt.fullName)??E,channelName:_,collectionAdditionalCategories:b,contentAdditionalCategories:C,childCount:k},ye=r?u:f,_e=ye||(((St=l==null?void 0:l.config.hierarchy)==null?void 0:St.formConfig)??[]),we=rp(_e,P,R,r,X),de=we.filter(K=>K.tab===t&&K.inputType!=="appIcon"&&K.visible!==!1),Q=$D({mode:"onChange",defaultValues:Object.fromEntries(we.map(K=>{const pe=["multiselect","chips","keywords","tagsinput"],ve=["nestedselect"];return pe.includes(K.inputType)?[K.code,K.currentValue??K.defaultValue??[]]:ve.includes(K.inputType)?[K.code,K.currentValue??K.defaultValue??{}]:[K.code,K.currentValue??K.defaultValue??""]}))});fN(Q,we);const{updateNode:ne}=Oe(),te=m.useRef(we);te.current=we;const q=m.useRef(M);q.current=M;const V=m.useRef(i);V.current=i;const ie=m.useRef(a);ie.current=a;const fe=m.useRef(typeof P.shuffle=="boolean"?P.shuffle:void 0),J=m.useRef(P.name??"");J.current=P.name??"";const se=m.useRef(s);se.current=s;const ke=["review","read","sourcingreview","orgreview"];m.useEffect(()=>{const K=q.current;if(K){const pe=Object.fromEntries(te.current.filter(ve=>ve.currentValue!==void 0&&ve.currentValue!==null).map(ve=>[ve.code,ve.currentValue]));Object.keys(pe).length>0&&ne(K,pe)}Q.trigger().then(()=>{const pe=Q.formState.errors,ve=te.current,$t=Array.from(new Set(Object.keys(pe).map(x=>{var O;return(O=ve.find(A=>A.code===x))==null?void 0:O.tab}).filter(Boolean)));ie.current(Object.keys(pe).length===0,$t)})},[]),m.useEffect(()=>{const K=Q.watch((pe,{name:ve})=>{const $t=q.current;if(!$t)return;const x=te.current,O=new Set(x.map(B=>B.code));if(ve&&O.has(ve)){let B=Q.getValues(ve);ve==="dialcodes"&&(B=Array.isArray(B)?B:B?[B]:[]),ve==="shuffle"&&(B===!0&&fe.current===!1&&Ee(o.sparkMetaForm.shuffleEnabledMessage,{icon:c.jsx(el,{size:16})}),fe.current=B);const G=dN(ve,B);G&&(ne($t,G),V.current(G))}else if(!ve){const B=Q.getValues(),G=Object.fromEntries(Object.entries(B).filter(([ee])=>O.has(ee))),H=uN(G,{isReview:ke.includes(se.current),nodeTitle:J.current});Object.keys(H).length>0&&(ne($t,H),V.current(H))}const A=Q.formState.errors,U=Array.from(new Set(Object.keys(A).map(B=>{var G;return(G=x.find(H=>H.code===B))==null?void 0:G.tab}).filter(Boolean)));ie.current(Object.keys(A).length===0,U)});return()=>K.unsubscribe()},[Q]),m.useEffect(()=>{for(const K of["author","creator","copyright","copyrightYear","license"]){const pe=te.current.find($t=>$t.code===K);if(!pe||pe.currentValue===void 0||pe.currentValue===null||pe.currentValue==="")continue;const ve=Q.getValues(K);(ve==null||ve==="")&&Q.setValue(K,pe.currentValue,{shouldDirty:!1})}},[E,_,Q]);const Te=de.reduce((K,pe)=>{const ve=K[K.length-1];return ve&&ve.section===pe.section?ve.fields.push(pe):K.push({section:pe.section,fields:[pe]}),K},[]),$e=K=>{const pe={key:K.code,name:K.code,label:K.label,required:K.required,disabled:K.editable===!1};switch(K.inputType){case"textarea":return c.jsx(zu,{...pe,multiline:!0,maxLength:K.maxLength});case"select":return c.jsx(JN,{...pe,options:K.options??[]});case"multiselect":return c.jsx(eR,{...pe,options:K.options??[]});case"chips":return c.jsx(tR,{...pe});case"radio":return c.jsx(rR,{...pe,options:K.options??[]});case"appIcon":return c.jsx(qR,{...pe,nodeId:M??""});case"datepicker":case"datetime":return c.jsx(UR,{...pe});case"keywords":case"tagsinput":return c.jsx(zR,{...pe});case"nestedselect":return c.jsx(VR,{...pe,levels:K.levels??[]});case"license":return c.jsx(HR,{...pe});case"dialcode":return c.jsx(QR,{...pe});default:return c.jsx(zu,{...pe,maxLength:K.maxLength})}};return c.jsx(TD,{...Q,children:c.jsxs("div",{className:Ha.form,children:[Te.map((K,pe)=>{const ve=K.section?HD[K.section]:void 0;return ve?c.jsx(bN,{title:ve.title,description:ve.description,children:K.fields.map($e)},K.section??pe):c.jsx("div",{className:Ha.ungrouped,children:K.fields.map($e)},pe)}),de.length===0&&!y&&c.jsx("p",{className:Ha.noFields,children:o.sparkMetaForm.noFieldsMessage})]})})};function op(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function ZR(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function ai(e){return e!==null&&e>=0}function XR(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function JR(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const lp=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=op(t,n,r),a=t[s],o=i[s];return!o||!a?null:{x:o.left-a.left,y:o.top-a.top,scaleX:o.width/a.width,scaleY:o.height/a.height}},oi={scaleX:1,scaleY:1},ek=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:s,rects:i,overIndex:a}=e;const o=(t=i[r])!=null?t:n;if(!o)return null;if(s===r){const u=i[a];return u?{x:0,y:r<a?u.top+u.height-(o.top+o.height):u.top-o.top,...oi}:null}const l=tk(i,s,r);return s>r&&s<=a?{x:0,y:-o.height-l,...oi}:s<r&&s>=a?{x:0,y:o.height+l,...oi}:{x:0,y:0,...oi}};function tk(e,t,r){const n=e[t],s=e[t-1],i=e[t+1];return n?r<t?s?n.top-(s.top+s.height):i?i.top-(n.top+n.height):0:i?i.top-(n.top+n.height):s?n.top-(s.top+s.height):0:0}const cp="Sortable",up=m.createContext({activeIndex:-1,containerId:cp,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:lp,disabled:{draggable:!1,droppable:!1}});function rk(e){let{children:t,id:r,items:n,strategy:s=lp,disabled:i=!1}=e;const{active:a,dragOverlay:o,droppableRects:l,over:u,measureDroppableContainers:f}=ef(),d=$s(cp,r),g=o.rect!==null,p=m.useMemo(()=>n.map(E=>typeof E=="object"&&"id"in E?E.id:E),[n]),w=a!=null,h=a?p.indexOf(a.id):-1,y=u?p.indexOf(u.id):-1,v=m.useRef(p),b=!XR(p,v.current),C=y!==-1&&h===-1||b,S=JR(i);Jt(()=>{b&&w&&f(p)},[b,p,w,f]),m.useEffect(()=>{v.current=p},[p]);const _=m.useMemo(()=>({activeIndex:h,containerId:d,disabled:S,disableTransforms:C,items:p,overIndex:y,useDragOverlay:g,sortedRects:ZR(p,l),strategy:s}),[h,d,S.draggable,S.droppable,C,p,y,l,g,s]);return m.createElement(up.Provider,{value:_},t)}const nk=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return op(r,n,s).indexOf(t)},sk=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:i,newIndex:a,previousItems:o,previousContainerId:l,transition:u}=e;return!u||!n||o!==i&&s===a?!1:r?!0:a!==s&&t===l},ik={duration:200,easing:"ease"},dp="transform",ak=qr.Transition.toString({property:dp,duration:0,easing:"linear"}),ok={roleDescription:"sortable"};function lk(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,a]=m.useState(null),o=m.useRef(r);return Jt(()=>{if(!t&&r!==o.current&&n.current){const l=s.current;if(l){const u=Gn(n.current,{ignoreTransform:!0}),f={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(f.x||f.y)&&a(f)}}r!==o.current&&(o.current=r)},[t,r,n,s]),m.useEffect(()=>{i&&a(null)},[i]),i}function ck(e){let{animateLayoutChanges:t=sk,attributes:r,disabled:n,data:s,getNewIndex:i=nk,id:a,strategy:o,resizeObserverConfig:l,transition:u=ik}=e;const{items:f,containerId:d,activeIndex:g,disabled:p,disableTransforms:w,sortedRects:h,overIndex:y,useDragOverlay:v,strategy:b}=m.useContext(up),C=uk(n,p),S=f.indexOf(a),_=m.useMemo(()=>({sortable:{containerId:d,index:S,items:f},...s}),[d,s,S,f]),E=m.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:N,node:R,isOver:M,setNodeRef:$}=fy({id:a,data:_,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...l}}),{active:D,activatorEvent:j,activeNodeRect:P,attributes:k,setNodeRef:L,listeners:z,isDragging:X,over:ye,setActivatorNodeRef:_e,transform:we}=Jd({id:a,data:_,attributes:{...ok,...r},disabled:C.draggable}),de=Zm($,L),Q=!!D,ne=Q&&!w&&ai(g)&&ai(y),te=!v&&X,q=te&&ne?we:null,ie=ne?q??(o??b)({rects:h,activeNodeRect:P,activeIndex:g,overIndex:y,index:S}):null,fe=ai(g)&&ai(y)?i({id:a,items:f,activeIndex:g,overIndex:y}):S,J=D==null?void 0:D.id,se=m.useRef({activeId:J,items:f,newIndex:fe,containerId:d}),ke=f!==se.current.items,Te=t({active:D,containerId:d,isDragging:X,isSorting:Q,id:a,index:S,items:f,newIndex:se.current.newIndex,previousItems:se.current.items,previousContainerId:se.current.containerId,transition:u,wasDragging:se.current.activeId!=null}),$e=lk({disabled:!Te,index:S,node:R,rect:N});return m.useEffect(()=>{Q&&se.current.newIndex!==fe&&(se.current.newIndex=fe),d!==se.current.containerId&&(se.current.containerId=d),f!==se.current.items&&(se.current.items=f)},[Q,fe,d,f]),m.useEffect(()=>{if(J===se.current.activeId)return;if(J&&!se.current.activeId){se.current.activeId=J;return}const qe=setTimeout(()=>{se.current.activeId=J},50);return()=>clearTimeout(qe)},[J]),{active:D,activeIndex:g,attributes:k,data:_,rect:N,index:S,newIndex:fe,items:f,isOver:M,isSorting:Q,isDragging:X,listeners:z,node:R,overIndex:y,over:ye,setNodeRef:de,setActivatorNodeRef:_e,setDroppableNodeRef:$,setDraggableNodeRef:L,transform:$e??ie,transition:Ve()};function Ve(){if($e||ke&&se.current.newIndex===S)return ak;if(!(te&&!Ki(j)||!u)&&(Q||Te))return qr.Transition.toString({...u,property:dp})}}function uk(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}function Ui(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const dk=[xe.Down,xe.Right,xe.Up,xe.Left],fk=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:a,scrollableAncestors:o}}=t;if(dk.includes(e.code)){if(e.preventDefault(),!r||!n)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const g=s.get(d.id);if(g)switch(e.code){case xe.Down:n.top<g.top&&l.push(d);break;case xe.Up:n.top>g.top&&l.push(d);break;case xe.Left:n.left>g.left&&l.push(d);break;case xe.Right:n.left<g.left&&l.push(d);break}});const u=pg({collisionRect:n,droppableRects:s,droppableContainers:l});let f=Pd(u,"id");if(f===(a==null?void 0:a.id)&&u.length>1&&(f=u[1].id),f!=null){const d=i.get(r.id),g=i.get(f),p=g?s.get(g.id):null,w=g==null?void 0:g.node.current;if(w&&p&&d&&g){const y=Yi(w).some((E,N)=>o[N]!==E),v=fp(d,g),b=hk(d,g),C=y||!v?{x:0,y:0}:{x:b?n.width-p.width:0,y:b?n.height-p.height:0},S={x:p.left,y:p.top};return C.x&&C.y?S:Es(S,C)}}}};function fp(e,t){return!Ui(e)||!Ui(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function hk(e,t){return!Ui(e)||!Ui(t)||!fp(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const pk="_row_11nth_1",mk="_removeBtn_11nth_14",gk="_grip_11nth_17",yk="_ctIcon_11nth_34",vk="_info_11nth_38",bk="_name_11nth_46",wk="_meta_11nth_55",Vr={row:pk,removeBtn:mk,grip:gk,ctIcon:yk,info:vk,name:bk,meta:wk},Ck={video:il,pdf:ea,h5p:tl,scorm:nl,audio:rl,quiz:Jo,default:Yn},Sk=({item:e,onRemove:t,isEditable:r})=>{const n=ce(),s=ca(e),i=Ck[s.key]??Yn,{attributes:a,listeners:o,setNodeRef:l,transform:u,transition:f,isDragging:d}=ck({id:e.id,disabled:!r}),g={transform:qr.Transform.toString(u),transition:f,opacity:d?.5:1};return c.jsxs("div",{ref:l,style:g,className:Vr.row,role:"listitem",children:[r&&c.jsx("span",{className:Vr.grip,...a,...o,"aria-label":n.contentRow.dragToReorderAriaLabel,children:c.jsx(of,{size:15})}),c.jsx("span",{className:[`sbx-ct-sq--${s.key}`,Vr.ctIcon].join(" "),"aria-hidden":"true",children:c.jsx(i,{size:14})}),c.jsxs("div",{className:Vr.info,children:[c.jsx("span",{className:Vr.name,title:e.name,children:e.name}),c.jsx("span",{className:Vr.meta,children:s.label})]}),c.jsx("span",{className:`sbx-ct-badge--${s.key}`,children:s.label}),r&&c.jsx("button",{type:"button",className:Vr.removeBtn,onClick:()=>t(e.id),"aria-label":n.contentRow.removeAriaLabel.replace("{name}",e.name),children:c.jsx(Cr,{size:14})})]})},xk="_container_lzvke_1",_k="_header_lzvke_7",Tk="_heading_lzvke_13",Ek="_count_lzvke_21",Ik="_list_lzvke_30",Ok="_emptyState_lzvke_36",Ak="_addRow_lzvke_52",Hr={container:xk,header:_k,heading:Tk,count:Ek,list:Ik,emptyState:Ok,addRow:Ak},Dk=({editorMode:e})=>{const t=ce(),{selectedNodeId:r,getChildrenOf:n,reorderChildren:s,deleteNode:i}=Oe(),a=r?n(r):[],o=e==="edit",l=kd(uo(Zi,{activationConstraint:{distance:5}}),uo(Yo,{coordinateGetter:fk})),u=m.useCallback(d=>{const{active:g,over:p}=d;if(!p||g.id===p.id||!r)return;const w=Oe.getState().getChildrenOf(r),h=w.findIndex(v=>v.id===g.id),y=w.findIndex(v=>v.id===p.id);h<0||y<0||s(r,h,y)},[r,s]),f=m.useCallback(d=>{window.confirm(t.unitContentList.removeConfirm)&&i(d)},[i,t.unitContentList.removeConfirm]);return r?c.jsxs("div",{className:Hr.container,children:[c.jsxs("div",{className:Hr.header,children:[c.jsx("span",{className:Hr.heading,children:t.unitContentList.heading}),c.jsx("span",{className:Hr.count,children:a.length})]}),a.length>0?c.jsx(Xd,{sensors:l,collisionDetection:hg,onDragEnd:u,children:c.jsx(rk,{items:a.map(d=>d.id),strategy:ek,children:c.jsx("div",{className:Hr.list,role:"list",children:a.map(d=>c.jsx(Sk,{item:d,onRemove:f,isEditable:o},d.id))})})}):c.jsxs("div",{className:Hr.emptyState,children:[c.jsx("p",{children:t.unitContentList.emptyTitle}),c.jsx("span",{children:t.unitContentList.emptyHint})]}),o&&c.jsxs("button",{className:Hr.addRow,type:"button","aria-label":t.unitContentList.addContentAriaLabel,children:[c.jsx(Us,{size:14})," ",t.unitContentList.addContent]})]}):null},Nk="_dropZone_ijo5w_1",Rk="_active_ijo5w_14",Qu={dropZone:Nk,active:Rk},kk=({isActive:e,label:t,nodeId:r,className:n})=>{const s=ce(),i=t??s.dropZone.dropHere;return c.jsx("div",{className:`${Qu.dropZone} ${e?Qu.active:""} ${n??""}`,"data-droppable":e?"true":void 0,"data-node-id":r,"aria-label":i,role:"region",children:c.jsx("span",{children:i})})};async function jk(e){var a;const t={status:["Live"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((a=(await Ne.post("/action/composite/v3/search",{request:{filters:t,query:e.query??"",limit:e.limit??20,offset:e.offset??0,sort_by:e.sortBy??{lastUpdatedOn:"desc"},fields:e.fields??["identifier","name","mimeType","contentType","primaryCategory","appIcon","channel","organisation","pkgVersion"]}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:a.result)??{},s=new Set(["count","facets"]);return{content:Object.entries(n).filter(([o])=>!s.has(o)).flatMap(([,o])=>Array.isArray(o)?o:[]),count:n.count??0}}async function Lk(e){var r,n;return(n=(r=(await Ne.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}const Gu="application/vnd.sunbird.question";function Wu(e){return{cardinality:"single",type:"integer",defaultValue:e.maxScore??1}}function hp(e,t,r){if(!e)return null;if(e.identifier===t)return{question:e,parent:r};for(const n of e.children??[]){const s=hp(n,t,e);if(s)return s}return null}function Pk(e,t){const r=hp(e,t);if(!r)return null;const{question:n,parent:s}=r,i={...e,children:[n],childNodes:[t],shuffle:s==null?void 0:s.shuffle,showSolutions:(s==null?void 0:s.showSolutions)??"No",showFeedback:(s==null?void 0:s.showFeedback)??"No"};return(s==null?void 0:s.shuffle)===!0?i.maxScore=1:n.qType==="SA"?delete i.maxScore:n.maxScore!=null&&(i.maxScore=n.maxScore),i}function Fk(e,t){const r=((t==null?void 0:t.enabled)??!0)&&!!e;return $n({queryKey:["quml","questionset",e],enabled:r,queryFn:async()=>{const n=await Hf(e),s=f=>{if(!f)return[];const d=f.mimeType===Gu&&f.identifier?[f.identifier]:[],g=(f.children??[]).flatMap(s);return[...d,...g]},i=s(n),a=new Map;i.length&&(await __(i)).forEach(d=>{const g=d.identifier;g&&a.set(g,d)});const o=f=>{if(!f)return f;if(f.mimeType===Gu&&f.identifier){const d=a.get(f.identifier)??f,g=d.outcomeDeclaration;return g!=null&&g.maxScore||(d.outcomeDeclaration={...g??{},maxScore:Wu(d)}),d}return Array.isArray(f.children)&&(f.children=f.children.map(d=>o(d))),f},l=o(n),u=l.outcomeDeclaration;return u!=null&&u.maxScore||(l.outcomeDeclaration={...u??{},maxScore:Wu(l)}),l}})}const Ku="/assets/quml-player/sunbird-quml-player.js",Mk="/assets/quml-player/styles.css",Yu="sunbird-quml-player";function Bk(e){const t=e.children??[];return t.length?t.every(n=>n.objectType==="Question")?[e]:t:[]}const nt=class nt{constructor(){ns(this,"eventHandlers",new WeakMap)}loadScript(){return nt.scriptLoaded||customElements.get(Yu)?(nt.scriptLoaded=!0,Promise.resolve()):(nt.scriptLoading||(nt.scriptLoading=new Promise((t,r)=>{const n=document.createElement("script");n.src=Ku,n.setAttribute("data-quml-player-script","true"),n.onload=()=>{nt.scriptLoaded=!0,nt.scriptLoading=void 0,t()},n.onerror=()=>{nt.scriptLoading=void 0,r(new Error(`Failed to load QuML player script: ${Ku}`))},document.body.appendChild(n)})),nt.scriptLoading)}loadStyles(){if(nt.stylesLoaded||document.querySelector('[data-quml-player-styles="true"]')){nt.stylesLoaded=!0;return}const t=document.createElement("link");t.rel="stylesheet",t.href=Mk,t.setAttribute("data-quml-player-styles","true"),document.head.appendChild(t),nt.stylesLoaded=!0}static unloadStyles(){var t;(t=document.querySelector('[data-quml-player-styles="true"]'))==null||t.remove(),nt.stylesLoaded=!1}async createConfig(t,r,n){var i,a,o;return await this.loadScript(),{context:{mode:(n==null?void 0:n.mode)??"play",host:"",pdata:{id:((i=r==null?void 0:r.pdata)==null?void 0:i.id)??"sunbird.portal",ver:((a=r==null?void 0:r.pdata)==null?void 0:a.ver)??"1.0",pid:((o=r==null?void 0:r.pdata)==null?void 0:o.pid)??"sunbird-portal"},contentId:t.identifier??"",sid:(r==null?void 0:r.sid)??"",uid:(r==null?void 0:r.uid)??(r==null?void 0:r.userId)??"",channel:(r==null?void 0:r.channel)??"",did:(r==null?void 0:r.did)??"",tags:(r==null?void 0:r.tags)??[],contextRollup:(n==null?void 0:n.contextRollup)??(r==null?void 0:r.rollup)??{},objectRollup:(n==null?void 0:n.objectRollup)??{},...n!=null&&n.cdata?{cdata:n.cdata}:{}},config:{language:"en"},data:{sections:Bk(t),identifier:t.identifier??""},metadata:t}}createElement(t){this.loadStyles();const r=document.createElement(Yu);return r.setAttribute("player-config",JSON.stringify(t)),r.setAttribute("data-player-id",t.metadata.identifier??"quml"),r}attachEventListeners(t,r,n){this.removeEventListeners(t);const s=a=>r==null?void 0:r(a),i=a=>n==null?void 0:n(a.detail);t.addEventListener("playerEvent",s),t.addEventListener("telemetryEvent",i),this.eventHandlers.set(t,{player:s,telemetry:i})}removeEventListeners(t){const r=this.eventHandlers.get(t);r&&(t.removeEventListener("playerEvent",r.player),t.removeEventListener("telemetryEvent",r.telemetry),this.eventHandlers.delete(t))}};ns(nt,"scriptLoaded",!1),ns(nt,"scriptLoading"),ns(nt,"stylesLoaded",!1);let zi=nt;const li=new zi,$k="_contentPlayerRoot_r6xk8_1",qk="_flowLayout_r6xk8_9",Uk="_stage_r6xk8_13",zk="_aspectRatio_r6xk8_16",Vk="_playerHeader_r6xk8_32",Hk="_playerHeaderThumb_r6xk8_46",Qk="_playerHeaderTitle_r6xk8_56",Gk="_typeBadge_r6xk8_66",Wk="_typeDot_r6xk8_105",Kk="_playerFrame_r6xk8_125",Yk="_coverOverlay_r6xk8_133",Zk="_coverHidden_r6xk8_145",Xk="_coverThumb_r6xk8_150",Jk="_coverPlayRing_r6xk8_159",ej="_coverPlayIcon_r6xk8_172",tj="_coverLabel_r6xk8_181",rj="_coverSkeleton_r6xk8_187",nj="_playerWrapper_r6xk8_213",sj="_infoStrip_r6xk8_223",ij="_infoChip_r6xk8_239",aj="_infoChipLabel_r6xk8_258",oj="_infoChipIcon_r6xk8_267",lj="_playerError_r6xk8_273",cj="_playerErrorIcon_r6xk8_287",uj="_playerErrorMsg_r6xk8_292",dj="_qumlRoot_r6xk8_299",Pe={contentPlayerRoot:$k,flowLayout:qk,stage:Uk,aspectRatio:zk,playerHeader:Vk,playerHeaderThumb:Hk,playerHeaderTitle:Qk,typeBadge:Gk,typeDot:Wk,playerFrame:Kk,coverOverlay:Yk,coverHidden:Zk,coverThumb:Xk,coverPlayRing:Jk,coverPlayIcon:ej,coverLabel:tj,coverSkeleton:rj,playerWrapper:nj,infoStrip:sj,infoChip:ij,infoChipLabel:aj,infoChipIcon:oj,playerError:lj,playerErrorIcon:cj,playerErrorMsg:uj,qumlRoot:dj},fj="application/vnd.sunbird.questionset";function hj(e,t){const r=new Map,n=i=>{for(const a of i)r.set(a.id,a),a.children&&n(a.children)};n(e);let s=r.get(t);for(;s;){if(s.mimeType===fj)return s.identifier;s=s.parent?r.get(s.parent):void 0}return null}const pj=[{key:"video",mimes:["video/mp4","video/webm","video/ogg"]},{key:"audio",mimes:["audio/mp3","audio/mpeg","audio/ogg","audio/wav"]},{key:"pdf",mimes:["application/pdf"]},{key:"epub",mimes:["application/epub"]},{key:"ecml",mimes:["application/vnd.ekstep.ecml-archive"]},{key:"h5p",mimes:["application/vnd.ekstep.h5p-archive"]},{key:"scorm",mimes:["application/vnd.ekstep.content-collection"]}];function mj(e){return pj.find(t=>t.mimes.includes(e))??{key:"other"}}function gj(e,t){switch(e){case"video":return t.contentPlayer.mimeLabelVideo;case"audio":return t.contentPlayer.mimeLabelAudio;case"pdf":return t.contentPlayer.mimeLabelPdf;case"epub":return t.contentPlayer.mimeLabelEpub;case"ecml":return t.contentPlayer.mimeLabelEcml;case"h5p":return t.contentPlayer.mimeLabelH5p;case"scorm":return t.contentPlayer.mimeLabelScorm;default:return t.contentPlayer.mimeLabelOther}}const yj={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},vj={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},bj={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},wj="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function Qa(e){for(const[t,r]of Object.entries(yj))if(r.includes(e))return t;return"default-player"}function Cj(e,t,r){var i;const n=r==null?void 0:r.context,s=t.mimeType??e.mimeType??"";return{context:{mode:"play",partner:[],pdata:{id:((i=n==null?void 0:n.pdata)==null?void 0:i.id)??"sunbird.portal",ver:1,pid:"sunbird-portal"},contentId:e.identifier,sid:(n==null?void 0:n.sid)??"",uid:(n==null?void 0:n.uid)??"",channel:(n==null?void 0:n.channel)??"",did:(n==null?void 0:n.did)??"",timeDiff:0,contextRollup:{},tags:[],app:[(n==null?void 0:n.channel)??""],dims:""},config:{showEndPage:!1,showStartPage:!0,host:"",overlay:{showUser:!1},splash:{text:"",icon:"",bgImage:"",webLink:""},sideMenu:{showDownload:!0,showExit:!1,showShare:!0},apislug:"/action",repos:["/sunbird-plugins/renderer"],plugins:[{id:"org.sunbird.iframeEvent",ver:1,type:"plugin"},{id:"org.sunbird.player.endpage",ver:1.1,type:"plugin"}],enableTelemetryValidation:!1},metadata:t,data:s==="application/vnd.ekstep.ecml-archive"?t.body??{}:{}}}function Sj(e){return document.querySelector(`script[src="${e}"]`)?Promise.resolve():new Promise((t,r)=>{const n=document.createElement("script");n.src=e,n.onload=()=>t(),n.onerror=()=>r(new Error(`Failed to load ${e}`)),document.head.appendChild(n)})}async function xj(e,t,r=100){await Sj(vj[t]??""),!customElements.get(e)&&await new Promise((n,s)=>{let i=0;const a=setInterval(()=>{i++,customElements.get(e)?(clearInterval(a),n()):i>=r&&(clearInterval(a),s(new Error(`Custom element <${e}> did not register`)))},100)})}const _j=[{key:"author",icon:ev},{key:"license",icon:Gy},{key:"language",icon:By},{key:"gradeLevel",icon:Wy},{key:"subject",icon:Ny},{key:"contentType",icon:Xy}];function Tj(e,t){switch(e){case"author":return t.contentPlayer.infoFieldAuthor;case"license":return t.contentPlayer.infoFieldLicense;case"language":return t.contentPlayer.infoFieldLanguage;case"gradeLevel":return t.contentPlayer.infoFieldClass;case"subject":return t.contentPlayer.infoFieldSubject;case"contentType":return t.contentPlayer.infoFieldType;default:return e}}function Ej({node:e}){const t=ce(),r=e.metadata??{},n=_j.flatMap(s=>{const i=r[s.key];if(!i)return[];const a=Array.isArray(i)?i.join(", "):String(i);return a?[{...s,label:Tj(s.key,t),val:a}]:[]});return n.length?c.jsx("div",{className:Pe.infoStrip,children:n.map(s=>c.jsxs("div",{className:Pe.infoChip,children:[s.icon&&c.jsx(s.icon,{size:13,className:Pe.infoChipIcon}),c.jsx("span",{className:Pe.infoChipLabel,children:s.label}),s.val]},s.key))}):null}function pp({node:e,hidden:t}){var s;const r=ce(),n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return c.jsx("div",{className:`${Pe.coverOverlay} ${t?Pe.coverHidden:""}`,children:n?c.jsxs(c.Fragment,{children:[c.jsx("img",{src:n,alt:e.name,className:Pe.coverThumb}),c.jsx("div",{className:Pe.coverPlayRing,children:c.jsx("div",{className:Pe.coverPlayIcon})}),c.jsx("span",{className:Pe.coverLabel,children:r.contentPlayer.loadingPreview})]}):c.jsx("div",{className:Pe.coverSkeleton})})}function mp({message:e}){return c.jsxs("div",{className:Pe.playerError,children:[c.jsx(Jy,{size:28,className:Pe.playerErrorIcon}),c.jsx("span",{className:Pe.playerErrorMsg,children:e})]})}function Ij({mimeType:e}){const t=ce(),r=mj(e);return c.jsxs("span",{className:Pe.typeBadge,"data-type":r.key,children:[c.jsx("span",{className:Pe.typeDot}),gj(r.key,t)]})}const Uo=({node:e,editorMode:t,type:r,singleQuestion:n,layout:s="fill"})=>{var a;if(r==="quml")return c.jsx(Aj,{node:e,editorMode:t,singleQuestion:!!n});const i=e.appIcon??((a=e.metadata)==null?void 0:a.appIcon);return c.jsxs("div",{className:`${Pe.contentPlayerRoot} ${s==="flow"?Pe.flowLayout:""}`,children:[c.jsxs("div",{className:Pe.stage,children:[c.jsxs("div",{className:Pe.playerHeader,children:[i&&c.jsx("img",{src:i,alt:"",className:Pe.playerHeaderThumb}),c.jsx("span",{className:Pe.playerHeaderTitle,children:e.name}),c.jsx(Ij,{mimeType:e.mimeType??""})]}),c.jsx(Oj,{node:e})]}),c.jsx(Ej,{node:e})]})};function Oj({node:e}){var v;const t=ce(),r=le(b=>b.editorConfig),[n,s]=m.useState(()=>Qa(e.mimeType??"")),[i,a]=m.useState(!1),[o,l]=m.useState(null),[u,f]=m.useState(e.metadata??{}),[d,g]=m.useState(!1),p=m.useRef(null),w=m.useRef(null),h=((v=r==null?void 0:r.config)==null?void 0:v.previewCdnUrl)??wj;m.useEffect(()=>{let b=!1;return g(!1),a(!1),l(null),f(e.metadata??{}),s(Qa(e.mimeType??"")),Lk(e.identifier).then(C=>{if(b)return;const S={...e.metadata??{},...C};f(S);const _=C.mimeType??e.mimeType??"";s(Qa(_)),g(!0)}).catch(()=>{b||g(!0)}),()=>{b=!0}},[e.identifier]);const y=Cj(e,u,r);return m.useEffect(()=>{if(!d||n!=="default-player")return;const b=p.current;if(!b)return;b.src=h;const C=()=>{try{const _=b.contentWindow;if(typeof(_==null?void 0:_.initializePreview)!="function"){l(t.contentPlayer.previewPlayerUnavailable);return}_.initializePreview(y),setTimeout(()=>a(!0),300)}catch(_){console.error("[ContentPlayer] initializePreview failed",_),l(t.contentPlayer.failedToInitializePlayer)}},S=()=>l(t.contentPlayer.previewPlayerLoadFailed);return b.addEventListener("load",C),b.addEventListener("error",S),()=>{b.removeEventListener("load",C),b.removeEventListener("error",S),b.src=""}},[e.identifier,n,h,d,t]),m.useEffect(()=>{if(!d||n==="default-player")return;const b=w.current;if(!b)return;const C=bj[n];if(!C)return;const S=y;xj(C,n).then(()=>{if(!w.current)return;if(!customElements.get(C)){s("default-player");return}const _=document.createElement(C);_.setAttribute("player-config",JSON.stringify(S)),_.addEventListener("playerEvent",()=>{}),_.addEventListener("telemetryEvent",()=>{}),b.innerHTML="",b.appendChild(_),setTimeout(()=>{try{_.playerConfig=S}catch{}a(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${n} script unavailable, falling back to iframe`),s("default-player")})},[e.identifier,n,d]),c.jsxs("div",{className:Pe.aspectRatio,children:[o?c.jsx(mp,{message:o}):c.jsx(pp,{node:e,hidden:i}),n==="default-player"?c.jsx("iframe",{ref:p,id:"contentPlayer",title:e.name,className:Pe.playerFrame,name:"contentPlayer",allowFullScreen:!0}):c.jsx("div",{ref:w,className:Pe.playerFrame})]})}function Aj({node:e,editorMode:t,singleQuestion:r}){const n=ce(),s=le(p=>p.editorConfig),i=Oe(p=>p.treeData),a=m.useRef(null),o=r?hj(i,e.id):e.identifier,{data:l,isLoading:u,error:f}=Fk(o??"",{enabled:!!o}),d=m.useMemo(()=>l?r?Pk(l,e.identifier):l:null,[l,r,e.identifier]);m.useEffect(()=>{const p=a.current;if(!p||!d)return;let w=null,h=!1;return(async()=>{try{const y=await li.createConfig(d,s==null?void 0:s.context,{mode:t==="edit"?"edit":"play"});if(h||!a.current)return;const v=li.createElement(y);w=v,li.attachEventListeners(v,b=>console.debug("[QumlPlayer] playerEvent",b.detail),b=>console.debug("[QumlPlayer] telemetryEvent",b)),p.innerHTML="",p.appendChild(v)}catch(y){console.error("[QumlPlayer] failed to initialize",y)}})(),()=>{h=!0,w&&(li.removeEventListeners(w),w.remove()),zi.unloadStyles()}},[d,s,t,r]);const g=f?`${n.contentPlayer.unableToLoadQuestionset} ${f.message}`:r&&!o?n.contentPlayer.parentQuestionsetNotResolved:r&&l&&!d?n.contentPlayer.questionNotFoundInQuestionset:null;return c.jsxs("div",{className:Pe.qumlRoot,children:[g?c.jsx(mp,{message:g}):u||!d?c.jsx(pp,{node:e,hidden:!1}):null,c.jsx("div",{ref:a,className:Pe.playerWrapper})]})}const Dj="_overlay_ifddx_1",Nj="_modal_ifddx_11",Rj="_header_ifddx_21",kj="_body_ifddx_37",jj="_hint_ifddx_43",Lj="_list_ifddx_49",Pj="_item_ifddx_55",Fj="_selected_ifddx_68",Mj="_empty_ifddx_73",Bj="_footer_ifddx_79",$j="_cancelBtn_ifddx_87",qj="_moveBtn_ifddx_95",Vt={overlay:Dj,modal:Nj,header:Rj,body:kj,hint:jj,list:Lj,item:Pj,selected:Fj,empty:Mj,footer:Bj,cancelBtn:$j,moveBtn:qj};function Uj(e,t,r){const n=[],s=i=>{var a;for(const o of i)o.isFolder&&o.id!==r&&o.id!==t&&n.push(o),(a=o.children)!=null&&a.length&&s(o.children)};return s(e),n}const zj=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var d;const s=ce(),{treeData:i,moveNode:a}=Oe(),o=Uj(i,((d=i[0])==null?void 0:d.id)??"",r),[l,u]=m.useState(null),f=()=>{l&&(a(e,r,l),n())};return c.jsx("div",{className:Vt.overlay,role:"dialog","aria-label":s.resourceReorderDialog.dialogAriaLabel,children:c.jsxs("div",{className:Vt.modal,children:[c.jsxs("div",{className:Vt.header,children:[c.jsxs("span",{children:[s.resourceReorderDialog.moveHeaderPrefix,' "',t,'"']}),c.jsx("button",{onClick:n,"aria-label":s.resourceReorderDialog.closeAriaLabel,children:c.jsx(Cr,{size:16})})]}),c.jsxs("div",{className:Vt.body,children:[c.jsx("p",{className:Vt.hint,children:s.resourceReorderDialog.selectUnitHint}),c.jsxs("ul",{className:Vt.list,children:[o.map(g=>c.jsxs("li",{className:`${Vt.item} ${l===g.id?Vt.selected:""}`,onClick:()=>u(g.id),children:[c.jsx(Fy,{size:14}),c.jsx("span",{children:g.name})]},g.id)),o.length===0&&c.jsx("li",{className:Vt.empty,children:s.resourceReorderDialog.noUnitsAvailable})]})]}),c.jsxs("div",{className:Vt.footer,children:[c.jsx("button",{className:Vt.cancelBtn,onClick:n,children:s.resourceReorderDialog.cancelButton}),c.jsx("button",{className:Vt.moveBtn,onClick:f,disabled:!l,children:s.resourceReorderDialog.moveButton})]})]})})},Vj="_overlay_16at9_1",Hj="_modal_16at9_11",Qj="_header_16at9_21",Gj="_body_16at9_37",Wj="_table_16at9_43",Kj="_pageInput_16at9_61",Yj="_empty_16at9_68",Zj="_footer_16at9_74",Xj="_cancelBtn_16at9_82",Jj="_saveBtn_16at9_90",or={overlay:Vj,modal:Hj,header:Qj,body:Gj,table:Wj,pageInput:Kj,empty:Yj,footer:Zj,cancelBtn:Xj,saveBtn:Jj};function eL(e){const t=[],r=n=>{var s;for(const i of n)!i.isFolder&&(!i.children||i.children.length===0)?t.push(i):(s=i.children)!=null&&s.length&&r(i.children)};return r(e),t}const tL=({onClose:e})=>{const t=ce(),{treeData:r,updateNode:n}=Oe(),s=eL(r),[i,a]=m.useState(()=>Object.fromEntries(s.map(l=>{var u;return[l.id,String(((u=l.metadata)==null?void 0:u.pageNumber)??"")]}))),o=m.useCallback(()=>{for(const[l,u]of Object.entries(i))u!==""&&n(l,{pageNumber:parseInt(u,10)||void 0});e()},[i,n,e]);return c.jsx("div",{className:or.overlay,role:"dialog","aria-label":t.assignPageNumber.dialogAriaLabel,children:c.jsxs("div",{className:or.modal,children:[c.jsxs("div",{className:or.header,children:[c.jsx("span",{children:t.assignPageNumber.title}),c.jsx("button",{onClick:e,"aria-label":t.assignPageNumber.closeAriaLabel,children:c.jsx(Cr,{size:16})})]}),c.jsx("div",{className:or.body,children:s.length===0?c.jsx("p",{className:or.empty,children:t.assignPageNumber.emptyState}):c.jsxs("table",{className:or.table,children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:t.assignPageNumber.contentColumnHeader}),c.jsx("th",{children:t.assignPageNumber.pageNumberColumnHeader})]})}),c.jsx("tbody",{children:s.map(l=>c.jsxs("tr",{children:[c.jsx("td",{children:l.name}),c.jsx("td",{children:c.jsx("input",{type:"number",min:1,value:i[l.id]??"",onChange:u=>a(f=>({...f,[l.id]:u.target.value})),className:or.pageInput})})]},l.id))})]})}),c.jsxs("div",{className:or.footer,children:[c.jsx("button",{className:or.cancelBtn,onClick:e,children:t.assignPageNumber.cancelButton}),c.jsxs("button",{className:or.saveBtn,onClick:o,children:[c.jsx(Qy,{size:14})," ",t.assignPageNumber.saveButton]})]})]})})},rL="_container_1a7t2_1",nL="_panelHeader_1a7t2_10",sL="_panelHeaderLeft_1a7t2_19",iL="_panelCollapseBtn_1a7t2_27",aL="_titleRow_1a7t2_46",oL="_field_1a7t2_47",lL="_moveBtn_1a7t2_64",cL="_icon_1a7t2_84",uL="_nameInput_1a7t2_93",dL="_fieldHeader_1a7t2_118",fL="_label_1a7t2_124",hL="_fieldCount_1a7t2_133",pL="_chips_1a7t2_170",mL="_chip_1a7t2_170",gL="_chipRemove_1a7t2_188",yL="_keywordInput_1a7t2_202",vL="_input_1a7t2_207",bL="_addBtn_1a7t2_220",wL="_radioGroup_1a7t2_234",CL="_radioLabel_1a7t2_239",Ge={container:rL,panelHeader:nL,panelHeaderLeft:sL,panelCollapseBtn:iL,titleRow:aL,field:oL,moveBtn:lL,icon:cL,nameInput:uL,fieldHeader:dL,label:fL,fieldCount:hL,chips:pL,chip:mL,chipRemove:gL,keywordInput:yL,input:vL,addBtn:bL,radioGroup:wL,radioLabel:CL},SL=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var j,P;const{updateNode:s,markDirty:i}=Oe(),a=t==="edit",o=ca(e),l=ce(),u=le(k=>k.relationalFormConfig),f=k=>u==null?void 0:u.find(L=>L.code===k),d=k=>!u||!!f(k),g=(k,L)=>{var z;return((z=f(k))==null?void 0:z.label)||L},[p,w]=m.useState(!0),h=((j=e.metadata)==null?void 0:j.relationalMetadata)??{},[y,v]=m.useState(h.name??e.name??""),[b,C]=m.useState(""),[S,_]=m.useState(Array.isArray(h.keywords)?h.keywords:Array.isArray((P=e.metadata)==null?void 0:P.keywords)?e.metadata.keywords:[]),[E,N]=m.useState(!!h.optional);m.useEffect(()=>{var L,z;const k=((L=e.metadata)==null?void 0:L.relationalMetadata)??{};v(k.name??e.name??""),_(Array.isArray(k.keywords)?k.keywords:Array.isArray((z=e.metadata)==null?void 0:z.keywords)?e.metadata.keywords:[]),N(!!k.optional)},[e.id]);const R=()=>{y.trim()&&y!==e.name&&(s(e.id,{name:y.trim()}),i())},M=()=>{const k=b.trim();if(k&&!S.includes(k)){const L=[...S,k];_(L),s(e.id,{keywords:L}),i()}C("")},$=k=>{const L=S.filter(z=>z!==k);_(L),s(e.id,{keywords:L}),i()},D=k=>{N(k),s(e.id,{optional:k}),i()};return c.jsxs("div",{className:Ge.container,children:[c.jsxs("div",{className:Ge.panelHeader,children:[c.jsxs("div",{className:Ge.panelHeaderLeft,children:[c.jsx("span",{className:`sbx-ct-badge--${o.key}`,children:o.label}),a&&c.jsx("button",{type:"button",className:Ge.moveBtn,onClick:r,children:l.contentEditForm.moveToAnotherUnitButton})]}),c.jsx("button",{type:"button",className:Ge.panelCollapseBtn,onClick:()=>w(k=>!k),"aria-expanded":p,"aria-label":p?l.contentEditForm.collapseMetadataPanelAriaLabel:l.contentEditForm.expandMetadataPanelAriaLabel,title:p?l.contentEditForm.collapseTitle:l.contentEditForm.expandTitle,children:p?c.jsx(Kn,{size:15}):c.jsx(ky,{size:15})})]}),p&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:Ge.titleRow,children:[e.appIcon&&c.jsx("img",{src:e.appIcon,alt:l.contentEditForm.iconAlt,className:Ge.icon}),c.jsx("input",{type:"text",className:Ge.nameInput,value:y,disabled:!a,onChange:k=>v(k.target.value),onBlur:R,placeholder:l.contentEditForm.contentNamePlaceholder})]}),d("keywords")&&c.jsxs("div",{className:Ge.field,children:[c.jsx("div",{className:Ge.fieldHeader,children:c.jsxs("label",{className:Ge.label,children:[g("keywords",l.contentEditForm.keywordsLabel),S.length>0&&c.jsx("span",{className:Ge.fieldCount,children:S.length})]})}),S.length>0&&c.jsx("div",{className:Ge.chips,children:S.map(k=>c.jsxs("span",{className:Ge.chip,children:[k,a&&c.jsx("button",{type:"button",className:Ge.chipRemove,onClick:()=>$(k),children:"×"})]},k))}),a&&c.jsxs("div",{className:Ge.keywordInput,children:[c.jsx("input",{type:"text",className:Ge.input,value:b,placeholder:l.contentEditForm.addKeywordPlaceholder,onChange:k=>C(k.target.value),onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),M())}}),c.jsx("button",{type:"button",className:Ge.addBtn,onClick:M,children:l.contentEditForm.addButton})]})]}),d("optional")&&c.jsxs("div",{className:Ge.field,children:[c.jsx("label",{className:Ge.label,children:g("optional",l.contentEditForm.optionalInCollectionLabel)}),c.jsxs("div",{className:Ge.radioGroup,children:[c.jsxs("label",{className:Ge.radioLabel,children:[c.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:E===!0,onChange:()=>D(!0),disabled:!a}),l.contentEditForm.yesOption]}),c.jsxs("label",{className:Ge.radioLabel,children:[c.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:E===!1,onChange:()=>D(!1),disabled:!a}),l.contentEditForm.noOption]})]})]})]}),n]})},xL="_iconBtn_vl14u_1",_L="_editable_vl14u_14",TL="_iconImg_vl14u_26",EL="_placeholder_vl14u_34",IL="_removeBtn_vl14u_41",ds={iconBtn:xL,editable:_L,iconImg:TL,placeholder:EL,removeBtn:IL},OL=({nodeId:e,value:t,editable:r})=>{const[n,s]=m.useState(!1),{updateNode:i,markDirty:a}=Oe(),o=ce(),l=f=>{i(e,{appIcon:f}),a(),s(!1)},u=f=>{f.stopPropagation(),i(e,{appIcon:""}),a()};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:[ds.iconBtn,r?ds.editable:""].filter(Boolean).join(" "),role:r?"button":void 0,tabIndex:r?0:-1,"aria-label":r?o.titleAppIcon.selectAppIconAriaLabel:o.titleAppIcon.appIconAriaLabel,onClick:()=>r&&s(!0),onKeyDown:f=>{r&&(f.key==="Enter"||f.key===" ")&&s(!0)},children:[t?c.jsx("img",{src:t,alt:o.titleAppIcon.appIconAlt,className:ds.iconImg}):c.jsx("div",{className:ds.placeholder,children:c.jsx(lf,{size:18})}),t&&r&&c.jsx("button",{type:"button",className:ds.removeBtn,onClick:u,"aria-label":o.titleAppIcon.removeIconAriaLabel,children:c.jsx(sl,{size:11})})]}),n&&c.jsx(ap,{nodeId:e,currentValue:t,onSelect:l,onClose:()=>s(!1)})]})},AL="_leafContentLayout_1lchu_1",DL="_container_1lchu_15",NL="_emptyState_1lchu_24",RL="_titleRow_1lchu_34",kL="_nodeTitle_1lchu_50",jL="_formArea_1lchu_72",LL="_contentListArea_1lchu_76",PL="_dropZone_1lchu_81",FL="_reviewComment_1lchu_88",ML="_reviewCommentLabel_1lchu_101",BL="_reviewCommentText_1lchu_107",Kt={leafContentLayout:AL,container:DL,emptyState:NL,titleRow:RL,nodeTitle:kL,formArea:jL,contentListArea:LL,dropZone:PL,reviewComment:FL,reviewCommentLabel:ML,reviewCommentText:BL},$L="application/vnd.sunbird.questionset",gp="application/vnd.sunbird.question",qL=[$L,gp];function Zu(e){var t,r;if(!(!e||e.status!=="Draft"||((t=e.metadata)==null?void 0:t.prevStatus)!=="Review"))return(r=e.metadata)==null?void 0:r.rejectComment}const UL=({editorMode:e,onToolbarEvent:t})=>{var P;const r=ce(),[n,s]=m.useState("details"),[i,a]=m.useState([]),[o,l]=m.useState(null),[u,f]=m.useState(!1),d=m.useRef(null),g=m.useRef(),{selectedNodeId:p,breadcrumb:w,activeNodeMeta:h,updateNode:y,treeData:v}=Oe(),b=le(k=>{var L,z,X,ye;return((z=(L=k.editorConfig)==null?void 0:L.context)==null?void 0:z.contentId)??((ye=(X=k.editorConfig)==null?void 0:X.context)==null?void 0:ye.identifier)??""}),C=p?yp(v,p):null,S=!!C&&!C.parent,_=!!(C!=null&&C.isFolder),E=C&&qL.includes(C.mimeType??""),N=(C==null?void 0:C.mimeType)===gp,R=C&&!C.isFolder&&!E&&!S,M=Zu(C)??(S?Zu(v[0]):void 0),$=m.useCallback(()=>{const k=d.current;if(!k||!p)return;const L=k.innerText.trim();clearTimeout(g.current),g.current=setTimeout(()=>{y(p,{name:L})},600)},[p,y]),D=m.useCallback(k=>{t({action:"onFormValueChange",data:k})},[t]),j=m.useCallback((k,L)=>{a(L),t({action:"onFormStatusChange",data:{isValid:k,nodeId:p}})},[t,p]);return C?E?c.jsx(Uo,{node:C,editorMode:e,type:"quml",singleQuestion:N}):R?c.jsxs("div",{className:Kt.leafContentLayout,children:[c.jsx(Uo,{node:C,editorMode:e,type:"content",layout:"flow"}),c.jsx(SL,{node:C,editorMode:e,onMoveClick:()=>l(C.identifier),reorderDialog:o?c.jsx(zj,{resourceId:o,resourceName:C.name,currentUnitId:C.parent??"",onClose:()=>l(null)}):null})]}):c.jsxs("div",{className:Kt.container,children:[c.jsx(gD,{crumbs:w}),M&&c.jsxs("div",{className:Kt.reviewComment,role:"alert",children:[c.jsx("span",{className:Kt.reviewCommentLabel,children:r.contextualEditor.reviewCommentLabel}),c.jsx("span",{className:Kt.reviewCommentText,children:M})]}),c.jsxs("div",{className:Kt.titleRow,children:[S&&p&&c.jsx(OL,{nodeId:p,value:String(C.appIcon??((P=C.metadata)==null?void 0:P.appIcon)??""),editable:e==="edit"}),c.jsx("div",{ref:d,className:Kt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:$,onBlur:$,"data-placeholder":r.contextualEditor.untitledPlaceholder,"aria-label":r.contextualEditor.nodeTitleAriaLabel,children:C.name})]}),c.jsx(SD,{activeTab:n,onChange:k=>s(k),errorTabs:i,visibleTabs:S?void 0:["details"]}),c.jsx("div",{className:Kt.formArea,children:c.jsx(YR,{nodeMetadata:h,activeTab:n,isRoot:S,isFolder:_,editorMode:e,onFormValueChange:D,onFormStatusChange:j},`${p??"none"}:${S?"root":"node"}`)}),(_||S)&&n==="details"&&c.jsx("div",{className:Kt.contentListArea,children:c.jsx(Dk,{editorMode:e})}),c.jsx(kk,{isActive:!1,label:r.contextualEditor.dropZoneLabel,nodeId:p??void 0,className:Kt.dropZone}),u&&c.jsx(tL,{contentId:b,onClose:()=>f(!1)})]}):c.jsx("div",{className:Kt.emptyState,children:c.jsx("p",{children:r.contextualEditor.emptyStateMessage})})};function yp(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=yp(r.children,t);if(n)return n}}}const vp=zs((e,t)=>({allContent:[],filteredContent:[],searchQuery:"",activeFilter:"all",advancedFilters:{},isLoading:!1,totalCount:0,offset:0,sortAZ:!1,setContent:(r,n)=>{e({allContent:r,totalCount:n,offset:r.length}),t().applyFilter()},appendContent:(r,n)=>{const i=[...t().allContent,...r];e({allContent:i,totalCount:n,offset:i.length}),t().applyFilter()},setFilter:r=>{e({activeFilter:r}),t().applyFilter()},setSearch:r=>{e({searchQuery:r}),t().applyFilter()},setLoading:r=>e({isLoading:r}),setAdvancedFilters:r=>e({advancedFilters:r}),setOffset:r=>e({offset:r}),setSortAZ:r=>e({sortAZ:r}),applyFilter:()=>{const{allContent:r,activeFilter:n,searchQuery:s}=t();let i=r;if(n&&n!=="all"){const a=n.toLowerCase();i=i.filter(o=>[o.mimeType??"",o.primaryCategory??"",o.contentType??""].join(" ").toLowerCase().includes(a))}if(s&&s.trim()!==""){const a=s.toLowerCase().trim();i=i.filter(o=>(o.name??"").toLowerCase().includes(a))}e({filteredContent:i})}})),zL=20;function bp(){var u;const e=le(f=>f.editorConfig),t=Oe(f=>f.selectedNodeId),r=Oe(f=>f.treeData),n=m.useCallback(()=>{if(!t||!r.length)return 0;function f(d,g,p=0){var w;for(const h of d){if(h.id===g)return p;if((w=h.children)!=null&&w.length){const y=f(h.children,g,p+1);if(y>=0)return y}}return-1}return Math.max(0,f(r,t))},[t,r])(),s=(u=e==null?void 0:e.config)==null?void 0:u.hierarchy;if(!s)return[...Au];const i=`level${n}`,a=s[i],o=a==null?void 0:a.children,l=o==null?void 0:o.Content;return l!=null&&l.length?l:[...Au]}function VL(){const e=vp(),t=le(d=>{var g,p;return((p=(g=d.editorConfig)==null?void 0:g.context)==null?void 0:p.channel)??""}),r=bp(),n=m.useRef(),s=m.useCallback(async(d="",g="all",p={},w=!0,h=!1)=>{var y,v,b,C,S;e.setLoading(!0);try{const _={status:["Live"],primaryCategory:g&&g!=="all"?[g]:r};(y=p==null?void 0:p.board)!=null&&y.length&&(_.board=p.board),(v=p==null?void 0:p.medium)!=null&&v.length&&(_.medium=p.medium),(b=p==null?void 0:p.gradeLevel)!=null&&b.length&&(_.gradeLevel=p.gradeLevel),(C=p==null?void 0:p.subject)!=null&&C.length&&(_.subject=p.subject),(S=p==null?void 0:p.primaryCategory)!=null&&S.length&&(_.primaryCategory=p.primaryCategory);const E=w?0:e.offset,{content:N,count:R}=await jk({filters:_,query:d,limit:d?50:zL,offset:E,channel:t||void 0,sortBy:h?{name:"asc"}:{lastUpdatedOn:"desc"}});w?e.setContent(N,R):e.appendContent(N,R)}catch(_){console.error("[useLibrary] load error:",_)}finally{e.setLoading(!1)}},[r,t]);m.useEffect(()=>{s()},[t]);const i=m.useCallback(d=>{e.setSearch(d),clearTimeout(n.current),n.current=setTimeout(()=>s(d,e.activeFilter,e.advancedFilters,!0,e.sortAZ),300)},[e.activeFilter,e.advancedFilters,e.sortAZ,s]),a=m.useCallback(d=>{e.setFilter(d),s(e.searchQuery,d,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,s]),o=m.useCallback(d=>{e.setAdvancedFilters(d),s(e.searchQuery,e.activeFilter,d,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,s]),l=m.useCallback(()=>{const d=!e.sortAZ;e.setSortAZ(d),s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,d)},[e.sortAZ,e.searchQuery,e.activeFilter,e.advancedFilters,s]),u=m.useCallback(()=>{e.isLoading||s(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,s]),f=e.allContent.length<e.totalCount;return{content:e.filteredContent,isLoading:e.isLoading,totalCount:e.totalCount,activeFilter:e.activeFilter,advancedFilters:e.advancedFilters,searchQuery:e.searchQuery,sortAZ:e.sortAZ,hasMore:f,search:i,setFilter:a,applyAdvancedFilters:o,toggleSort:l,loadMore:u,refetch:()=>s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const HL="_card_jzciw_1",QL="_addBtn_jzciw_17",GL="_dragging_jzciw_24",WL="_ctIcon_jzciw_29",KL="_info_jzciw_33",YL="_name_jzciw_41",ZL="_meta_jzciw_50",XL="_addBtnMuted_jzciw_78",JL="_added_jzciw_87",eP="_addedBadge_jzciw_96",lr={card:HL,addBtn:QL,dragging:GL,ctIcon:WL,info:KL,name:YL,meta:ZL,addBtnMuted:XL,added:JL,addedBadge:eP},tP={video:il,pdf:ea,h5p:tl,scorm:nl,audio:rl,quiz:Jo,default:Yn},rP=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var y,v;const i=ce(),a=ca(e),o=tP[a.key]??Yn,l=xl(),u=XO(),f=l&&!s&&u,{attributes:d,listeners:g,setNodeRef:p,isDragging:w}=Jd({id:e.identifier,disabled:!n||!l||!u,data:{type:"library-item",item:e}}),h=()=>{r&&r(e)};return c.jsxs("div",{ref:p,className:[lr.card,w?lr.dragging:"",s?lr.added:""].join(" "),"aria-label":e.name,...n?{...d,...g}:{},role:"listitem",onClick:h,children:[c.jsx("span",{className:[`sbx-ct-sq--${a.key}`,lr.ctIcon].join(" "),"aria-hidden":"true",children:c.jsx(o,{size:14})}),c.jsxs("div",{className:lr.info,children:[c.jsx("span",{className:lr.name,title:e.name,children:e.name}),c.jsxs("span",{className:lr.meta,children:[((y=e.organisation)==null?void 0:y[0])??e.channel??"",(v=e.organisation)!=null&&v[0]&&e.primaryCategory?" · ":"",e.primaryCategory??""]})]}),s&&c.jsx("span",{className:lr.addedBadge,"aria-label":i.libraryCard.alreadyAddedAriaLabel,title:i.libraryCard.alreadyAddedTitle,children:c.jsx(Wn,{size:12})}),!s&&n&&c.jsx("button",{type:"button",className:[lr.addBtn,!f&&l?lr.addBtnMuted:""].join(" "),onClick:b=>{b.stopPropagation(),t(e)},disabled:!l,"aria-disabled":!f,"aria-label":i.libraryCard.addItemAriaLabel.replace("{name}",e.name),title:l?u?i.libraryCard.addToUnitTitle:i.libraryCard.selectUnitToAddTitle:i.libraryCard.draftOnlyTitle,children:c.jsx(Us,{size:14})})]})},nP="_chips_xhhaq_1",sP="_chip_xhhaq_1",Xu={chips:nP,chip:sP},iP=({filters:e,active:t,onChange:r})=>{const n=ce();return c.jsx("div",{className:Xu.chips,role:"group","aria-label":n.filterChips.contentTypeFiltersAriaLabel,children:e.map(s=>c.jsx("button",{type:"button",role:"radio","aria-checked":t===s.value,className:["sbx-chip",t===s.value?"filled":"outline",Xu.chip].join(" "),onClick:()=>r(s.value),children:s.label},s.value))})},aP="_panel_1cl11_1",oP="_header_1cl11_10",lP="_headerTitle_1cl11_19",cP="_closeBtn_1cl11_25",uP="_body_1cl11_43",dP="_section_1cl11_59",fP="_sectionLabel_1cl11_65",hP="_chips_1cl11_73",pP="_chip_1cl11_73",mP="_active_1cl11_96",gP="_footer_1cl11_102",yP="_resetBtn_1cl11_112",vP="_applyBtn_1cl11_129",at={panel:aP,header:oP,headerTitle:lP,closeBtn:cP,body:uP,section:dP,sectionLabel:fP,chips:hP,chip:pP,active:mP,footer:gP,resetBtn:yP,applyBtn:vP},bP=e=>[{key:"board",label:e.libraryFilterPanel.boardLabel},{key:"medium",label:e.libraryFilterPanel.mediumLabel},{key:"gradeLevel",label:e.libraryFilterPanel.classLabel},{key:"subject",label:e.libraryFilterPanel.subjectLabel}],wP=new Set(["board","medium","gradeLevel","subject","topic"]),CP=({local:e,toggle:t})=>{const r=ce(),n=bp();return n.length?c.jsxs("div",{className:at.section,children:[c.jsx("div",{className:at.sectionLabel,children:r.libraryFilterPanel.primaryCategoryLabel}),c.jsx("div",{className:at.chips,children:n.map(s=>c.jsx("button",{type:"button",className:[at.chip,(e.primaryCategory??[]).includes(s)?at.active:""].join(" "),onClick:()=>t("primaryCategory",s),children:s},s))})]}):null},SP=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var y,v;const s=ce(),i=le(b=>b.editorConfig),a=le(b=>b.searchFormConfig),o=le(b=>b.contentFramework),l=le(b=>b.contentTargetFWIds),{organisationFramework:u}=Jh(o??((y=i==null?void 0:i.context)==null?void 0:y.framework),l??((v=i==null?void 0:i.context)==null?void 0:v.targetFWIds)),[f,d]=m.useState(t),g=a!=null&&a.length?a.filter(b=>wP.has(b.code)).map(b=>({key:b.code,label:b.label||b.code})):bP(s);m.useEffect(()=>{d(t)},[t]);const p=(b,C)=>{d(S=>{const _=S[b]??[],E=_.includes(C)?_.filter(N=>N!==C):[..._,C];return{...S,[b]:E}})},w=(u==null?void 0:u.categories)??[],h=b=>{var C;return((C=w.find(S=>S.code===b))==null?void 0:C.terms)??[]};return e?c.jsxs("div",{className:at.panel,role:"dialog","aria-label":s.libraryFilterPanel.filterLibraryAriaLabel,"aria-modal":"true",children:[c.jsxs("div",{className:at.header,children:[c.jsx("span",{className:at.headerTitle,children:s.libraryFilterPanel.filtersHeaderTitle}),c.jsx("button",{type:"button",className:at.closeBtn,onClick:n,"aria-label":s.libraryFilterPanel.closeFiltersAriaLabel,children:c.jsx(Cr,{size:16})})]}),c.jsxs("div",{className:at.body,children:[g.map(({key:b,label:C})=>{const S=h(b);return S.length?c.jsxs("div",{className:at.section,children:[c.jsx("div",{className:at.sectionLabel,children:C}),c.jsx("div",{className:at.chips,children:S.slice(0,20).map(_=>c.jsx("button",{type:"button",className:[at.chip,(f[b]??[]).includes(_.name)?at.active:""].join(" "),onClick:()=>p(b,_.name),children:_.name},_.identifier))})]},b):null}),c.jsx(CP,{local:f,toggle:p})]}),c.jsxs("div",{className:at.footer,children:[c.jsx("button",{type:"button",className:at.resetBtn,onClick:()=>d({}),children:s.libraryFilterPanel.resetButton}),c.jsx("button",{type:"button",className:at.applyBtn,onClick:()=>{r(f),n()},children:s.libraryFilterPanel.applyButton})]})]}):null},xP="_header_6qdpu_10",_P="_title_6qdpu_20",TP="_headerActions_6qdpu_31",EP="_iconBtn_6qdpu_38",IP="_playerArea_6qdpu_56",OP="_footer_6qdpu_64",AP="_addBtn_6qdpu_73",DP="_modalOverlay_6qdpu_92",NP="_modalPanel_6qdpu_103",gr={header:xP,title:_P,headerActions:TP,iconBtn:EP,playerArea:IP,footer:OP,addBtn:AP,modalOverlay:DP,modalPanel:NP},RP="application/vnd.sunbird.questionset",kP=({content:e,editorMode:t,onAdd:r,onClose:n})=>{const s=ce(),i=t==="edit";if(!e)return null;const a={id:e.identifier,identifier:e.identifier,name:e.name??"",mimeType:e.mimeType,primaryCategory:e.primaryCategory,contentType:e.contentType,appIcon:e.appIcon,status:e.status,isFolder:!1,children:[],metadata:e};return Br.createPortal(c.jsx("div",{className:gr.modalOverlay,role:"dialog","aria-modal":"true","aria-label":s.libraryPreviewPanel.contentPreviewAriaLabel,onClick:n,children:c.jsxs("div",{className:gr.modalPanel,onClick:o=>o.stopPropagation(),children:[c.jsxs("div",{className:gr.header,children:[c.jsx("span",{className:gr.title,title:e.name,children:e.name}),c.jsx("div",{className:gr.headerActions,children:c.jsx("button",{type:"button",className:gr.iconBtn,onClick:n,"aria-label":s.libraryPreviewPanel.closePreviewAriaLabel,children:c.jsx(Cr,{size:16})})})]}),c.jsx("div",{className:gr.playerArea,children:c.jsx(Uo,{node:a,editorMode:"read",type:e.mimeType===RP?"quml":"content"})}),i&&c.jsx("div",{className:gr.footer,children:c.jsx("button",{type:"button",className:gr.addBtn,onClick:()=>r(e),children:s.libraryPreviewPanel.addToUnitButton})})]})}),document.body)},jP="_dock_1lpg0_1",LP="_header_1lpg0_8",PP="_headerLeft_1lpg0_17",FP="_headerTitle_1lpg0_24",MP="_count_1lpg0_30",BP="_searchRow_1lpg0_39",$P="_searchWrap_1lpg0_47",qP="_searchIcon_1lpg0_53",UP="_searchInput_1lpg0_62",zP="_filterToggleBtn_1lpg0_80",VP="_filterToggleBtnActive_1lpg0_99",HP="_filterBadge_1lpg0_105",QP="_filters_1lpg0_124",GP="_mainArea_1lpg0_134",WP="_sidePanelOverlay_1lpg0_143",KP="_cardList_1lpg0_152",YP="_skeleton_1lpg0_168",ZP="_skeletonIcon_1lpg0_178",XP="_skeletonText_1lpg0_186",JP="_skeletonLine_1lpg0_193",eF="_skeletonLineSm_1lpg0_200",tF="_loadMoreBtn_1lpg0_215",rF="_emptyState_1lpg0_240",nF="_collapseBtn_1lpg0_260",Me={dock:jP,header:LP,headerLeft:PP,headerTitle:FP,count:MP,searchRow:BP,searchWrap:$P,searchIcon:qP,searchInput:UP,filterToggleBtn:zP,filterToggleBtnActive:VP,filterBadge:HP,filters:QP,mainArea:GP,sidePanelOverlay:WP,cardList:KP,skeleton:YP,skeletonIcon:ZP,skeletonText:XP,skeletonLine:JP,skeletonLineSm:eF,loadMoreBtn:tF,emptyState:rF,collapseBtn:nF};function sF(e){const t=new Set,r=[...e];for(;r.length>0;){const n=r.shift();n.isFolder||t.add(n.identifier),n.children&&r.push(...n.children)}return t}const iF=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const n=ce(),{content:s,isLoading:i,totalCount:a,activeFilter:o,searchQuery:l,sortAZ:u,hasMore:f,search:d,setFilter:g,applyAdvancedFilters:p,toggleSort:w,loadMore:h}=VL(),{addResource:y,selectedNodeId:v,treeData:b}=Oe(),C=e==="edit",[S,_]=m.useState(!1),[E,N]=m.useState({}),[R,M]=m.useState(null),$=m.useMemo(()=>sF(b),[b]),D=m.useCallback(z=>{var _e;if(!v){Ee.error(n.libraryDock.selectUnitFirstToast);return}const X=(_e=b[0])==null?void 0:_e.id;if(v===X){Ee(n.libraryDock.selectUnitFromOutlineToast,{icon:c.jsx(el,{size:16}),duration:4e3});return}if(y(z,v)===!1){Ee.error(n.libraryDock.itemAlreadyAddedToast.replace("{name}",z.name));return}Ee.success(n.libraryDock.itemAddedToast.replace("{name}",z.name))},[v,y,b,n]),j=m.useCallback(z=>{N(z),p(z)},[p]),P=m.useCallback(z=>{M(z)},[]),k=m.useCallback(z=>{D(z),M(null)},[D]),L=m.useMemo(()=>Object.values(E).reduce((z,X)=>z+((X==null?void 0:X.length)??0),0),[E]);return c.jsxs("div",{className:Me.dock,children:[c.jsx("div",{className:Me.header,children:c.jsxs("div",{className:Me.headerLeft,children:[c.jsx("button",{type:"button",className:Me.collapseBtn,onClick:r,"aria-label":n.libraryDock.collapseLibraryPanelAriaLabel,title:n.libraryDock.collapseLibraryTitle,children:c.jsx(Vy,{size:15})}),c.jsx(qy,{size:16}),c.jsx("span",{className:Me.headerTitle,children:n.libraryDock.headerTitle}),a>0&&c.jsx("span",{className:Me.count,children:a})]})}),c.jsxs("div",{className:Me.searchRow,children:[c.jsxs("div",{className:Me.searchWrap,children:[c.jsx(mo,{size:14,className:Me.searchIcon}),c.jsx("input",{type:"search",className:Me.searchInput,placeholder:n.libraryDock.searchPlaceholder,value:l,onChange:z=>d(z.target.value),"aria-label":n.libraryDock.searchAriaLabel})]}),c.jsx("button",{type:"button",className:[Me.filterToggleBtn,u?Me.filterToggleBtnActive:""].join(" "),onClick:w,"aria-label":u?n.libraryDock.sortAZAriaLabel:n.libraryDock.sortRecentAriaLabel,title:u?n.libraryDock.sortAZTitle:n.libraryDock.sortRecentTitle,children:u?c.jsx(Dy,{size:15}):c.jsx(Ly,{size:15})}),c.jsxs("button",{type:"button",className:[Me.filterToggleBtn,S?Me.filterToggleBtnActive:""].join(" "),onClick:()=>_(z=>!z),"aria-label":n.libraryDock.toggleAdvancedFiltersAriaLabel,"aria-pressed":S,title:n.libraryDock.advancedFiltersTitle,children:[c.jsx(Zy,{size:15}),L>0&&c.jsx("span",{className:Me.filterBadge,children:L})]})]}),c.jsx("div",{className:Me.filters,children:c.jsx(iP,{filters:JO,active:o,onChange:g})}),c.jsxs("div",{className:Me.mainArea,children:[c.jsx("div",{className:Me.cardList,role:"list","aria-label":n.libraryDock.libraryContentAriaLabel,children:i&&s.length===0?Array.from({length:4}).map((z,X)=>c.jsxs("div",{className:Me.skeleton,"aria-hidden":"true",children:[c.jsx("div",{className:Me.skeletonIcon}),c.jsxs("div",{className:Me.skeletonText,children:[c.jsx("div",{className:Me.skeletonLine}),c.jsx("div",{className:Me.skeletonLineSm})]})]},X)):s.length>0?c.jsxs(c.Fragment,{children:[s.map(z=>c.jsx(rP,{item:z,onAdd:D,onPreview:P,isDraggable:C,isAdded:$.has(z.identifier)},z.identifier)),f&&c.jsx("button",{type:"button",className:Me.loadMoreBtn,onClick:h,disabled:i,"aria-label":n.libraryDock.loadMoreAriaLabel,children:i?n.libraryDock.loadingText:n.libraryDock.loadMoreText})]}):c.jsxs("div",{className:Me.emptyState,children:[c.jsx(mo,{size:24}),c.jsx("p",{children:n.libraryDock.noContentFound}),c.jsx("span",{children:n.libraryDock.tryDifferentSearch})]})}),S&&c.jsx("div",{className:Me.sidePanelOverlay,children:c.jsx(SP,{isOpen:S,filters:E,onApply:j,onClose:()=>_(!1)})}),R&&c.jsx(kP,{content:R,editorMode:e,onAdd:k,onClose:()=>M(null)})]})]})};function aF(e,t,r){const n={},s={},i=new Set(["id","isFolder","children","parent","isNew","breadcrumb","title","relationalMetadata","optional"]),a=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","targetFWIds","targetTopicIds","topic","topicsIds"]),o=new Set(["audience","attributions","keywords","language","additionalCategories","medium","gradeLevel","subject","boardIds","mediumIds","gradeLevelIds","subjectIds","targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","dialcodes"]),l=new Set(["copyrightYear","compatibilityLevel","version"]);function u(g,p=!1){const w={};for(const[h,y]of Object.entries(g))if(!i.has(h)&&!(p&&a.has(h)))if(o.has(h))Array.isArray(y)?w[h]=y:y!=null&&y!==""?w[h]=[y]:w[h]=[];else if(l.has(h)){const v=Number(y);isNaN(v)||(w[h]=v)}else w[h]=y;return w}function f(g){var w;const p={};for(const h of g.children??[]){if(h.isFolder)continue;const y=t[h.identifier];if(!y)continue;const{isNew:v,...b}=y;if(Object.keys(b).length===0)continue;const C=((w=h.metadata)==null?void 0:w.relationalMetadata)??{};p[h.identifier]={name:h.name,...C,...b}}return p}function d(g,p){var C,S;const w=g.identifier,h=t[w],y=w.startsWith("temp-")||!!(h!=null&&h.isNew),v=!g.isFolder&&!p;if(p||y||h&&!v){let _;if(y)_={mimeType:"application/vnd.ekstep.content-collection",code:w,contentType:((C=g.metadata)==null?void 0:C.contentType)??"CourseUnit",primaryCategory:((S=g.metadata)==null?void 0:S.primaryCategory)??"Course Unit",name:g.name,visibility:"Parent",channel:r,...u(g.metadata??{})};else if(p){const{isNew:E,...N}=h??{};_={...u(g.metadata??{},!0),...u(N,!1),name:g.name}}else{const{isNew:E,...N}=h??{};_={name:g.name,visibility:"Parent",...u(N,!0)}}n[w]={metadata:_,objectType:g.objectType||(g.isFolder?"Collection":"Content"),root:p,isNew:y}}const b=g.isFolder?f(g):{};s[w]={name:g.name,children:(g.children??[]).map(_=>_.identifier),...Object.keys(b).length>0?{relationalMetadata:b}:{},root:p},(g.children??[]).forEach(_=>d(_,!1))}return e.forEach((g,p)=>d(g,p===0)),{nodesModified:n,hierarchy:s}}function oF(){const[e,t]=m.useState(!1),r=Oe(f=>f.treeCache),n=Oe(f=>f.treeData),s=le(f=>f.isDirty),i=le(f=>f.lastSaved),{setIsDirty:a,setLastSaved:o}=le(),l=le(f=>f.editorConfig);return{save:m.useCallback(async()=>{if(!l||e)return;const f=l.context.contentId??l.context.identifier??"";if(!f)return;const d=l.context.channel??"",g=l.context.userId??l.context.uid??"";t(!0);try{const{nodesModified:p,hierarchy:w}=aF(n,r,d),{identifiers:h}=await E_(f,p,w,g);h&&Object.keys(h).length>0&&Oe.getState().replaceNodeIds(h);const y=new Date().toISOString();o(y),a(!1)}catch(p){console.error("[useSaveHierarchy] save failed:",p),Ee.error("Failed to save. Please try again.")}finally{t(!1)}},[l,e,n,r,a,o]),isSaving:e,isDirty:s,lastSaved:i}}const lF={};function cF(e){return e==null||e===""||Array.isArray(e)&&e.length===0}function uF(e,t,r,n,s){const i=[],a=(o,l)=>{var u;for(const f of o){const d=l&&!f.parent,g=d?r:f.isFolder?n:null;if(g&&g.length>0){const p={...f.metadata??{},...t[f.id]??{}},h=rp(g,p,lF,d,s).filter(y=>y.required&&y.visible!==!1&&y.inputType!=="appIcon"&&cF(y.currentValue)).map(y=>y.label);h.length>0&&i.push({nodeId:f.id,nodeName:f.name||"Untitled",missing:h})}(u=f.children)!=null&&u.length&&a(f.children,!1)}};return a(e,!0),i}function dF(e){const t=le(d=>d.editorConfig),r=le(d=>d.setButtonLoader),n=le(d=>d.validateAllForms),s=le(d=>d.rootFormConfig),i=le(d=>d.unitFormConfig),a=Oe(d=>d.treeData),o=Oe(d=>d.treeCache),l=Oe(d=>d.selectNode),u=m.useCallback(()=>{var h,y,v;const d={editorMode:"edit",objectType:(h=t==null?void 0:t.config)==null?void 0:h.objectType,userFullName:(v=(y=t==null?void 0:t.context)==null?void 0:y.user)==null?void 0:v.fullName},g=uF(a,o,s,i,d);if(g.length===0)return!0;const p=g[0];Ee.error(`"${p.nodeName}": please fill required field${p.missing.length>1?"s":""} — ${p.missing.join(", ")}`);const{setFormStatus:w}=le.getState();return g.forEach(b=>w(b.nodeId,!1)),l(p.nodeId),!1},[a,o,s,i,t,l]);return{runAction:m.useCallback(async(d,g)=>{var h,y,v,b;const p=((h=t==null?void 0:t.context)==null?void 0:h.contentId)??((y=t==null?void 0:t.context)==null?void 0:y.identifier)??"";if(!p)return Ee.error("No content identifier found."),!1;const w=((v=t==null?void 0:t.context)==null?void 0:v.userId)??((b=t==null?void 0:t.context)==null?void 0:b.uid)??"";try{switch(d){case"sendForReview":return u()?n(a)?(r("saveCollection",!0),await e(),await A_(p),Ee.success("Content sent for review"),!0):(Ee.error("Some units have missing required fields. Please fill them before sending for review."),!1):!1;case"reject":{r("rejectCollection",!0);const C=(g==null?void 0:g.comment)??"";return await D_(p,C),Ee.success("Content rejected and sent back to the author"),!0}case"publish":return u()?n(a)?(r("publishCollection",!0),await e(),await I_(p,w),Ee.success("Content published successfully"),!0):(Ee.error("Some units have missing required fields. Please fill them before publishing."),!1):!1;default:return!1}}catch(C){console.error(`[useToolbarActions] ${d} failed`,C);const S=d==="sendForReview"?"send for review":d==="reject"?"reject":"publish";return Ee.error(`Failed to ${S}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r,u,n,a]),checkRequiredFields:u}}const fF="_shell_90fon_1",hF="_workspace_90fon_8",pF="_sidebarCollapsed_90fon_16",mF="_dockCollapsed_90fon_19",gF="_dock_90fon_19",yF="_outline_90fon_40",vF="_reopenTab_90fon_45",bF="_outlineHidden_90fon_79",wF="_editor_90fon_86",CF="_dockHidden_90fon_101",SF="_dockReopenTab_90fon_108",xF="_dragChip_90fon_133",_F="_dragChipLabel_90fon_148",jt={shell:fF,workspace:hF,sidebarCollapsed:pF,dockCollapsed:mF,dock:gF,outline:yF,reopenTab:vF,outlineHidden:bF,editor:wF,dockHidden:CF,dockReopenTab:SF,dragChip:xF,dragChipLabel:_F},TF=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const s=ce(),[i,a]=m.useState(null),[o,l]=m.useState(!1),[u,f]=m.useState(!1),[d,g]=m.useState(!1),{addResource:p,treeData:w}=Oe(),h=le(L=>L.setFormStatus),[y,v]=m.useState(!0),b=Oe(L=>L.selectedNodeId),{save:C,isSaving:S,isDirty:_,lastSaved:E}=oF(),{runAction:N,checkRequiredFields:R}=dF(C);m.useEffect(()=>{if(!_)return;const L=z=>{z.preventDefault(),z.returnValue=""};return window.addEventListener("beforeunload",L),()=>window.removeEventListener("beforeunload",L)},[_]);const M=kd(uo(Zi,{activationConstraint:{distance:8}})),$=m.useCallback(L=>{var X;const z=(X=L.active.data.current)==null?void 0:X.item;z&&a(z)},[]),D=m.useCallback(L=>{var de,Q;a(null);const z=(de=L.active.data.current)==null?void 0:de.item;if(!z)return;const X=L.over,ye=(X==null?void 0:X.id)??b??void 0;if(!ye){Ee.error(s.splitBuilderShell.dropOntoUnitError);return}const _e=(Q=w[0])==null?void 0:Q.id;if(ye===_e){Ee.error(s.splitBuilderShell.dropOntoCourseError);return}if(!p(z,ye)){Ee.error(s.splitBuilderShell.alreadyInCollectionError.replace("{name}",z.name));return}r==null||r(z,ye),Ee.success(s.splitBuilderShell.addedToUnitSuccess.replace("{name}",z.name))},[b,p,r,s]),j=m.useCallback(async L=>{if(L.action==="onFormStatusChange"){const{isValid:z,nodeId:X}=L.data??{},ye=z!==!1;v(ye),X&&h(X,ye);return}if(L.action==="back"&&_&&e==="edit"){g(!0);return}if(L.action==="saveCollection"){if(!y){Ee.error(s.splitBuilderShell.fillRequiredMetadataError);return}if(!R())return;await C(),n==null||n(w),t==null||t(L);return}if(L.action==="sendForReview"||L.action==="reject"||L.action==="publish"){await N(L.action,L.data)&&(t==null||t(L));return}t==null||t(L)},[C,N,R,t,n,w,_,y,e,s]),P=m.useCallback(async()=>{if(!R()){g(!1);return}await C(),g(!1),n==null||n(w),t==null||t({action:"back"})},[C,R,n,t,w]),k=m.useCallback(()=>{g(!1),t==null||t({action:"back"})},[t]);return c.jsxs(Xd,{sensors:M,onDragStart:$,onDragEnd:D,children:[c.jsxs("div",{className:jt.shell,children:[c.jsx(B0,{editorMode:e,isSaving:S,isDirty:_,lastSaved:E,isFormValid:y,onToolbarEvent:j}),c.jsxs("div",{className:[jt.workspace,o?jt.sidebarCollapsed:"",u?jt.dockCollapsed:""].filter(Boolean).join(" "),children:[c.jsx("aside",{className:[jt.outline,o?jt.outlineHidden:""].join(" "),"aria-label":s.splitBuilderShell.outlineAriaLabel,"aria-hidden":o,children:c.jsx(dD,{editorMode:e,collapsed:o,onToggleCollapse:()=>l(L=>!L)})}),o&&c.jsx("button",{className:jt.reopenTab,onClick:()=>l(!1),title:s.splitBuilderShell.showOutlineTitle,type:"button",children:"›"}),c.jsx("main",{className:jt.editor,role:"main","aria-label":s.splitBuilderShell.editorAriaLabel,children:c.jsx(UL,{editorMode:e,onToolbarEvent:j})}),c.jsx("aside",{className:[jt.dock,u?jt.dockHidden:""].filter(Boolean).join(" "),"aria-label":s.splitBuilderShell.libraryAriaLabel,"aria-hidden":u,children:c.jsx(iF,{editorMode:e,collapsed:u,onToggleCollapse:()=>f(L=>!L)})}),u&&c.jsx("button",{className:jt.dockReopenTab,onClick:()=>f(!1),title:s.splitBuilderShell.showLibraryTitle,type:"button",children:"‹"})]})]}),c.jsx(Ty,{dropAnimation:null,children:i?c.jsx("div",{className:jt.dragChip,children:c.jsx("span",{className:jt.dragChipLabel,children:i.name})}):null}),d&&c.jsx($0,{onSave:P,onDiscard:k,onCancel:()=>g(!1),isSaving:S})]})},EF="v1";function IF(e){const t=e.validations,r=t==null?void 0:t.find(s=>s.type==="maxlength"||s.type==="maxLength");if(!r)return e.maxLength;const n=Number(r.value);return Number.isFinite(n)?n:void 0}function Ju(e,t){var r;return{code:e.code??"",label:e.label??e.name??e.code??"",name:e.name,inputType:e.inputType,dataType:e.dataType,required:e.required===!0||Array.isArray(e.validations)&&e.validations.some(n=>n.type==="required")||String(((r=e.renderingHints)==null?void 0:r.class)??"").includes("required"),editable:e.editable!==!1,visible:e.visible!==!1,placeholder:e.placeholder,maxLength:IF(e),depends:e.depends,sourceCategory:e.sourceCategory,range:e.range,enum:e.enum,default:e.default,defaultValue:e.defaultValue,index:e.index,section:t,output:e.output}}function Er(e){const t=e==null?void 0:e.properties;if(!Array.isArray(t))return[];const r=[];for(const n of t)if(Array.isArray(n.fields)){const s=n.name??void 0,i=n.fields.filter(a=>!!a.code).sort((a,o)=>(a.index??0)-(o.index??0));for(const a of i)r.push(Ju(a,s))}else n.code&&r.push(Ju(n));return r}function OF(e){const t=e==null?void 0:e.properties;if(!t)return{};const r={};for(const[n,s]of Object.entries(t))s&&"default"in s&&(r[n]=s.default);return r}async function AF(e,t,r="Collection",n=EF){var u,f;const i=(f=(u=(await Ne.post(`/action/object/category/definition/${n}/read?fields=objectMetadata,forms,name,label`,{request:{objectCategoryDefinition:{objectType:r,name:e,...t?{channel:t}:{}}}})).data)==null?void 0:u.result)==null?void 0:f.objectCategoryDefinition,a=(i==null?void 0:i.forms)??{},o=(i==null?void 0:i.objectMetadata)??{},l=o.config??{};return{rootForm:Er(a.create),unitForm:Er(a.unitMetadata),childForm:Er(a.childMetadata),searchForm:Er(a.search??a.searchConfig),relationalForm:Er(a.relationalMetadata),publishChecklist:Er(a.publishchecklist),reviewChecklist:Er(a.review),rfcChecklist:Er(a.requestforchangeschecklist),schemaDefaults:OF(o.schema),frameworkMetadata:l.frameworkMetadata??{},sourcingSettings:l.sourcingSettings??{}}}function DF({config:e,onError:t}){const[r,n]=m.useState(!0),[s,i]=m.useState(null),[a,o]=m.useState(!1),{setEditorConfig:l,setEditorMode:u,setCategoryDefinition:f,setContentFramework:d}=le(),{setTreeData:g,selectNode:p}=Oe();return m.useEffect(()=>{let w=!1;async function h(){var y,v,b;try{n(!0),i(null),e.apiBaseUrl&&Uf(e.apiBaseUrl),l(e),u(e.config.mode);const C=e.context.contentId??e.context.identifier??"",S=e.context.channel??"";let _;if(S)try{_=(y=await ep(S))==null?void 0:y.defaultFramework}catch{}let E=!1;if(C){const N=e.config.objectType==="QuestionSet",{rootNode:R}=N?await T_(C):await Qf(C);if(!w&&(g(R?[R]:[]),R)){p(R.id);const P=R.metadata??{},k=P.framework??_??e.context.framework??null,L=P.targetFWIds??e.context.targetFWIds??null;d(k,L),E=!0}const M=e.config.primaryCategory??"Course",$=e.context.channel??"",D=e.config.categoryDefinitionApiVersion??"v1";try{const j=await AF(M,$,e.config.objectType??"Collection",D);if(!w){f(j);const P=((v=j.sourcingSettings)==null?void 0:v.collection)??{},k={};P.maxDepth&&!e.config.maxDepth&&(k.maxDepth=P.maxDepth),P.children&&!e.config.children&&(k.children=P.children),P.hierarchy&&!((b=e.config.hierarchy)!=null&&b.level1)&&(k.hierarchy={...e.config.hierarchy??{},...P.hierarchy}),Object.keys(k).length>0&&l({...e,config:{...e.config,...k}})}}catch{}}!w&&!E&&d(_??e.context.framework??null,e.context.targetFWIds??null),w||o(!0)}catch(C){if(!w){const S=C instanceof Error?C:new Error(String(C));i(S),t==null||t(S)}}finally{w||n(!1)}}return h(),()=>{w=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:a}}function NF(){const e=gf(t=>t.setLanguage);m.useEffect(()=>{e(localStorage.getItem(wo)||"en",{broadcast:!1});const t=n=>{n.key===wo&&n.newValue&&e(n.newValue,{broadcast:!1})},r=n=>{var i;const s=(i=n.detail)==null?void 0:i.lang;s&&e(s,{broadcast:!1})};return window.addEventListener("storage",t),window.addEventListener(Co,r),()=>{window.removeEventListener("storage",t),window.removeEventListener(Co,r)}},[e])}const RF="_root_qcpw6_1",kF="_loadingState_qcpw6_10",jF="_loadingSpinner_qcpw6_20",LF="_errorState_qcpw6_34",ms={root:RF,loadingState:kF,loadingSpinner:jF,errorState:LF},PF=new Kp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});function FF({error:e,onRetry:t}){const r=ce();return c.jsxs("div",{className:ms.errorState,children:[c.jsx("h3",{children:r.collectionEditor.errorBoundaryTitle}),c.jsx("p",{children:e.message}),c.jsx("button",{onClick:t,children:r.collectionEditor.retryButton})]})}class MF extends m.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t){var r,n;(n=(r=this.props).onError)==null||n.call(r,t)}render(){return this.state.error?c.jsx(FF,{error:this.state.error,onRetry:()=>this.setState({error:null})}):this.props.children}}function BF(e){NF();const t=ce(),{isLoading:r,error:n}=DF({config:e,onError:e.onError}),s=le(i=>i.editorMode);return r?c.jsxs("div",{className:ms.loadingState,children:[c.jsx("div",{className:ms.loadingSpinner}),c.jsx("p",{children:t.collectionEditor.loadingMessage})]}):n?c.jsxs("div",{className:ms.errorState,children:[c.jsx("h3",{children:t.collectionEditor.loadErrorTitle}),c.jsx("p",{children:n.message})]}):c.jsx("div",{className:`sb-split-builder ${ms.root}`,children:c.jsx(TF,{editorMode:s,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const wp=e=>c.jsx(MF,{onError:e.onError,children:c.jsxs(Zp,{client:PF,children:[c.jsx(BF,{...e}),c.jsx(Ym,{position:"top-right",toastOptions:{duration:3e3}})]})}),Vi=Symbol.for("r2wc.reactRender"),ed=Symbol.for("r2wc.shouldRender"),ci=Symbol.for("r2wc.root");function $F(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function qF(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var td={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[Vi]()}}),e[Vi]()}};function UF(e,t,r,n={}){var s={isConnected:"isConnected"in HTMLElement.prototype},i=!1,a=function(){var u=Reflect.construct(HTMLElement,arguments,this.constructor);return typeof n.shadow=="string"?u.attachShadow({mode:n.shadow}):n.shadow&&(console.warn('Specifying the "shadow" option as a boolean is deprecated and will be removed in a future version.'),u.attachShadow({mode:"open"})),u},o=Object.create(HTMLElement.prototype);o.constructor=a;var l=new Proxy(o,{has:function(u,f){return f in e.propTypes||f in o},set:function(u,f,d,g){return i&&(s[f]=!0),typeof f=="symbol"||s[f]||f in u?(e.propTypes&&f in e.propTypes&&td.expando(g,f,d),Reflect.set(u,f,d,g)):(td.expando(g,f,d),!0)},getOwnPropertyDescriptor:function(u,f){var d=Reflect.getOwnPropertyDescriptor(u,f);if(d)return d;if(f in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return a.prototype=l,o.connectedCallback=function(){this[ed]=!0,this[Vi]()},o.disconnectedCallback=function(){typeof r.createRoot=="function"?this[ci].unmount():r.unmountComponentAtNode(this)},o[Vi]=function(){if(this[ed]===!0){var u={};Object.keys(this).forEach(function(g){s[g]!==!1&&(u[g]=this[g])},this),i=!0;const f=n.shadow?this.shadowRoot:this,d=t.createElement(e,u);typeof r.createRoot=="function"?(this[ci]||(this[ci]=r.createRoot(f)),this[ci].render(d)):r.render(d,f),i=!1}},e.propTypes&&(a.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(u){return $F(u)}):Object.keys(e.propTypes),o.attributeChangedCallback=function(u,f,d){var g=n.dashStyleAttributes?qF(u):u;this[g]=d}),a}var gs={},fs=Br;if(process.env.NODE_ENV==="production")gs.createRoot=fs.createRoot,gs.hydrateRoot=fs.hydrateRoot;else{var ui=fs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;gs.createRoot=function(e,t){ui.usingClientEntryPoint=!0;try{return fs.createRoot(e,t)}finally{ui.usingClientEntryPoint=!1}},gs.hydrateRoot=function(e,t,r){ui.usingClientEntryPoint=!0;try{return fs.hydrateRoot(e,t,r)}finally{ui.usingClientEntryPoint=!1}}}function zF(){if(document.getElementById("sb-ce-react-styles"))return;const e=document.createElement("style");e.id="sb-ce-react-styles",e.textContent="@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');",document.head.insertBefore(e,document.head.firstChild)}function VF(e="sb-collection-editor"){if(zF(),typeof customElements>"u"||customElements.get(e))return;const t=UF(wp,m,gs,{});customElements.define(e,t)}exports.CollectionEditor=wp;exports.registerCollectionEditor=VF;exports.setApiBaseUrl=Uf;exports.useEditorStore=le;exports.useLibraryStore=vp;exports.useTreeStore=Oe;
|