@project-sunbird/collection-editor-react 0.1.14 → 0.1.15

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/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var vl=e=>{throw TypeError(e)};var io=(e,t,r)=>t.has(e)||vl("Cannot "+r);var O=(e,t,r)=>(io(e,t,"read from private field"),r?r.call(e):t.get(e)),re=(e,t,r)=>t.has(e)?vl("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Y=(e,t,r,n)=>(io(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),me=(e,t,r)=>(io(e,t,"access private method"),r);var zs=(e,t,r,n)=>({set _(s){Y(e,t,s,r)},get _(){return O(e,t,n)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),Rr=require("react-dom"),l=require("react/jsx-runtime");function Yh(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 Ce=Yh(p);var Ds=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(){}},qr,Or,xn,Uu,Xh=(Uu=class extends Ds{constructor(){super();re(this,qr);re(this,Or);re(this,xn);Y(this,xn,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){O(this,Or)||this.setEventListener(O(this,xn))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Or))==null||t.call(this),Y(this,Or,void 0))}setEventListener(t){var r;Y(this,xn,t),(r=O(this,Or))==null||r.call(this),Y(this,Or,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){O(this,qr)!==t&&(Y(this,qr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof O(this,qr)=="boolean"?O(this,qr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},qr=new WeakMap,Or=new WeakMap,xn=new WeakMap,Uu),ja=new Xh,Zh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},nr,Hr,Vu,Jh=(Vu=class{constructor(){re(this,nr,Zh);re(this,Hr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&O(this,Hr)&&e!==O(this,nr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:O(this,nr),provider:e}),Y(this,nr,e),process.env.NODE_ENV!=="production"&&Y(this,Hr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Hr,!0),O(this,nr).setTimeout(e,t)}clearTimeout(e){O(this,nr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Hr,!0),O(this,nr).setInterval(e,t)}clearInterval(e){O(this,nr).clearInterval(e)}},nr=new WeakMap,Hr=new WeakMap,Vu),Ur=new Jh;function ep(e){setTimeout(e,0)}var tp=typeof window>"u"||"Deno"in globalThis;function Et(){}function rp(e,t){return typeof e=="function"?e(t):e}function Fo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Xu(e,t){return Math.max(e+(t||0)-Date.now(),0)}function kr(e,t){return typeof e=="function"?e(t):e}function Rt(e,t){return typeof e=="function"?e(t):e}function bl(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==Ra(o,t.options))return!1}else if(!ps(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function _l(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(hs(t.options.mutationKey)!==hs(i))return!1}else if(!ps(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Ra(e,t){return((t==null?void 0:t.queryKeyHashFn)||hs)(e)}function hs(e){return JSON.stringify(e,(t,r)=>Uo(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function ps(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ps(e[r],t[r])):!1}var np=Object.prototype.hasOwnProperty;function $o(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=wl(e)&&wl(t);if(!n&&!(Uo(e)&&Uo(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),a=o.length,c=n?new Array(a):{};let d=0;for(let u=0;u<a;u++){const f=n?u:o[u],m=e[f],g=t[f];if(m===g){c[f]=m,(n?u<i:np.call(e,f))&&d++;continue}if(m===null||g===null||typeof m!="object"||typeof g!="object"){c[f]=g;continue}const _=$o(m,g,r+1);c[f]=_,_===m&&d++}return i===a&&d===i?e:c}function Bo(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 wl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Uo(e){if(!xl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!xl(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function xl(e){return Object.prototype.toString.call(e)==="[object Object]"}function sp(e){return new Promise(t=>{Ur.setTimeout(t,e)})}function Vo(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 $o(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 $o(e,t)}return t}function ip(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function op(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var vi=Symbol();function Zu(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===vi&&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===vi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ju(e,t){return typeof e=="function"?e(...t):!!e}function ap(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 gs=(()=>{let e=()=>tp;return{isServer(){return e()},setIsServer(t){e=t}}})();function zo(){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=ep;function cp(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=lp;const i=a=>{t?e.push(a):s(()=>{r(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{n(()=>{a.forEach(c=>{r(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||o()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{r=a},setBatchNotifyFunction:a=>{n=a},setScheduler:a=>{s=a}}}var it=cp(),Sn,Er,Cn,zu,up=(zu=class extends Ds{constructor(){super();re(this,Sn,!0);re(this,Er);re(this,Cn);Y(this,Cn,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(){O(this,Er)||this.setEventListener(O(this,Cn))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Er))==null||t.call(this),Y(this,Er,void 0))}setEventListener(t){var r;Y(this,Cn,t),(r=O(this,Er))==null||r.call(this),Y(this,Er,t(this.setOnline.bind(this)))}setOnline(t){O(this,Sn)!==t&&(Y(this,Sn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return O(this,Sn)}},Sn=new WeakMap,Er=new WeakMap,Cn=new WeakMap,zu),bi=new up;function dp(e){return Math.min(1e3*2**e,3e4)}function ed(e){return(e??"online")==="online"?bi.isOnline():!0}var qo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function td(e){let t=!1,r=0,n;const s=zo(),i=()=>s.status!=="pending",o=h=>{var y;if(!i()){const v=new qo(h);m(v),(y=e.onCancel)==null||y.call(e,v)}},a=()=>{t=!0},c=()=>{t=!1},d=()=>ja.isFocused()&&(e.networkMode==="always"||bi.isOnline())&&e.canRun(),u=()=>ed(e.networkMode)&&e.canRun(),f=h=>{i()||(n==null||n(),s.resolve(h))},m=h=>{i()||(n==null||n(),s.reject(h))},g=()=>new Promise(h=>{var y;n=v=>{(i()||d())&&h(v)},(y=e.onPause)==null||y.call(e)}).then(()=>{var h;n=void 0,i()||(h=e.onContinue)==null||h.call(e)}),_=()=>{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(f).catch(v=>{var D;if(i())return;const b=e.retry??(gs.isServer()?0:3),x=e.retryDelay??dp,w=typeof x=="function"?x(r,v):x,C=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,v);if(t||!C){m(v);return}r++,(D=e.onFail)==null||D.call(e,r,v),sp(w).then(()=>d()?void 0:g()).then(()=>{t?m(v):_()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?_():g().then(_),s)}}var Wr,qu,rd=(qu=class{constructor(){re(this,Wr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Fo(this.gcTime)&&Y(this,Wr,Ur.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(gs.isServer()?1/0:5*60*1e3))}clearGcTimeout(){O(this,Wr)!==void 0&&(Ur.clearTimeout(O(this,Wr)),Y(this,Wr,void 0))}},Wr=new WeakMap,qu);function fp(e){return{onFetch:(t,r)=>{var u,f,m,g,_;const n=t.options,s=(m=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,i=((g=t.state.data)==null?void 0:g.pages)||[],o=((_=t.state.data)==null?void 0:_.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const d=async()=>{let h=!1;const y=x=>{ap(x,()=>t.signal,()=>h=!0)},v=Zu(t.options,t.fetchOptions),b=async(x,w,C)=>{if(h)return Promise.reject(t.signal.reason);if(w==null&&x.pages.length)return Promise.resolve(x);const j=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:w,direction:C?"backward":"forward",meta:t.options.meta};return y(A),A})(),k=await v(j),{maxPages:$}=t.options,N=C?op:ip;return{pages:N(x.pages,k,$),pageParams:N(x.pageParams,w,$)}};if(s&&i.length){const x=s==="backward",w=x?hp:Sl,C={pages:i,pageParams:o},D=w(n,C);a=await b(C,D,x)}else{const x=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:Sl(n,a);if(c>0&&w==null)break;a=await b(a,w),c++}while(c<x)}return a};t.options.persister?t.fetchFn=()=>{var h,y;return(y=(h=t.options).persister)==null?void 0:y.call(h,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=d}}}function Sl(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 hp(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 On,Kr,En,$t,Qr,Ze,xs,Gr,jt,nd,dr,Hu,pp=(Hu=class extends rd{constructor(t){super();re(this,jt);re(this,On);re(this,Kr);re(this,En);re(this,$t);re(this,Qr);re(this,Ze);re(this,xs);re(this,Gr);Y(this,Gr,!1),Y(this,xs,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,Qr,t.client),Y(this,$t,O(this,Qr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(this,Kr,Ol(this.options)),this.state=t.state??O(this,Kr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return O(this,On)}get promise(){var t;return(t=O(this,Ze))==null?void 0:t.promise}setOptions(t){if(this.options={...O(this,xs),...t},t!=null&&t._type&&Y(this,On,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Ol(this.options);r.data!==void 0&&(this.setState(Cl(r.data,r.dataUpdatedAt)),Y(this,Kr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,$t).remove(this)}setData(t,r){const n=Vo(this.state.data,t,this.options);return me(this,jt,dr).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){me(this,jt,dr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=O(this,Ze))==null?void 0:n.promise;return(s=O(this,Ze))==null||s.cancel(t),r?r.then(Et).catch(Et):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return O(this,Kr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Rt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===vi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>kr(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:!Xu(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,Ze))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,Ze))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,$t).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(O(this,Ze)&&(O(this,Gr)||me(this,jt,nd).call(this)?O(this,Ze).cancel({revert:!0}):O(this,Ze).cancelRetry()),this.scheduleGc()),O(this,$t).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||me(this,jt,dr).call(this,{type:"invalidate"})}async fetch(t,r){var d,u,f,m,g,_,h,y,v,b,x;if(this.state.fetchStatus!=="idle"&&((d=O(this,Ze))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(O(this,Ze))return O(this,Ze).continueRetry(),O(this,Ze).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(C=>C.options.queryFn);w&&this.setOptions(w.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=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(Y(this,Gr,!0),n.signal)})},i=()=>{const w=Zu(this.options,r),D=(()=>{const j={client:O(this,Qr),queryKey:this.queryKey,meta:this.meta};return s(j),j})();return Y(this,Gr,!1),this.options.persister?this.options.persister(w,D,this):w(D)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:O(this,Qr),state:this.state,fetchFn:i};return s(w),w})(),c=O(this,On)==="infinite"?fp(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),Y(this,En,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&me(this,jt,dr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),Y(this,Ze,td({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof qo&&w.revert&&this.setState({...O(this,En),fetchStatus:"idle"}),n.abort()},onFail:(w,C)=>{me(this,jt,dr).call(this,{type:"failed",failureCount:w,error:C})},onPause:()=>{me(this,jt,dr).call(this,{type:"pause"})},onContinue:()=>{me(this,jt,dr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await O(this,Ze).start();if(w===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(w),(g=(m=O(this,$t).config).onSuccess)==null||g.call(m,w,this),(h=(_=O(this,$t).config).onSettled)==null||h.call(_,w,this.state.error,this),w}catch(w){if(w instanceof qo){if(w.silent)return O(this,Ze).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw me(this,jt,dr).call(this,{type:"error",error:w}),(v=(y=O(this,$t).config).onError)==null||v.call(y,w,this),(x=(b=O(this,$t).config).onSettled)==null||x.call(b,this.state.data,w,this),w}finally{this.scheduleGc()}}},On=new WeakMap,Kr=new WeakMap,En=new WeakMap,$t=new WeakMap,Qr=new WeakMap,Ze=new WeakMap,xs=new WeakMap,Gr=new WeakMap,jt=new WeakSet,nd=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},dr=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,...sd(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Cl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Y(this,En,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),it.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),O(this,$t).notify({query:this,type:"updated",action:t})})},Hu);function sd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ed(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Cl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ol(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 Ot,_e,Ss,_t,Yr,Dn,fr,Dr,Cs,In,Nn,Xr,Zr,Ir,Tn,Oe,ss,Ho,Wo,Ko,Qo,Go,Yo,Xo,id,Wu,gp=(Wu=class extends Ds{constructor(t,r){super();re(this,Oe);re(this,Ot);re(this,_e);re(this,Ss);re(this,_t);re(this,Yr);re(this,Dn);re(this,fr);re(this,Dr);re(this,Cs);re(this,In);re(this,Nn);re(this,Xr);re(this,Zr);re(this,Ir);re(this,Tn,new Set);this.options=r,Y(this,Ot,t),Y(this,Dr,null),Y(this,fr,zo()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,_e).addObserver(this),El(O(this,_e),this.options)?me(this,Oe,ss).call(this):this.updateResult(),me(this,Oe,Qo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Zo(O(this,_e),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Zo(O(this,_e),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,me(this,Oe,Go).call(this),me(this,Oe,Yo).call(this),O(this,_e).removeObserver(this)}setOptions(t){const r=this.options,n=O(this,_e);if(this.options=O(this,Ot).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Rt(this.options.enabled,O(this,_e))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");me(this,Oe,Xo).call(this),O(this,_e).setOptions(this.options),r._defaulted&&!Bo(this.options,r)&&O(this,Ot).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,_e),observer:this});const s=this.hasListeners();s&&Dl(O(this,_e),n,this.options,r)&&me(this,Oe,ss).call(this),this.updateResult(),s&&(O(this,_e)!==n||Rt(this.options.enabled,O(this,_e))!==Rt(r.enabled,O(this,_e))||kr(this.options.staleTime,O(this,_e))!==kr(r.staleTime,O(this,_e)))&&me(this,Oe,Ho).call(this);const i=me(this,Oe,Wo).call(this);s&&(O(this,_e)!==n||Rt(this.options.enabled,O(this,_e))!==Rt(r.enabled,O(this,_e))||i!==O(this,Ir))&&me(this,Oe,Ko).call(this,i)}getOptimisticResult(t){const r=O(this,Ot).getQueryCache().build(O(this,Ot),t),n=this.createResult(r,t);return yp(this,n)&&(Y(this,_t,n),Y(this,Dn,this.options),Y(this,Yr,O(this,_e).state)),n}getCurrentResult(){return O(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&&O(this,fr).status==="pending"&&O(this,fr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){O(this,Tn).add(t)}getCurrentQuery(){return O(this,_e)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=O(this,Ot).defaultQueryOptions(t),n=O(this,Ot).getQueryCache().build(O(this,Ot),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return me(this,Oe,ss).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,_t)))}createResult(t,r){var $;const n=O(this,_e),s=this.options,i=O(this,_t),o=O(this,Yr),a=O(this,Dn),d=t!==n?t.state:O(this,Ss),{state:u}=t;let f={...u},m=!1,g;if(r._optimisticResults){const N=this.hasListeners(),A=!N&&El(t,r),U=N&&Dl(t,n,r,s);(A||U)&&(f={...f,...sd(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:_,errorUpdatedAt:h,status:y}=f;g=f.data;let v=!1;if(r.placeholderData!==void 0&&g===void 0&&y==="pending"){let N;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(N=i.data,v=!0):N=typeof r.placeholderData=="function"?r.placeholderData(($=O(this,Nn))==null?void 0:$.state.data,O(this,Nn)):r.placeholderData,N!==void 0&&(y="success",g=Vo(i==null?void 0:i.data,N,r),m=!0)}if(r.select&&g!==void 0&&!v)if(i&&g===(o==null?void 0:o.data)&&r.select===O(this,Cs))g=O(this,In);else try{Y(this,Cs,r.select),g=r.select(g),g=Vo(i==null?void 0:i.data,g,r),Y(this,In,g),Y(this,Dr,null)}catch(N){Y(this,Dr,N)}O(this,Dr)&&(_=O(this,Dr),g=O(this,In),h=Date.now(),y="error");const b=f.fetchStatus==="fetching",x=y==="pending",w=y==="error",C=x&&b,D=g!==void 0,k={status:y,fetchStatus:f.fetchStatus,isPending:x,isSuccess:y==="success",isError:w,isInitialLoading:C,isLoading:C,data:g,dataUpdatedAt:f.dataUpdatedAt,error:_,errorUpdatedAt:h,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:b,isRefetching:b&&!x,isLoadingError:w&&!D,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:w&&D,isStale:ka(t,r),refetch:this.refetch,promise:O(this,fr),isEnabled:Rt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const N=k.data!==void 0,A=k.status==="error"&&!N,U=F=>{A?F.reject(k.error):N&&F.resolve(k.data)},R=()=>{const F=Y(this,fr,k.promise=zo());U(F)},B=O(this,fr);switch(B.status){case"pending":t.queryHash===n.queryHash&&U(B);break;case"fulfilled":(A||k.data!==B.value)&&R();break;case"rejected":(!A||k.error!==B.reason)&&R();break}}return k}updateResult(){const t=O(this,_t),r=this.createResult(O(this,_e),this.options);if(Y(this,Yr,O(this,_e).state),Y(this,Dn,this.options),O(this,Yr).data!==void 0&&Y(this,Nn,O(this,_e)),Bo(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&&!O(this,Tn).size)return!0;const o=new Set(i??O(this,Tn));return this.options.throwOnError&&o.add("error"),Object.keys(O(this,_t)).some(a=>{const c=a;return O(this,_t)[c]!==t[c]&&o.has(c)})};me(this,Oe,id).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&me(this,Oe,Qo).call(this)}},Ot=new WeakMap,_e=new WeakMap,Ss=new WeakMap,_t=new WeakMap,Yr=new WeakMap,Dn=new WeakMap,fr=new WeakMap,Dr=new WeakMap,Cs=new WeakMap,In=new WeakMap,Nn=new WeakMap,Xr=new WeakMap,Zr=new WeakMap,Ir=new WeakMap,Tn=new WeakMap,Oe=new WeakSet,ss=function(t){me(this,Oe,Xo).call(this);let r=O(this,_e).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Et)),r},Ho=function(){me(this,Oe,Go).call(this);const t=kr(this.options.staleTime,O(this,_e));if(gs.isServer()||O(this,_t).isStale||!Fo(t))return;const n=Xu(O(this,_t).dataUpdatedAt,t)+1;Y(this,Xr,Ur.setTimeout(()=>{O(this,_t).isStale||this.updateResult()},n))},Wo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,_e)):this.options.refetchInterval)??!1},Ko=function(t){me(this,Oe,Yo).call(this),Y(this,Ir,t),!(gs.isServer()||Rt(this.options.enabled,O(this,_e))===!1||!Fo(O(this,Ir))||O(this,Ir)===0)&&Y(this,Zr,Ur.setInterval(()=>{(this.options.refetchIntervalInBackground||ja.isFocused())&&me(this,Oe,ss).call(this)},O(this,Ir)))},Qo=function(){me(this,Oe,Ho).call(this),me(this,Oe,Ko).call(this,me(this,Oe,Wo).call(this))},Go=function(){O(this,Xr)!==void 0&&(Ur.clearTimeout(O(this,Xr)),Y(this,Xr,void 0))},Yo=function(){O(this,Zr)!==void 0&&(Ur.clearInterval(O(this,Zr)),Y(this,Zr,void 0))},Xo=function(){const t=O(this,Ot).getQueryCache().build(O(this,Ot),this.options);if(t===O(this,_e))return;const r=O(this,_e);Y(this,_e,t),Y(this,Ss,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},id=function(t){it.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(O(this,_t))}),O(this,Ot).getQueryCache().notify({query:O(this,_e),type:"observerResultsUpdated"})})},Wu);function mp(e,t){return Rt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Rt(t.retryOnMount,e)===!1)}function El(e,t){return mp(e,t)||e.state.data!==void 0&&Zo(e,t,t.refetchOnMount)}function Zo(e,t,r){if(Rt(t.enabled,e)!==!1&&kr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&ka(e,t)}return!1}function Dl(e,t,r,n){return(e!==t||Rt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&ka(e,r)}function ka(e,t){return Rt(t.enabled,e)!==!1&&e.isStaleByTime(kr(t.staleTime,e))}function yp(e,t){return!Bo(e.getCurrentResult(),t)}var Os,sr,pt,Jr,ir,_r,Ku,vp=(Ku=class extends rd{constructor(t){super();re(this,ir);re(this,Os);re(this,sr);re(this,pt);re(this,Jr);Y(this,Os,t.client),this.mutationId=t.mutationId,Y(this,pt,t.mutationCache),Y(this,sr,[]),this.state=t.state||bp(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,sr).includes(t)||(O(this,sr).push(t),this.clearGcTimeout(),O(this,pt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Y(this,sr,O(this,sr).filter(r=>r!==t)),this.scheduleGc(),O(this,pt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,sr).length||(this.state.status==="pending"?this.scheduleGc():O(this,pt).remove(this))}continue(){var t;return((t=O(this,Jr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,d,u,f,m,g,_,h,y,v,b,x,w,C,D,j;const r=()=>{me(this,ir,_r).call(this,{type:"continue"})},n={client:O(this,Os),meta:this.options.meta,mutationKey:this.options.mutationKey};Y(this,Jr,td({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(k,$)=>{me(this,ir,_r).call(this,{type:"failed",failureCount:k,error:$})},onPause:()=>{me(this,ir,_r).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,pt).canRun(this)}));const s=this.state.status==="pending",i=!O(this,Jr).canStart();try{if(s)r();else{me(this,ir,_r).call(this,{type:"pending",variables:t,isPaused:i}),O(this,pt).config.onMutate&&await O(this,pt).config.onMutate(t,this,n);const $=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));$!==this.state.context&&me(this,ir,_r).call(this,{type:"pending",context:$,variables:t,isPaused:i})}const k=await O(this,Jr).start();return await((d=(c=O(this,pt).config).onSuccess)==null?void 0:d.call(c,k,t,this.state.context,this,n)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,k,t,this.state.context,n)),await((g=(m=O(this,pt).config).onSettled)==null?void 0:g.call(m,k,null,this.state.variables,this.state.context,this,n)),await((h=(_=this.options).onSettled)==null?void 0:h.call(_,k,null,t,this.state.context,n)),me(this,ir,_r).call(this,{type:"success",data:k}),k}catch(k){try{await((v=(y=O(this,pt).config).onError)==null?void 0:v.call(y,k,t,this.state.context,this,n))}catch($){Promise.reject($)}try{await((x=(b=this.options).onError)==null?void 0:x.call(b,k,t,this.state.context,n))}catch($){Promise.reject($)}try{await((C=(w=O(this,pt).config).onSettled)==null?void 0:C.call(w,void 0,k,this.state.variables,this.state.context,this,n))}catch($){Promise.reject($)}try{await((j=(D=this.options).onSettled)==null?void 0:j.call(D,void 0,k,t,this.state.context,n))}catch($){Promise.reject($)}throw me(this,ir,_r).call(this,{type:"error",error:k}),k}finally{O(this,pt).runNext(this)}}},Os=new WeakMap,sr=new WeakMap,pt=new WeakMap,Jr=new WeakMap,ir=new WeakSet,_r=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),it.batch(()=>{O(this,sr).forEach(n=>{n.onMutationUpdate(t)}),O(this,pt).notify({mutation:this,type:"updated",action:t})})},Ku);function bp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var hr,Ht,Es,Qu,_p=(Qu=class extends Ds{constructor(t={}){super();re(this,hr);re(this,Ht);re(this,Es);this.config=t,Y(this,hr,new Set),Y(this,Ht,new Map),Y(this,Es,0)}build(t,r,n){const s=new vp({client:t,mutationCache:this,mutationId:++zs(this,Es)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){O(this,hr).add(t);const r=qs(t);if(typeof r=="string"){const n=O(this,Ht).get(r);n?n.push(t):O(this,Ht).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,hr).delete(t)){const r=qs(t);if(typeof r=="string"){const n=O(this,Ht).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&O(this,Ht).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=qs(t);if(typeof r=="string"){const n=O(this,Ht).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=qs(t);if(typeof r=="string"){const s=(n=O(this,Ht).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(){it.batch(()=>{O(this,hr).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,hr).clear(),O(this,Ht).clear()})}getAll(){return Array.from(O(this,hr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>_l(r,n))}findAll(t={}){return this.getAll().filter(r=>_l(t,r))}notify(t){it.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return it.batch(()=>Promise.all(t.map(r=>r.continue().catch(Et))))}},hr=new WeakMap,Ht=new WeakMap,Es=new WeakMap,Qu);function qs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var or,Gu,wp=(Gu=class extends Ds{constructor(t={}){super();re(this,or);this.config=t,Y(this,or,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??Ra(s,r);let o=this.get(i);return o||(o=new pp({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){O(this,or).has(t.queryHash)||(O(this,or).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=O(this,or).get(t.queryHash);r&&(t.destroy(),r===t&&O(this,or).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){it.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,or).get(t)}getAll(){return[...O(this,or).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>bl(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>bl(t,n)):r}notify(t){it.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){it.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){it.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},or=new WeakMap,Gu),Ve,Nr,Tr,jn,Rn,jr,kn,An,Yu,xp=(Yu=class{constructor(e={}){re(this,Ve);re(this,Nr);re(this,Tr);re(this,jn);re(this,Rn);re(this,jr);re(this,kn);re(this,An);Y(this,Ve,e.queryCache||new wp),Y(this,Nr,e.mutationCache||new _p),Y(this,Tr,e.defaultOptions||{}),Y(this,jn,new Map),Y(this,Rn,new Map),Y(this,jr,0)}mount(){zs(this,jr)._++,O(this,jr)===1&&(Y(this,kn,ja.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ve).onFocus())})),Y(this,An,bi.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ve).onOnline())})))}unmount(){var e,t;zs(this,jr)._--,O(this,jr)===0&&((e=O(this,kn))==null||e.call(this),Y(this,kn,void 0),(t=O(this,An))==null||t.call(this),Y(this,An,void 0))}isFetching(e){return O(this,Ve).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,Nr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=O(this,Ve).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=O(this,Ve).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(kr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return O(this,Ve).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=O(this,Ve).get(n.queryHash),i=s==null?void 0:s.state.data,o=rp(t,i);if(o!==void 0)return O(this,Ve).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return it.batch(()=>O(this,Ve).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=O(this,Ve).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=O(this,Ve);it.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=O(this,Ve);return it.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=it.batch(()=>O(this,Ve).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Et).catch(Et)}invalidateQueries(e,t={}){return it.batch(()=>(O(this,Ve).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=it.batch(()=>O(this,Ve).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(Et)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Et)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=O(this,Ve).build(this,t);return r.isStaleByTime(kr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Et).catch(Et)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Et).catch(Et)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return bi.isOnline()?O(this,Nr).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Ve)}getMutationCache(){return O(this,Nr)}getDefaultOptions(){return O(this,Tr)}setDefaultOptions(e){Y(this,Tr,e)}setQueryDefaults(e,t){O(this,jn).set(hs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,jn).values()],r={};return t.forEach(n=>{ps(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){O(this,Rn).set(hs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,Rn).values()],r={};return t.forEach(n=>{ps(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,Tr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ra(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===vi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,Tr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Ve).clear(),O(this,Nr).clear()}},Ve=new WeakMap,Nr=new WeakMap,Tr=new WeakMap,jn=new WeakMap,Rn=new WeakMap,jr=new WeakMap,kn=new WeakMap,An=new WeakMap,Yu),od=Ce.createContext(void 0),Sp=e=>{const t=Ce.useContext(od);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Cp=({client:e,children:t})=>(Ce.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(od.Provider,{value:e,children:t})),ad=Ce.createContext(!1),Op=()=>Ce.useContext(ad);ad.Provider;function Ep(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Dp=Ce.createContext(Ep()),Ip=()=>Ce.useContext(Dp),Np=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Ju(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Tp=e=>{Ce.useEffect(()=>{e.clearReset()},[e])},jp=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Ju(r,[e.error,n])),Rp=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))}},kp=(e,t)=>e.isLoading&&e.isFetching&&!t,Ap=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Il=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Pp(e,t,r){var g,_,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=Op(),s=Ip(),i=Sp(),o=i.defaultQueryOptions(e);(_=(g=i.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||_.call(g,o);const a=i.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.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 c=e.subscribed!==!1;o._optimisticResults=n?"isRestoring":c?"optimistic":void 0,Rp(o),Np(o,s,a),Tp(s);const d=!i.getQueryCache().get(o.queryHash),[u]=Ce.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),m=!n&&c;if(Ce.useSyncExternalStore(Ce.useCallback(v=>{const b=m?u.subscribe(it.batchCalls(v)):Et;return u.updateResult(),b},[u,m]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Ce.useEffect(()=>{u.setOptions(o)},[o,u]),Ap(o,f))throw Il(o,u,s);if(jp({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((y=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,o,f),o.experimental_prefetchInRender&&!gs.isServer()&&kp(f,n)){const v=d?Il(o,u,s):a==null?void 0:a.promise;v==null||v.catch(Et).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function Jo(e,t){return Pp(e,gp)}let Mp={data:""},Lp=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||Mp},Fp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,$p=/\/\*[^]*?\*\/| +/g,Nl=/\n+/g,Cr=(e,t)=>{let r="",n="",s="";for(let i in e){let o=e[i];i[0]=="@"?i[1]=="i"?r=i+" "+o+";":n+=i[1]=="f"?Cr(o,i):i+"{"+Cr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=Cr(o,t?t.replace(/([^,])+/g,a=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,a):a?a+" "+c:c)):i):o!=null&&(i=i[1]=="-"?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=Cr.p?Cr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},yr={},ld=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+ld(e[r]);return t}return e},Bp=(e,t,r,n,s)=>{let i=ld(e),o=yr[i]||(yr[i]=(c=>{let d=0,u=11;for(;d<c.length;)u=101*u+c.charCodeAt(d++)>>>0;return"go"+u})(i));if(!yr[o]){let c=i!==e?e:(d=>{let u,f,m=[{}];for(;u=Fp.exec(d.replace($p,""));)u[4]?m.shift():u[3]?(f=u[3].replace(Nl," ").trim(),m.unshift(m[0][f]=m[0][f]||{})):m[0][u[1]]=u[2].replace(Nl," ").trim();return m[0]})(e);yr[o]=Cr(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&yr.g;return r&&(yr.g=yr[o]),((c,d,u,f)=>{f?d.data=d.data.replace(f,c):d.data.indexOf(c)===-1&&(d.data=u?c+d.data:d.data+c)})(yr[o],t,n,a),o},Up=(e,t,r)=>e.reduce((n,s,i)=>{let o=t[i];if(o&&o.call){let a=o(r),c=a&&a.props&&a.props.className||/^go/.test(a)&&a;o=c?"."+c:a&&typeof a=="object"?a.props?"":Cr(a,""):a===!1?"":a}return n+s+(o??"")},"");function Pi(e){let t=this||{},r=e.call?e(t.p):e;return Bp(r.unshift?r.raw?Up(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,Lp(t.target),t.g,t.o,t.k)}let cd,ea,ta;Pi.bind({g:1});let pr=Pi.bind({k:1});function Vp(e,t,r,n){Cr.p=t,cd=e,ea=r,ta=n}function Pr(e,t){let r=this||{};return function(){let n=arguments;function s(i,o){let a=Object.assign({},i),c=a.className||s.className;r.p=Object.assign({theme:ea&&ea()},a),r.o=/go\d/.test(c),a.className=Pi.apply(r,n)+(c?" "+c:"");let d=e;return e[0]&&(d=a.as||e,delete a.as),ta&&d[0]&&ta(a),cd(d,a)}return s}}var zp=e=>typeof e=="function",_i=(e,t)=>zp(e)?e(t):e,qp=(()=>{let e=0;return()=>(++e).toString()})(),ud=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Hp=20,Aa="default",dd=(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(o=>o.id===t.toast.id?{...o,...t.toast}:o)};case 2:let{toast:n}=t;return dd(e,{type:e.toasts.find(o=>o.id===n.id)?1:0,toast:n});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,dismissed:!0,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.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(o=>({...o,pauseDuration:o.pauseDuration+i}))}}},ri=[],fd={toasts:[],pausedAt:void 0,settings:{toastLimit:Hp}},ar={},hd=(e,t=Aa)=>{ar[t]=dd(ar[t]||fd,e),ri.forEach(([r,n])=>{r===t&&n(ar[t])})},pd=e=>Object.keys(ar).forEach(t=>hd(e,t)),Wp=e=>Object.keys(ar).find(t=>ar[t].toasts.some(r=>r.id===e)),Mi=(e=Aa)=>t=>{hd(t,e)},Kp={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Qp=(e={},t=Aa)=>{let[r,n]=p.useState(ar[t]||fd),s=p.useRef(ar[t]);p.useEffect(()=>(s.current!==ar[t]&&n(ar[t]),ri.push([t,n]),()=>{let o=ri.findIndex(([a])=>a===t);o>-1&&ri.splice(o,1)}),[t]);let i=r.toasts.map(o=>{var a,c,d;return{...e,...e[o.type],...o,removeDelay:o.removeDelay||((a=e[o.type])==null?void 0:a.removeDelay)||(e==null?void 0:e.removeDelay),duration:o.duration||((c=e[o.type])==null?void 0:c.duration)||(e==null?void 0:e.duration)||Kp[o.type],style:{...e.style,...(d=e[o.type])==null?void 0:d.style,...o.style}}});return{...r,toasts:i}},Gp=(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)||qp()}),Is=e=>(t,r)=>{let n=Gp(t,e,r);return Mi(n.toasterId||Wp(n.id))({type:2,toast:n}),n.id},Ge=(e,t)=>Is("blank")(e,t);Ge.error=Is("error");Ge.success=Is("success");Ge.loading=Is("loading");Ge.custom=Is("custom");Ge.dismiss=(e,t)=>{let r={type:3,toastId:e};t?Mi(t)(r):pd(r)};Ge.dismissAll=e=>Ge.dismiss(void 0,e);Ge.remove=(e,t)=>{let r={type:4,toastId:e};t?Mi(t)(r):pd(r)};Ge.removeAll=e=>Ge.remove(void 0,e);Ge.promise=(e,t,r)=>{let n=Ge.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?_i(t.success,s):void 0;return i?Ge.success(i,{id:n,...r,...r==null?void 0:r.success}):Ge.dismiss(n),s}).catch(s=>{let i=t.error?_i(t.error,s):void 0;i?Ge.error(i,{id:n,...r,...r==null?void 0:r.error}):Ge.dismiss(n)}),e};var Yp=1e3,Xp=(e,t="default")=>{let{toasts:r,pausedAt:n}=Qp(e,t),s=p.useRef(new Map).current,i=p.useCallback((f,m=Yp)=>{if(s.has(f))return;let g=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},m);s.set(f,g)},[]);p.useEffect(()=>{if(n)return;let f=Date.now(),m=r.map(g=>{if(g.duration===1/0)return;let _=(g.duration||0)+g.pauseDuration-(f-g.createdAt);if(_<0){g.visible&&Ge.dismiss(g.id);return}return setTimeout(()=>Ge.dismiss(g.id,t),_)});return()=>{m.forEach(g=>g&&clearTimeout(g))}},[r,n,t]);let o=p.useCallback(Mi(t),[t]),a=p.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=p.useCallback((f,m)=>{o({type:1,toast:{id:f,height:m}})},[o]),d=p.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),u=p.useCallback((f,m)=>{let{reverseOrder:g=!1,gutter:_=8,defaultPosition:h}=m||{},y=r.filter(x=>(x.position||h)===(f.position||h)&&x.height),v=y.findIndex(x=>x.id===f.id),b=y.filter((x,w)=>w<v&&x.visible).length;return y.filter(x=>x.visible).slice(...g?[b+1]:[0,b]).reduce((x,w)=>x+(w.height||0)+_,0)},[r]);return p.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let m=s.get(f.id);m&&(clearTimeout(m),s.delete(f.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:c,startPause:a,endPause:d,calculateOffset:u}}},Zp=pr`
1
+ "use strict";var bl=e=>{throw TypeError(e)};var oo=(e,t,r)=>t.has(e)||bl("Cannot "+r);var O=(e,t,r)=>(oo(e,t,"read from private field"),r?r.call(e):t.get(e)),ne=(e,t,r)=>t.has(e)?bl("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),X=(e,t,r,n)=>(oo(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),ye=(e,t,r)=>(oo(e,t,"access private method"),r);var zs=(e,t,r,n)=>({set _(s){X(e,t,s,r)},get _(){return O(e,t,n)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),Rr=require("react-dom"),l=require("react/jsx-runtime");function Yh(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 Ce=Yh(p);var Ds=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(){}},qr,Or,wn,Uu,Xh=(Uu=class extends Ds{constructor(){super();ne(this,qr);ne(this,Or);ne(this,wn);X(this,wn,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){O(this,Or)||this.setEventListener(O(this,wn))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Or))==null||t.call(this),X(this,Or,void 0))}setEventListener(t){var r;X(this,wn,t),(r=O(this,Or))==null||r.call(this),X(this,Or,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){O(this,qr)!==t&&(X(this,qr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof O(this,qr)=="boolean"?O(this,qr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},qr=new WeakMap,Or=new WeakMap,wn=new WeakMap,Uu),Ra=new Xh,Zh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},nr,Hr,Vu,Jh=(Vu=class{constructor(){ne(this,nr,Zh);ne(this,Hr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&O(this,Hr)&&e!==O(this,nr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:O(this,nr),provider:e}),X(this,nr,e),process.env.NODE_ENV!=="production"&&X(this,Hr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&X(this,Hr,!0),O(this,nr).setTimeout(e,t)}clearTimeout(e){O(this,nr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&X(this,Hr,!0),O(this,nr).setInterval(e,t)}clearInterval(e){O(this,nr).clearInterval(e)}},nr=new WeakMap,Hr=new WeakMap,Vu),Ur=new Jh;function ep(e){setTimeout(e,0)}var tp=typeof window>"u"||"Deno"in globalThis;function Et(){}function rp(e,t){return typeof e=="function"?e(t):e}function $o(e){return typeof e=="number"&&e>=0&&e!==1/0}function Xu(e,t){return Math.max(e+(t||0)-Date.now(),0)}function kr(e,t){return typeof e=="function"?e(t):e}function Rt(e,t){return typeof e=="function"?e(t):e}function _l(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==ka(o,t.options))return!1}else if(!ps(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function wl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(hs(t.options.mutationKey)!==hs(i))return!1}else if(!ps(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function ka(e,t){return((t==null?void 0:t.queryKeyHashFn)||hs)(e)}function hs(e){return JSON.stringify(e,(t,r)=>Vo(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function ps(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ps(e[r],t[r])):!1}var np=Object.prototype.hasOwnProperty;function Bo(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=xl(e)&&xl(t);if(!n&&!(Vo(e)&&Vo(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),a=o.length,c=n?new Array(a):{};let d=0;for(let u=0;u<a;u++){const f=n?u:o[u],m=e[f],g=t[f];if(m===g){c[f]=m,(n?u<i:np.call(e,f))&&d++;continue}if(m===null||g===null||typeof m!="object"||typeof g!="object"){c[f]=g;continue}const _=Bo(m,g,r+1);c[f]=_,_===m&&d++}return i===a&&d===i?e:c}function Uo(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 xl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vo(e){if(!Sl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Sl(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Sl(e){return Object.prototype.toString.call(e)==="[object Object]"}function sp(e){return new Promise(t=>{Ur.setTimeout(t,e)})}function zo(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 Bo(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 Bo(e,t)}return t}function ip(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function op(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var bi=Symbol();function Zu(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===bi&&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===bi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ju(e,t){return typeof e=="function"?e(...t):!!e}function ap(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 gs=(()=>{let e=()=>tp;return{isServer(){return e()},setIsServer(t){e=t}}})();function qo(){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=ep;function cp(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=lp;const i=a=>{t?e.push(a):s(()=>{r(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{n(()=>{a.forEach(c=>{r(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||o()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{r=a},setBatchNotifyFunction:a=>{n=a},setScheduler:a=>{s=a}}}var it=cp(),xn,Er,Sn,zu,up=(zu=class extends Ds{constructor(){super();ne(this,xn,!0);ne(this,Er);ne(this,Sn);X(this,Sn,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(){O(this,Er)||this.setEventListener(O(this,Sn))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Er))==null||t.call(this),X(this,Er,void 0))}setEventListener(t){var r;X(this,Sn,t),(r=O(this,Er))==null||r.call(this),X(this,Er,t(this.setOnline.bind(this)))}setOnline(t){O(this,xn)!==t&&(X(this,xn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return O(this,xn)}},xn=new WeakMap,Er=new WeakMap,Sn=new WeakMap,zu),_i=new up;function dp(e){return Math.min(1e3*2**e,3e4)}function ed(e){return(e??"online")==="online"?_i.isOnline():!0}var Ho=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function td(e){let t=!1,r=0,n;const s=qo(),i=()=>s.status!=="pending",o=h=>{var y;if(!i()){const v=new Ho(h);m(v),(y=e.onCancel)==null||y.call(e,v)}},a=()=>{t=!0},c=()=>{t=!1},d=()=>Ra.isFocused()&&(e.networkMode==="always"||_i.isOnline())&&e.canRun(),u=()=>ed(e.networkMode)&&e.canRun(),f=h=>{i()||(n==null||n(),s.resolve(h))},m=h=>{i()||(n==null||n(),s.reject(h))},g=()=>new Promise(h=>{var y;n=v=>{(i()||d())&&h(v)},(y=e.onPause)==null||y.call(e)}).then(()=>{var h;n=void 0,i()||(h=e.onContinue)==null||h.call(e)}),_=()=>{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(f).catch(v=>{var D;if(i())return;const b=e.retry??(gs.isServer()?0:3),x=e.retryDelay??dp,w=typeof x=="function"?x(r,v):x,C=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,v);if(t||!C){m(v);return}r++,(D=e.onFail)==null||D.call(e,r,v),sp(w).then(()=>d()?void 0:g()).then(()=>{t?m(v):_()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?_():g().then(_),s)}}var Wr,qu,rd=(qu=class{constructor(){ne(this,Wr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),$o(this.gcTime)&&X(this,Wr,Ur.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(gs.isServer()?1/0:5*60*1e3))}clearGcTimeout(){O(this,Wr)!==void 0&&(Ur.clearTimeout(O(this,Wr)),X(this,Wr,void 0))}},Wr=new WeakMap,qu);function fp(e){return{onFetch:(t,r)=>{var u,f,m,g,_;const n=t.options,s=(m=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,i=((g=t.state.data)==null?void 0:g.pages)||[],o=((_=t.state.data)==null?void 0:_.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const d=async()=>{let h=!1;const y=x=>{ap(x,()=>t.signal,()=>h=!0)},v=Zu(t.options,t.fetchOptions),b=async(x,w,C)=>{if(h)return Promise.reject(t.signal.reason);if(w==null&&x.pages.length)return Promise.resolve(x);const j=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:w,direction:C?"backward":"forward",meta:t.options.meta};return y(A),A})(),k=await v(j),{maxPages:$}=t.options,N=C?op:ip;return{pages:N(x.pages,k,$),pageParams:N(x.pageParams,w,$)}};if(s&&i.length){const x=s==="backward",w=x?hp:Cl,C={pages:i,pageParams:o},D=w(n,C);a=await b(C,D,x)}else{const x=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:Cl(n,a);if(c>0&&w==null)break;a=await b(a,w),c++}while(c<x)}return a};t.options.persister?t.fetchFn=()=>{var h,y;return(y=(h=t.options).persister)==null?void 0:y.call(h,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=d}}}function Cl(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 hp(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 Cn,Kr,On,$t,Qr,Ze,xs,Gr,jt,nd,dr,Hu,pp=(Hu=class extends rd{constructor(t){super();ne(this,jt);ne(this,Cn);ne(this,Kr);ne(this,On);ne(this,$t);ne(this,Qr);ne(this,Ze);ne(this,xs);ne(this,Gr);X(this,Gr,!1),X(this,xs,t.defaultOptions),this.setOptions(t.options),this.observers=[],X(this,Qr,t.client),X(this,$t,O(this,Qr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,X(this,Kr,El(this.options)),this.state=t.state??O(this,Kr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return O(this,Cn)}get promise(){var t;return(t=O(this,Ze))==null?void 0:t.promise}setOptions(t){if(this.options={...O(this,xs),...t},t!=null&&t._type&&X(this,Cn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=El(this.options);r.data!==void 0&&(this.setState(Ol(r.data,r.dataUpdatedAt)),X(this,Kr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,$t).remove(this)}setData(t,r){const n=zo(this.state.data,t,this.options);return ye(this,jt,dr).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){ye(this,jt,dr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=O(this,Ze))==null?void 0:n.promise;return(s=O(this,Ze))==null||s.cancel(t),r?r.then(Et).catch(Et):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return O(this,Kr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Rt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===bi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>kr(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:!Xu(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,Ze))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,Ze))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,$t).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(O(this,Ze)&&(O(this,Gr)||ye(this,jt,nd).call(this)?O(this,Ze).cancel({revert:!0}):O(this,Ze).cancelRetry()),this.scheduleGc()),O(this,$t).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ye(this,jt,dr).call(this,{type:"invalidate"})}async fetch(t,r){var d,u,f,m,g,_,h,y,v,b,x;if(this.state.fetchStatus!=="idle"&&((d=O(this,Ze))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(O(this,Ze))return O(this,Ze).continueRetry(),O(this,Ze).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(C=>C.options.queryFn);w&&this.setOptions(w.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=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(X(this,Gr,!0),n.signal)})},i=()=>{const w=Zu(this.options,r),D=(()=>{const j={client:O(this,Qr),queryKey:this.queryKey,meta:this.meta};return s(j),j})();return X(this,Gr,!1),this.options.persister?this.options.persister(w,D,this):w(D)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:O(this,Qr),state:this.state,fetchFn:i};return s(w),w})(),c=O(this,Cn)==="infinite"?fp(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),X(this,On,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&ye(this,jt,dr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),X(this,Ze,td({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof Ho&&w.revert&&this.setState({...O(this,On),fetchStatus:"idle"}),n.abort()},onFail:(w,C)=>{ye(this,jt,dr).call(this,{type:"failed",failureCount:w,error:C})},onPause:()=>{ye(this,jt,dr).call(this,{type:"pause"})},onContinue:()=>{ye(this,jt,dr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await O(this,Ze).start();if(w===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(w),(g=(m=O(this,$t).config).onSuccess)==null||g.call(m,w,this),(h=(_=O(this,$t).config).onSettled)==null||h.call(_,w,this.state.error,this),w}catch(w){if(w instanceof Ho){if(w.silent)return O(this,Ze).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw ye(this,jt,dr).call(this,{type:"error",error:w}),(v=(y=O(this,$t).config).onError)==null||v.call(y,w,this),(x=(b=O(this,$t).config).onSettled)==null||x.call(b,this.state.data,w,this),w}finally{this.scheduleGc()}}},Cn=new WeakMap,Kr=new WeakMap,On=new WeakMap,$t=new WeakMap,Qr=new WeakMap,Ze=new WeakMap,xs=new WeakMap,Gr=new WeakMap,jt=new WeakSet,nd=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},dr=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,...sd(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Ol(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return X(this,On,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),it.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),O(this,$t).notify({query:this,type:"updated",action:t})})},Hu);function sd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ed(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Ol(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function El(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 Ot,_e,Ss,_t,Yr,En,fr,Dr,Cs,Dn,In,Xr,Zr,Ir,Nn,Oe,ss,Wo,Ko,Qo,Go,Yo,Xo,Zo,id,Wu,gp=(Wu=class extends Ds{constructor(t,r){super();ne(this,Oe);ne(this,Ot);ne(this,_e);ne(this,Ss);ne(this,_t);ne(this,Yr);ne(this,En);ne(this,fr);ne(this,Dr);ne(this,Cs);ne(this,Dn);ne(this,In);ne(this,Xr);ne(this,Zr);ne(this,Ir);ne(this,Nn,new Set);this.options=r,X(this,Ot,t),X(this,Dr,null),X(this,fr,qo()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,_e).addObserver(this),Dl(O(this,_e),this.options)?ye(this,Oe,ss).call(this):this.updateResult(),ye(this,Oe,Go).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Jo(O(this,_e),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Jo(O(this,_e),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ye(this,Oe,Yo).call(this),ye(this,Oe,Xo).call(this),O(this,_e).removeObserver(this)}setOptions(t){const r=this.options,n=O(this,_e);if(this.options=O(this,Ot).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Rt(this.options.enabled,O(this,_e))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ye(this,Oe,Zo).call(this),O(this,_e).setOptions(this.options),r._defaulted&&!Uo(this.options,r)&&O(this,Ot).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,_e),observer:this});const s=this.hasListeners();s&&Il(O(this,_e),n,this.options,r)&&ye(this,Oe,ss).call(this),this.updateResult(),s&&(O(this,_e)!==n||Rt(this.options.enabled,O(this,_e))!==Rt(r.enabled,O(this,_e))||kr(this.options.staleTime,O(this,_e))!==kr(r.staleTime,O(this,_e)))&&ye(this,Oe,Wo).call(this);const i=ye(this,Oe,Ko).call(this);s&&(O(this,_e)!==n||Rt(this.options.enabled,O(this,_e))!==Rt(r.enabled,O(this,_e))||i!==O(this,Ir))&&ye(this,Oe,Qo).call(this,i)}getOptimisticResult(t){const r=O(this,Ot).getQueryCache().build(O(this,Ot),t),n=this.createResult(r,t);return yp(this,n)&&(X(this,_t,n),X(this,En,this.options),X(this,Yr,O(this,_e).state)),n}getCurrentResult(){return O(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&&O(this,fr).status==="pending"&&O(this,fr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){O(this,Nn).add(t)}getCurrentQuery(){return O(this,_e)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=O(this,Ot).defaultQueryOptions(t),n=O(this,Ot).getQueryCache().build(O(this,Ot),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return ye(this,Oe,ss).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,_t)))}createResult(t,r){var $;const n=O(this,_e),s=this.options,i=O(this,_t),o=O(this,Yr),a=O(this,En),d=t!==n?t.state:O(this,Ss),{state:u}=t;let f={...u},m=!1,g;if(r._optimisticResults){const N=this.hasListeners(),A=!N&&Dl(t,r),U=N&&Il(t,n,r,s);(A||U)&&(f={...f,...sd(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:_,errorUpdatedAt:h,status:y}=f;g=f.data;let v=!1;if(r.placeholderData!==void 0&&g===void 0&&y==="pending"){let N;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(N=i.data,v=!0):N=typeof r.placeholderData=="function"?r.placeholderData(($=O(this,In))==null?void 0:$.state.data,O(this,In)):r.placeholderData,N!==void 0&&(y="success",g=zo(i==null?void 0:i.data,N,r),m=!0)}if(r.select&&g!==void 0&&!v)if(i&&g===(o==null?void 0:o.data)&&r.select===O(this,Cs))g=O(this,Dn);else try{X(this,Cs,r.select),g=r.select(g),g=zo(i==null?void 0:i.data,g,r),X(this,Dn,g),X(this,Dr,null)}catch(N){X(this,Dr,N)}O(this,Dr)&&(_=O(this,Dr),g=O(this,Dn),h=Date.now(),y="error");const b=f.fetchStatus==="fetching",x=y==="pending",w=y==="error",C=x&&b,D=g!==void 0,k={status:y,fetchStatus:f.fetchStatus,isPending:x,isSuccess:y==="success",isError:w,isInitialLoading:C,isLoading:C,data:g,dataUpdatedAt:f.dataUpdatedAt,error:_,errorUpdatedAt:h,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:b,isRefetching:b&&!x,isLoadingError:w&&!D,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:w&&D,isStale:Aa(t,r),refetch:this.refetch,promise:O(this,fr),isEnabled:Rt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const N=k.data!==void 0,A=k.status==="error"&&!N,U=F=>{A?F.reject(k.error):N&&F.resolve(k.data)},R=()=>{const F=X(this,fr,k.promise=qo());U(F)},B=O(this,fr);switch(B.status){case"pending":t.queryHash===n.queryHash&&U(B);break;case"fulfilled":(A||k.data!==B.value)&&R();break;case"rejected":(!A||k.error!==B.reason)&&R();break}}return k}updateResult(){const t=O(this,_t),r=this.createResult(O(this,_e),this.options);if(X(this,Yr,O(this,_e).state),X(this,En,this.options),O(this,Yr).data!==void 0&&X(this,In,O(this,_e)),Uo(r,t))return;X(this,_t,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!O(this,Nn).size)return!0;const o=new Set(i??O(this,Nn));return this.options.throwOnError&&o.add("error"),Object.keys(O(this,_t)).some(a=>{const c=a;return O(this,_t)[c]!==t[c]&&o.has(c)})};ye(this,Oe,id).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ye(this,Oe,Go).call(this)}},Ot=new WeakMap,_e=new WeakMap,Ss=new WeakMap,_t=new WeakMap,Yr=new WeakMap,En=new WeakMap,fr=new WeakMap,Dr=new WeakMap,Cs=new WeakMap,Dn=new WeakMap,In=new WeakMap,Xr=new WeakMap,Zr=new WeakMap,Ir=new WeakMap,Nn=new WeakMap,Oe=new WeakSet,ss=function(t){ye(this,Oe,Zo).call(this);let r=O(this,_e).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Et)),r},Wo=function(){ye(this,Oe,Yo).call(this);const t=kr(this.options.staleTime,O(this,_e));if(gs.isServer()||O(this,_t).isStale||!$o(t))return;const n=Xu(O(this,_t).dataUpdatedAt,t)+1;X(this,Xr,Ur.setTimeout(()=>{O(this,_t).isStale||this.updateResult()},n))},Ko=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,_e)):this.options.refetchInterval)??!1},Qo=function(t){ye(this,Oe,Xo).call(this),X(this,Ir,t),!(gs.isServer()||Rt(this.options.enabled,O(this,_e))===!1||!$o(O(this,Ir))||O(this,Ir)===0)&&X(this,Zr,Ur.setInterval(()=>{(this.options.refetchIntervalInBackground||Ra.isFocused())&&ye(this,Oe,ss).call(this)},O(this,Ir)))},Go=function(){ye(this,Oe,Wo).call(this),ye(this,Oe,Qo).call(this,ye(this,Oe,Ko).call(this))},Yo=function(){O(this,Xr)!==void 0&&(Ur.clearTimeout(O(this,Xr)),X(this,Xr,void 0))},Xo=function(){O(this,Zr)!==void 0&&(Ur.clearInterval(O(this,Zr)),X(this,Zr,void 0))},Zo=function(){const t=O(this,Ot).getQueryCache().build(O(this,Ot),this.options);if(t===O(this,_e))return;const r=O(this,_e);X(this,_e,t),X(this,Ss,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},id=function(t){it.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(O(this,_t))}),O(this,Ot).getQueryCache().notify({query:O(this,_e),type:"observerResultsUpdated"})})},Wu);function mp(e,t){return Rt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Rt(t.retryOnMount,e)===!1)}function Dl(e,t){return mp(e,t)||e.state.data!==void 0&&Jo(e,t,t.refetchOnMount)}function Jo(e,t,r){if(Rt(t.enabled,e)!==!1&&kr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Aa(e,t)}return!1}function Il(e,t,r,n){return(e!==t||Rt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Aa(e,r)}function Aa(e,t){return Rt(t.enabled,e)!==!1&&e.isStaleByTime(kr(t.staleTime,e))}function yp(e,t){return!Uo(e.getCurrentResult(),t)}var Os,sr,pt,Jr,ir,_r,Ku,vp=(Ku=class extends rd{constructor(t){super();ne(this,ir);ne(this,Os);ne(this,sr);ne(this,pt);ne(this,Jr);X(this,Os,t.client),this.mutationId=t.mutationId,X(this,pt,t.mutationCache),X(this,sr,[]),this.state=t.state||bp(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,sr).includes(t)||(O(this,sr).push(t),this.clearGcTimeout(),O(this,pt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){X(this,sr,O(this,sr).filter(r=>r!==t)),this.scheduleGc(),O(this,pt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,sr).length||(this.state.status==="pending"?this.scheduleGc():O(this,pt).remove(this))}continue(){var t;return((t=O(this,Jr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,d,u,f,m,g,_,h,y,v,b,x,w,C,D,j;const r=()=>{ye(this,ir,_r).call(this,{type:"continue"})},n={client:O(this,Os),meta:this.options.meta,mutationKey:this.options.mutationKey};X(this,Jr,td({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(k,$)=>{ye(this,ir,_r).call(this,{type:"failed",failureCount:k,error:$})},onPause:()=>{ye(this,ir,_r).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,pt).canRun(this)}));const s=this.state.status==="pending",i=!O(this,Jr).canStart();try{if(s)r();else{ye(this,ir,_r).call(this,{type:"pending",variables:t,isPaused:i}),O(this,pt).config.onMutate&&await O(this,pt).config.onMutate(t,this,n);const $=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));$!==this.state.context&&ye(this,ir,_r).call(this,{type:"pending",context:$,variables:t,isPaused:i})}const k=await O(this,Jr).start();return await((d=(c=O(this,pt).config).onSuccess)==null?void 0:d.call(c,k,t,this.state.context,this,n)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,k,t,this.state.context,n)),await((g=(m=O(this,pt).config).onSettled)==null?void 0:g.call(m,k,null,this.state.variables,this.state.context,this,n)),await((h=(_=this.options).onSettled)==null?void 0:h.call(_,k,null,t,this.state.context,n)),ye(this,ir,_r).call(this,{type:"success",data:k}),k}catch(k){try{await((v=(y=O(this,pt).config).onError)==null?void 0:v.call(y,k,t,this.state.context,this,n))}catch($){Promise.reject($)}try{await((x=(b=this.options).onError)==null?void 0:x.call(b,k,t,this.state.context,n))}catch($){Promise.reject($)}try{await((C=(w=O(this,pt).config).onSettled)==null?void 0:C.call(w,void 0,k,this.state.variables,this.state.context,this,n))}catch($){Promise.reject($)}try{await((j=(D=this.options).onSettled)==null?void 0:j.call(D,void 0,k,t,this.state.context,n))}catch($){Promise.reject($)}throw ye(this,ir,_r).call(this,{type:"error",error:k}),k}finally{O(this,pt).runNext(this)}}},Os=new WeakMap,sr=new WeakMap,pt=new WeakMap,Jr=new WeakMap,ir=new WeakSet,_r=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),it.batch(()=>{O(this,sr).forEach(n=>{n.onMutationUpdate(t)}),O(this,pt).notify({mutation:this,type:"updated",action:t})})},Ku);function bp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var hr,Ht,Es,Qu,_p=(Qu=class extends Ds{constructor(t={}){super();ne(this,hr);ne(this,Ht);ne(this,Es);this.config=t,X(this,hr,new Set),X(this,Ht,new Map),X(this,Es,0)}build(t,r,n){const s=new vp({client:t,mutationCache:this,mutationId:++zs(this,Es)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){O(this,hr).add(t);const r=qs(t);if(typeof r=="string"){const n=O(this,Ht).get(r);n?n.push(t):O(this,Ht).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,hr).delete(t)){const r=qs(t);if(typeof r=="string"){const n=O(this,Ht).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&O(this,Ht).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=qs(t);if(typeof r=="string"){const n=O(this,Ht).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=qs(t);if(typeof r=="string"){const s=(n=O(this,Ht).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(){it.batch(()=>{O(this,hr).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,hr).clear(),O(this,Ht).clear()})}getAll(){return Array.from(O(this,hr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>wl(r,n))}findAll(t={}){return this.getAll().filter(r=>wl(t,r))}notify(t){it.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return it.batch(()=>Promise.all(t.map(r=>r.continue().catch(Et))))}},hr=new WeakMap,Ht=new WeakMap,Es=new WeakMap,Qu);function qs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var or,Gu,wp=(Gu=class extends Ds{constructor(t={}){super();ne(this,or);this.config=t,X(this,or,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??ka(s,r);let o=this.get(i);return o||(o=new pp({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){O(this,or).has(t.queryHash)||(O(this,or).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=O(this,or).get(t.queryHash);r&&(t.destroy(),r===t&&O(this,or).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){it.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,or).get(t)}getAll(){return[...O(this,or).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>_l(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>_l(t,n)):r}notify(t){it.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){it.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){it.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},or=new WeakMap,Gu),Ve,Nr,Tr,Tn,jn,jr,Rn,kn,Yu,xp=(Yu=class{constructor(e={}){ne(this,Ve);ne(this,Nr);ne(this,Tr);ne(this,Tn);ne(this,jn);ne(this,jr);ne(this,Rn);ne(this,kn);X(this,Ve,e.queryCache||new wp),X(this,Nr,e.mutationCache||new _p),X(this,Tr,e.defaultOptions||{}),X(this,Tn,new Map),X(this,jn,new Map),X(this,jr,0)}mount(){zs(this,jr)._++,O(this,jr)===1&&(X(this,Rn,Ra.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ve).onFocus())})),X(this,kn,_i.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ve).onOnline())})))}unmount(){var e,t;zs(this,jr)._--,O(this,jr)===0&&((e=O(this,Rn))==null||e.call(this),X(this,Rn,void 0),(t=O(this,kn))==null||t.call(this),X(this,kn,void 0))}isFetching(e){return O(this,Ve).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,Nr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=O(this,Ve).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=O(this,Ve).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(kr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return O(this,Ve).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=O(this,Ve).get(n.queryHash),i=s==null?void 0:s.state.data,o=rp(t,i);if(o!==void 0)return O(this,Ve).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return it.batch(()=>O(this,Ve).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=O(this,Ve).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=O(this,Ve);it.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=O(this,Ve);return it.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=it.batch(()=>O(this,Ve).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Et).catch(Et)}invalidateQueries(e,t={}){return it.batch(()=>(O(this,Ve).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=it.batch(()=>O(this,Ve).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(Et)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Et)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=O(this,Ve).build(this,t);return r.isStaleByTime(kr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Et).catch(Et)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Et).catch(Et)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return _i.isOnline()?O(this,Nr).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Ve)}getMutationCache(){return O(this,Nr)}getDefaultOptions(){return O(this,Tr)}setDefaultOptions(e){X(this,Tr,e)}setQueryDefaults(e,t){O(this,Tn).set(hs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,Tn).values()],r={};return t.forEach(n=>{ps(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){O(this,jn).set(hs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,jn).values()],r={};return t.forEach(n=>{ps(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,Tr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ka(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===bi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,Tr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Ve).clear(),O(this,Nr).clear()}},Ve=new WeakMap,Nr=new WeakMap,Tr=new WeakMap,Tn=new WeakMap,jn=new WeakMap,jr=new WeakMap,Rn=new WeakMap,kn=new WeakMap,Yu),od=Ce.createContext(void 0),Sp=e=>{const t=Ce.useContext(od);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Cp=({client:e,children:t})=>(Ce.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(od.Provider,{value:e,children:t})),ad=Ce.createContext(!1),Op=()=>Ce.useContext(ad);ad.Provider;function Ep(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Dp=Ce.createContext(Ep()),Ip=()=>Ce.useContext(Dp),Np=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Ju(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Tp=e=>{Ce.useEffect(()=>{e.clearReset()},[e])},jp=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Ju(r,[e.error,n])),Rp=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))}},kp=(e,t)=>e.isLoading&&e.isFetching&&!t,Ap=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Nl=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Pp(e,t,r){var g,_,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=Op(),s=Ip(),i=Sp(),o=i.defaultQueryOptions(e);(_=(g=i.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||_.call(g,o);const a=i.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.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 c=e.subscribed!==!1;o._optimisticResults=n?"isRestoring":c?"optimistic":void 0,Rp(o),Np(o,s,a),Tp(s);const d=!i.getQueryCache().get(o.queryHash),[u]=Ce.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),m=!n&&c;if(Ce.useSyncExternalStore(Ce.useCallback(v=>{const b=m?u.subscribe(it.batchCalls(v)):Et;return u.updateResult(),b},[u,m]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Ce.useEffect(()=>{u.setOptions(o)},[o,u]),Ap(o,f))throw Nl(o,u,s);if(jp({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((y=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,o,f),o.experimental_prefetchInRender&&!gs.isServer()&&kp(f,n)){const v=d?Nl(o,u,s):a==null?void 0:a.promise;v==null||v.catch(Et).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function ea(e,t){return Pp(e,gp)}let Mp={data:""},Lp=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||Mp},Fp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,$p=/\/\*[^]*?\*\/| +/g,Tl=/\n+/g,Cr=(e,t)=>{let r="",n="",s="";for(let i in e){let o=e[i];i[0]=="@"?i[1]=="i"?r=i+" "+o+";":n+=i[1]=="f"?Cr(o,i):i+"{"+Cr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=Cr(o,t?t.replace(/([^,])+/g,a=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,a):a?a+" "+c:c)):i):o!=null&&(i=i[1]=="-"?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=Cr.p?Cr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},yr={},ld=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+ld(e[r]);return t}return e},Bp=(e,t,r,n,s)=>{let i=ld(e),o=yr[i]||(yr[i]=(c=>{let d=0,u=11;for(;d<c.length;)u=101*u+c.charCodeAt(d++)>>>0;return"go"+u})(i));if(!yr[o]){let c=i!==e?e:(d=>{let u,f,m=[{}];for(;u=Fp.exec(d.replace($p,""));)u[4]?m.shift():u[3]?(f=u[3].replace(Tl," ").trim(),m.unshift(m[0][f]=m[0][f]||{})):m[0][u[1]]=u[2].replace(Tl," ").trim();return m[0]})(e);yr[o]=Cr(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&yr.g;return r&&(yr.g=yr[o]),((c,d,u,f)=>{f?d.data=d.data.replace(f,c):d.data.indexOf(c)===-1&&(d.data=u?c+d.data:d.data+c)})(yr[o],t,n,a),o},Up=(e,t,r)=>e.reduce((n,s,i)=>{let o=t[i];if(o&&o.call){let a=o(r),c=a&&a.props&&a.props.className||/^go/.test(a)&&a;o=c?"."+c:a&&typeof a=="object"?a.props?"":Cr(a,""):a===!1?"":a}return n+s+(o??"")},"");function Mi(e){let t=this||{},r=e.call?e(t.p):e;return Bp(r.unshift?r.raw?Up(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,Lp(t.target),t.g,t.o,t.k)}let cd,ta,ra;Mi.bind({g:1});let pr=Mi.bind({k:1});function Vp(e,t,r,n){Cr.p=t,cd=e,ta=r,ra=n}function Pr(e,t){let r=this||{};return function(){let n=arguments;function s(i,o){let a=Object.assign({},i),c=a.className||s.className;r.p=Object.assign({theme:ta&&ta()},a),r.o=/go\d/.test(c),a.className=Mi.apply(r,n)+(c?" "+c:"");let d=e;return e[0]&&(d=a.as||e,delete a.as),ra&&d[0]&&ra(a),cd(d,a)}return s}}var zp=e=>typeof e=="function",wi=(e,t)=>zp(e)?e(t):e,qp=(()=>{let e=0;return()=>(++e).toString()})(),ud=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Hp=20,Pa="default",dd=(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(o=>o.id===t.toast.id?{...o,...t.toast}:o)};case 2:let{toast:n}=t;return dd(e,{type:e.toasts.find(o=>o.id===n.id)?1:0,toast:n});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,dismissed:!0,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.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(o=>({...o,pauseDuration:o.pauseDuration+i}))}}},ni=[],fd={toasts:[],pausedAt:void 0,settings:{toastLimit:Hp}},ar={},hd=(e,t=Pa)=>{ar[t]=dd(ar[t]||fd,e),ni.forEach(([r,n])=>{r===t&&n(ar[t])})},pd=e=>Object.keys(ar).forEach(t=>hd(e,t)),Wp=e=>Object.keys(ar).find(t=>ar[t].toasts.some(r=>r.id===e)),Li=(e=Pa)=>t=>{hd(t,e)},Kp={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Qp=(e={},t=Pa)=>{let[r,n]=p.useState(ar[t]||fd),s=p.useRef(ar[t]);p.useEffect(()=>(s.current!==ar[t]&&n(ar[t]),ni.push([t,n]),()=>{let o=ni.findIndex(([a])=>a===t);o>-1&&ni.splice(o,1)}),[t]);let i=r.toasts.map(o=>{var a,c,d;return{...e,...e[o.type],...o,removeDelay:o.removeDelay||((a=e[o.type])==null?void 0:a.removeDelay)||(e==null?void 0:e.removeDelay),duration:o.duration||((c=e[o.type])==null?void 0:c.duration)||(e==null?void 0:e.duration)||Kp[o.type],style:{...e.style,...(d=e[o.type])==null?void 0:d.style,...o.style}}});return{...r,toasts:i}},Gp=(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)||qp()}),Is=e=>(t,r)=>{let n=Gp(t,e,r);return Li(n.toasterId||Wp(n.id))({type:2,toast:n}),n.id},Ge=(e,t)=>Is("blank")(e,t);Ge.error=Is("error");Ge.success=Is("success");Ge.loading=Is("loading");Ge.custom=Is("custom");Ge.dismiss=(e,t)=>{let r={type:3,toastId:e};t?Li(t)(r):pd(r)};Ge.dismissAll=e=>Ge.dismiss(void 0,e);Ge.remove=(e,t)=>{let r={type:4,toastId:e};t?Li(t)(r):pd(r)};Ge.removeAll=e=>Ge.remove(void 0,e);Ge.promise=(e,t,r)=>{let n=Ge.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?wi(t.success,s):void 0;return i?Ge.success(i,{id:n,...r,...r==null?void 0:r.success}):Ge.dismiss(n),s}).catch(s=>{let i=t.error?wi(t.error,s):void 0;i?Ge.error(i,{id:n,...r,...r==null?void 0:r.error}):Ge.dismiss(n)}),e};var Yp=1e3,Xp=(e,t="default")=>{let{toasts:r,pausedAt:n}=Qp(e,t),s=p.useRef(new Map).current,i=p.useCallback((f,m=Yp)=>{if(s.has(f))return;let g=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},m);s.set(f,g)},[]);p.useEffect(()=>{if(n)return;let f=Date.now(),m=r.map(g=>{if(g.duration===1/0)return;let _=(g.duration||0)+g.pauseDuration-(f-g.createdAt);if(_<0){g.visible&&Ge.dismiss(g.id);return}return setTimeout(()=>Ge.dismiss(g.id,t),_)});return()=>{m.forEach(g=>g&&clearTimeout(g))}},[r,n,t]);let o=p.useCallback(Li(t),[t]),a=p.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=p.useCallback((f,m)=>{o({type:1,toast:{id:f,height:m}})},[o]),d=p.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),u=p.useCallback((f,m)=>{let{reverseOrder:g=!1,gutter:_=8,defaultPosition:h}=m||{},y=r.filter(x=>(x.position||h)===(f.position||h)&&x.height),v=y.findIndex(x=>x.id===f.id),b=y.filter((x,w)=>w<v&&x.visible).length;return y.filter(x=>x.visible).slice(...g?[b+1]:[0,b]).reduce((x,w)=>x+(w.height||0)+_,0)},[r]);return p.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let m=s.get(f.id);m&&(clearTimeout(m),s.delete(f.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:c,startPause:a,endPause:d,calculateOffset:u}}},Zp=pr`
2
2
  from {
3
3
  transform: scale(0) rotate(45deg);
4
4
  opacity: 0;
@@ -169,16 +169,16 @@ to {
169
169
  color: inherit;
170
170
  flex: 1 1 auto;
171
171
  white-space: pre-line;
172
- `,vg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=ud()?[pg,gg]:[fg(r),hg(r)];return{animation:t?`${pr(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${pr(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},bg=Ce.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?vg(e.position||t||"top-center",e.visible):{opacity:0},i=Ce.createElement(dg,{toast:e}),o=Ce.createElement(yg,{...e.ariaProps},_i(e.message,e));return Ce.createElement(mg,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):Ce.createElement(Ce.Fragment,null,i,o))});Vp(Ce.createElement);var _g=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=Ce.useCallback(o=>{if(o){let a=()=>{let c=o.getBoundingClientRect().height;n(e,c)};a(),new MutationObserver(a).observe(o,{subtree:!0,childList:!0,characterData:!0})}},[e,n]);return Ce.createElement("div",{ref:i,className:t,style:r},s)},wg=(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:ud()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},xg=Pi`
172
+ `,vg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=ud()?[pg,gg]:[fg(r),hg(r)];return{animation:t?`${pr(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${pr(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},bg=Ce.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?vg(e.position||t||"top-center",e.visible):{opacity:0},i=Ce.createElement(dg,{toast:e}),o=Ce.createElement(yg,{...e.ariaProps},wi(e.message,e));return Ce.createElement(mg,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):Ce.createElement(Ce.Fragment,null,i,o))});Vp(Ce.createElement);var _g=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=Ce.useCallback(o=>{if(o){let a=()=>{let c=o.getBoundingClientRect().height;n(e,c)};a(),new MutationObserver(a).observe(o,{subtree:!0,childList:!0,characterData:!0})}},[e,n]);return Ce.createElement("div",{ref:i,className:t,style:r},s)},wg=(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:ud()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},xg=Mi`
173
173
  z-index: 9999;
174
174
  > * {
175
175
  pointer-events: auto;
176
176
  }
177
- `,Hs=16,Sg=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:d}=Xp(r,i);return Ce.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Hs,left:Hs,right:Hs,bottom:Hs,pointerEvents:"none",...o},className:a,onMouseEnter:d.startPause,onMouseLeave:d.endPause},c.map(u=>{let f=u.position||t,m=d.calculateOffset(u,{reverseOrder:e,gutter:n,defaultPosition:t}),g=wg(f,m);return Ce.createElement(_g,{id:u.id,key:u.id,onHeightUpdate:d.updateHeight,className:u.visible?xg:"",style:g},u.type==="custom"?_i(u.message,u):s?s(u):Ce.createElement(bg,{toast:u,position:f}))}))},Se=Ge;function Cg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const Li=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $n(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Pa(e){return"nodeType"in e}function wt(e){var t,r;return e?$n(e)?e:Pa(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Ma(e){const{Document:t}=wt(e);return e instanceof t}function Ns(e){return $n(e)?!1:e instanceof wt(e).HTMLElement}function gd(e){return e instanceof wt(e).SVGElement}function Bn(e){return e?$n(e)?e.document:Pa(e)?Ma(e)?e:Ns(e)||gd(e)?e.ownerDocument:document:document:document}const Kt=Li?p.useLayoutEffect:p.useEffect;function Fi(e){const t=p.useRef(e);return Kt(()=>{t.current=e}),p.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 Og(){const e=p.useRef(null),t=p.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=p.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function ms(e,t){t===void 0&&(t=[e]);const r=p.useRef(e);return Kt(()=>{r.current!==e&&(r.current=e)},t),r}function Ts(e,t){const r=p.useRef();return p.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function wi(e){const t=Fi(e),r=p.useRef(null),n=p.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function xi(e){const t=p.useRef();return p.useEffect(()=>{t.current=e},[e]),t.current}let oo={};function js(e,t){return p.useMemo(()=>{if(t)return t;const r=oo[e]==null?0:oo[e]+1;return oo[e]=r,e+"-"+r},[e,t])}function md(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,o)=>{const a=Object.entries(o);for(const[c,d]of a){const u=i[c];u!=null&&(i[c]=u+e*d)}return i},{...t})}}const wn=md(1),ys=md(-1);function Eg(e){return"clientX"in e&&"clientY"in e}function $i(e){if(!e)return!1;const{KeyboardEvent:t}=wt(e.target);return t&&e instanceof t}function Dg(e){if(!e)return!1;const{TouchEvent:t}=wt(e.target);return t&&e instanceof t}function Si(e){if(Dg(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 Eg(e)?{x:e.clientX,y:e.clientY}:null}const Ar=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[Ar.Translate.toString(e),Ar.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Tl="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ig(e){return e.matches(Tl)?e:e.querySelector(Tl)}const Ng={display:"none"};function Tg(e){let{id:t,value:r}=e;return p.createElement("div",{id:t,style:Ng},r)}function jg(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 p.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function Rg(){const[e,t]=p.useState("");return{announce:p.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const yd=p.createContext(null);function kg(e){const t=p.useContext(yd);p.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Ag(){const[e]=p.useState(()=>new Set),t=p.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[p.useCallback(n=>{let{type:s,event:i}=n;e.forEach(o=>{var a;return(a=o[s])==null?void 0:a.call(o,i)})},[e]),t]}const Pg={draggable:`
177
+ `,Hs=16,Sg=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:d}=Xp(r,i);return Ce.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Hs,left:Hs,right:Hs,bottom:Hs,pointerEvents:"none",...o},className:a,onMouseEnter:d.startPause,onMouseLeave:d.endPause},c.map(u=>{let f=u.position||t,m=d.calculateOffset(u,{reverseOrder:e,gutter:n,defaultPosition:t}),g=wg(f,m);return Ce.createElement(_g,{id:u.id,key:u.id,onHeightUpdate:d.updateHeight,className:u.visible?xg:"",style:g},u.type==="custom"?wi(u.message,u):s?s(u):Ce.createElement(bg,{toast:u,position:f}))}))},Se=Ge;function Cg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const Fi=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Fn(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ma(e){return"nodeType"in e}function wt(e){var t,r;return e?Fn(e)?e:Ma(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function La(e){const{Document:t}=wt(e);return e instanceof t}function Ns(e){return Fn(e)?!1:e instanceof wt(e).HTMLElement}function gd(e){return e instanceof wt(e).SVGElement}function $n(e){return e?Fn(e)?e.document:Ma(e)?La(e)?e:Ns(e)||gd(e)?e.ownerDocument:document:document:document}const Kt=Fi?p.useLayoutEffect:p.useEffect;function $i(e){const t=p.useRef(e);return Kt(()=>{t.current=e}),p.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 Og(){const e=p.useRef(null),t=p.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=p.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function ms(e,t){t===void 0&&(t=[e]);const r=p.useRef(e);return Kt(()=>{r.current!==e&&(r.current=e)},t),r}function Ts(e,t){const r=p.useRef();return p.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function xi(e){const t=$i(e),r=p.useRef(null),n=p.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function Si(e){const t=p.useRef();return p.useEffect(()=>{t.current=e},[e]),t.current}let ao={};function js(e,t){return p.useMemo(()=>{if(t)return t;const r=ao[e]==null?0:ao[e]+1;return ao[e]=r,e+"-"+r},[e,t])}function md(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,o)=>{const a=Object.entries(o);for(const[c,d]of a){const u=i[c];u!=null&&(i[c]=u+e*d)}return i},{...t})}}const _n=md(1),ys=md(-1);function Eg(e){return"clientX"in e&&"clientY"in e}function Bi(e){if(!e)return!1;const{KeyboardEvent:t}=wt(e.target);return t&&e instanceof t}function Dg(e){if(!e)return!1;const{TouchEvent:t}=wt(e.target);return t&&e instanceof t}function Ci(e){if(Dg(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 Eg(e)?{x:e.clientX,y:e.clientY}:null}const Ar=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[Ar.Translate.toString(e),Ar.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),jl="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ig(e){return e.matches(jl)?e:e.querySelector(jl)}const Ng={display:"none"};function Tg(e){let{id:t,value:r}=e;return p.createElement("div",{id:t,style:Ng},r)}function jg(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 p.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function Rg(){const[e,t]=p.useState("");return{announce:p.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const yd=p.createContext(null);function kg(e){const t=p.useContext(yd);p.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Ag(){const[e]=p.useState(()=>new Set),t=p.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[p.useCallback(n=>{let{type:s,event:i}=n;e.forEach(o=>{var a;return(a=o[s])==null?void 0:a.call(o,i)})},[e]),t]}const Pg={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
- `},Mg={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 Lg(e){let{announcements:t=Mg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=Pg}=e;const{announce:i,announcement:o}=Rg(),a=js("DndLiveRegion"),[c,d]=p.useState(!1);if(p.useEffect(()=>{d(!0)},[]),kg(p.useMemo(()=>({onDragStart(f){let{active:m}=f;i(t.onDragStart({active:m}))},onDragMove(f){let{active:m,over:g}=f;t.onDragMove&&i(t.onDragMove({active:m,over:g}))},onDragOver(f){let{active:m,over:g}=f;i(t.onDragOver({active:m,over:g}))},onDragEnd(f){let{active:m,over:g}=f;i(t.onDragEnd({active:m,over:g}))},onDragCancel(f){let{active:m,over:g}=f;i(t.onDragCancel({active:m,over:g}))}}),[i,t])),!c)return null;const u=p.createElement(p.Fragment,null,p.createElement(Tg,{id:n,value:s.draggable}),p.createElement(jg,{id:a,announcement:o}));return r?Rr.createPortal(u,r):u}var Qe;(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"})(Qe||(Qe={}));function Ci(){}function ra(e,t){return p.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function vd(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Qt=Object.freeze({x:0,y:0});function bd(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Fg(e,t){const r=Si(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 _d(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function $g(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function jl(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 wd(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function Rl(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 Bg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Rl(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=bd(Rl(c),s);i.push({id:a,data:{droppableContainer:o,value:d}})}}return i.sort(_d)},Ug=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=jl(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=jl(c),u=s.reduce((m,g,_)=>m+bd(d[_],g),0),f=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(_d)};function Vg(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),o=s-n,a=i-r;if(n<s&&r<i){const c=t.width*t.height,d=e.width*e.height,u=o*a,f=u/(c+d-u);return Number(f.toFixed(4))}return 0}const zg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const i of n){const{id:o}=i,a=r.get(o);if(a){const c=Vg(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort($g)};function qg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function xd(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Qt}function Hg(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((o,a)=>({...o,top:o.top+e*a.y,bottom:o.bottom+e*a.y,left:o.left+e*a.x,right:o.right+e*a.x}),{...r})}}const Wg=Hg(1);function Sd(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 Kg(e,t,r){const n=Sd(t);if(!n)return e;const{scaleX:s,scaleY:i,x:o,y:a}=n,c=e.left-o-(1-s)*parseFloat(r),d=e.top-a-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),u=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:u,height:f,top:d,right:c+u,bottom:d+f,left:c}}const Qg={ignoreTransform:!1};function Un(e,t){t===void 0&&(t=Qg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=wt(e).getComputedStyle(e);d&&(r=Kg(r,d,u))}const{top:n,left:s,width:i,height:o,bottom:a,right:c}=r;return{top:n,left:s,width:i,height:o,bottom:a,right:c}}function kl(e){return Un(e,{ignoreTransform:!0})}function Gg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Yg(e,t){return t===void 0&&(t=wt(e).getComputedStyle(e)),t.position==="fixed"}function Xg(e,t){t===void 0&&(t=wt(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 Bi(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Ma(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!Ns(s)||gd(s)||r.includes(s))return r;const i=wt(e).getComputedStyle(s);return s!==e&&Xg(s,i)&&r.push(s),Yg(s,i)?r:n(s.parentNode)}return e?n(e):r}function Cd(e){const[t]=Bi(e,1);return t??null}function ao(e){return!Li||!e?null:$n(e)?e:Pa(e)?Ma(e)||e===Bn(e).scrollingElement?window:Ns(e)?e:null:null}function Od(e){return $n(e)?e.scrollX:e.scrollLeft}function Ed(e){return $n(e)?e.scrollY:e.scrollTop}function na(e){return{x:Od(e),y:Ed(e)}}var tt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(tt||(tt={}));function Dd(e){return!Li||!e?!1:e===document.scrollingElement}function Id(e){const t={x:0,y:0},r=Dd(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,o=e.scrollTop>=n.y,a=e.scrollLeft>=n.x;return{isTop:s,isLeft:i,isBottom:o,isRight:a,maxScroll:n,minScroll:t}}const Zg={x:.2,y:.2};function Jg(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=Zg);const{isTop:d,isBottom:u,isLeft:f,isRight:m}=Id(e),g={x:0,y:0},_={x:0,y:0},h={height:t.height*s.y,width:t.width*s.x};return!d&&i<=t.top+h.height?(g.y=tt.Backward,_.y=n*Math.abs((t.top+h.height-i)/h.height)):!u&&c>=t.bottom-h.height&&(g.y=tt.Forward,_.y=n*Math.abs((t.bottom-h.height-c)/h.height)),!m&&a>=t.right-h.width?(g.x=tt.Forward,_.x=n*Math.abs((t.right-h.width-a)/h.width)):!f&&o<=t.left+h.width&&(g.x=tt.Backward,_.x=n*Math.abs((t.left+h.width-o)/h.width)),{direction:g,speed:_}}function em(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}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 Nd(e){return e.reduce((t,r)=>wn(t,na(r)),Qt)}function tm(e){return e.reduce((t,r)=>t+Od(r),0)}function rm(e){return e.reduce((t,r)=>t+Ed(r),0)}function Td(e,t){if(t===void 0&&(t=Un),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);Cd(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const nm=[["x",["left","right"],tm],["y",["top","bottom"],rm]];class La{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=Bi(r),s=Nd(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of nm)for(const c of o)Object.defineProperty(this,c,{get:()=>{const d=a(n),u=s[i]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ls{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 sm(e){const{EventTarget:t}=wt(e);return e instanceof t?e:Bn(e)}function lo(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 Bt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Bt||(Bt={}));function Al(e){e.preventDefault()}function im(e){e.stopPropagation()}var we;(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"})(we||(we={}));const jd={start:[we.Space,we.Enter],cancel:[we.Esc],end:[we.Space,we.Enter,we.Tab]},om=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case we.Right:return{...r,x:r.x+25};case we.Left:return{...r,x:r.x-25};case we.Down:return{...r,y:r.y+25};case we.Up:return{...r,y:r.y-25}}};class Fa{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 ls(Bn(r)),this.windowListeners=new ls(wt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Bt.Resize,this.handleCancel),this.windowListeners.add(Bt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Bt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Td(n),r(Qt)}handleKeyDown(t){if($i(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=jd,coordinateGetter:o=om,scrollBehavior:a="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=n.current,u=d?{x:d.left,y:d.top}:Qt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=o(t,{active:r,context:n.current,currentCoordinates:u});if(f){const m=ys(f,u),g={x:0,y:0},{scrollableAncestors:_}=n.current;for(const h of _){const y=t.code,{isTop:v,isRight:b,isLeft:x,isBottom:w,maxScroll:C,minScroll:D}=Id(h),j=em(h),k={x:Math.min(y===we.Right?j.right-j.width/2:j.right,Math.max(y===we.Right?j.left:j.left+j.width/2,f.x)),y:Math.min(y===we.Down?j.bottom-j.height/2:j.bottom,Math.max(y===we.Down?j.top:j.top+j.height/2,f.y))},$=y===we.Right&&!b||y===we.Left&&!x,N=y===we.Down&&!w||y===we.Up&&!v;if($&&k.x!==f.x){const A=h.scrollLeft+m.x,U=y===we.Right&&A<=C.x||y===we.Left&&A>=D.x;if(U&&!m.y){h.scrollTo({left:A,behavior:a});return}U?g.x=h.scrollLeft-A:g.x=y===we.Right?h.scrollLeft-C.x:h.scrollLeft-D.x,g.x&&h.scrollBy({left:-g.x,behavior:a});break}else if(N&&k.y!==f.y){const A=h.scrollTop+m.y,U=y===we.Down&&A<=C.y||y===we.Up&&A>=D.y;if(U&&!m.x){h.scrollTo({top:A,behavior:a});return}U?g.y=h.scrollTop-A:g.y=y===we.Down?h.scrollTop-C.y:h.scrollTop-D.y,g.y&&h.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,wn(ys(f,this.referenceCoordinates),g))}}}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()}}Fa.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=jd,onActivation:s}=t,{active:i}=r;const{code:o}=e.nativeEvent;if(n.start.includes(o)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function Pl(e){return!!(e&&"distance"in e)}function Ml(e){return!!(e&&"delay"in e)}class $a{constructor(t,r,n){var s;n===void 0&&(n=sm(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:o}=i;this.props=t,this.events=r,this.document=Bn(o),this.documentListeners=new ls(this.document),this.listeners=new ls(n),this.windowListeners=new ls(wt(o)),this.initialCoordinates=(s=Si(i))!=null?s:Qt,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(Bt.Resize,this.handleCancel),this.windowListeners.add(Bt.DragStart,Al),this.windowListeners.add(Bt.VisibilityChange,this.handleCancel),this.windowListeners.add(Bt.ContextMenu,Al),this.documentListeners.add(Bt.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ml(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Pl(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(Bt.Click,im,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Bt.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const c=(r=Si(t))!=null?r:Qt,d=ys(s,c);if(!n&&a){if(Pl(a)){if(a.tolerance!=null&&lo(d,a.tolerance))return this.handleCancel();if(lo(d,a.distance))return this.handleStart()}if(Ml(a)&&lo(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}t.cancelable&&t.preventDefault(),o(c)}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===we.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const am={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ui extends $a{constructor(t){const{event:r}=t,n=Bn(r.target);super(t,am,n)}}Ui.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 lm={move:{name:"mousemove"},end:{name:"mouseup"}};var sa;(function(e){e[e.RightClick=2]="RightClick"})(sa||(sa={}));class cm extends $a{constructor(t){super(t,lm,Bn(t.event.target))}}cm.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===sa.RightClick?!1:(n==null||n({event:r}),!0)}}];const co={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class um extends $a{constructor(t){super(t,co)}static setup(){return window.addEventListener(co.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(co.move.name,t)};function t(){}}}um.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 cs;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(cs||(cs={}));var Oi;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Oi||(Oi={}));function dm(e){let{acceleration:t,activator:r=cs.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=Oi.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:m}=e;const g=hm({delta:f,disabled:!i}),[_,h]=Og(),y=p.useRef({x:0,y:0}),v=p.useRef({x:0,y:0}),b=p.useMemo(()=>{switch(r){case cs.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case cs.DraggableRect:return s}},[r,s,c]),x=p.useRef(null),w=p.useCallback(()=>{const D=x.current;if(!D)return;const j=y.current.x*v.current.x,k=y.current.y*v.current.y;D.scrollBy(j,k)},[]),C=p.useMemo(()=>a===Oi.TreeOrder?[...d].reverse():d,[a,d]);p.useEffect(()=>{if(!i||!d.length||!b){h();return}for(const D of C){if((n==null?void 0:n(D))===!1)continue;const j=d.indexOf(D),k=u[j];if(!k)continue;const{direction:$,speed:N}=Jg(D,k,b,t,m);for(const A of["x","y"])g[A][$[A]]||(N[A]=0,$[A]=0);if(N.x>0||N.y>0){h(),x.current=D,_(w,o),y.current=N,v.current=$;return}}y.current={x:0,y:0},v.current={x:0,y:0},h()},[t,w,n,h,i,o,JSON.stringify(b),JSON.stringify(g),_,d,C,u,JSON.stringify(m)])}const fm={x:{[tt.Backward]:!1,[tt.Forward]:!1},y:{[tt.Backward]:!1,[tt.Forward]:!1}};function hm(e){let{delta:t,disabled:r}=e;const n=xi(t);return Ts(s=>{if(r||!n||!s)return fm;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[tt.Backward]:s.x[tt.Backward]||i.x===-1,[tt.Forward]:s.x[tt.Forward]||i.x===1},y:{[tt.Backward]:s.y[tt.Backward]||i.y===-1,[tt.Forward]:s.y[tt.Forward]||i.y===1}}},[r,t,n])}function pm(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Ts(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function gm(e,t){return p.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,n)}));return[...r,...i]},[]),[e,t])}var vs;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(vs||(vs={}));var ia;(function(e){e.Optimized="optimized"})(ia||(ia={}));const Ll=new Map;function mm(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=p.useState(null),{frequency:a,measure:c,strategy:d}=s,u=p.useRef(e),f=y(),m=ms(f),g=p.useCallback(function(v){v===void 0&&(v=[]),!m.current&&o(b=>b===null?v:b.concat(v.filter(x=>!b.includes(x))))},[m]),_=p.useRef(null),h=Ts(v=>{if(f&&!r)return Ll;if(!v||v===Ll||u.current!==e||i!=null){const b=new Map;for(let x of e){if(!x)continue;if(i&&i.length>0&&!i.includes(x.id)&&x.rect.current){b.set(x.id,x.rect.current);continue}const w=x.node.current,C=w?new La(c(w),w):null;x.rect.current=C,C&&b.set(x.id,C)}return b}return v},[e,i,r,f,c]);return p.useEffect(()=>{u.current=e},[e]),p.useEffect(()=>{f||g()},[r,f]),p.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),p.useEffect(()=>{f||typeof a!="number"||_.current!==null||(_.current=setTimeout(()=>{g(),_.current=null},a))},[a,f,g,...n]),{droppableRects:h,measureDroppableContainers:g,measuringScheduled:i!=null};function y(){switch(d){case vs.Always:return!1;case vs.BeforeDragging:return r;default:return!r}}}function Ba(e,t){return Ts(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function ym(e,t){return Ba(e,t)}function vm(e){let{callback:t,disabled:r}=e;const n=Fi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Vi(e){let{callback:t,disabled:r}=e;const n=Fi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function bm(e){return new La(Un(e),e)}function Fl(e,t,r){t===void 0&&(t=bm);const[n,s]=p.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??r)!=null?d:null}const u=t(e);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const o=vm({callback(c){if(e)for(const d of c){const{type:u,target:f}=d;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=Vi({callback:i});return Kt(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),n}function _m(e){const t=Ba(e);return xd(e,t)}const $l=[];function wm(e){const t=p.useRef(e),r=Ts(n=>e?n&&n!==$l&&e&&t.current&&e.parentNode===t.current.parentNode?n:Bi(e):$l,[e]);return p.useEffect(()=>{t.current=e},[e]),r}function xm(e){const[t,r]=p.useState(null),n=p.useRef(e),s=p.useCallback(i=>{const o=ao(i.target);o&&r(a=>a?(a.set(o,na(o)),new Map(a)):null)},[]);return p.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const d=ao(c);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,na(d)]):null}).filter(c=>c!=null);r(a.length?new Map(a):null),n.current=e}return()=>{o(e),o(i)};function o(a){a.forEach(c=>{const d=ao(c);d==null||d.removeEventListener("scroll",s)})}},[s,e]),p.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>wn(i,o),Qt):Nd(e):Qt,[e,t])}function Bl(e,t){t===void 0&&(t=[]);const r=p.useRef(null);return p.useEffect(()=>{r.current=null},t),p.useEffect(()=>{const n=e!==Qt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?ys(e,r.current):Qt}function Sm(e){p.useEffect(()=>{if(!Li)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 Cm(e,t){return p.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=o=>{i(o,t)},r},{}),[e,t])}function Rd(e){return p.useMemo(()=>e?Gg(e):null,[e])}const Ul=[];function Om(e,t){t===void 0&&(t=Un);const[r]=e,n=Rd(r?wt(r):null),[s,i]=p.useState(Ul);function o(){i(()=>e.length?e.map(c=>Dd(c)?n:new La(t(c),c)):Ul)}const a=Vi({callback:o});return Kt(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function kd(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ns(t)?t:e}function Em(e){let{measure:t}=e;const[r,n]=p.useState(null),s=p.useCallback(d=>{for(const{target:u}of d)if(Ns(u)){n(f=>{const m=t(u);return f?{...f,width:m.width,height:m.height}:m});break}},[t]),i=Vi({callback:s}),o=p.useCallback(d=>{const u=kd(d);i==null||i.disconnect(),u&&(i==null||i.observe(u)),n(u?t(u):null)},[t,i]),[a,c]=wi(o);return p.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Dm=[{sensor:Ui,options:{}},{sensor:Fa,options:{}}],Im={current:{}},ni={draggable:{measure:kl},droppable:{measure:kl,strategy:vs.WhileDragging,frequency:ia.Optimized},dragOverlay:{measure:Un}};class us 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 Nm={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new us,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ci},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ni,measureDroppableContainers:Ci,windowRect:null,measuringScheduled:!1},Ad={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ci,draggableNodes:new Map,over:null,measureDroppableContainers:Ci},Rs=p.createContext(Ad),Pd=p.createContext(Nm);function Tm(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new us}}}function jm(e,t){switch(t.type){case Qe.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Qe.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 Qe.DragEnd:case Qe.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Qe.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new us(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case Qe.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const o=new us(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case Qe.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new us(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Rm(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=p.useContext(Rs),i=xi(n),o=xi(r==null?void 0:r.id);return p.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!$i(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:c,node:d}=a;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const f=Ig(u);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function Md(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function km(e){return p.useMemo(()=>({draggable:{...ni.draggable,...e==null?void 0:e.draggable},droppable:{...ni.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ni.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 Am(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const i=p.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;Kt(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!n)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const u=r(d),f=xd(u,n);if(o||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const m=Cd(d);m&&m.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const zi=p.createContext({...Qt,scaleX:1,scaleY:1});var xr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xr||(xr={}));const Ld=p.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:d,sensors:u=Dm,collisionDetection:f=zg,measuring:m,modifiers:g,..._}=t;const h=p.useReducer(jm,void 0,Tm),[y,v]=h,[b,x]=Ag(),[w,C]=p.useState(xr.Uninitialized),D=w===xr.Initialized,{draggable:{active:j,nodes:k,translate:$},droppable:{containers:N}}=y,A=j!=null?k.get(j):null,U=p.useRef({initial:null,translated:null}),R=p.useMemo(()=>{var Xe;return j!=null?{id:j,data:(Xe=A==null?void 0:A.data)!=null?Xe:Im,rect:U}:null},[j,A]),B=p.useRef(null),[F,J]=p.useState(null),[se,ge]=p.useState(null),ye=ms(_,Object.values(_)),ve=js("DndDescribedBy",o),K=p.useMemo(()=>N.getEnabled(),[N]),P=km(m),{droppableRects:X,measureDroppableContainers:M,measuringScheduled:G}=mm(K,{dragging:D,dependencies:[$.x,$.y],config:P.droppable}),W=pm(k,j),oe=p.useMemo(()=>se?Si(se):null,[se]),be=Mr(),Ne=ym(W,P.draggable.measure);Am({activeNode:j!=null?k.get(j):null,config:be.layoutShiftCompensation,initialRect:Ne,measure:P.draggable.measure});const ie=Fl(W,P.draggable.measure,Ne),ne=Fl(W?W.parentElement:null),le=p.useRef({activatorEvent:null,active:null,activeNode:W,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Le=N.getNodeFor((r=le.current.over)==null?void 0:r.id),ze=Em({measure:P.dragOverlay.measure}),Te=(n=ze.nodeRef.current)!=null?n:W,te=D?(s=ze.rect)!=null?s:ie:null,We=!!(ze.nodeRef.current&&ze.rect),at=_m(We?null:ie),vt=Rd(Te?wt(Te):null),qe=wm(D?Le??W:null),Ye=Om(qe),lt=Md(g,{transform:{x:$.x-at.x,y:$.y-at.y,scaleX:1,scaleY:1},activatorEvent:se,active:R,activeNodeRect:ie,containerNodeRect:ne,draggingNodeRect:te,over:le.current.over,overlayNodeRect:ze.rect,scrollableAncestors:qe,scrollableAncestorRects:Ye,windowRect:vt}),Us=oe?wn(oe,$):null,no=xm(qe),yl=Bl(no),Vs=Bl(no,[ie]),S=wn(lt,yl),I=te?Wg(te,lt):null,T=R&&I?f({active:R,collisionRect:I,droppableRects:X,droppableContainers:K,pointerCoordinates:Us}):null,V=wd(T,"id"),[z,Q]=p.useState(null),q=We?lt:wn(lt,Vs),ee=qg(q,(i=z==null?void 0:z.rect)!=null?i:null,ie),he=p.useRef(null),Fe=p.useCallback((Xe,ct)=>{let{sensor:bt,options:Vt}=ct;if(B.current==null)return;const Pt=k.get(B.current);if(!Pt)return;const Nt=Xe.nativeEvent,Xt=new bt({active:B.current,activeNode:Pt,event:Nt,options:Vt,context:le,onAbort(rt){if(!k.get(rt))return;const{onDragAbort:Zt}=ye.current,cr={id:rt};Zt==null||Zt(cr),b({type:"onDragAbort",event:cr})},onPending(rt,gr,Zt,cr){if(!k.get(rt))return;const{onDragPending:Qn}=ye.current,mr={id:rt,constraint:gr,initialCoordinates:Zt,offset:cr};Qn==null||Qn(mr),b({type:"onDragPending",event:mr})},onStart(rt){const gr=B.current;if(gr==null)return;const Zt=k.get(gr);if(!Zt)return;const{onDragStart:cr}=ye.current,Kn={activatorEvent:Nt,active:{id:gr,data:Zt.data,rect:U}};Rr.unstable_batchedUpdates(()=>{cr==null||cr(Kn),C(xr.Initializing),v({type:Qe.DragStart,initialCoordinates:rt,active:gr}),b({type:"onDragStart",event:Kn}),J(he.current),ge(Nt)})},onMove(rt){v({type:Qe.DragMove,coordinates:rt})},onEnd:ln(Qe.DragEnd),onCancel:ln(Qe.DragCancel)});he.current=Xt;function ln(rt){return async function(){const{active:Zt,collisions:cr,over:Kn,scrollAdjustedTranslate:Qn}=le.current;let mr=null;if(Zt&&Qn){const{cancelDrop:Gn}=ye.current;mr={activatorEvent:Nt,active:Zt,collisions:cr,delta:Qn,over:Kn},rt===Qe.DragEnd&&typeof Gn=="function"&&await Promise.resolve(Gn(mr))&&(rt=Qe.DragCancel)}B.current=null,Rr.unstable_batchedUpdates(()=>{v({type:rt}),C(xr.Uninitialized),Q(null),J(null),ge(null),he.current=null;const Gn=rt===Qe.DragEnd?"onDragEnd":"onDragCancel";if(mr){const so=ye.current[Gn];so==null||so(mr),b({type:Gn,event:mr})}})}}},[k]),xt=p.useCallback((Xe,ct)=>(bt,Vt)=>{const Pt=bt.nativeEvent,Nt=k.get(Vt);if(B.current!==null||!Nt||Pt.dndKit||Pt.defaultPrevented)return;const Xt={active:Nt};Xe(bt,ct.options,Xt)===!0&&(Pt.dndKit={capturedBy:ct.sensor},B.current=Vt,Fe(bt,ct))},[k,Fe]),St=gm(u,xt);Sm(u),Kt(()=>{ie&&w===xr.Initializing&&C(xr.Initialized)},[ie,w]),p.useEffect(()=>{const{onDragMove:Xe}=ye.current,{active:ct,activatorEvent:bt,collisions:Vt,over:Pt}=le.current;if(!ct||!bt)return;const Nt={active:ct,activatorEvent:bt,collisions:Vt,delta:{x:S.x,y:S.y},over:Pt};Rr.unstable_batchedUpdates(()=>{Xe==null||Xe(Nt),b({type:"onDragMove",event:Nt})})},[S.x,S.y]),p.useEffect(()=>{const{active:Xe,activatorEvent:ct,collisions:bt,droppableContainers:Vt,scrollAdjustedTranslate:Pt}=le.current;if(!Xe||B.current==null||!ct||!Pt)return;const{onDragOver:Nt}=ye.current,Xt=Vt.get(V),ln=Xt&&Xt.rect.current?{id:Xt.id,rect:Xt.rect.current,data:Xt.data,disabled:Xt.disabled}:null,rt={active:Xe,activatorEvent:ct,collisions:bt,delta:{x:Pt.x,y:Pt.y},over:ln};Rr.unstable_batchedUpdates(()=>{Q(ln),Nt==null||Nt(rt),b({type:"onDragOver",event:rt})})},[V]),Kt(()=>{le.current={activatorEvent:se,active:R,activeNode:W,collisionRect:I,collisions:T,droppableRects:X,draggableNodes:k,draggingNode:Te,draggingNodeRect:te,droppableContainers:N,over:z,scrollableAncestors:qe,scrollAdjustedTranslate:S},U.current={initial:te,translated:I}},[R,W,T,I,k,Te,te,X,N,z,qe,S]),dm({...be,delta:$,draggingRect:I,pointerCoordinates:Us,scrollableAncestors:qe,scrollableAncestorRects:Ye});const lr=p.useMemo(()=>({active:R,activeNode:W,activeNodeRect:ie,activatorEvent:se,collisions:T,containerNodeRect:ne,dragOverlay:ze,draggableNodes:k,droppableContainers:N,droppableRects:X,over:z,measureDroppableContainers:M,scrollableAncestors:qe,scrollableAncestorRects:Ye,measuringConfiguration:P,measuringScheduled:G,windowRect:vt}),[R,W,ie,se,T,ne,ze,k,N,X,z,M,qe,Ye,P,G,vt]),Wn=p.useMemo(()=>({activatorEvent:se,activators:St,active:R,activeNodeRect:ie,ariaDescribedById:{draggable:ve},dispatch:v,draggableNodes:k,over:z,measureDroppableContainers:M}),[se,St,R,ie,v,ve,k,z,M]);return p.createElement(yd.Provider,{value:x},p.createElement(Rs.Provider,{value:Wn},p.createElement(Pd.Provider,{value:lr},p.createElement(zi.Provider,{value:ee},d)),p.createElement(Rm,{disabled:(a==null?void 0:a.restoreFocus)===!1})),p.createElement(Lg,{...a,hiddenTextDescribedById:ve}));function Mr(){const Xe=(F==null?void 0:F.autoScrollEnabled)===!1,ct=typeof c=="object"?c.enabled===!1:c===!1,bt=D&&!Xe&&!ct;return typeof c=="object"?{...c,enabled:bt}:{enabled:bt}}}),Pm=p.createContext(null),Vl="button",Mm="Draggable";function Fd(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=js(Mm),{activators:o,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:m}=p.useContext(Rs),{role:g=Vl,roleDescription:_="draggable",tabIndex:h=0}=s??{},y=(c==null?void 0:c.id)===t,v=p.useContext(y?zi:Pm),[b,x]=wi(),[w,C]=wi(),D=Cm(o,t),j=ms(r);Kt(()=>(f.set(t,{id:t,key:i,node:b,activatorNode:w,data:j}),()=>{const $=f.get(t);$&&$.key===i&&f.delete(t)}),[f,t]);const k=p.useMemo(()=>({role:g,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&g===Vl?!0:void 0,"aria-roledescription":_,"aria-describedby":u.draggable}),[n,g,h,y,_,u.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:k,isDragging:y,listeners:n?void 0:D,node:b,over:m,setNodeRef:x,setActivatorNodeRef:C,transform:v}}function $d(){return p.useContext(Pd)}const Lm="Droppable",Fm={timeout:25};function $m(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=js(Lm),{active:o,dispatch:a,over:c,measureDroppableContainers:d}=p.useContext(Rs),u=p.useRef({disabled:r}),f=p.useRef(!1),m=p.useRef(null),g=p.useRef(null),{disabled:_,updateMeasurementsFor:h,timeout:y}={...Fm,...s},v=ms(h??n),b=p.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{d(Array.isArray(v.current)?v.current:[v.current]),g.current=null},y)},[y]),x=Vi({callback:b,disabled:_||!o}),w=p.useCallback((k,$)=>{x&&($&&(x.unobserve($),f.current=!1),k&&x.observe(k))},[x]),[C,D]=wi(w),j=ms(t);return p.useEffect(()=>{!x||!C.current||(x.disconnect(),f.current=!1,x.observe(C.current))},[C,x]),p.useEffect(()=>(a({type:Qe.RegisterDroppable,element:{id:n,key:i,disabled:r,node:C,rect:m,data:j}}),()=>a({type:Qe.UnregisterDroppable,key:i,id:n})),[n]),p.useEffect(()=>{r!==u.current.disabled&&(a({type:Qe.SetDroppableDisabled,id:n,key:i,disabled:r}),u.current.disabled=r)},[n,i,r,a]),{active:o,rect:m,isOver:(c==null?void 0:c.id)===n,node:C,over:c,setNodeRef:D}}function Bm(e){let{animation:t,children:r}=e;const[n,s]=p.useState(null),[i,o]=p.useState(null),a=xi(r);return!r&&!n&&a&&s(a),Kt(()=>{if(!i)return;const c=n==null?void 0:n.key,d=n==null?void 0:n.props.id;if(c==null||d==null){s(null);return}Promise.resolve(t(d,i)).then(()=>{s(null)})},[t,n,i]),p.createElement(p.Fragment,null,r,n?p.cloneElement(n,{ref:o}):null)}const Um={x:0,y:0,scaleX:1,scaleY:1};function Vm(e){let{children:t}=e;return p.createElement(Rs.Provider,{value:Ad},p.createElement(zi.Provider,{value:Um},t))}const zm={position:"fixed",touchAction:"none"},qm=e=>$i(e)?"transform 250ms ease":void 0,Hm=p.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:d,transition:u=qm}=e;if(!a)return null;const f=s?d:{...d,scaleX:1,scaleY:1},m={...zm,width:a.width,height:a.height,top:a.top,left:a.left,transform:Ar.Transform.toString(f),transformOrigin:s&&n?Fg(n,a):void 0,transition:typeof u=="function"?u(n):u,...c};return p.createElement(r,{className:o,style:m,ref:t},i)}),Wm=e=>t=>{let{active:r,dragOverlay:n}=t;const s={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[a,c]of Object.entries(i.active))c!==void 0&&(s[a]=r.node.style.getPropertyValue(a),r.node.style.setProperty(a,c));if(i!=null&&i.dragOverlay)for(const[a,c]of Object.entries(i.dragOverlay))c!==void 0&&n.node.style.setProperty(a,c);return o!=null&&o.active&&r.node.classList.add(o.active),o!=null&&o.dragOverlay&&n.node.classList.add(o.dragOverlay),function(){for(const[c,d]of Object.entries(s))r.node.style.setProperty(c,d);o!=null&&o.active&&r.node.classList.remove(o.active)}},Km=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Ar.Transform.toString(t)},{transform:Ar.Transform.toString(r)}]},Qm={duration:250,easing:"ease",keyframes:Km,sideEffects:Wm({styles:{active:{opacity:"0"}}})};function Gm(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Fi((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const d=kd(o);if(!d)return;const{transform:u}=wt(o).getComputedStyle(o),f=Sd(u);if(!f)return;const m=typeof t=="function"?t:Ym(t);return Td(c,s.draggable.measure),m({active:{id:i,data:a.data,node:c,rect:s.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:o,rect:s.dragOverlay.measure(d)},droppableContainers:n,measuringConfiguration:s,transform:f})})}function Ym(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...Qm,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...d}=i;if(!t)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},f={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/a.rect.height:1},m={x:c.x-u.x,y:c.y-u.y,...f},g=s({...d,active:o,dragOverlay:a,transform:{initial:c,final:m}}),[_]=g,h=g[g.length-1];if(JSON.stringify(_)===JSON.stringify(h))return;const y=n==null?void 0:n({active:o,dragOverlay:a,...d}),v=a.node.animate(g,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{v.onfinish=()=>{y==null||y(),b()}})}}let zl=0;function Xm(e){return p.useMemo(()=>{if(e!=null)return zl++,zl},[e])}const Zm=p.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:d=999}=e;const{activatorEvent:u,active:f,activeNodeRect:m,containerNodeRect:g,draggableNodes:_,droppableContainers:h,dragOverlay:y,over:v,measuringConfiguration:b,scrollableAncestors:x,scrollableAncestorRects:w,windowRect:C}=$d(),D=p.useContext(zi),j=Xm(f==null?void 0:f.id),k=Md(o,{activatorEvent:u,active:f,activeNodeRect:m,containerNodeRect:g,draggingNodeRect:y.rect,over:v,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:w,transform:D,windowRect:C}),$=Ba(m),N=Gm({config:n,draggableNodes:_,droppableContainers:h,measuringConfiguration:b}),A=$?y.setRef:void 0;return p.createElement(Vm,null,p.createElement(Bm,{animation:N},f&&j?p.createElement(Hm,{key:j,id:f.id,ref:A,as:a,activatorEvent:u,adjustScale:t,className:c,transition:i,rect:$,style:{zIndex:d,...s},transform:k},r):null))});/**
181
+ `},Mg={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 Lg(e){let{announcements:t=Mg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=Pg}=e;const{announce:i,announcement:o}=Rg(),a=js("DndLiveRegion"),[c,d]=p.useState(!1);if(p.useEffect(()=>{d(!0)},[]),kg(p.useMemo(()=>({onDragStart(f){let{active:m}=f;i(t.onDragStart({active:m}))},onDragMove(f){let{active:m,over:g}=f;t.onDragMove&&i(t.onDragMove({active:m,over:g}))},onDragOver(f){let{active:m,over:g}=f;i(t.onDragOver({active:m,over:g}))},onDragEnd(f){let{active:m,over:g}=f;i(t.onDragEnd({active:m,over:g}))},onDragCancel(f){let{active:m,over:g}=f;i(t.onDragCancel({active:m,over:g}))}}),[i,t])),!c)return null;const u=p.createElement(p.Fragment,null,p.createElement(Tg,{id:n,value:s.draggable}),p.createElement(jg,{id:a,announcement:o}));return r?Rr.createPortal(u,r):u}var Qe;(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"})(Qe||(Qe={}));function Oi(){}function na(e,t){return p.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function vd(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Qt=Object.freeze({x:0,y:0});function bd(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Fg(e,t){const r=Ci(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 _d(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function $g(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Rl(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 wd(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function kl(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 Bg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=kl(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=bd(kl(c),s);i.push({id:a,data:{droppableContainer:o,value:d}})}}return i.sort(_d)},Ug=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Rl(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=Rl(c),u=s.reduce((m,g,_)=>m+bd(d[_],g),0),f=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(_d)};function Vg(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),o=s-n,a=i-r;if(n<s&&r<i){const c=t.width*t.height,d=e.width*e.height,u=o*a,f=u/(c+d-u);return Number(f.toFixed(4))}return 0}const zg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const i of n){const{id:o}=i,a=r.get(o);if(a){const c=Vg(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort($g)};function qg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function xd(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Qt}function Hg(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((o,a)=>({...o,top:o.top+e*a.y,bottom:o.bottom+e*a.y,left:o.left+e*a.x,right:o.right+e*a.x}),{...r})}}const Wg=Hg(1);function Sd(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 Kg(e,t,r){const n=Sd(t);if(!n)return e;const{scaleX:s,scaleY:i,x:o,y:a}=n,c=e.left-o-(1-s)*parseFloat(r),d=e.top-a-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),u=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:u,height:f,top:d,right:c+u,bottom:d+f,left:c}}const Qg={ignoreTransform:!1};function Bn(e,t){t===void 0&&(t=Qg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=wt(e).getComputedStyle(e);d&&(r=Kg(r,d,u))}const{top:n,left:s,width:i,height:o,bottom:a,right:c}=r;return{top:n,left:s,width:i,height:o,bottom:a,right:c}}function Al(e){return Bn(e,{ignoreTransform:!0})}function Gg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Yg(e,t){return t===void 0&&(t=wt(e).getComputedStyle(e)),t.position==="fixed"}function Xg(e,t){t===void 0&&(t=wt(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 Ui(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(La(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!Ns(s)||gd(s)||r.includes(s))return r;const i=wt(e).getComputedStyle(s);return s!==e&&Xg(s,i)&&r.push(s),Yg(s,i)?r:n(s.parentNode)}return e?n(e):r}function Cd(e){const[t]=Ui(e,1);return t??null}function lo(e){return!Fi||!e?null:Fn(e)?e:Ma(e)?La(e)||e===$n(e).scrollingElement?window:Ns(e)?e:null:null}function Od(e){return Fn(e)?e.scrollX:e.scrollLeft}function Ed(e){return Fn(e)?e.scrollY:e.scrollTop}function sa(e){return{x:Od(e),y:Ed(e)}}var tt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(tt||(tt={}));function Dd(e){return!Fi||!e?!1:e===document.scrollingElement}function Id(e){const t={x:0,y:0},r=Dd(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,o=e.scrollTop>=n.y,a=e.scrollLeft>=n.x;return{isTop:s,isLeft:i,isBottom:o,isRight:a,maxScroll:n,minScroll:t}}const Zg={x:.2,y:.2};function Jg(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=Zg);const{isTop:d,isBottom:u,isLeft:f,isRight:m}=Id(e),g={x:0,y:0},_={x:0,y:0},h={height:t.height*s.y,width:t.width*s.x};return!d&&i<=t.top+h.height?(g.y=tt.Backward,_.y=n*Math.abs((t.top+h.height-i)/h.height)):!u&&c>=t.bottom-h.height&&(g.y=tt.Forward,_.y=n*Math.abs((t.bottom-h.height-c)/h.height)),!m&&a>=t.right-h.width?(g.x=tt.Forward,_.x=n*Math.abs((t.right-h.width-a)/h.width)):!f&&o<=t.left+h.width&&(g.x=tt.Backward,_.x=n*Math.abs((t.left+h.width-o)/h.width)),{direction:g,speed:_}}function em(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}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 Nd(e){return e.reduce((t,r)=>_n(t,sa(r)),Qt)}function tm(e){return e.reduce((t,r)=>t+Od(r),0)}function rm(e){return e.reduce((t,r)=>t+Ed(r),0)}function Td(e,t){if(t===void 0&&(t=Bn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);Cd(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const nm=[["x",["left","right"],tm],["y",["top","bottom"],rm]];class Fa{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=Ui(r),s=Nd(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of nm)for(const c of o)Object.defineProperty(this,c,{get:()=>{const d=a(n),u=s[i]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ls{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 sm(e){const{EventTarget:t}=wt(e);return e instanceof t?e:$n(e)}function co(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 Bt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Bt||(Bt={}));function Pl(e){e.preventDefault()}function im(e){e.stopPropagation()}var we;(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"})(we||(we={}));const jd={start:[we.Space,we.Enter],cancel:[we.Esc],end:[we.Space,we.Enter,we.Tab]},om=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case we.Right:return{...r,x:r.x+25};case we.Left:return{...r,x:r.x-25};case we.Down:return{...r,y:r.y+25};case we.Up:return{...r,y:r.y-25}}};class $a{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 ls($n(r)),this.windowListeners=new ls(wt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Bt.Resize,this.handleCancel),this.windowListeners.add(Bt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Bt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Td(n),r(Qt)}handleKeyDown(t){if(Bi(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=jd,coordinateGetter:o=om,scrollBehavior:a="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=n.current,u=d?{x:d.left,y:d.top}:Qt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=o(t,{active:r,context:n.current,currentCoordinates:u});if(f){const m=ys(f,u),g={x:0,y:0},{scrollableAncestors:_}=n.current;for(const h of _){const y=t.code,{isTop:v,isRight:b,isLeft:x,isBottom:w,maxScroll:C,minScroll:D}=Id(h),j=em(h),k={x:Math.min(y===we.Right?j.right-j.width/2:j.right,Math.max(y===we.Right?j.left:j.left+j.width/2,f.x)),y:Math.min(y===we.Down?j.bottom-j.height/2:j.bottom,Math.max(y===we.Down?j.top:j.top+j.height/2,f.y))},$=y===we.Right&&!b||y===we.Left&&!x,N=y===we.Down&&!w||y===we.Up&&!v;if($&&k.x!==f.x){const A=h.scrollLeft+m.x,U=y===we.Right&&A<=C.x||y===we.Left&&A>=D.x;if(U&&!m.y){h.scrollTo({left:A,behavior:a});return}U?g.x=h.scrollLeft-A:g.x=y===we.Right?h.scrollLeft-C.x:h.scrollLeft-D.x,g.x&&h.scrollBy({left:-g.x,behavior:a});break}else if(N&&k.y!==f.y){const A=h.scrollTop+m.y,U=y===we.Down&&A<=C.y||y===we.Up&&A>=D.y;if(U&&!m.x){h.scrollTo({top:A,behavior:a});return}U?g.y=h.scrollTop-A:g.y=y===we.Down?h.scrollTop-C.y:h.scrollTop-D.y,g.y&&h.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,_n(ys(f,this.referenceCoordinates),g))}}}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()}}$a.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=jd,onActivation:s}=t,{active:i}=r;const{code:o}=e.nativeEvent;if(n.start.includes(o)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function Ml(e){return!!(e&&"distance"in e)}function Ll(e){return!!(e&&"delay"in e)}class Ba{constructor(t,r,n){var s;n===void 0&&(n=sm(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:o}=i;this.props=t,this.events=r,this.document=$n(o),this.documentListeners=new ls(this.document),this.listeners=new ls(n),this.windowListeners=new ls(wt(o)),this.initialCoordinates=(s=Ci(i))!=null?s:Qt,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(Bt.Resize,this.handleCancel),this.windowListeners.add(Bt.DragStart,Pl),this.windowListeners.add(Bt.VisibilityChange,this.handleCancel),this.windowListeners.add(Bt.ContextMenu,Pl),this.documentListeners.add(Bt.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ll(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Ml(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(Bt.Click,im,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Bt.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const c=(r=Ci(t))!=null?r:Qt,d=ys(s,c);if(!n&&a){if(Ml(a)){if(a.tolerance!=null&&co(d,a.tolerance))return this.handleCancel();if(co(d,a.distance))return this.handleStart()}if(Ll(a)&&co(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}t.cancelable&&t.preventDefault(),o(c)}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===we.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const am={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Vi extends Ba{constructor(t){const{event:r}=t,n=$n(r.target);super(t,am,n)}}Vi.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 lm={move:{name:"mousemove"},end:{name:"mouseup"}};var ia;(function(e){e[e.RightClick=2]="RightClick"})(ia||(ia={}));class cm extends Ba{constructor(t){super(t,lm,$n(t.event.target))}}cm.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===ia.RightClick?!1:(n==null||n({event:r}),!0)}}];const uo={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class um extends Ba{constructor(t){super(t,uo)}static setup(){return window.addEventListener(uo.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(uo.move.name,t)};function t(){}}}um.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 cs;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(cs||(cs={}));var Ei;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ei||(Ei={}));function dm(e){let{acceleration:t,activator:r=cs.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=Ei.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:m}=e;const g=hm({delta:f,disabled:!i}),[_,h]=Og(),y=p.useRef({x:0,y:0}),v=p.useRef({x:0,y:0}),b=p.useMemo(()=>{switch(r){case cs.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case cs.DraggableRect:return s}},[r,s,c]),x=p.useRef(null),w=p.useCallback(()=>{const D=x.current;if(!D)return;const j=y.current.x*v.current.x,k=y.current.y*v.current.y;D.scrollBy(j,k)},[]),C=p.useMemo(()=>a===Ei.TreeOrder?[...d].reverse():d,[a,d]);p.useEffect(()=>{if(!i||!d.length||!b){h();return}for(const D of C){if((n==null?void 0:n(D))===!1)continue;const j=d.indexOf(D),k=u[j];if(!k)continue;const{direction:$,speed:N}=Jg(D,k,b,t,m);for(const A of["x","y"])g[A][$[A]]||(N[A]=0,$[A]=0);if(N.x>0||N.y>0){h(),x.current=D,_(w,o),y.current=N,v.current=$;return}}y.current={x:0,y:0},v.current={x:0,y:0},h()},[t,w,n,h,i,o,JSON.stringify(b),JSON.stringify(g),_,d,C,u,JSON.stringify(m)])}const fm={x:{[tt.Backward]:!1,[tt.Forward]:!1},y:{[tt.Backward]:!1,[tt.Forward]:!1}};function hm(e){let{delta:t,disabled:r}=e;const n=Si(t);return Ts(s=>{if(r||!n||!s)return fm;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[tt.Backward]:s.x[tt.Backward]||i.x===-1,[tt.Forward]:s.x[tt.Forward]||i.x===1},y:{[tt.Backward]:s.y[tt.Backward]||i.y===-1,[tt.Forward]:s.y[tt.Forward]||i.y===1}}},[r,t,n])}function pm(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Ts(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function gm(e,t){return p.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,n)}));return[...r,...i]},[]),[e,t])}var vs;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(vs||(vs={}));var oa;(function(e){e.Optimized="optimized"})(oa||(oa={}));const Fl=new Map;function mm(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=p.useState(null),{frequency:a,measure:c,strategy:d}=s,u=p.useRef(e),f=y(),m=ms(f),g=p.useCallback(function(v){v===void 0&&(v=[]),!m.current&&o(b=>b===null?v:b.concat(v.filter(x=>!b.includes(x))))},[m]),_=p.useRef(null),h=Ts(v=>{if(f&&!r)return Fl;if(!v||v===Fl||u.current!==e||i!=null){const b=new Map;for(let x of e){if(!x)continue;if(i&&i.length>0&&!i.includes(x.id)&&x.rect.current){b.set(x.id,x.rect.current);continue}const w=x.node.current,C=w?new Fa(c(w),w):null;x.rect.current=C,C&&b.set(x.id,C)}return b}return v},[e,i,r,f,c]);return p.useEffect(()=>{u.current=e},[e]),p.useEffect(()=>{f||g()},[r,f]),p.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),p.useEffect(()=>{f||typeof a!="number"||_.current!==null||(_.current=setTimeout(()=>{g(),_.current=null},a))},[a,f,g,...n]),{droppableRects:h,measureDroppableContainers:g,measuringScheduled:i!=null};function y(){switch(d){case vs.Always:return!1;case vs.BeforeDragging:return r;default:return!r}}}function Ua(e,t){return Ts(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function ym(e,t){return Ua(e,t)}function vm(e){let{callback:t,disabled:r}=e;const n=$i(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function zi(e){let{callback:t,disabled:r}=e;const n=$i(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function bm(e){return new Fa(Bn(e),e)}function $l(e,t,r){t===void 0&&(t=bm);const[n,s]=p.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??r)!=null?d:null}const u=t(e);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const o=vm({callback(c){if(e)for(const d of c){const{type:u,target:f}=d;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=zi({callback:i});return Kt(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),n}function _m(e){const t=Ua(e);return xd(e,t)}const Bl=[];function wm(e){const t=p.useRef(e),r=Ts(n=>e?n&&n!==Bl&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ui(e):Bl,[e]);return p.useEffect(()=>{t.current=e},[e]),r}function xm(e){const[t,r]=p.useState(null),n=p.useRef(e),s=p.useCallback(i=>{const o=lo(i.target);o&&r(a=>a?(a.set(o,sa(o)),new Map(a)):null)},[]);return p.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const d=lo(c);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,sa(d)]):null}).filter(c=>c!=null);r(a.length?new Map(a):null),n.current=e}return()=>{o(e),o(i)};function o(a){a.forEach(c=>{const d=lo(c);d==null||d.removeEventListener("scroll",s)})}},[s,e]),p.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>_n(i,o),Qt):Nd(e):Qt,[e,t])}function Ul(e,t){t===void 0&&(t=[]);const r=p.useRef(null);return p.useEffect(()=>{r.current=null},t),p.useEffect(()=>{const n=e!==Qt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?ys(e,r.current):Qt}function Sm(e){p.useEffect(()=>{if(!Fi)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 Cm(e,t){return p.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=o=>{i(o,t)},r},{}),[e,t])}function Rd(e){return p.useMemo(()=>e?Gg(e):null,[e])}const Vl=[];function Om(e,t){t===void 0&&(t=Bn);const[r]=e,n=Rd(r?wt(r):null),[s,i]=p.useState(Vl);function o(){i(()=>e.length?e.map(c=>Dd(c)?n:new Fa(t(c),c)):Vl)}const a=zi({callback:o});return Kt(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function kd(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ns(t)?t:e}function Em(e){let{measure:t}=e;const[r,n]=p.useState(null),s=p.useCallback(d=>{for(const{target:u}of d)if(Ns(u)){n(f=>{const m=t(u);return f?{...f,width:m.width,height:m.height}:m});break}},[t]),i=zi({callback:s}),o=p.useCallback(d=>{const u=kd(d);i==null||i.disconnect(),u&&(i==null||i.observe(u)),n(u?t(u):null)},[t,i]),[a,c]=xi(o);return p.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Dm=[{sensor:Vi,options:{}},{sensor:$a,options:{}}],Im={current:{}},si={draggable:{measure:Al},droppable:{measure:Al,strategy:vs.WhileDragging,frequency:oa.Optimized},dragOverlay:{measure:Bn}};class us 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 Nm={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new us,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Oi},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:si,measureDroppableContainers:Oi,windowRect:null,measuringScheduled:!1},Ad={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Oi,draggableNodes:new Map,over:null,measureDroppableContainers:Oi},Rs=p.createContext(Ad),Pd=p.createContext(Nm);function Tm(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new us}}}function jm(e,t){switch(t.type){case Qe.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Qe.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 Qe.DragEnd:case Qe.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Qe.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new us(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case Qe.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const o=new us(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case Qe.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new us(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Rm(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=p.useContext(Rs),i=Si(n),o=Si(r==null?void 0:r.id);return p.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!Bi(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:c,node:d}=a;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const f=Ig(u);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function Md(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function km(e){return p.useMemo(()=>({draggable:{...si.draggable,...e==null?void 0:e.draggable},droppable:{...si.droppable,...e==null?void 0:e.droppable},dragOverlay:{...si.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 Am(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const i=p.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;Kt(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!n)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const u=r(d),f=xd(u,n);if(o||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const m=Cd(d);m&&m.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const qi=p.createContext({...Qt,scaleX:1,scaleY:1});var xr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xr||(xr={}));const Ld=p.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:d,sensors:u=Dm,collisionDetection:f=zg,measuring:m,modifiers:g,..._}=t;const h=p.useReducer(jm,void 0,Tm),[y,v]=h,[b,x]=Ag(),[w,C]=p.useState(xr.Uninitialized),D=w===xr.Initialized,{draggable:{active:j,nodes:k,translate:$},droppable:{containers:N}}=y,A=j!=null?k.get(j):null,U=p.useRef({initial:null,translated:null}),R=p.useMemo(()=>{var Xe;return j!=null?{id:j,data:(Xe=A==null?void 0:A.data)!=null?Xe:Im,rect:U}:null},[j,A]),B=p.useRef(null),[F,J]=p.useState(null),[ie,me]=p.useState(null),ve=ms(_,Object.values(_)),be=js("DndDescribedBy",o),K=p.useMemo(()=>N.getEnabled(),[N]),M=km(m),{droppableRects:G,measureDroppableContainers:P,measuringScheduled:Y}=mm(K,{dragging:D,dependencies:[$.x,$.y],config:M.droppable}),W=pm(k,j),oe=p.useMemo(()=>ie?Ci(ie):null,[ie]),pe=Mr(),Ne=ym(W,M.draggable.measure);Am({activeNode:j!=null?k.get(j):null,config:pe.layoutShiftCompensation,initialRect:Ne,measure:M.draggable.measure});const re=$l(W,M.draggable.measure,Ne),se=$l(W?W.parentElement:null),le=p.useRef({activatorEvent:null,active:null,activeNode:W,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Le=N.getNodeFor((r=le.current.over)==null?void 0:r.id),ze=Em({measure:M.dragOverlay.measure}),Te=(n=ze.nodeRef.current)!=null?n:W,te=D?(s=ze.rect)!=null?s:re:null,We=!!(ze.nodeRef.current&&ze.rect),at=_m(We?null:re),vt=Rd(Te?wt(Te):null),qe=wm(D?Le??W:null),Ye=Om(qe),lt=Md(g,{transform:{x:$.x-at.x,y:$.y-at.y,scaleX:1,scaleY:1},activatorEvent:ie,active:R,activeNodeRect:re,containerNodeRect:se,draggingNodeRect:te,over:le.current.over,overlayNodeRect:ze.rect,scrollableAncestors:qe,scrollableAncestorRects:Ye,windowRect:vt}),Us=oe?_n(oe,$):null,so=xm(qe),vl=Ul(so),Vs=Ul(so,[re]),S=_n(lt,vl),I=te?Wg(te,lt):null,T=R&&I?f({active:R,collisionRect:I,droppableRects:G,droppableContainers:K,pointerCoordinates:Us}):null,V=wd(T,"id"),[z,Q]=p.useState(null),q=We?lt:_n(lt,Vs),ee=qg(q,(i=z==null?void 0:z.rect)!=null?i:null,re),he=p.useRef(null),Fe=p.useCallback((Xe,ct)=>{let{sensor:bt,options:Vt}=ct;if(B.current==null)return;const Pt=k.get(B.current);if(!Pt)return;const Nt=Xe.nativeEvent,Xt=new bt({active:B.current,activeNode:Pt,event:Nt,options:Vt,context:le,onAbort(rt){if(!k.get(rt))return;const{onDragAbort:Zt}=ve.current,cr={id:rt};Zt==null||Zt(cr),b({type:"onDragAbort",event:cr})},onPending(rt,gr,Zt,cr){if(!k.get(rt))return;const{onDragPending:Kn}=ve.current,mr={id:rt,constraint:gr,initialCoordinates:Zt,offset:cr};Kn==null||Kn(mr),b({type:"onDragPending",event:mr})},onStart(rt){const gr=B.current;if(gr==null)return;const Zt=k.get(gr);if(!Zt)return;const{onDragStart:cr}=ve.current,Wn={activatorEvent:Nt,active:{id:gr,data:Zt.data,rect:U}};Rr.unstable_batchedUpdates(()=>{cr==null||cr(Wn),C(xr.Initializing),v({type:Qe.DragStart,initialCoordinates:rt,active:gr}),b({type:"onDragStart",event:Wn}),J(he.current),me(Nt)})},onMove(rt){v({type:Qe.DragMove,coordinates:rt})},onEnd:ln(Qe.DragEnd),onCancel:ln(Qe.DragCancel)});he.current=Xt;function ln(rt){return async function(){const{active:Zt,collisions:cr,over:Wn,scrollAdjustedTranslate:Kn}=le.current;let mr=null;if(Zt&&Kn){const{cancelDrop:Qn}=ve.current;mr={activatorEvent:Nt,active:Zt,collisions:cr,delta:Kn,over:Wn},rt===Qe.DragEnd&&typeof Qn=="function"&&await Promise.resolve(Qn(mr))&&(rt=Qe.DragCancel)}B.current=null,Rr.unstable_batchedUpdates(()=>{v({type:rt}),C(xr.Uninitialized),Q(null),J(null),me(null),he.current=null;const Qn=rt===Qe.DragEnd?"onDragEnd":"onDragCancel";if(mr){const io=ve.current[Qn];io==null||io(mr),b({type:Qn,event:mr})}})}}},[k]),xt=p.useCallback((Xe,ct)=>(bt,Vt)=>{const Pt=bt.nativeEvent,Nt=k.get(Vt);if(B.current!==null||!Nt||Pt.dndKit||Pt.defaultPrevented)return;const Xt={active:Nt};Xe(bt,ct.options,Xt)===!0&&(Pt.dndKit={capturedBy:ct.sensor},B.current=Vt,Fe(bt,ct))},[k,Fe]),St=gm(u,xt);Sm(u),Kt(()=>{re&&w===xr.Initializing&&C(xr.Initialized)},[re,w]),p.useEffect(()=>{const{onDragMove:Xe}=ve.current,{active:ct,activatorEvent:bt,collisions:Vt,over:Pt}=le.current;if(!ct||!bt)return;const Nt={active:ct,activatorEvent:bt,collisions:Vt,delta:{x:S.x,y:S.y},over:Pt};Rr.unstable_batchedUpdates(()=>{Xe==null||Xe(Nt),b({type:"onDragMove",event:Nt})})},[S.x,S.y]),p.useEffect(()=>{const{active:Xe,activatorEvent:ct,collisions:bt,droppableContainers:Vt,scrollAdjustedTranslate:Pt}=le.current;if(!Xe||B.current==null||!ct||!Pt)return;const{onDragOver:Nt}=ve.current,Xt=Vt.get(V),ln=Xt&&Xt.rect.current?{id:Xt.id,rect:Xt.rect.current,data:Xt.data,disabled:Xt.disabled}:null,rt={active:Xe,activatorEvent:ct,collisions:bt,delta:{x:Pt.x,y:Pt.y},over:ln};Rr.unstable_batchedUpdates(()=>{Q(ln),Nt==null||Nt(rt),b({type:"onDragOver",event:rt})})},[V]),Kt(()=>{le.current={activatorEvent:ie,active:R,activeNode:W,collisionRect:I,collisions:T,droppableRects:G,draggableNodes:k,draggingNode:Te,draggingNodeRect:te,droppableContainers:N,over:z,scrollableAncestors:qe,scrollAdjustedTranslate:S},U.current={initial:te,translated:I}},[R,W,T,I,k,Te,te,G,N,z,qe,S]),dm({...pe,delta:$,draggingRect:I,pointerCoordinates:Us,scrollableAncestors:qe,scrollableAncestorRects:Ye});const lr=p.useMemo(()=>({active:R,activeNode:W,activeNodeRect:re,activatorEvent:ie,collisions:T,containerNodeRect:se,dragOverlay:ze,draggableNodes:k,droppableContainers:N,droppableRects:G,over:z,measureDroppableContainers:P,scrollableAncestors:qe,scrollableAncestorRects:Ye,measuringConfiguration:M,measuringScheduled:Y,windowRect:vt}),[R,W,re,ie,T,se,ze,k,N,G,z,P,qe,Ye,M,Y,vt]),Hn=p.useMemo(()=>({activatorEvent:ie,activators:St,active:R,activeNodeRect:re,ariaDescribedById:{draggable:be},dispatch:v,draggableNodes:k,over:z,measureDroppableContainers:P}),[ie,St,R,re,v,be,k,z,P]);return p.createElement(yd.Provider,{value:x},p.createElement(Rs.Provider,{value:Hn},p.createElement(Pd.Provider,{value:lr},p.createElement(qi.Provider,{value:ee},d)),p.createElement(Rm,{disabled:(a==null?void 0:a.restoreFocus)===!1})),p.createElement(Lg,{...a,hiddenTextDescribedById:be}));function Mr(){const Xe=(F==null?void 0:F.autoScrollEnabled)===!1,ct=typeof c=="object"?c.enabled===!1:c===!1,bt=D&&!Xe&&!ct;return typeof c=="object"?{...c,enabled:bt}:{enabled:bt}}}),Pm=p.createContext(null),zl="button",Mm="Draggable";function Fd(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=js(Mm),{activators:o,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:m}=p.useContext(Rs),{role:g=zl,roleDescription:_="draggable",tabIndex:h=0}=s??{},y=(c==null?void 0:c.id)===t,v=p.useContext(y?qi:Pm),[b,x]=xi(),[w,C]=xi(),D=Cm(o,t),j=ms(r);Kt(()=>(f.set(t,{id:t,key:i,node:b,activatorNode:w,data:j}),()=>{const $=f.get(t);$&&$.key===i&&f.delete(t)}),[f,t]);const k=p.useMemo(()=>({role:g,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&g===zl?!0:void 0,"aria-roledescription":_,"aria-describedby":u.draggable}),[n,g,h,y,_,u.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:k,isDragging:y,listeners:n?void 0:D,node:b,over:m,setNodeRef:x,setActivatorNodeRef:C,transform:v}}function $d(){return p.useContext(Pd)}const Lm="Droppable",Fm={timeout:25};function $m(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=js(Lm),{active:o,dispatch:a,over:c,measureDroppableContainers:d}=p.useContext(Rs),u=p.useRef({disabled:r}),f=p.useRef(!1),m=p.useRef(null),g=p.useRef(null),{disabled:_,updateMeasurementsFor:h,timeout:y}={...Fm,...s},v=ms(h??n),b=p.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{d(Array.isArray(v.current)?v.current:[v.current]),g.current=null},y)},[y]),x=zi({callback:b,disabled:_||!o}),w=p.useCallback((k,$)=>{x&&($&&(x.unobserve($),f.current=!1),k&&x.observe(k))},[x]),[C,D]=xi(w),j=ms(t);return p.useEffect(()=>{!x||!C.current||(x.disconnect(),f.current=!1,x.observe(C.current))},[C,x]),p.useEffect(()=>(a({type:Qe.RegisterDroppable,element:{id:n,key:i,disabled:r,node:C,rect:m,data:j}}),()=>a({type:Qe.UnregisterDroppable,key:i,id:n})),[n]),p.useEffect(()=>{r!==u.current.disabled&&(a({type:Qe.SetDroppableDisabled,id:n,key:i,disabled:r}),u.current.disabled=r)},[n,i,r,a]),{active:o,rect:m,isOver:(c==null?void 0:c.id)===n,node:C,over:c,setNodeRef:D}}function Bm(e){let{animation:t,children:r}=e;const[n,s]=p.useState(null),[i,o]=p.useState(null),a=Si(r);return!r&&!n&&a&&s(a),Kt(()=>{if(!i)return;const c=n==null?void 0:n.key,d=n==null?void 0:n.props.id;if(c==null||d==null){s(null);return}Promise.resolve(t(d,i)).then(()=>{s(null)})},[t,n,i]),p.createElement(p.Fragment,null,r,n?p.cloneElement(n,{ref:o}):null)}const Um={x:0,y:0,scaleX:1,scaleY:1};function Vm(e){let{children:t}=e;return p.createElement(Rs.Provider,{value:Ad},p.createElement(qi.Provider,{value:Um},t))}const zm={position:"fixed",touchAction:"none"},qm=e=>Bi(e)?"transform 250ms ease":void 0,Hm=p.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:d,transition:u=qm}=e;if(!a)return null;const f=s?d:{...d,scaleX:1,scaleY:1},m={...zm,width:a.width,height:a.height,top:a.top,left:a.left,transform:Ar.Transform.toString(f),transformOrigin:s&&n?Fg(n,a):void 0,transition:typeof u=="function"?u(n):u,...c};return p.createElement(r,{className:o,style:m,ref:t},i)}),Wm=e=>t=>{let{active:r,dragOverlay:n}=t;const s={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[a,c]of Object.entries(i.active))c!==void 0&&(s[a]=r.node.style.getPropertyValue(a),r.node.style.setProperty(a,c));if(i!=null&&i.dragOverlay)for(const[a,c]of Object.entries(i.dragOverlay))c!==void 0&&n.node.style.setProperty(a,c);return o!=null&&o.active&&r.node.classList.add(o.active),o!=null&&o.dragOverlay&&n.node.classList.add(o.dragOverlay),function(){for(const[c,d]of Object.entries(s))r.node.style.setProperty(c,d);o!=null&&o.active&&r.node.classList.remove(o.active)}},Km=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Ar.Transform.toString(t)},{transform:Ar.Transform.toString(r)}]},Qm={duration:250,easing:"ease",keyframes:Km,sideEffects:Wm({styles:{active:{opacity:"0"}}})};function Gm(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return $i((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const d=kd(o);if(!d)return;const{transform:u}=wt(o).getComputedStyle(o),f=Sd(u);if(!f)return;const m=typeof t=="function"?t:Ym(t);return Td(c,s.draggable.measure),m({active:{id:i,data:a.data,node:c,rect:s.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:o,rect:s.dragOverlay.measure(d)},droppableContainers:n,measuringConfiguration:s,transform:f})})}function Ym(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...Qm,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...d}=i;if(!t)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},f={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/a.rect.height:1},m={x:c.x-u.x,y:c.y-u.y,...f},g=s({...d,active:o,dragOverlay:a,transform:{initial:c,final:m}}),[_]=g,h=g[g.length-1];if(JSON.stringify(_)===JSON.stringify(h))return;const y=n==null?void 0:n({active:o,dragOverlay:a,...d}),v=a.node.animate(g,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{v.onfinish=()=>{y==null||y(),b()}})}}let ql=0;function Xm(e){return p.useMemo(()=>{if(e!=null)return ql++,ql},[e])}const Zm=p.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:d=999}=e;const{activatorEvent:u,active:f,activeNodeRect:m,containerNodeRect:g,draggableNodes:_,droppableContainers:h,dragOverlay:y,over:v,measuringConfiguration:b,scrollableAncestors:x,scrollableAncestorRects:w,windowRect:C}=$d(),D=p.useContext(qi),j=Xm(f==null?void 0:f.id),k=Md(o,{activatorEvent:u,active:f,activeNodeRect:m,containerNodeRect:g,draggingNodeRect:y.rect,over:v,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:w,transform:D,windowRect:C}),$=Ua(m),N=Gm({config:n,draggableNodes:_,droppableContainers:h,measuringConfiguration:b}),A=$?y.setRef:void 0;return p.createElement(Vm,null,p.createElement(Bm,{animation:N},f&&j?p.createElement(Hm,{key:j,id:f.id,ref:A,as:a,activatorEvent:u,adjustScale:t,className:c,transition:i,rect:$,style:{zIndex:d,...s},transform:k},r):null))});/**
182
182
  * @license lucide-react v0.400.0 - ISC
183
183
  *
184
184
  * This source code is licensed under the ISC license.
@@ -218,7 +218,7 @@ to {
218
218
  *
219
219
  * This source code is licensed under the ISC license.
220
220
  * See the LICENSE file in the root directory of this source tree.
221
- */const Vn=de("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
221
+ */const Un=de("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
222
222
  * @license lucide-react v0.400.0 - ISC
223
223
  *
224
224
  * This source code is licensed under the ISC license.
@@ -243,12 +243,12 @@ to {
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 Ua=de("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"}]]);/**
246
+ */const Va=de("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"}]]);/**
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 oa=de("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"}]]);/**
251
+ */const aa=de("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"}]]);/**
252
252
  * @license lucide-react v0.400.0 - ISC
253
253
  *
254
254
  * 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 Va=de("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"}]]);/**
271
+ */const za=de("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"}]]);/**
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 zn=de("File",[["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"}]]);/**
276
+ */const Vn=de("File",[["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"}]]);/**
277
277
  * @license lucide-react v0.400.0 - ISC
278
278
  *
279
279
  * This source code is licensed under the ISC license.
@@ -308,7 +308,7 @@ to {
308
308
  *
309
309
  * This source code is licensed under the ISC license.
310
310
  * See the LICENSE file in the root directory of this source tree.
311
- */const za=de("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"}]]);/**
311
+ */const qa=de("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"}]]);/**
312
312
  * @license lucide-react v0.400.0 - ISC
313
313
  *
314
314
  * This source code is licensed under the ISC license.
@@ -318,17 +318,17 @@ to {
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 si=de("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/**
321
+ */const ii=de("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/**
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 qa=de("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"}]]);/**
326
+ */const Ha=de("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"}]]);/**
327
327
  * @license lucide-react v0.400.0 - ISC
328
328
  *
329
329
  * This source code is licensed under the ISC license.
330
330
  * See the LICENSE file in the root directory of this source tree.
331
- */const Ha=de("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"}]]);/**
331
+ */const Wa=de("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"}]]);/**
332
332
  * @license lucide-react v0.400.0 - ISC
333
333
  *
334
334
  * This source code is licensed under the ISC license.
@@ -358,7 +358,7 @@ to {
358
358
  *
359
359
  * This source code is licensed under the ISC license.
360
360
  * See the LICENSE file in the root directory of this source tree.
361
- */const ql=de("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"}]]);/**
361
+ */const Hl=de("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"}]]);/**
362
362
  * @license lucide-react v0.400.0 - ISC
363
363
  *
364
364
  * This source code is licensed under the ISC license.
@@ -373,7 +373,7 @@ 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 aa=de("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
376
+ */const la=de("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
377
377
  * @license lucide-react v0.400.0 - ISC
378
378
  *
379
379
  * This source code is licensed under the ISC license.
@@ -393,12 +393,12 @@ to {
393
393
  *
394
394
  * This source code is licensed under the ISC license.
395
395
  * See the LICENSE file in the root directory of this source tree.
396
- */const Wa=de("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"}]]);/**
396
+ */const Ka=de("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"}]]);/**
397
397
  * @license lucide-react v0.400.0 - ISC
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 Hl=de("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"}]]);/**
401
+ */const Wl=de("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"}]]);/**
402
402
  * @license lucide-react v0.400.0 - ISC
403
403
  *
404
404
  * This source code is licensed under the ISC license.
@@ -408,12 +408,12 @@ to {
408
408
  *
409
409
  * This source code is licensed under the ISC license.
410
410
  * See the LICENSE file in the root directory of this source tree.
411
- */const Ka=de("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"}]]);/**
411
+ */const Qa=de("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"}]]);/**
412
412
  * @license lucide-react v0.400.0 - ISC
413
413
  *
414
414
  * This source code is licensed under the ISC license.
415
415
  * See the LICENSE file in the root directory of this source tree.
416
- */const on=de("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),xy={},Wl=e=>{let t;const r=new Set,n=(u,f)=>{const m=typeof u=="function"?u(t):u;if(!Object.is(m,t)){const g=t;t=f??(typeof m!="object"||m===null)?m:Object.assign({},t,m),r.forEach(_=>_(t,g))}},s=()=>t,c={setState:n,getState:s,getInitialState:()=>d,subscribe:u=>(r.add(u),()=>r.delete(u)),destroy:()=>{(xy?"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()}},d=t=e(n,s,c);return c},Sy=e=>e?Wl(e):Wl;function Kd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var la={exports:{}},uo={},Ws={exports:{}},fo={};/**
416
+ */const on=de("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),xy={},Kl=e=>{let t;const r=new Set,n=(u,f)=>{const m=typeof u=="function"?u(t):u;if(!Object.is(m,t)){const g=t;t=f??(typeof m!="object"||m===null)?m:Object.assign({},t,m),r.forEach(_=>_(t,g))}},s=()=>t,c={setState:n,getState:s,getInitialState:()=>d,subscribe:u=>(r.add(u),()=>r.delete(u)),destroy:()=>{(xy?"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()}},d=t=e(n,s,c);return c},Sy=e=>e?Kl(e):Kl;function Kd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ca={exports:{}},fo={},Ws={exports:{}},ho={};/**
417
417
  * @license React
418
418
  * use-sync-external-store-shim.production.js
419
419
  *
@@ -421,7 +421,7 @@ to {
421
421
  *
422
422
  * This source code is licensed under the MIT license found in the
423
423
  * LICENSE file in the root directory of this source tree.
424
- */var Kl;function Cy(){if(Kl)return fo;Kl=1;var e=p;function t(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(f,m){var g=m(),_=n({inst:{value:g,getSnapshot:m}}),h=_[0].inst,y=_[1];return i(function(){h.value=g,h.getSnapshot=m,c(h)&&y({inst:h})},[f,g,m]),s(function(){return c(h)&&y({inst:h}),f(function(){c(h)&&y({inst:h})})},[f]),o(g),g}function c(f){var m=f.getSnapshot;f=f.value;try{var g=m();return!r(f,g)}catch{return!0}}function d(f,m){return m()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return fo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,fo}var ho={};/**
424
+ */var Ql;function Cy(){if(Ql)return ho;Ql=1;var e=p;function t(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(f,m){var g=m(),_=n({inst:{value:g,getSnapshot:m}}),h=_[0].inst,y=_[1];return i(function(){h.value=g,h.getSnapshot=m,c(h)&&y({inst:h})},[f,g,m]),s(function(){return c(h)&&y({inst:h}),f(function(){c(h)&&y({inst:h})})},[f]),o(g),g}function c(f){var m=f.getSnapshot;f=f.value;try{var g=m();return!r(f,g)}catch{return!0}}function d(f,m){return m()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return ho.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,ho}var po={};/**
425
425
  * @license React
426
426
  * use-sync-external-store-shim.development.js
427
427
  *
@@ -429,7 +429,7 @@ to {
429
429
  *
430
430
  * This source code is licensed under the MIT license found in the
431
431
  * LICENSE file in the root directory of this source tree.
432
- */var Ql;function Oy(){return Ql||(Ql=1,process.env.NODE_ENV!=="production"&&function(){function e(g,_){return g===_&&(g!==0||1/g===1/_)||g!==g&&_!==_}function t(g,_){u||s.startTransition===void 0||(u=!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=_();if(!f){var y=_();i(h,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}y=o({inst:{value:h,getSnapshot:_}});var v=y[0].inst,b=y[1];return c(function(){v.value=h,v.getSnapshot=_,r(v)&&b({inst:v})},[g,h,_]),a(function(){return r(v)&&b({inst:v}),g(function(){r(v)&&b({inst:v})})},[g]),d(h),h}function r(g){var _=g.getSnapshot;g=g.value;try{var h=_();return!i(g,h)}catch{return!0}}function n(g,_){return _()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=p,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,c=s.useLayoutEffect,d=s.useDebugValue,u=!1,f=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;ho.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ho}var Gl;function Qa(){return Gl||(Gl=1,process.env.NODE_ENV==="production"?Ws.exports=Cy():Ws.exports=Oy()),Ws.exports}/**
432
+ */var Gl;function Oy(){return Gl||(Gl=1,process.env.NODE_ENV!=="production"&&function(){function e(g,_){return g===_&&(g!==0||1/g===1/_)||g!==g&&_!==_}function t(g,_){u||s.startTransition===void 0||(u=!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=_();if(!f){var y=_();i(h,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}y=o({inst:{value:h,getSnapshot:_}});var v=y[0].inst,b=y[1];return c(function(){v.value=h,v.getSnapshot=_,r(v)&&b({inst:v})},[g,h,_]),a(function(){return r(v)&&b({inst:v}),g(function(){r(v)&&b({inst:v})})},[g]),d(h),h}function r(g){var _=g.getSnapshot;g=g.value;try{var h=_();return!i(g,h)}catch{return!0}}function n(g,_){return _()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=p,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,c=s.useLayoutEffect,d=s.useDebugValue,u=!1,f=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;po.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),po}var Yl;function Ga(){return Yl||(Yl=1,process.env.NODE_ENV==="production"?Ws.exports=Cy():Ws.exports=Oy()),Ws.exports}/**
433
433
  * @license React
434
434
  * use-sync-external-store-shim/with-selector.production.js
435
435
  *
@@ -437,7 +437,7 @@ to {
437
437
  *
438
438
  * This source code is licensed under the MIT license found in the
439
439
  * LICENSE file in the root directory of this source tree.
440
- */var Yl;function Ey(){if(Yl)return uo;Yl=1;var e=p,t=Qa();function r(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}var n=typeof Object.is=="function"?Object.is:r,s=t.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,c=e.useDebugValue;return uo.useSyncExternalStoreWithSelector=function(d,u,f,m,g){var _=i(null);if(_.current===null){var h={hasValue:!1,value:null};_.current=h}else h=_.current;_=a(function(){function v(D){if(!b){if(b=!0,x=D,D=m(D),g!==void 0&&h.hasValue){var j=h.value;if(g(j,D))return w=j}return w=D}if(j=w,n(x,D))return j;var k=m(D);return g!==void 0&&g(j,k)?(x=D,j):(x=D,w=k)}var b=!1,x,w,C=f===void 0?null:f;return[function(){return v(u())},C===null?void 0:function(){return v(C())}]},[u,f,m,g]);var y=s(d,_[0],_[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},uo}var po={};/**
440
+ */var Xl;function Ey(){if(Xl)return fo;Xl=1;var e=p,t=Ga();function r(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}var n=typeof Object.is=="function"?Object.is:r,s=t.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,c=e.useDebugValue;return fo.useSyncExternalStoreWithSelector=function(d,u,f,m,g){var _=i(null);if(_.current===null){var h={hasValue:!1,value:null};_.current=h}else h=_.current;_=a(function(){function v(D){if(!b){if(b=!0,x=D,D=m(D),g!==void 0&&h.hasValue){var j=h.value;if(g(j,D))return w=j}return w=D}if(j=w,n(x,D))return j;var k=m(D);return g!==void 0&&g(j,k)?(x=D,j):(x=D,w=k)}var b=!1,x,w,C=f===void 0?null:f;return[function(){return v(u())},C===null?void 0:function(){return v(C())}]},[u,f,m,g]);var y=s(d,_[0],_[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},fo}var go={};/**
441
441
  * @license React
442
442
  * use-sync-external-store-shim/with-selector.development.js
443
443
  *
@@ -445,22 +445,22 @@ to {
445
445
  *
446
446
  * This source code is licensed under the MIT license found in the
447
447
  * LICENSE file in the root directory of this source tree.
448
- */var Xl;function Dy(){return Xl||(Xl=1,process.env.NODE_ENV!=="production"&&function(){function e(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=p,r=Qa(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;po.useSyncExternalStoreWithSelector=function(d,u,f,m,g){var _=i(null);if(_.current===null){var h={hasValue:!1,value:null};_.current=h}else h=_.current;_=a(function(){function v(D){if(!b){if(b=!0,x=D,D=m(D),g!==void 0&&h.hasValue){var j=h.value;if(g(j,D))return w=j}return w=D}if(j=w,n(x,D))return j;var k=m(D);return g!==void 0&&g(j,k)?(x=D,j):(x=D,w=k)}var b=!1,x,w,C=f===void 0?null:f;return[function(){return v(u())},C===null?void 0:function(){return v(C())}]},[u,f,m,g]);var y=s(d,_[0],_[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),po}process.env.NODE_ENV==="production"?la.exports=Ey():la.exports=Dy();var Iy=la.exports;const Ny=Kd(Iy),Qd={},{useDebugValue:Ty}=p,{useSyncExternalStoreWithSelector:jy}=Ny;let Zl=!1;const Ry=e=>e;function ky(e,t=Ry,r){(Qd?"production":void 0)!=="production"&&r&&!Zl&&(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"),Zl=!0);const n=jy(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Ty(n),n}const Jl=e=>{(Qd?"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"?Sy(e):e,r=(n,s)=>ky(t,n,s);return Object.assign(r,t),r},qi=e=>e?Jl(e):Jl,ue=qi(e=>({editorConfig:null,editorMode:"edit",buttonLoaders:{saveCollection:!1,publishCollection:!1,addFromLibrary:!1,rejectCollection:!1,sendBackCollection:!1,sourcingApproveCollection:!1,sourcingRejectCollection:!1},showPreview:!1,pageId:"collection_editor",isCurrentNodeFolder:!1,isCurrentNodeRoot:!1,isQumlPlayer:!1,isDirty:!1,lastSaved:null,formStatusMapper:{},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}),setFormStatus:(t,r)=>e(n=>({formStatusMapper:{...n.formStatusMapper,[t]:r}})),validateAllForms:t=>{const r=ue.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}})})),Ay=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:ue},Symbol.toStringTag,{value:"Module"}));function Br(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 Gd(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=Gd(s.children,t,r+1);if(i>=0)return i}}return-1}const Py=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function Yd(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Py)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:Yd(n.children,t,r)}:n})}function ii(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:ii(n.children,t,r)}:n)}function ca(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?ca(r.children,t):[]}))}function Xd(e,t,r,n){return e.map(s=>{if(s.id===t){const i=[...s.children??[]],[o]=i.splice(r,1);return i.splice(n,0,o),{...s,children:i}}return s.children&&s.children.length>0?{...s,children:Xd(s.children,t,r,n)}:s})}function Zd(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?Zd(r.children,t):[]}})}function My(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 Ly(e,t){const r=Br(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?Br(e,s.parent):void 0;return n}const Re=qi((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(),o=Br(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};ue.getState().setNodeFlags({isFolder:(o==null?void 0:o.isFolder)??!1,isRoot:!(o!=null&&o.parent),isQuml:!1}),e({selectedNodeId:r,breadcrumb:a,activeNodeMeta:c})},updateNode:(r,n)=>{e(s=>({treeData:Yd(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),ue.getState().setIsDirty(!0)},addNode:(r,n)=>{var d,u;const s=t(),i=((u=(d=ue.getState().editorConfig)==null?void 0:d.config)==null?void 0:u.maxDepth)??4,o=Gd(s.treeData,r);if(o>=i)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${i}). parentDepth=${o}`),"";const a="temp-"+Math.random().toString(36).slice(2),c={id:a,identifier:a,name:"Untitled Unit",isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:a,name:"Untitled Unit",visibility:"Parent"}};return e(f=>({treeData:ii(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(a),0),a},deleteNode:r=>{e(n=>({treeData:ca(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:Xd(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=Br(i.treeData,r);if(!o)return i;let a=ca(i.treeData,r);return a=ii(a,s,{...o,parent:s}),{treeData:a}}),ue.getState().setIsDirty(!0)},addResource:(r,n)=>{var u,f,m;const s=ue.getState().editorConfig,i=((u=s==null?void 0:s.config)==null?void 0:u.allowContentUnderRoot)??!1,o=(f=t().treeData[0])==null?void 0:f.id;if(!i&&n===o||Br(t().treeData,r.identifier))return!1;const a=((m=s==null?void 0:s.config)==null?void 0:m.maxContentsLimit)??1200;if(My(t().treeData)>=a)return!1;const d={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(g=>({treeData:ii(g.treeData,n,d)})),t().markDirty(),!0},markDirty:()=>{ue.getState().setIsDirty(!0)},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const s=Zd(n.treeData,r),i={};for(const[a,c]of Object.entries(n.treeCache)){const d=r[a]??a,{isNew:u,...f}=c;i[d]=f}const o=n.selectedNodeId?r[n.selectedNodeId]??n.selectedNodeId:null;return{treeData:s,treeCache:i,selectedNodeId:o}})},getNodeById:r=>Br(t().treeData,r),getChildrenOf:r=>{const n=Br(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>Ly(t().treeData,r)})),Fy=qi(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),$y="_spin_1ah4d_9",By={spin:$y},Uy=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:By.spin,width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-label":"Loading",role:"status",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"3",strokeDasharray:"31.4",strokeDashoffset:"10",strokeLinecap:"round"})}),Ie=({variant:e="ghost",size:t="md",isLoading:r,disabled:n,onClick:s,children:i,className:o,type:a="button"})=>l.jsxs("button",{type:a,className:`sbx-btn-${e} ${t==="sm"?"sbx-btn-sm":""} ${o??""}`,onClick:s,disabled:r||n,"aria-busy":r?!0:void 0,children:[r?l.jsx(Uy,{size:14}):null,i]}),Vy="_overlay_w9xez_1",zy="_modal_w9xez_11",qy="_modalHeader_w9xez_23",Hy="_modalHeaderClose_w9xez_33",Wy="_modalBody_w9xez_51",Ky="_modalFooter_w9xez_58",Qy="_checkRow_w9xez_65",Gy="_formGroup_w9xez_108",Yy="_textarea_w9xez_119",Xy="_sliderGroup_w9xez_140",Zy="_sliderValue_w9xez_152",Jy="_sliderLabels_w9xez_160",ev="_sectionTitle_w9xez_168",De={overlay:Vy,modal:zy,modalHeader:qy,modalHeaderClose:Hy,modalBody:Wy,modalFooter:Ky,checkRow:Qy,formGroup:Gy,textarea:Yy,sliderGroup:Xy,sliderValue:Zy,sliderLabels:Jy,sectionTitle:ev},tv=({contentId:e,onConfirm:t,onCancel:r})=>{const n=ue(u=>{var f,m;return(m=(f=u.editorConfig)==null?void 0:f.config)==null?void 0:m.objectType})||"Content",s=ue(u=>u.publishChecklist)??[],[i,o]=p.useState({}),a=s.every(u=>i[u.code]),c=s.length===0||a,d=()=>{t()};return l.jsx("div",{className:De.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:De.modal,children:[l.jsxs("div",{className:De.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:De.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:De.modalBody,children:s.length===0?l.jsxs("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:["Are you sure you want to publish this ",n,"?"]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:De.sectionTitle,children:"Please confirm that ALL the following items are verified (by ticking the check-boxes) before you can publish:"}),s.map(u=>l.jsxs("label",{className:De.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!i[u.code],onChange:f=>o(m=>({...m,[u.code]:f.target.checked}))}),l.jsx("span",{children:u.label})]},u.code))]})}),l.jsxs("div",{className:De.modalFooter,children:[l.jsx(Ie,{variant:"ghost",onClick:r,children:"No"}),l.jsx(Ie,{variant:"primary",onClick:d,disabled:!c,children:"Yes"})]})]})})},rv=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=p.useState(""),[o,a]=p.useState(7),c=t==="approve",d=c?"Review Quality":"Reject Content",u=!c&&s.trim().length===0,f=()=>{c?r(s.trim(),o):r(s.trim())};return l.jsx("div",{className:De.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:De.modal,children:[l.jsxs("div",{className:De.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:d}),l.jsx("button",{className:De.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:De.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:De.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:De.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:m=>a(Number(m.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:De.sliderValue,children:o})]}),l.jsxs("div",{className:De.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:De.formGroup,children:[l.jsxs("label",{htmlFor:"quality-comment",children:["Comment"," ",l.jsx("span",{style:{fontWeight:400,color:"var(--sbx-gray-400, #9CA3AF)"},children:"(optional)"})]}),l.jsx("textarea",{id:"quality-comment",className:De.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:m=>i(m.target.value),rows:4})]})]}):l.jsxs("div",{className:De.formGroup,children:[l.jsxs("label",{htmlFor:"reject-reason",children:["Rejection Reason"," ",l.jsx("span",{style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:"reject-reason",className:De.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:m=>i(m.target.value),rows:5,required:!0,"aria-required":"true"}),s.trim().length===0&&l.jsx("p",{style:{fontSize:12,color:"var(--sbx-error, #DC2626)",marginTop:4},children:"A rejection reason is required."})]})}),l.jsxs("div",{className:De.modalFooter,children:[l.jsx(Ie,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(Ie,{variant:c?"primary":"danger",onClick:f,disabled:u,children:c?"Approve":"Reject"})]})]})})};function Jd(e,t){return function(){return e.apply(t,arguments)}}const{toString:nv}=Object.prototype,{getPrototypeOf:Pn}=Object,{iterator:Ps,toStringTag:ef}=Symbol,Ei=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),bs=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),Ei(r,t))return!0;r=Pn(r)}return!1},sv=(e,t)=>e!=null&&bs(e,t)?e[t]:void 0,Ga=(e=>t=>{const r=nv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Gt=e=>(e=e.toLowerCase(),t=>Ga(t)===e),Hi=e=>t=>typeof t===e,{isArray:rn}=Array,Mn=Hi("undefined");function qn(e){return e!==null&&!Mn(e)&&e.constructor!==null&&!Mn(e.constructor)&&Dt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const tf=Gt("ArrayBuffer");function iv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&tf(e.buffer),t}const ov=Hi("string"),Dt=Hi("function"),rf=Hi("number"),Hn=e=>e!==null&&typeof e=="object",av=e=>e===!0||e===!1,oi=e=>{if(!Hn(e))return!1;const t=Pn(e);return(t===null||t===Object.prototype||Pn(t)===null)&&!bs(e,ef)&&!bs(e,Ps)},lv=e=>{if(!Hn(e)||qn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},cv=Gt("Date"),uv=Gt("File"),dv=e=>!!(e&&typeof e.uri<"u"),fv=e=>e&&typeof e.getParts<"u",hv=Gt("Blob"),pv=Gt("FileList"),gv=e=>Hn(e)&&Dt(e.pipe);function mv(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const ec=mv(),tc=typeof ec.FormData<"u"?ec.FormData:void 0,yv=e=>{if(!e)return!1;if(tc&&e instanceof tc)return!0;const t=Pn(e);if(!t||t===Object.prototype||!Dt(e.append))return!1;const r=Ga(e);return r==="formdata"||r==="object"&&Dt(e.toString)&&e.toString()==="[object FormData]"},vv=Gt("URLSearchParams"),[bv,_v,wv,xv]=["ReadableStream","Request","Response","Headers"].map(Gt),Sv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ms(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),rn(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(qn(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(n=0;n<o;n++)a=i[n],t.call(null,e[a],a,e)}}function nf(e,t){if(qn(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 Vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,sf=e=>!Mn(e)&&e!==Vr;function ua(...e){const{caseless:t,skipUndefined:r}=sf(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&nf(n,o)||o,c=Ei(n,a)?n[a]:void 0;oi(c)&&oi(i)?n[a]=ua(c,i):oi(i)?n[a]=ua({},i):rn(i)?n[a]=i.slice():(!r||!Mn(i))&&(n[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||qn(a)||(Ms(a,s),typeof a!="object"||rn(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let d=0;d<c.length;d++){const u=c[d];Pv.call(a,u)&&s(a[u],u)}}return n}const Cv=(e,t,r,{allOwnKeys:n}={})=>(Ms(t,(s,i)=>{r&&Dt(s)?Object.defineProperty(e,i,{__proto__:null,value:Jd(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),Ov=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Ev=(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)},Dv=(e,t,r,n)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!n||n(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=r!==!1&&Pn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Iv=(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},Nv=e=>{if(!e)return null;if(rn(e))return e;let t=e.length;if(!rf(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Tv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Pn(Uint8Array)),jv=(e,t)=>{const n=(e&&e[Ps]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Rv=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},kv=Gt("HTMLFormElement"),Av=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:Pv}=Object.prototype,Mv=Gt("RegExp"),of=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Ms(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},Lv=e=>{of(e,(t,r)=>{if(Dt(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Dt(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+"'")})}})},Fv=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return rn(e)?n(e):n(String(e).split(t)),r},$v=()=>{},Bv=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Uv(e){return!!(e&&Dt(e.append)&&e[ef]==="FormData"&&e[Ps])}const Vv=e=>{const t=new WeakSet,r=n=>{if(Hn(n)){if(t.has(n))return;if(qn(n))return n;if(!("toJSON"in n)){t.add(n);const s=rn(n)?[]:{};return Ms(n,(i,o)=>{const a=r(i);!Mn(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},zv=Gt("AsyncFunction"),qv=e=>e&&(Hn(e)||Dt(e))&&Dt(e.then)&&Dt(e.catch),af=((e,t)=>e?setImmediate:t?((r,n)=>(Vr.addEventListener("message",({source:s,data:i})=>{s===Vr&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),Vr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Dt(Vr.postMessage)),Hv=typeof queueMicrotask<"u"?queueMicrotask.bind(Vr):typeof process<"u"&&process.nextTick||af,lf=e=>e!=null&&Dt(e[Ps]),Wv=e=>e!=null&&bs(e,Ps)&&lf(e),E={isArray:rn,isArrayBuffer:tf,isBuffer:qn,isFormData:yv,isArrayBufferView:iv,isString:ov,isNumber:rf,isBoolean:av,isObject:Hn,isPlainObject:oi,isEmptyObject:lv,isReadableStream:bv,isRequest:_v,isResponse:wv,isHeaders:xv,isUndefined:Mn,isDate:cv,isFile:uv,isReactNativeBlob:dv,isReactNative:fv,isBlob:hv,isRegExp:Mv,isFunction:Dt,isStream:gv,isURLSearchParams:vv,isTypedArray:Tv,isFileList:pv,forEach:Ms,merge:ua,extend:Cv,trim:Sv,stripBOM:Ov,inherits:Ev,toFlatObject:Dv,kindOf:Ga,kindOfTest:Gt,endsWith:Iv,toArray:Nv,forEachEntry:jv,matchAll:Rv,isHTMLForm:kv,hasOwnProperty:Ei,hasOwnProp:Ei,hasOwnInPrototypeChain:bs,getSafeProp:sv,reduceDescriptors:of,freezeMethods:Lv,toObjectSet:Fv,toCamelCase:Av,noop:$v,toFiniteNumber:Bv,findKey:nf,global:Vr,isContextDefined:sf,isSpecCompliantForm:Uv,toJSONObject:Vv,isAsyncFn:zv,isThenable:qv,setImmediate:af,asap:Hv,isIterable:lf,isSafeIterable:Wv},Kv=E.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"]),Qv=e=>{const t={};let r,n,s;return e&&e.split(`
449
- `).forEach(function(o){s=o.indexOf(":"),r=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!r||t[r]&&Kv[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function Gv(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 Yv=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Xv=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Ya(e,t){return E.isArray(e)?e.map(r=>Ya(r,t)):Gv(String(e).replace(t,""))}const Zv=e=>Ya(e,Yv),Jv=e=>Ya(e,Xv);function cf(e){const t=Object.create(null);return E.forEach(e.toJSON(),(r,n)=>{t[n]=Jv(r)}),t}const rc=Symbol("internals");function Yn(e){return e&&String(e).trim().toLowerCase()}function ai(e){return e===!1||e==null?e:E.isArray(e)?e.map(ai):Zv(String(e))}function eb(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 tb=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function go(e,t,r,n,s){if(E.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!E.isString(t)){if(E.isString(n))return t.indexOf(n)!==-1;if(E.isRegExp(n))return n.test(t)}}function rb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function nb(e,t){const r=E.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{__proto__:null,value:function(s,i,o){return this[n].call(this,t,s,i,o)},configurable:!0})})}let yt=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,c,d){const u=Yn(c);if(!u)return;const f=E.findKey(s,u);(!f||s[f]===void 0||d===!0||d===void 0&&s[f]!==!1)&&(s[f||c]=ai(a))}const o=(a,c)=>E.forEach(a,(d,u)=>i(d,u,c));if(E.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(E.isString(t)&&(t=t.trim())&&!tb(t))o(Qv(t),r);else if(E.isObject(t)&&E.isSafeIterable(t)){let a=Object.create(null),c,d;for(const u of t){if(!E.isArray(u))throw new TypeError("Object iterator must return a key-value pair");d=u[0],E.hasOwnProp(a,d)?(c=a[d],a[d]=E.isArray(c)?[...c,u[1]]:[c,u[1]]):a[d]=u[1]}o(a,r)}else t!=null&&i(r,t,n);return this}get(t,r){if(t=Yn(t),t){const n=E.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return eb(s);if(E.isFunction(r))return r.call(this,s,n);if(E.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Yn(t),t){const n=E.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||go(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=Yn(o),o){const a=E.findKey(n,o);a&&(!r||go(n,n[a],a,r))&&(delete n[a],s=!0)}}return E.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||go(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const r=this,n={};return E.forEach(this,(s,i)=>{const o=E.findKey(n,i);if(o){r[o]=ai(s),delete r[i];return}const a=t?rb(i):String(i).trim();a!==i&&delete r[i],r[a]=ai(s),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return E.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&E.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(`
450
- `)}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[rc]=this[rc]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Yn(o);n[a]||(nb(s,o),n[a]=!0)}return E.isArray(t)?t.forEach(i):i(t),this}};yt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);E.reduceDescriptors(yt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});E.freezeMethods(yt);const sb="[REDACTED ****]";function ib(e){if(E.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(E.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function ob(e,t){const r=new Set(t.map(i=>String(i).toLowerCase())),n=[],s=i=>{if(i===null||typeof i!="object"||E.isBuffer(i))return i;if(n.indexOf(i)!==-1)return;i instanceof yt&&(i=i.toJSON()),n.push(i);let o;if(E.isArray(i))o=[],i.forEach((a,c)=>{const d=s(a);E.isUndefined(d)||(o[c]=d)});else{if(!E.isPlainObject(i)&&ib(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=r.has(a.toLowerCase())?sb:s(c);E.isUndefined(d)||(o[a]=d)}}return n.pop(),o};return s(e)}let Z=class uf extends Error{static from(t,r,n,s,i,o){const a=new uf(t.message,r||t.code,n,s,i);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}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&&E.hasOwnProp(t,"redact")?t.redact:void 0,n=E.isArray(r)&&r.length>0?ob(t,r):E.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 ab=null,df=100;function da(e){return E.isPlainObject(e)||E.isArray(e)}function ff(e){return E.endsWith(e,"[]")?e.slice(0,-2):e}function mo(e,t,r){return e?e.concat(t).map(function(s,i){return s=ff(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function lb(e){return E.isArray(e)&&!e.some(da)}const cb=E.toFlatObject(E,{},null,function(t){return/^is[A-Z]/.test(t)});function Wi(e,t,r){if(!E.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=E.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,x){return!E.isUndefined(x[b])});const n=r.metaTokens,s=r.visitor||_,i=r.dots,o=r.indexes,a=r.Blob||typeof Blob<"u"&&Blob,c=r.maxDepth===void 0?df:r.maxDepth,d=a&&E.isSpecCompliantForm(t),u=[];if(!E.isFunction(s))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(E.isDate(v))return v.toISOString();if(E.isBoolean(v))return v.toString();if(!d&&E.isBlob(v))throw new Z("Blob is not supported. Use a Buffer instead.");return E.isArrayBuffer(v)||E.isTypedArray(v)?d&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function m(v){if(v>c)throw new Z("Object is too deeply nested ("+v+" levels). Max depth: "+c,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function g(v,b){if(c===1/0)return JSON.stringify(v);const x=[];return JSON.stringify(v,function(C,D){if(!E.isObject(D))return D;for(;x.length&&x[x.length-1]!==this;)x.pop();return x.push(D),m(b+x.length-1),D})}function _(v,b,x){let w=v;if(E.isReactNative(t)&&E.isReactNativeBlob(v))return t.append(mo(x,b,i),f(v)),!1;if(v&&!x&&typeof v=="object"){if(E.endsWith(b,"{}"))b=n?b:b.slice(0,-2),v=g(v,1);else if(E.isArray(v)&&lb(v)||(E.isFileList(v)||E.endsWith(b,"[]"))&&(w=E.toArray(v)))return b=ff(b),w.forEach(function(D,j){!(E.isUndefined(D)||D===null)&&t.append(o===!0?mo([b],j,i):o===null?b:b+"[]",f(D))}),!1}return da(v)?!0:(t.append(mo(x,b,i),f(v)),!1)}const h=Object.assign(cb,{defaultVisitor:_,convertValue:f,isVisitable:da});function y(v,b,x=0){if(!E.isUndefined(v)){if(m(x),u.indexOf(v)!==-1)throw new Error("Circular reference detected in "+b.join("."));u.push(v),E.forEach(v,function(C,D){(!(E.isUndefined(C)||C===null)&&s.call(t,C,E.isString(D)?D.trim():D,b,h))===!0&&y(C,b?b.concat(D):[D],x+1)}),u.pop()}}if(!E.isObject(e))throw new TypeError("data must be an object");return y(e),t}function nc(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function Xa(e,t){this._pairs=[],e&&Wi(e,this,t)}const hf=Xa.prototype;hf.append=function(t,r){this._pairs.push([t,r])};hf.toString=function(t){const r=t?function(n){return t.call(this,n,nc)}:nc;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function ub(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function pf(e,t,r){if(!t)return e;const n=E.isFunction(r)?{serialize:r}:r,s=E.getSafeProp(n,"encode")||ub,i=E.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=E.isURLSearchParams(t)?t.toString():new Xa(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class sc{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){E.forEach(this.handlers,function(n){n!==null&&t(n)})}}const Za={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},db=typeof URLSearchParams<"u"?URLSearchParams:Xa,fb=typeof FormData<"u"?FormData:null,hb=typeof Blob<"u"?Blob:null,pb={isBrowser:!0,classes:{URLSearchParams:db,FormData:fb,Blob:hb},protocols:["http","https","file","blob","url","data"]},Ja=typeof window<"u"&&typeof document<"u",fa=typeof navigator=="object"&&navigator||void 0,gb=Ja&&(!fa||["ReactNative","NativeScript","NS"].indexOf(fa.product)<0),mb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",yb=Ja&&window.location.href||"http://localhost",vb=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ja,hasStandardBrowserEnv:gb,hasStandardBrowserWebWorkerEnv:mb,navigator:fa,origin:yb},Symbol.toStringTag,{value:"Module"})),ot={...vb,...pb};function bb(e,t){return Wi(e,new ot.classes.URLSearchParams,{visitor:function(r,n,s,i){return ot.isNode&&E.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const ic=df;function gf(e){if(e>ic)throw new Z("FormData field is too deeply nested ("+e+" levels). Max depth: "+ic,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function _b(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)gf(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function wb(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 mf(e){function t(r,n,s,i){gf(i);let o=r[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=r.length;return o=!o&&E.isArray(s)?s.length:o,c?(E.hasOwnProp(s,o)?s[o]=E.isArray(s[o])?s[o].concat(n):[s[o],n]:s[o]=n,!a):((!E.hasOwnProp(s,o)||!E.isObject(s[o]))&&(s[o]=[]),t(r,n,s[o],i)&&E.isArray(s[o])&&(s[o]=wb(s[o])),!a)}if(E.isFormData(e)&&E.isFunction(e.entries)){const r={};return E.forEachEntry(e,(n,s)=>{t(_b(n),s,r,0)}),r}return null}const cn=(e,t)=>e!=null&&E.hasOwnProp(e,t)?e[t]:void 0;function xb(e,t,r){if(E.isString(e))try{return(t||JSON.parse)(e),E.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const Ls={transitional:Za,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=E.isObject(t);if(i&&E.isHTMLForm(t)&&(t=new FormData(t)),E.isFormData(t))return s?JSON.stringify(mf(t)):t;if(E.isArrayBuffer(t)||E.isBuffer(t)||E.isStream(t)||E.isFile(t)||E.isBlob(t)||E.isReadableStream(t))return t;if(E.isArrayBufferView(t))return t.buffer;if(E.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const c=cn(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return bb(t,c).toString();if((a=E.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=cn(this,"env"),u=d&&d.FormData;return Wi(a?{"files[]":t}:t,u&&new u,c)}}return i||s?(r.setContentType("application/json",!1),xb(t)):t}],transformResponse:[function(t){const r=cn(this,"transitional")||Ls.transitional,n=r&&r.forcedJSONParsing,s=cn(this,"responseType"),i=s==="json";if(E.isResponse(t)||E.isReadableStream(t))return t;if(t&&E.isString(t)&&(n&&!s||i)){const a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,cn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?Z.from(c,Z.ERR_BAD_RESPONSE,this,null,cn(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ot.classes.FormData,Blob:ot.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};E.forEach(["delete","get","head","post","put","patch","query"],e=>{Ls.headers[e]={}});function yo(e,t){const r=this||Ls,n=t||r,s=yt.from(n.headers);let i=n.data;return E.forEach(e,function(a){i=a.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function yf(e){return!!(e&&e.__CANCEL__)}let Fs=class extends Z{constructor(t,r,n){super(t??"canceled",Z.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function vf(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 Sb(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Cb(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),u=n[i];o||(o=d),r[s]=c,n[s]=d;let f=i,m=0;for(;f!==s;)m+=r[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const g=u&&d-u;return g?Math.round(m*1e3/g):void 0}}function Ob(e,t){let r=0,n=1e3/t,s,i;const o=(d,u=Date.now())=>{r=u,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-r;f>=n?o(d,u):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const Di=(e,t,r=3)=>{let n=0;const s=Cb(50,250);return Ob(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=a!=null?Math.min(o,a):o,d=Math.max(0,c-n),u=s(d);n=Math.max(n,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-c)/u:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},oc=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},ac=e=>(...t)=>E.asap(()=>e(...t)),Eb=ot.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,ot.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(ot.origin),ot.navigator&&/(msie|trident)/i.test(ot.navigator.userAgent)):()=>!0,Db=ot.hasStandardBrowserEnv?{write(e,t,r,n,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];E.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),E.isString(n)&&a.push(`path=${n}`),E.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),E.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.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 Ib(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Nb(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Tb=/^https?:(?!\/\/)/i,jb=/[\t\n\r]/g;function Rb(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function kb(e){return Rb(e).replace(jb,"")}function lc(e,t){if(typeof e=="string"&&Tb.test(kb(e)))throw new Z('Invalid URL: missing "//" after protocol',Z.ERR_INVALID_URL,t)}function bf(e,t,r,n){lc(t,n);let s=!Ib(t);return e&&(s||r===!1)?(lc(e,n),Nb(e,t)):t}const cc=e=>e instanceof yt?{...e}:e;function nn(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(u,f,m,g){return E.isPlainObject(u)&&E.isPlainObject(f)?E.merge.call({caseless:g},u,f):E.isPlainObject(f)?E.merge({},f):E.isArray(f)?f.slice():f}function s(u,f,m,g){if(E.isUndefined(f)){if(!E.isUndefined(u))return n(void 0,u,m,g)}else return n(u,f,m,g)}function i(u,f){if(!E.isUndefined(f))return n(void 0,f)}function o(u,f){if(E.isUndefined(f)){if(!E.isUndefined(u))return n(void 0,u)}else return n(void 0,f)}function a(u){const f=E.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!E.isUndefined(f))if(E.isPlainObject(f)){if(E.hasOwnProp(f,u))return f[u]}else return;const m=E.hasOwnProp(e,"transitional")?e.transitional:void 0;if(E.isPlainObject(m)&&E.hasOwnProp(m,u))return m[u]}function c(u,f,m){if(E.hasOwnProp(t,m))return n(u,f);if(E.hasOwnProp(e,m))return n(void 0,u)}const d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:c,headers:(u,f,m)=>s(cc(u),cc(f),m,!0)};return E.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const m=E.hasOwnProp(d,f)?d[f]:s,g=E.hasOwnProp(e,f)?e[f]:void 0,_=E.hasOwnProp(t,f)?t[f]:void 0,h=m(g,_,f);E.isUndefined(h)&&m!==c||(r[f]=h)}),E.hasOwnProp(t,"validateStatus")&&E.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(E.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const Ab=["content-type","content-length"];function Pb(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{Ab.includes(n.toLowerCase())&&e.set(n,s)})}const Mb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function _f(e){const t=nn({},e),r=m=>E.hasOwnProp(t,m)?t[m]:void 0,n=r("data");let s=r("withXSRFToken");const i=r("xsrfHeaderName"),o=r("xsrfCookieName");let a=r("headers");const c=r("auth"),d=r("baseURL"),u=r("allowAbsoluteUrls"),f=r("url");if(t.headers=a=yt.from(a),t.url=pf(bf(d,f,u,t),r("params"),r("paramsSerializer")),c){const m=E.getSafeProp(c,"username")||"",g=E.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(m+":"+(g?Mb(g):"")))}if(E.isFormData(n)&&(ot.hasStandardBrowserEnv||ot.hasStandardBrowserWebWorkerEnv||E.isReactNative(n)?a.setContentType(void 0):E.isFunction(n.getHeaders)&&Pb(a,n.getHeaders(),r("formDataHeaderPolicy"))),ot.hasStandardBrowserEnv&&(E.isFunction(s)&&(s=s(t)),s===!0||s==null&&Eb(t.url))){const g=i&&o&&Db.read(o);g&&a.set(i,g)}return t}const Lb=typeof XMLHttpRequest<"u",Fb=Lb&&function(e){return new Promise(function(r,n){const s=_f(e);let i=s.data;const o=yt.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:d}=s,u,f,m,g,_;function h(){g&&g(),_&&_(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function v(){if(!y)return;const x=yt.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:e,request:y};vf(function(j){r(j),h()},function(j){n(j),h()},C),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(w){const C=w&&w.message?w.message:"Network Error",D=new Z(C,Z.ERR_NETWORK,e,y);D.event=w||null,n(D),h(),y=null},y.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const C=s.transitional||Za;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new Z(w,C.clarifyTimeoutError?Z.ETIMEDOUT:Z.ECONNABORTED,e,y)),h(),y=null},i===void 0&&o.setContentType(null),"setRequestHeader"in y&&E.forEach(cf(o),function(w,C){y.setRequestHeader(C,w)}),E.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),d&&([m,_]=Di(d,!0),y.addEventListener("progress",m)),c&&y.upload&&([f,g]=Di(c),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(u=x=>{y&&(n(!x||x.type?new Fs(null,e,y):x),y.abort(),h(),y=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const b=Sb(s.url);if(b&&!ot.protocols.includes(b)){n(new Z("Unsupported protocol "+b+":",Z.ERR_BAD_REQUEST,e));return}y.send(i||null)})},$b=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const s=function(c){if(!n){n=!0,o();const d=c instanceof Error?c:this.reason;r.abort(d instanceof Z?d:new Fs(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new Z(`timeout of ${t}ms exceeded`,Z.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),e=null)};e.forEach(c=>c.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>E.asap(o),a},Bb=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},Ub=async function*(e,t){for await(const r of Vb(e))yield*Bb(r,t)},Vb=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()}},uc=(e,t,r,n)=>{const s=Ub(e,t);let i=0,o,a=c=>{o||(o=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await s.next();if(d){a(),c.close();return}let f=u.byteLength;if(r){let m=i+=f;r(m)}c.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},Ii=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,zb=(e,t,r)=>t+2<r&&Ii(e.charCodeAt(t+1))&&Ii(e.charCodeAt(t+2));function qb(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 o=n.length;const a=n.length;for(let g=0;g<a;g++)if(n.charCodeAt(g)===37&&g+2<a){const _=n.charCodeAt(g+1),h=n.charCodeAt(g+2);Ii(_)&&Ii(h)&&(o-=2,g+=2)}let c=0,d=a-1;const u=g=>g>=2&&n.charCodeAt(g-2)===37&&n.charCodeAt(g-1)===51&&(n.charCodeAt(g)===68||n.charCodeAt(g)===100);d>=0&&(n.charCodeAt(d)===61?(c++,d--):u(d)&&(c++,d-=3)),c===1&&d>=0&&(n.charCodeAt(d)===61||u(d))&&c++;const m=Math.floor(o/4)*3-(c||0);return m>0?m:0}let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&zb(n,o,a))i+=1,o+=2;else if(c<128)i+=1;else if(c<2048)i+=2;else if(c>=55296&&c<=56319&&o+1<a){const d=n.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i}const el="1.18.0",dc=64*1024,{isFunction:Ks}=E,Hb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),fc=e=>{if(!E.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},hc=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Wb=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},Kb=e=>{const t=E.global!==void 0&&E.global!==null?E.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=E.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?Ks(s):typeof fetch=="function",c=Ks(i),d=Ks(o);if(!a)return!1;const u=a&&Ks(r),f=a&&(typeof n=="function"?(v=>b=>v.encode(b))(new n):async v=>new Uint8Array(await new i(v).arrayBuffer())),m=c&&u&&hc(()=>{let v=!1;const b=new i(ot.origin,{body:new r,method:"POST",get duplex(){return v=!0,"half"}}),x=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),v&&!x}),g=d&&u&&hc(()=>E.isReadableStream(new o("").body)),_={stream:g&&(v=>v.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!_[v]&&(_[v]=(b,x)=>{let w=b&&b[v];if(w)return w.call(b);throw new Z(`Response type '${v}' is not supported`,Z.ERR_NOT_SUPPORT,x)})});const h=async v=>{if(v==null)return 0;if(E.isBlob(v))return v.size;if(E.isSpecCompliantForm(v))return(await new i(ot.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(E.isArrayBufferView(v)||E.isArrayBuffer(v))return v.byteLength;if(E.isURLSearchParams(v)&&(v=v+""),E.isString(v))return(await f(v)).byteLength},y=async(v,b)=>{const x=E.toFiniteNumber(v.getContentLength());return x??h(b)};return async v=>{let{url:b,method:x,data:w,signal:C,cancelToken:D,timeout:j,onDownloadProgress:k,onUploadProgress:$,responseType:N,headers:A,withCredentials:U="same-origin",fetchOptions:R,maxContentLength:B,maxBodyLength:F}=_f(v);const J=E.isNumber(B)&&B>-1,se=E.isNumber(F)&&F>-1,ge=W=>E.hasOwnProp(v,W)?v[W]:void 0;let ye=s||fetch;N=N?(N+"").toLowerCase():"text";let ve=$b([C,D&&D.toAbortSignal()],j),K=null;const P=ve&&ve.unsubscribe&&(()=>{ve.unsubscribe()});let X,M=null;const G=()=>new Z("Request body larger than maxBodyLength limit",Z.ERR_BAD_REQUEST,v,K);try{let W;const oe=ge("auth");if(oe){const te=E.getSafeProp(oe,"username")||"",We=E.getSafeProp(oe,"password")||"";W={username:te,password:We}}if(Wb(b)){const te=new URL(b,ot.origin);if(!W&&(te.username||te.password)){const We=fc(te.username),at=fc(te.password);W={username:We,password:at}}(te.username||te.password)&&(te.username="",te.password="",b=te.href)}if(W&&(A.delete("authorization"),A.set("Authorization","Basic "+btoa(Hb((W.username||"")+":"+(W.password||""))))),J&&typeof b=="string"&&b.startsWith("data:")&&qb(b)>B)throw new Z("maxContentLength size of "+B+" exceeded",Z.ERR_BAD_RESPONSE,v,K);if(se&&x!=="get"&&x!=="head"){const te=await h(w);if(typeof te=="number"&&isFinite(te)&&(X=te,te>F))throw G()}const be=se&&(E.isReadableStream(w)||E.isStream(w)),Ne=(te,We,at)=>uc(te,dc,vt=>{if(se&&vt>F)throw M=G();We&&We(vt)},at);if(m&&x!=="get"&&x!=="head"&&($||be)){if(X=X??await y(A,w),X!==0||be){let te=new i(b,{method:"POST",body:w,duplex:"half"}),We;if(E.isFormData(w)&&(We=te.headers.get("content-type"))&&A.setContentType(We),te.body){const[at,vt]=$&&oc(X,Di(ac($)))||[];w=Ne(te.body,at,vt)}}}else if(be&&!c&&u&&x!=="get"&&x!=="head")w=Ne(w);else if(be&&c&&!m&&x!=="get"&&x!=="head")throw new Z("Stream request bodies are not supported by the current fetch implementation",Z.ERR_NOT_SUPPORT,v,K);E.isString(U)||(U=U?"include":"omit");const ie=c&&"credentials"in i.prototype;if(E.isFormData(w)){const te=A.getContentType();te&&/^multipart\/form-data/i.test(te)&&!/boundary=/i.test(te)&&A.delete("content-type")}A.set("User-Agent","axios/"+el,!1);const ne={...R,signal:ve,method:x.toUpperCase(),headers:cf(A.normalize()),body:w,duplex:"half",credentials:ie?U:void 0};K=c&&new i(b,ne);let le=await(c?ye(K,R):ye(b,ne));const Le=yt.from(le.headers);if(J){const te=E.toFiniteNumber(Le.getContentLength());if(te!=null&&te>B)throw new Z("maxContentLength size of "+B+" exceeded",Z.ERR_BAD_RESPONSE,v,K)}const ze=g&&(N==="stream"||N==="response");if(g&&le.body&&(k||J||ze&&P)){const te={};["status","statusText","headers"].forEach(lt=>{te[lt]=le[lt]});const We=E.toFiniteNumber(Le.getContentLength()),[at,vt]=k&&oc(We,Di(ac(k),!0))||[];let qe=0;const Ye=lt=>{if(J&&(qe=lt,qe>B))throw new Z("maxContentLength size of "+B+" exceeded",Z.ERR_BAD_RESPONSE,v,K);at&&at(lt)};le=new o(uc(le.body,dc,Ye,()=>{vt&&vt(),P&&P()}),te)}N=N||"text";let Te=await _[E.findKey(_,N)||"text"](le,v);if(J&&!g&&!ze){let te;if(Te!=null&&(typeof Te.byteLength=="number"?te=Te.byteLength:typeof Te.size=="number"?te=Te.size:typeof Te=="string"&&(te=typeof n=="function"?new n().encode(Te).byteLength:Te.length)),typeof te=="number"&&te>B)throw new Z("maxContentLength size of "+B+" exceeded",Z.ERR_BAD_RESPONSE,v,K)}return!ze&&P&&P(),await new Promise((te,We)=>{vf(te,We,{data:Te,headers:yt.from(le.headers),status:le.status,statusText:le.statusText,config:v,request:K})})}catch(W){if(P&&P(),ve&&ve.aborted&&ve.reason instanceof Z){const oe=ve.reason;throw oe.config=v,K&&(oe.request=K),W!==oe&&(oe.cause=W),oe}throw M?(K&&!M.request&&(M.request=K),M):W instanceof Z?(K&&!W.request&&(W.request=K),W):W&&W.name==="TypeError"&&/Load failed|fetch/i.test(W.message)?Object.assign(new Z("Network Error",Z.ERR_NETWORK,v,K,W&&W.response),{cause:W.cause||W}):Z.from(W,W&&W.code,v,K,W&&W.response)}}},Qb=new Map,wf=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,i=[n,s,r];let o=i.length,a=o,c,d,u=Qb;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:Kb(t)),u=d;return d};wf();const tl={http:ab,xhr:Fb,fetch:{get:wf}};E.forEach(tl,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const pc=e=>`- ${e}`,Gb=e=>E.isFunction(e)||e===null||e===!1;function Yb(e,t){e=E.isArray(e)?e:[e];const{length:r}=e;let n,s;const i={};for(let o=0;o<r;o++){n=e[o];let a;if(s=n,!Gb(n)&&(s=tl[(a=String(n)).toLowerCase()],s===void 0))throw new Z(`Unknown adapter '${a}'`);if(s&&(E.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
451
- `+o.map(pc).join(`
452
- `):" "+pc(o[0]):"as no adapter specified";throw new Z("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const xf={getAdapter:Yb,adapters:tl};function vo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Fs(null,e)}function gc(e){return vo(e),e.headers=yt.from(e.headers),e.data=yo.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),xf.getAdapter(e.adapter||Ls.adapter,e)(e).then(function(n){vo(e),e.response=n;try{n.data=yo.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=yt.from(n.headers),n},function(n){if(!yf(n)&&(vo(e),n&&n.response)){e.response=n.response;try{n.response.data=yo.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=yt.from(n.response.headers)}return Promise.reject(n)})}const Ki={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ki[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const mc={};Ki.transitional=function(t,r,n){function s(i,o){return"[Axios v"+el+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,a)=>{if(t===!1)throw new Z(s(o," has been removed"+(r?" in "+r:"")),Z.ERR_DEPRECATED);return r&&!mc[o]&&(mc[o]=!0,console.warn(s(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,o,a):!0}};Ki.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Xb(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],o=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(o){const a=e[i],c=a===void 0||o(a,i,e);if(c!==!0)throw new Z("option "+i+" must be "+c,Z.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Z("Unknown option "+i,Z.ERR_BAD_OPTION)}}const li={assertOptions:Xb,validators:Ki},ut=li.validators;let en=class{constructor(t){this.defaults=t||{},this.interceptors={request:new sc,response:new sc}}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 o=s.stack.indexOf(`
448
+ */var Zl;function Dy(){return Zl||(Zl=1,process.env.NODE_ENV!=="production"&&function(){function e(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=p,r=Ga(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;go.useSyncExternalStoreWithSelector=function(d,u,f,m,g){var _=i(null);if(_.current===null){var h={hasValue:!1,value:null};_.current=h}else h=_.current;_=a(function(){function v(D){if(!b){if(b=!0,x=D,D=m(D),g!==void 0&&h.hasValue){var j=h.value;if(g(j,D))return w=j}return w=D}if(j=w,n(x,D))return j;var k=m(D);return g!==void 0&&g(j,k)?(x=D,j):(x=D,w=k)}var b=!1,x,w,C=f===void 0?null:f;return[function(){return v(u())},C===null?void 0:function(){return v(C())}]},[u,f,m,g]);var y=s(d,_[0],_[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),go}process.env.NODE_ENV==="production"?ca.exports=Ey():ca.exports=Dy();var Iy=ca.exports;const Ny=Kd(Iy),Qd={},{useDebugValue:Ty}=p,{useSyncExternalStoreWithSelector:jy}=Ny;let Jl=!1;const Ry=e=>e;function ky(e,t=Ry,r){(Qd?"production":void 0)!=="production"&&r&&!Jl&&(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"),Jl=!0);const n=jy(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Ty(n),n}const ec=e=>{(Qd?"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"?Sy(e):e,r=(n,s)=>ky(t,n,s);return Object.assign(r,t),r},Hi=e=>e?ec(e):ec,ue=Hi(e=>({editorConfig:null,editorMode:"edit",buttonLoaders:{saveCollection:!1,publishCollection:!1,addFromLibrary:!1,rejectCollection:!1,sendBackCollection:!1,sourcingApproveCollection:!1,sourcingRejectCollection:!1},showPreview:!1,pageId:"collection_editor",isCurrentNodeFolder:!1,isCurrentNodeRoot:!1,isQumlPlayer:!1,isDirty:!1,lastSaved:null,formStatusMapper:{},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}),setFormStatus:(t,r)=>e(n=>({formStatusMapper:{...n.formStatusMapper,[t]:r}})),validateAllForms:t=>{const r=ue.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}})})),Ay=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:ue},Symbol.toStringTag,{value:"Module"}));function Br(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 Gd(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=Gd(s.children,t,r+1);if(i>=0)return i}}return-1}const Py=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function Yd(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Py)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:Yd(n.children,t,r)}:n})}function oi(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:oi(n.children,t,r)}:n)}function ua(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?ua(r.children,t):[]}))}function Xd(e,t,r,n){return e.map(s=>{if(s.id===t){const i=[...s.children??[]],[o]=i.splice(r,1);return i.splice(n,0,o),{...s,children:i}}return s.children&&s.children.length>0?{...s,children:Xd(s.children,t,r,n)}:s})}function Zd(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?Zd(r.children,t):[]}})}function My(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 Ly(e,t){const r=Br(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?Br(e,s.parent):void 0;return n}const Re=Hi((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(),o=Br(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};ue.getState().setNodeFlags({isFolder:(o==null?void 0:o.isFolder)??!1,isRoot:!(o!=null&&o.parent),isQuml:!1}),e({selectedNodeId:r,breadcrumb:a,activeNodeMeta:c})},updateNode:(r,n)=>{e(s=>({treeData:Yd(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),ue.getState().setIsDirty(!0)},addNode:(r,n)=>{var d,u;const s=t(),i=((u=(d=ue.getState().editorConfig)==null?void 0:d.config)==null?void 0:u.maxDepth)??4,o=Gd(s.treeData,r);if(o>=i)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${i}). parentDepth=${o}`),"";const a="temp-"+Math.random().toString(36).slice(2),c={id:a,identifier:a,name:"Untitled Unit",isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:a,name:"Untitled Unit",visibility:"Parent"}};return e(f=>({treeData:oi(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(a),0),a},deleteNode:r=>{e(n=>({treeData:ua(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:Xd(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=Br(i.treeData,r);if(!o)return i;let a=ua(i.treeData,r);return a=oi(a,s,{...o,parent:s}),{treeData:a}}),ue.getState().setIsDirty(!0)},addResource:(r,n)=>{var u,f,m;const s=ue.getState().editorConfig,i=((u=s==null?void 0:s.config)==null?void 0:u.allowContentUnderRoot)??!1,o=(f=t().treeData[0])==null?void 0:f.id;if(!i&&n===o||Br(t().treeData,r.identifier))return!1;const a=((m=s==null?void 0:s.config)==null?void 0:m.maxContentsLimit)??1200;if(My(t().treeData)>=a)return!1;const d={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(g=>({treeData:oi(g.treeData,n,d)})),t().markDirty(),!0},markDirty:()=>{ue.getState().setIsDirty(!0)},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const s=Zd(n.treeData,r),i={};for(const[a,c]of Object.entries(n.treeCache)){const d=r[a]??a,{isNew:u,...f}=c;i[d]=f}const o=n.selectedNodeId?r[n.selectedNodeId]??n.selectedNodeId:null;return{treeData:s,treeCache:i,selectedNodeId:o}})},getNodeById:r=>Br(t().treeData,r),getChildrenOf:r=>{const n=Br(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>Ly(t().treeData,r)})),Fy=Hi(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),$y="_spin_1ah4d_9",By={spin:$y},Uy=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:By.spin,width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-label":"Loading",role:"status",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"3",strokeDasharray:"31.4",strokeDashoffset:"10",strokeLinecap:"round"})}),Ie=({variant:e="ghost",size:t="md",isLoading:r,disabled:n,onClick:s,children:i,className:o,type:a="button"})=>l.jsxs("button",{type:a,className:`sbx-btn-${e} ${t==="sm"?"sbx-btn-sm":""} ${o??""}`,onClick:s,disabled:r||n,"aria-busy":r?!0:void 0,children:[r?l.jsx(Uy,{size:14}):null,i]}),Vy="_overlay_w9xez_1",zy="_modal_w9xez_11",qy="_modalHeader_w9xez_23",Hy="_modalHeaderClose_w9xez_33",Wy="_modalBody_w9xez_51",Ky="_modalFooter_w9xez_58",Qy="_checkRow_w9xez_65",Gy="_formGroup_w9xez_108",Yy="_textarea_w9xez_119",Xy="_sliderGroup_w9xez_140",Zy="_sliderValue_w9xez_152",Jy="_sliderLabels_w9xez_160",ev="_sectionTitle_w9xez_168",De={overlay:Vy,modal:zy,modalHeader:qy,modalHeaderClose:Hy,modalBody:Wy,modalFooter:Ky,checkRow:Qy,formGroup:Gy,textarea:Yy,sliderGroup:Xy,sliderValue:Zy,sliderLabels:Jy,sectionTitle:ev},tv=({contentId:e,onConfirm:t,onCancel:r})=>{const n=ue(u=>{var f,m;return(m=(f=u.editorConfig)==null?void 0:f.config)==null?void 0:m.objectType})||"Content",s=ue(u=>u.publishChecklist)??[],[i,o]=p.useState({}),a=s.every(u=>i[u.code]),c=s.length===0||a,d=()=>{t()};return l.jsx("div",{className:De.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:De.modal,children:[l.jsxs("div",{className:De.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:De.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:De.modalBody,children:s.length===0?l.jsxs("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:["Are you sure you want to publish this ",n,"?"]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:De.sectionTitle,children:"Please confirm that ALL the following items are verified (by ticking the check-boxes) before you can publish:"}),s.map(u=>l.jsxs("label",{className:De.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!i[u.code],onChange:f=>o(m=>({...m,[u.code]:f.target.checked}))}),l.jsx("span",{children:u.label})]},u.code))]})}),l.jsxs("div",{className:De.modalFooter,children:[l.jsx(Ie,{variant:"ghost",onClick:r,children:"No"}),l.jsx(Ie,{variant:"primary",onClick:d,disabled:!c,children:"Yes"})]})]})})},rv=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=p.useState(""),[o,a]=p.useState(7),c=t==="approve",d=c?"Review Quality":"Reject Content",u=!c&&s.trim().length===0,f=()=>{c?r(s.trim(),o):r(s.trim())};return l.jsx("div",{className:De.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:De.modal,children:[l.jsxs("div",{className:De.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:d}),l.jsx("button",{className:De.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:De.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:De.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:De.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:m=>a(Number(m.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:De.sliderValue,children:o})]}),l.jsxs("div",{className:De.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:De.formGroup,children:[l.jsxs("label",{htmlFor:"quality-comment",children:["Comment"," ",l.jsx("span",{style:{fontWeight:400,color:"var(--sbx-gray-400, #9CA3AF)"},children:"(optional)"})]}),l.jsx("textarea",{id:"quality-comment",className:De.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:m=>i(m.target.value),rows:4})]})]}):l.jsxs("div",{className:De.formGroup,children:[l.jsxs("label",{htmlFor:"reject-reason",children:["Rejection Reason"," ",l.jsx("span",{style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:"reject-reason",className:De.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:m=>i(m.target.value),rows:5,required:!0,"aria-required":"true"}),s.trim().length===0&&l.jsx("p",{style:{fontSize:12,color:"var(--sbx-error, #DC2626)",marginTop:4},children:"A rejection reason is required."})]})}),l.jsxs("div",{className:De.modalFooter,children:[l.jsx(Ie,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(Ie,{variant:c?"primary":"danger",onClick:f,disabled:u,children:c?"Approve":"Reject"})]})]})})};function Jd(e,t){return function(){return e.apply(t,arguments)}}const{toString:nv}=Object.prototype,{getPrototypeOf:An}=Object,{iterator:Ps,toStringTag:ef}=Symbol,Di=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),bs=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),Di(r,t))return!0;r=An(r)}return!1},sv=(e,t)=>e!=null&&bs(e,t)?e[t]:void 0,Ya=(e=>t=>{const r=nv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Gt=e=>(e=e.toLowerCase(),t=>Ya(t)===e),Wi=e=>t=>typeof t===e,{isArray:rn}=Array,Pn=Wi("undefined");function zn(e){return e!==null&&!Pn(e)&&e.constructor!==null&&!Pn(e.constructor)&&Dt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const tf=Gt("ArrayBuffer");function iv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&tf(e.buffer),t}const ov=Wi("string"),Dt=Wi("function"),rf=Wi("number"),qn=e=>e!==null&&typeof e=="object",av=e=>e===!0||e===!1,ai=e=>{if(!qn(e))return!1;const t=An(e);return(t===null||t===Object.prototype||An(t)===null)&&!bs(e,ef)&&!bs(e,Ps)},lv=e=>{if(!qn(e)||zn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},cv=Gt("Date"),uv=Gt("File"),dv=e=>!!(e&&typeof e.uri<"u"),fv=e=>e&&typeof e.getParts<"u",hv=Gt("Blob"),pv=Gt("FileList"),gv=e=>qn(e)&&Dt(e.pipe);function mv(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const tc=mv(),rc=typeof tc.FormData<"u"?tc.FormData:void 0,yv=e=>{if(!e)return!1;if(rc&&e instanceof rc)return!0;const t=An(e);if(!t||t===Object.prototype||!Dt(e.append))return!1;const r=Ya(e);return r==="formdata"||r==="object"&&Dt(e.toString)&&e.toString()==="[object FormData]"},vv=Gt("URLSearchParams"),[bv,_v,wv,xv]=["ReadableStream","Request","Response","Headers"].map(Gt),Sv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ms(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),rn(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),o=i.length;let a;for(n=0;n<o;n++)a=i[n],t.call(null,e[a],a,e)}}function nf(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 Vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,sf=e=>!Pn(e)&&e!==Vr;function da(...e){const{caseless:t,skipUndefined:r}=sf(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&nf(n,o)||o,c=Di(n,a)?n[a]:void 0;ai(c)&&ai(i)?n[a]=da(c,i):ai(i)?n[a]=da({},i):rn(i)?n[a]=i.slice():(!r||!Pn(i))&&(n[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||zn(a)||(Ms(a,s),typeof a!="object"||rn(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let d=0;d<c.length;d++){const u=c[d];Pv.call(a,u)&&s(a[u],u)}}return n}const Cv=(e,t,r,{allOwnKeys:n}={})=>(Ms(t,(s,i)=>{r&&Dt(s)?Object.defineProperty(e,i,{__proto__:null,value:Jd(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),Ov=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Ev=(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)},Dv=(e,t,r,n)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!n||n(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=r!==!1&&An(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Iv=(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},Nv=e=>{if(!e)return null;if(rn(e))return e;let t=e.length;if(!rf(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Tv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&An(Uint8Array)),jv=(e,t)=>{const n=(e&&e[Ps]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Rv=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},kv=Gt("HTMLFormElement"),Av=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:Pv}=Object.prototype,Mv=Gt("RegExp"),of=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Ms(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},Lv=e=>{of(e,(t,r)=>{if(Dt(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Dt(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+"'")})}})},Fv=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return rn(e)?n(e):n(String(e).split(t)),r},$v=()=>{},Bv=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Uv(e){return!!(e&&Dt(e.append)&&e[ef]==="FormData"&&e[Ps])}const Vv=e=>{const t=new WeakSet,r=n=>{if(qn(n)){if(t.has(n))return;if(zn(n))return n;if(!("toJSON"in n)){t.add(n);const s=rn(n)?[]:{};return Ms(n,(i,o)=>{const a=r(i);!Pn(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},zv=Gt("AsyncFunction"),qv=e=>e&&(qn(e)||Dt(e))&&Dt(e.then)&&Dt(e.catch),af=((e,t)=>e?setImmediate:t?((r,n)=>(Vr.addEventListener("message",({source:s,data:i})=>{s===Vr&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),Vr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Dt(Vr.postMessage)),Hv=typeof queueMicrotask<"u"?queueMicrotask.bind(Vr):typeof process<"u"&&process.nextTick||af,lf=e=>e!=null&&Dt(e[Ps]),Wv=e=>e!=null&&bs(e,Ps)&&lf(e),E={isArray:rn,isArrayBuffer:tf,isBuffer:zn,isFormData:yv,isArrayBufferView:iv,isString:ov,isNumber:rf,isBoolean:av,isObject:qn,isPlainObject:ai,isEmptyObject:lv,isReadableStream:bv,isRequest:_v,isResponse:wv,isHeaders:xv,isUndefined:Pn,isDate:cv,isFile:uv,isReactNativeBlob:dv,isReactNative:fv,isBlob:hv,isRegExp:Mv,isFunction:Dt,isStream:gv,isURLSearchParams:vv,isTypedArray:Tv,isFileList:pv,forEach:Ms,merge:da,extend:Cv,trim:Sv,stripBOM:Ov,inherits:Ev,toFlatObject:Dv,kindOf:Ya,kindOfTest:Gt,endsWith:Iv,toArray:Nv,forEachEntry:jv,matchAll:Rv,isHTMLForm:kv,hasOwnProperty:Di,hasOwnProp:Di,hasOwnInPrototypeChain:bs,getSafeProp:sv,reduceDescriptors:of,freezeMethods:Lv,toObjectSet:Fv,toCamelCase:Av,noop:$v,toFiniteNumber:Bv,findKey:nf,global:Vr,isContextDefined:sf,isSpecCompliantForm:Uv,toJSONObject:Vv,isAsyncFn:zv,isThenable:qv,setImmediate:af,asap:Hv,isIterable:lf,isSafeIterable:Wv},Kv=E.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"]),Qv=e=>{const t={};let r,n,s;return e&&e.split(`
449
+ `).forEach(function(o){s=o.indexOf(":"),r=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!r||t[r]&&Kv[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function Gv(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 Yv=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Xv=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Xa(e,t){return E.isArray(e)?e.map(r=>Xa(r,t)):Gv(String(e).replace(t,""))}const Zv=e=>Xa(e,Yv),Jv=e=>Xa(e,Xv);function cf(e){const t=Object.create(null);return E.forEach(e.toJSON(),(r,n)=>{t[n]=Jv(r)}),t}const nc=Symbol("internals");function Gn(e){return e&&String(e).trim().toLowerCase()}function li(e){return e===!1||e==null?e:E.isArray(e)?e.map(li):Zv(String(e))}function eb(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 tb=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function mo(e,t,r,n,s){if(E.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!E.isString(t)){if(E.isString(n))return t.indexOf(n)!==-1;if(E.isRegExp(n))return n.test(t)}}function rb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function nb(e,t){const r=E.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{__proto__:null,value:function(s,i,o){return this[n].call(this,t,s,i,o)},configurable:!0})})}let yt=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,c,d){const u=Gn(c);if(!u)return;const f=E.findKey(s,u);(!f||s[f]===void 0||d===!0||d===void 0&&s[f]!==!1)&&(s[f||c]=li(a))}const o=(a,c)=>E.forEach(a,(d,u)=>i(d,u,c));if(E.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(E.isString(t)&&(t=t.trim())&&!tb(t))o(Qv(t),r);else if(E.isObject(t)&&E.isSafeIterable(t)){let a=Object.create(null),c,d;for(const u of t){if(!E.isArray(u))throw new TypeError("Object iterator must return a key-value pair");d=u[0],E.hasOwnProp(a,d)?(c=a[d],a[d]=E.isArray(c)?[...c,u[1]]:[c,u[1]]):a[d]=u[1]}o(a,r)}else t!=null&&i(r,t,n);return this}get(t,r){if(t=Gn(t),t){const n=E.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return eb(s);if(E.isFunction(r))return r.call(this,s,n);if(E.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Gn(t),t){const n=E.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||mo(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=Gn(o),o){const a=E.findKey(n,o);a&&(!r||mo(n,n[a],a,r))&&(delete n[a],s=!0)}}return E.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||mo(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const r=this,n={};return E.forEach(this,(s,i)=>{const o=E.findKey(n,i);if(o){r[o]=li(s),delete r[i];return}const a=t?rb(i):String(i).trim();a!==i&&delete r[i],r[a]=li(s),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return E.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&E.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(`
450
+ `)}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[nc]=this[nc]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Gn(o);n[a]||(nb(s,o),n[a]=!0)}return E.isArray(t)?t.forEach(i):i(t),this}};yt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);E.reduceDescriptors(yt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});E.freezeMethods(yt);const sb="[REDACTED ****]";function ib(e){if(E.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(E.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function ob(e,t){const r=new Set(t.map(i=>String(i).toLowerCase())),n=[],s=i=>{if(i===null||typeof i!="object"||E.isBuffer(i))return i;if(n.indexOf(i)!==-1)return;i instanceof yt&&(i=i.toJSON()),n.push(i);let o;if(E.isArray(i))o=[],i.forEach((a,c)=>{const d=s(a);E.isUndefined(d)||(o[c]=d)});else{if(!E.isPlainObject(i)&&ib(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=r.has(a.toLowerCase())?sb:s(c);E.isUndefined(d)||(o[a]=d)}}return n.pop(),o};return s(e)}let Z=class uf extends Error{static from(t,r,n,s,i,o){const a=new uf(t.message,r||t.code,n,s,i);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}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&&E.hasOwnProp(t,"redact")?t.redact:void 0,n=E.isArray(r)&&r.length>0?ob(t,r):E.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 ab=null,df=100;function fa(e){return E.isPlainObject(e)||E.isArray(e)}function ff(e){return E.endsWith(e,"[]")?e.slice(0,-2):e}function yo(e,t,r){return e?e.concat(t).map(function(s,i){return s=ff(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function lb(e){return E.isArray(e)&&!e.some(fa)}const cb=E.toFlatObject(E,{},null,function(t){return/^is[A-Z]/.test(t)});function Ki(e,t,r){if(!E.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=E.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,x){return!E.isUndefined(x[b])});const n=r.metaTokens,s=r.visitor||_,i=r.dots,o=r.indexes,a=r.Blob||typeof Blob<"u"&&Blob,c=r.maxDepth===void 0?df:r.maxDepth,d=a&&E.isSpecCompliantForm(t),u=[];if(!E.isFunction(s))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(E.isDate(v))return v.toISOString();if(E.isBoolean(v))return v.toString();if(!d&&E.isBlob(v))throw new Z("Blob is not supported. Use a Buffer instead.");return E.isArrayBuffer(v)||E.isTypedArray(v)?d&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function m(v){if(v>c)throw new Z("Object is too deeply nested ("+v+" levels). Max depth: "+c,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function g(v,b){if(c===1/0)return JSON.stringify(v);const x=[];return JSON.stringify(v,function(C,D){if(!E.isObject(D))return D;for(;x.length&&x[x.length-1]!==this;)x.pop();return x.push(D),m(b+x.length-1),D})}function _(v,b,x){let w=v;if(E.isReactNative(t)&&E.isReactNativeBlob(v))return t.append(yo(x,b,i),f(v)),!1;if(v&&!x&&typeof v=="object"){if(E.endsWith(b,"{}"))b=n?b:b.slice(0,-2),v=g(v,1);else if(E.isArray(v)&&lb(v)||(E.isFileList(v)||E.endsWith(b,"[]"))&&(w=E.toArray(v)))return b=ff(b),w.forEach(function(D,j){!(E.isUndefined(D)||D===null)&&t.append(o===!0?yo([b],j,i):o===null?b:b+"[]",f(D))}),!1}return fa(v)?!0:(t.append(yo(x,b,i),f(v)),!1)}const h=Object.assign(cb,{defaultVisitor:_,convertValue:f,isVisitable:fa});function y(v,b,x=0){if(!E.isUndefined(v)){if(m(x),u.indexOf(v)!==-1)throw new Error("Circular reference detected in "+b.join("."));u.push(v),E.forEach(v,function(C,D){(!(E.isUndefined(C)||C===null)&&s.call(t,C,E.isString(D)?D.trim():D,b,h))===!0&&y(C,b?b.concat(D):[D],x+1)}),u.pop()}}if(!E.isObject(e))throw new TypeError("data must be an object");return y(e),t}function sc(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function Za(e,t){this._pairs=[],e&&Ki(e,this,t)}const hf=Za.prototype;hf.append=function(t,r){this._pairs.push([t,r])};hf.toString=function(t){const r=t?function(n){return t.call(this,n,sc)}:sc;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function ub(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function pf(e,t,r){if(!t)return e;const n=E.isFunction(r)?{serialize:r}:r,s=E.getSafeProp(n,"encode")||ub,i=E.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=E.isURLSearchParams(t)?t.toString():new Za(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class ic{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){E.forEach(this.handlers,function(n){n!==null&&t(n)})}}const Ja={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},db=typeof URLSearchParams<"u"?URLSearchParams:Za,fb=typeof FormData<"u"?FormData:null,hb=typeof Blob<"u"?Blob:null,pb={isBrowser:!0,classes:{URLSearchParams:db,FormData:fb,Blob:hb},protocols:["http","https","file","blob","url","data"]},el=typeof window<"u"&&typeof document<"u",ha=typeof navigator=="object"&&navigator||void 0,gb=el&&(!ha||["ReactNative","NativeScript","NS"].indexOf(ha.product)<0),mb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",yb=el&&window.location.href||"http://localhost",vb=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:el,hasStandardBrowserEnv:gb,hasStandardBrowserWebWorkerEnv:mb,navigator:ha,origin:yb},Symbol.toStringTag,{value:"Module"})),ot={...vb,...pb};function bb(e,t){return Ki(e,new ot.classes.URLSearchParams,{visitor:function(r,n,s,i){return ot.isNode&&E.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const oc=df;function gf(e){if(e>oc)throw new Z("FormData field is too deeply nested ("+e+" levels). Max depth: "+oc,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function _b(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)gf(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function wb(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 mf(e){function t(r,n,s,i){gf(i);let o=r[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=r.length;return o=!o&&E.isArray(s)?s.length:o,c?(E.hasOwnProp(s,o)?s[o]=E.isArray(s[o])?s[o].concat(n):[s[o],n]:s[o]=n,!a):((!E.hasOwnProp(s,o)||!E.isObject(s[o]))&&(s[o]=[]),t(r,n,s[o],i)&&E.isArray(s[o])&&(s[o]=wb(s[o])),!a)}if(E.isFormData(e)&&E.isFunction(e.entries)){const r={};return E.forEachEntry(e,(n,s)=>{t(_b(n),s,r,0)}),r}return null}const cn=(e,t)=>e!=null&&E.hasOwnProp(e,t)?e[t]:void 0;function xb(e,t,r){if(E.isString(e))try{return(t||JSON.parse)(e),E.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const Ls={transitional:Ja,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=E.isObject(t);if(i&&E.isHTMLForm(t)&&(t=new FormData(t)),E.isFormData(t))return s?JSON.stringify(mf(t)):t;if(E.isArrayBuffer(t)||E.isBuffer(t)||E.isStream(t)||E.isFile(t)||E.isBlob(t)||E.isReadableStream(t))return t;if(E.isArrayBufferView(t))return t.buffer;if(E.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const c=cn(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return bb(t,c).toString();if((a=E.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=cn(this,"env"),u=d&&d.FormData;return Ki(a?{"files[]":t}:t,u&&new u,c)}}return i||s?(r.setContentType("application/json",!1),xb(t)):t}],transformResponse:[function(t){const r=cn(this,"transitional")||Ls.transitional,n=r&&r.forcedJSONParsing,s=cn(this,"responseType"),i=s==="json";if(E.isResponse(t)||E.isReadableStream(t))return t;if(t&&E.isString(t)&&(n&&!s||i)){const a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,cn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?Z.from(c,Z.ERR_BAD_RESPONSE,this,null,cn(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ot.classes.FormData,Blob:ot.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};E.forEach(["delete","get","head","post","put","patch","query"],e=>{Ls.headers[e]={}});function vo(e,t){const r=this||Ls,n=t||r,s=yt.from(n.headers);let i=n.data;return E.forEach(e,function(a){i=a.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function yf(e){return!!(e&&e.__CANCEL__)}let Fs=class extends Z{constructor(t,r,n){super(t??"canceled",Z.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function vf(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 Sb(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Cb(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),u=n[i];o||(o=d),r[s]=c,n[s]=d;let f=i,m=0;for(;f!==s;)m+=r[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const g=u&&d-u;return g?Math.round(m*1e3/g):void 0}}function Ob(e,t){let r=0,n=1e3/t,s,i;const o=(d,u=Date.now())=>{r=u,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-r;f>=n?o(d,u):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const Ii=(e,t,r=3)=>{let n=0;const s=Cb(50,250);return Ob(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=a!=null?Math.min(o,a):o,d=Math.max(0,c-n),u=s(d);n=Math.max(n,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-c)/u:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},ac=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},lc=e=>(...t)=>E.asap(()=>e(...t)),Eb=ot.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,ot.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(ot.origin),ot.navigator&&/(msie|trident)/i.test(ot.navigator.userAgent)):()=>!0,Db=ot.hasStandardBrowserEnv?{write(e,t,r,n,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];E.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),E.isString(n)&&a.push(`path=${n}`),E.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),E.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.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 Ib(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Nb(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Tb=/^https?:(?!\/\/)/i,jb=/[\t\n\r]/g;function Rb(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function kb(e){return Rb(e).replace(jb,"")}function cc(e,t){if(typeof e=="string"&&Tb.test(kb(e)))throw new Z('Invalid URL: missing "//" after protocol',Z.ERR_INVALID_URL,t)}function bf(e,t,r,n){cc(t,n);let s=!Ib(t);return e&&(s||r===!1)?(cc(e,n),Nb(e,t)):t}const uc=e=>e instanceof yt?{...e}:e;function nn(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(u,f,m,g){return E.isPlainObject(u)&&E.isPlainObject(f)?E.merge.call({caseless:g},u,f):E.isPlainObject(f)?E.merge({},f):E.isArray(f)?f.slice():f}function s(u,f,m,g){if(E.isUndefined(f)){if(!E.isUndefined(u))return n(void 0,u,m,g)}else return n(u,f,m,g)}function i(u,f){if(!E.isUndefined(f))return n(void 0,f)}function o(u,f){if(E.isUndefined(f)){if(!E.isUndefined(u))return n(void 0,u)}else return n(void 0,f)}function a(u){const f=E.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!E.isUndefined(f))if(E.isPlainObject(f)){if(E.hasOwnProp(f,u))return f[u]}else return;const m=E.hasOwnProp(e,"transitional")?e.transitional:void 0;if(E.isPlainObject(m)&&E.hasOwnProp(m,u))return m[u]}function c(u,f,m){if(E.hasOwnProp(t,m))return n(u,f);if(E.hasOwnProp(e,m))return n(void 0,u)}const d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:c,headers:(u,f,m)=>s(uc(u),uc(f),m,!0)};return E.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const m=E.hasOwnProp(d,f)?d[f]:s,g=E.hasOwnProp(e,f)?e[f]:void 0,_=E.hasOwnProp(t,f)?t[f]:void 0,h=m(g,_,f);E.isUndefined(h)&&m!==c||(r[f]=h)}),E.hasOwnProp(t,"validateStatus")&&E.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(E.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const Ab=["content-type","content-length"];function Pb(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{Ab.includes(n.toLowerCase())&&e.set(n,s)})}const Mb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function _f(e){const t=nn({},e),r=m=>E.hasOwnProp(t,m)?t[m]:void 0,n=r("data");let s=r("withXSRFToken");const i=r("xsrfHeaderName"),o=r("xsrfCookieName");let a=r("headers");const c=r("auth"),d=r("baseURL"),u=r("allowAbsoluteUrls"),f=r("url");if(t.headers=a=yt.from(a),t.url=pf(bf(d,f,u,t),r("params"),r("paramsSerializer")),c){const m=E.getSafeProp(c,"username")||"",g=E.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(m+":"+(g?Mb(g):"")))}if(E.isFormData(n)&&(ot.hasStandardBrowserEnv||ot.hasStandardBrowserWebWorkerEnv||E.isReactNative(n)?a.setContentType(void 0):E.isFunction(n.getHeaders)&&Pb(a,n.getHeaders(),r("formDataHeaderPolicy"))),ot.hasStandardBrowserEnv&&(E.isFunction(s)&&(s=s(t)),s===!0||s==null&&Eb(t.url))){const g=i&&o&&Db.read(o);g&&a.set(i,g)}return t}const Lb=typeof XMLHttpRequest<"u",Fb=Lb&&function(e){return new Promise(function(r,n){const s=_f(e);let i=s.data;const o=yt.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:d}=s,u,f,m,g,_;function h(){g&&g(),_&&_(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function v(){if(!y)return;const x=yt.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:e,request:y};vf(function(j){r(j),h()},function(j){n(j),h()},C),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(w){const C=w&&w.message?w.message:"Network Error",D=new Z(C,Z.ERR_NETWORK,e,y);D.event=w||null,n(D),h(),y=null},y.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const C=s.transitional||Ja;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new Z(w,C.clarifyTimeoutError?Z.ETIMEDOUT:Z.ECONNABORTED,e,y)),h(),y=null},i===void 0&&o.setContentType(null),"setRequestHeader"in y&&E.forEach(cf(o),function(w,C){y.setRequestHeader(C,w)}),E.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),d&&([m,_]=Ii(d,!0),y.addEventListener("progress",m)),c&&y.upload&&([f,g]=Ii(c),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(u=x=>{y&&(n(!x||x.type?new Fs(null,e,y):x),y.abort(),h(),y=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const b=Sb(s.url);if(b&&!ot.protocols.includes(b)){n(new Z("Unsupported protocol "+b+":",Z.ERR_BAD_REQUEST,e));return}y.send(i||null)})},$b=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const s=function(c){if(!n){n=!0,o();const d=c instanceof Error?c:this.reason;r.abort(d instanceof Z?d:new Fs(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new Z(`timeout of ${t}ms exceeded`,Z.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),e=null)};e.forEach(c=>c.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>E.asap(o),a},Bb=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},Ub=async function*(e,t){for await(const r of Vb(e))yield*Bb(r,t)},Vb=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()}},dc=(e,t,r,n)=>{const s=Ub(e,t);let i=0,o,a=c=>{o||(o=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await s.next();if(d){a(),c.close();return}let f=u.byteLength;if(r){let m=i+=f;r(m)}c.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},Ni=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,zb=(e,t,r)=>t+2<r&&Ni(e.charCodeAt(t+1))&&Ni(e.charCodeAt(t+2));function qb(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 o=n.length;const a=n.length;for(let g=0;g<a;g++)if(n.charCodeAt(g)===37&&g+2<a){const _=n.charCodeAt(g+1),h=n.charCodeAt(g+2);Ni(_)&&Ni(h)&&(o-=2,g+=2)}let c=0,d=a-1;const u=g=>g>=2&&n.charCodeAt(g-2)===37&&n.charCodeAt(g-1)===51&&(n.charCodeAt(g)===68||n.charCodeAt(g)===100);d>=0&&(n.charCodeAt(d)===61?(c++,d--):u(d)&&(c++,d-=3)),c===1&&d>=0&&(n.charCodeAt(d)===61||u(d))&&c++;const m=Math.floor(o/4)*3-(c||0);return m>0?m:0}let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&zb(n,o,a))i+=1,o+=2;else if(c<128)i+=1;else if(c<2048)i+=2;else if(c>=55296&&c<=56319&&o+1<a){const d=n.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i}const tl="1.18.0",fc=64*1024,{isFunction:Ks}=E,Hb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),hc=e=>{if(!E.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},pc=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Wb=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},Kb=e=>{const t=E.global!==void 0&&E.global!==null?E.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=E.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?Ks(s):typeof fetch=="function",c=Ks(i),d=Ks(o);if(!a)return!1;const u=a&&Ks(r),f=a&&(typeof n=="function"?(v=>b=>v.encode(b))(new n):async v=>new Uint8Array(await new i(v).arrayBuffer())),m=c&&u&&pc(()=>{let v=!1;const b=new i(ot.origin,{body:new r,method:"POST",get duplex(){return v=!0,"half"}}),x=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),v&&!x}),g=d&&u&&pc(()=>E.isReadableStream(new o("").body)),_={stream:g&&(v=>v.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!_[v]&&(_[v]=(b,x)=>{let w=b&&b[v];if(w)return w.call(b);throw new Z(`Response type '${v}' is not supported`,Z.ERR_NOT_SUPPORT,x)})});const h=async v=>{if(v==null)return 0;if(E.isBlob(v))return v.size;if(E.isSpecCompliantForm(v))return(await new i(ot.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(E.isArrayBufferView(v)||E.isArrayBuffer(v))return v.byteLength;if(E.isURLSearchParams(v)&&(v=v+""),E.isString(v))return(await f(v)).byteLength},y=async(v,b)=>{const x=E.toFiniteNumber(v.getContentLength());return x??h(b)};return async v=>{let{url:b,method:x,data:w,signal:C,cancelToken:D,timeout:j,onDownloadProgress:k,onUploadProgress:$,responseType:N,headers:A,withCredentials:U="same-origin",fetchOptions:R,maxContentLength:B,maxBodyLength:F}=_f(v);const J=E.isNumber(B)&&B>-1,ie=E.isNumber(F)&&F>-1,me=W=>E.hasOwnProp(v,W)?v[W]:void 0;let ve=s||fetch;N=N?(N+"").toLowerCase():"text";let be=$b([C,D&&D.toAbortSignal()],j),K=null;const M=be&&be.unsubscribe&&(()=>{be.unsubscribe()});let G,P=null;const Y=()=>new Z("Request body larger than maxBodyLength limit",Z.ERR_BAD_REQUEST,v,K);try{let W;const oe=me("auth");if(oe){const te=E.getSafeProp(oe,"username")||"",We=E.getSafeProp(oe,"password")||"";W={username:te,password:We}}if(Wb(b)){const te=new URL(b,ot.origin);if(!W&&(te.username||te.password)){const We=hc(te.username),at=hc(te.password);W={username:We,password:at}}(te.username||te.password)&&(te.username="",te.password="",b=te.href)}if(W&&(A.delete("authorization"),A.set("Authorization","Basic "+btoa(Hb((W.username||"")+":"+(W.password||""))))),J&&typeof b=="string"&&b.startsWith("data:")&&qb(b)>B)throw new Z("maxContentLength size of "+B+" exceeded",Z.ERR_BAD_RESPONSE,v,K);if(ie&&x!=="get"&&x!=="head"){const te=await h(w);if(typeof te=="number"&&isFinite(te)&&(G=te,te>F))throw Y()}const pe=ie&&(E.isReadableStream(w)||E.isStream(w)),Ne=(te,We,at)=>dc(te,fc,vt=>{if(ie&&vt>F)throw P=Y();We&&We(vt)},at);if(m&&x!=="get"&&x!=="head"&&($||pe)){if(G=G??await y(A,w),G!==0||pe){let te=new i(b,{method:"POST",body:w,duplex:"half"}),We;if(E.isFormData(w)&&(We=te.headers.get("content-type"))&&A.setContentType(We),te.body){const[at,vt]=$&&ac(G,Ii(lc($)))||[];w=Ne(te.body,at,vt)}}}else if(pe&&!c&&u&&x!=="get"&&x!=="head")w=Ne(w);else if(pe&&c&&!m&&x!=="get"&&x!=="head")throw new Z("Stream request bodies are not supported by the current fetch implementation",Z.ERR_NOT_SUPPORT,v,K);E.isString(U)||(U=U?"include":"omit");const re=c&&"credentials"in i.prototype;if(E.isFormData(w)){const te=A.getContentType();te&&/^multipart\/form-data/i.test(te)&&!/boundary=/i.test(te)&&A.delete("content-type")}A.set("User-Agent","axios/"+tl,!1);const se={...R,signal:be,method:x.toUpperCase(),headers:cf(A.normalize()),body:w,duplex:"half",credentials:re?U:void 0};K=c&&new i(b,se);let le=await(c?ve(K,R):ve(b,se));const Le=yt.from(le.headers);if(J){const te=E.toFiniteNumber(Le.getContentLength());if(te!=null&&te>B)throw new Z("maxContentLength size of "+B+" exceeded",Z.ERR_BAD_RESPONSE,v,K)}const ze=g&&(N==="stream"||N==="response");if(g&&le.body&&(k||J||ze&&M)){const te={};["status","statusText","headers"].forEach(lt=>{te[lt]=le[lt]});const We=E.toFiniteNumber(Le.getContentLength()),[at,vt]=k&&ac(We,Ii(lc(k),!0))||[];let qe=0;const Ye=lt=>{if(J&&(qe=lt,qe>B))throw new Z("maxContentLength size of "+B+" exceeded",Z.ERR_BAD_RESPONSE,v,K);at&&at(lt)};le=new o(dc(le.body,fc,Ye,()=>{vt&&vt(),M&&M()}),te)}N=N||"text";let Te=await _[E.findKey(_,N)||"text"](le,v);if(J&&!g&&!ze){let te;if(Te!=null&&(typeof Te.byteLength=="number"?te=Te.byteLength:typeof Te.size=="number"?te=Te.size:typeof Te=="string"&&(te=typeof n=="function"?new n().encode(Te).byteLength:Te.length)),typeof te=="number"&&te>B)throw new Z("maxContentLength size of "+B+" exceeded",Z.ERR_BAD_RESPONSE,v,K)}return!ze&&M&&M(),await new Promise((te,We)=>{vf(te,We,{data:Te,headers:yt.from(le.headers),status:le.status,statusText:le.statusText,config:v,request:K})})}catch(W){if(M&&M(),be&&be.aborted&&be.reason instanceof Z){const oe=be.reason;throw oe.config=v,K&&(oe.request=K),W!==oe&&(oe.cause=W),oe}throw P?(K&&!P.request&&(P.request=K),P):W instanceof Z?(K&&!W.request&&(W.request=K),W):W&&W.name==="TypeError"&&/Load failed|fetch/i.test(W.message)?Object.assign(new Z("Network Error",Z.ERR_NETWORK,v,K,W&&W.response),{cause:W.cause||W}):Z.from(W,W&&W.code,v,K,W&&W.response)}}},Qb=new Map,wf=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,i=[n,s,r];let o=i.length,a=o,c,d,u=Qb;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:Kb(t)),u=d;return d};wf();const rl={http:ab,xhr:Fb,fetch:{get:wf}};E.forEach(rl,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const gc=e=>`- ${e}`,Gb=e=>E.isFunction(e)||e===null||e===!1;function Yb(e,t){e=E.isArray(e)?e:[e];const{length:r}=e;let n,s;const i={};for(let o=0;o<r;o++){n=e[o];let a;if(s=n,!Gb(n)&&(s=rl[(a=String(n)).toLowerCase()],s===void 0))throw new Z(`Unknown adapter '${a}'`);if(s&&(E.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
451
+ `+o.map(gc).join(`
452
+ `):" "+gc(o[0]):"as no adapter specified";throw new Z("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const xf={getAdapter:Yb,adapters:rl};function bo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Fs(null,e)}function mc(e){return bo(e),e.headers=yt.from(e.headers),e.data=vo.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),xf.getAdapter(e.adapter||Ls.adapter,e)(e).then(function(n){bo(e),e.response=n;try{n.data=vo.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=yt.from(n.headers),n},function(n){if(!yf(n)&&(bo(e),n&&n.response)){e.response=n.response;try{n.response.data=vo.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=yt.from(n.response.headers)}return Promise.reject(n)})}const Qi={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Qi[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const yc={};Qi.transitional=function(t,r,n){function s(i,o){return"[Axios v"+tl+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,a)=>{if(t===!1)throw new Z(s(o," has been removed"+(r?" in "+r:"")),Z.ERR_DEPRECATED);return r&&!yc[o]&&(yc[o]=!0,console.warn(s(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,o,a):!0}};Qi.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Xb(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],o=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(o){const a=e[i],c=a===void 0||o(a,i,e);if(c!==!0)throw new Z("option "+i+" must be "+c,Z.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Z("Unknown option "+i,Z.ERR_BAD_OPTION)}}const ci={assertOptions:Xb,validators:Qi},ut=ci.validators;let en=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ic,response:new ic}}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 o=s.stack.indexOf(`
453
453
  `);return o===-1?"":s.stack.slice(o+1)})();try{if(!n.stack)n.stack=i;else if(i){const o=i.indexOf(`
454
454
  `),a=o===-1?-1:i.indexOf(`
455
455
  `,o+1),c=a===-1?"":i.slice(a+1);String(n.stack).endsWith(c)||(n.stack+=`
456
- `+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=nn(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&li.assertOptions(n,{silentJSONParsing:ut.transitional(ut.boolean),forcedJSONParsing:ut.transitional(ut.boolean),clarifyTimeoutError:ut.transitional(ut.boolean),legacyInterceptorReqResOrdering:ut.transitional(ut.boolean),advertiseZstdAcceptEncoding:ut.transitional(ut.boolean),validateStatusUndefinedResolves:ut.transitional(ut.boolean)},!1),s!=null&&(E.isFunction(s)?r.paramsSerializer={serialize:s}:li.assertOptions(s,{encode:ut.function,serialize:ut.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),li.assertOptions(r,{baseUrl:ut.spelling("baseURL"),withXsrfToken:ut.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&E.merge(i.common,i[r.method]);i&&E.forEach(["delete","get","head","post","put","patch","query","common"],_=>{delete i[_]}),r.headers=yt.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(r)===!1)return;c=c&&h.synchronous;const y=r.transitional||Za;y&&y.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const d=[];this.interceptors.response.forEach(function(h){d.push(h.fulfilled,h.rejected)});let u,f=0,m;if(!c){const _=[gc.bind(this),void 0];for(_.unshift(...a),_.push(...d),m=_.length,u=Promise.resolve(r);f<m;)u=u.then(_[f++],_[f++]);return u}m=a.length;let g=r;for(;f<m;){const _=a[f++],h=a[f++];try{g=_(g)}catch(y){h.call(this,y);break}}try{u=gc.call(this,g)}catch(_){return Promise.reject(_)}for(f=0,m=d.length;f<m;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=nn(this.defaults,t);const r=bf(t.baseURL,t.url,t.allowAbsoluteUrls,t);return pf(r,t.params,t.paramsSerializer)}};E.forEach(["delete","get","head","options"],function(t){en.prototype[t]=function(r,n){return this.request(nn(n||{},{method:t,url:r,data:n&&E.hasOwnProp(n,"data")?n.data:void 0}))}});E.forEach(["post","put","patch","query"],function(t){function r(n){return function(i,o,a){return this.request(nn(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}en.prototype[t]=r(),t!=="query"&&(en.prototype[t+"Form"]=r(!0))});let Zb=class Sf{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 o=new Promise(a=>{n.subscribe(a),i=a}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},t(function(i,o,a){n.reason||(n.reason=new Fs(i,o,a),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 Sf(function(s){t=s}),cancel:t}}};function Jb(e){return function(r){return e.apply(null,r)}}function e_(e){return E.isObject(e)&&e.isAxiosError===!0}const ha={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(ha).forEach(([e,t])=>{ha[t]=e});function Cf(e){const t=new en(e),r=Jd(en.prototype.request,t);return E.extend(r,en.prototype,t,{allOwnKeys:!0}),E.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return Cf(nn(e,s))},r}const He=Cf(Ls);He.Axios=en;He.CanceledError=Fs;He.CancelToken=Zb;He.isCancel=yf;He.VERSION=el;He.toFormData=Wi;He.AxiosError=Z;He.Cancel=He.CanceledError;He.all=function(t){return Promise.all(t)};He.spread=Jb;He.isAxiosError=e_;He.mergeConfig=nn;He.AxiosHeaders=yt;He.formToJSON=e=>mf(E.isHTMLForm(e)?new FormData(e):e);He.getAdapter=xf.getAdapter;He.HttpStatusCode=ha;He.default=He;const{Axios:JR,AxiosError:ek,CanceledError:tk,isCancel:rk,CancelToken:nk,VERSION:sk,all:ik,Cancel:ok,isAxiosError:ak,spread:lk,toFormData:ck,AxiosHeaders:uk,HttpStatusCode:dk,formToJSON:fk,getAdapter:hk,mergeConfig:pk,create:gk}=He;let pa="";function Of(e){pa=e}const Me=He.create({timeout:3e4});Me.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>Ay),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.channel&&(e.headers["X-Channel-Id"]=n.channel),pa&&(e.baseURL=pa),e});const Ef=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function t_(e,t={}){var c,d,u,f;const n={"organisations.roles":[((c=t.objectType)==null?void 0:c.toLowerCase())==="textbook"?"BOOK_CREATOR":"CONTENT_CREATOR"]};t.rootOrgId&&(n.rootOrgId=[t.rootOrgId]);const s=e.includes("@"),i=/^\d{10,}$/.test(e.trim()),o={filters:n,fields:Ef,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(u=(d=(await Me.post("/action/user/v1/search",{request:o},{params:{fields:"orgName"},headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:d.result)==null?void 0:u.response)==null?void 0:f.content)??[]}async function r_(e){var r,n,s;return e.length?((s=(n=(r=(await Me.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Ef,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)??[]:[]}function Df(e,t){const r=e??{},n=r.identifier??"",s=r.objectType??"",o=(r.mimeType??"")==="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",a=r.children,c=Array.isArray(a)?a.map(d=>Df(d,n)):[];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:o,children:c,metadata:r,parent:t}}async function If(e){var s,i,o,a,c,d,u;const t=await Me.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 f=((a=(o=t.data)==null?void 0:o.params)==null?void 0:a.errmsg)||((d=(c=t.data)==null?void 0:c.params)==null?void 0:d.err)||((u=t.data)==null?void 0:u.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${f}`)}const n=Df(r);return{content:r,rootNode:n}}async function n_(e,t,r,n){var i;return((i=(await Me.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:i.result)??{}}async function s_(e,t=""){await Me.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function i_(e){var r,n;return(n=(r=(await Me.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function o_(e){await Me.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function a_(e,t){await Me.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function l_(e,t){await Me.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const c_="_container_r27rp_1",u_="_header_r27rp_13",d_="_title_r27rp_22",f_="_closeBtn_r27rp_29",h_="_body_r27rp_45",p_="_label_r27rp_54",g_="_searchSection_r27rp_62",m_="_searchRow_r27rp_68",y_="_searchInput_r27rp_74",v_="_searchSpinner_r27rp_89",b_="_resultsList_r27rp_105",__="_resultItem_r27rp_118",w_="_userInfo_r27rp_133",x_="_userName_r27rp_141",S_="_userEmail_r27rp_150",C_="_userOrg_r27rp_158",O_="_noResults_r27rp_167",E_="_collabSection_r27rp_174",D_="_sectionTitle_r27rp_179",I_="_badge_r27rp_189",N_="_emptyCollab_r27rp_203",T_="_collabList_r27rp_214",j_="_collabItem_r27rp_223",R_="_userAvatar_r27rp_237",k_="_error_r27rp_251",A_="_success_r27rp_257",P_="_footer_r27rp_263",xe={container:c_,header:u_,title:d_,closeBtn:f_,body:h_,label:p_,searchSection:g_,searchRow:m_,searchInput:y_,searchSpinner:v_,resultsList:b_,resultItem:__,userInfo:w_,userName:x_,userEmail:S_,userOrg:C_,noResults:O_,collabSection:E_,sectionTitle:D_,badge:I_,emptyCollab:N_,collabList:T_,collabItem:j_,userAvatar:R_,error:k_,success:A_,footer:P_},M_=({contentId:e,onClose:t})=>{var k,$;const r=ue(N=>N.editorConfig),n=(k=r==null?void 0:r.context)==null?void 0:k.channel,s=($=r==null?void 0:r.config)==null?void 0:$.objectType,[i,o]=p.useState(""),[a,c]=p.useState([]),[d,u]=p.useState(!1),[f,m]=p.useState([]),[g,_]=p.useState(!1),[h,y]=p.useState(""),[v,b]=p.useState(!1),x=p.useRef(null);p.useEffect(()=>{let N=!1;return(async()=>{try{const A=await i_(e),U=(A==null?void 0:A.collaborators)??[];if(!U.length)return;const R=await r_(U);if(N)return;const B=U.map(F=>R.find(J=>J.identifier===F)??{identifier:F,firstName:F});m(B)}catch{}})(),()=>{N=!0}},[e]),p.useEffect(()=>{x.current&&clearTimeout(x.current);const N=i.trim();if(N.length<2){c([]);return}return x.current=setTimeout(async()=>{u(!0);try{const A=await t_(N,{rootOrgId:n,objectType:s}),U=new Set(f.map(R=>R.identifier));c(A.filter(R=>!U.has(R.identifier)))}catch{c([])}finally{u(!1)}},300),()=>{x.current&&clearTimeout(x.current)}},[i,f,n,s]);const w=p.useCallback(N=>{m(A=>A.find(U=>U.identifier===N.identifier)?A:[...A,N]),c(A=>A.filter(U=>U.identifier!==N.identifier)),b(!1)},[]),C=p.useCallback(N=>{m(A=>A.filter(U=>U.identifier!==N)),b(!1)},[]),D=p.useCallback(async()=>{_(!0),y(""),b(!1);try{await l_(e,f.map(N=>N.identifier)),b(!0)}catch{y("Failed to save collaborators. Please try again.")}finally{_(!1)}},[e,f]),j=N=>`${N.firstName}${N.lastName?` ${N.lastName}`:""}`;return l.jsxs("div",{className:xe.container,children:[l.jsxs("div",{className:xe.header,children:[l.jsx("h2",{className:xe.title,children:"Manage Collaborators"}),l.jsx("button",{className:xe.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:xe.body,children:[l.jsxs("div",{className:xe.searchSection,children:[l.jsx("label",{className:xe.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:xe.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:xe.searchInput,placeholder:"Search by name or email...",value:i,onChange:N=>o(N.target.value)}),d&&l.jsx("span",{className:xe.searchSpinner,"aria-label":"Searching..."})]}),a.length>0&&l.jsx("ul",{className:xe.resultsList,role:"listbox","aria-label":"Search results",children:a.map(N=>{var A,U,R,B;return l.jsxs("li",{className:xe.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:xe.userInfo,children:[l.jsx("span",{className:xe.userName,children:j(N)}),N.email&&l.jsx("span",{className:xe.userEmail,children:N.email}),(((U=(A=N.organisations)==null?void 0:A[0])==null?void 0:U.orgName)??N.rootOrgName)&&l.jsx("span",{className:xe.userOrg,children:((B=(R=N.organisations)==null?void 0:R[0])==null?void 0:B.orgName)??N.rootOrgName})]}),l.jsx(Ie,{variant:"primary",size:"sm",onClick:()=>w(N),children:"Add"})]},N.identifier)})}),i.trim().length>=2&&!d&&a.length===0&&l.jsx("p",{className:xe.noResults,children:"No users found."})]}),l.jsxs("div",{className:xe.collabSection,children:[l.jsxs("h3",{className:xe.sectionTitle,children:["Current Collaborators",f.length>0&&l.jsx("span",{className:xe.badge,children:f.length})]}),f.length===0?l.jsx("p",{className:xe.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:xe.collabList,children:f.map(N=>{var A,U,R,B;return l.jsxs("li",{className:xe.collabItem,children:[l.jsx("div",{className:xe.userAvatar,"aria-hidden":"true",children:j(N).charAt(0).toUpperCase()}),l.jsxs("div",{className:xe.userInfo,children:[l.jsx("span",{className:xe.userName,children:j(N)}),N.email&&l.jsx("span",{className:xe.userEmail,children:N.email}),(((U=(A=N.organisations)==null?void 0:A[0])==null?void 0:U.orgName)??N.rootOrgName)&&l.jsx("span",{className:xe.userOrg,children:((B=(R=N.organisations)==null?void 0:R[0])==null?void 0:B.orgName)??N.rootOrgName})]}),l.jsx(Ie,{variant:"danger",size:"sm",onClick:()=>C(N.identifier),children:"Remove"})]},N.identifier)})})]}),h&&l.jsx("p",{className:xe.error,role:"alert",children:h}),v&&l.jsx("p",{className:xe.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:xe.footer,children:[l.jsx(Ie,{variant:"ghost",onClick:t,disabled:g,children:"Cancel"}),l.jsx(Ie,{variant:"primary",isLoading:g,onClick:D,children:"Save"})]})]})};async function L_(e){return(await Me.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function F_(e,t){var s;const n=((s=(await Me.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 $_(e){var n;const r=((n=(await Me.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 B_="_topbar_zj8wk_1",U_="_left_zj8wk_15",V_="_right_zj8wk_23",z_="_backBtn_zj8wk_30",q_="_title_zj8wk_49",H_="_statusChip_zj8wk_61",W_="_savedIndicator_zj8wk_73",K_="_unsaved_zj8wk_83",Q_="_iconBtn_zj8wk_88",G_="_iconBtnLabel_zj8wk_115",Y_="_qrDropdown_zj8wk_119",X_="_qrMenu_zj8wk_123",Z_="_reviewBtns_zj8wk_158",J_="_sourcingBtns_zj8wk_167",ew="_modalOverlay_zj8wk_176",tw="_sbOverlay_zj8wk_186",rw="_sbModal_zj8wk_196",nw="_sbModalHeader_zj8wk_207",sw="_sbModalTitle_zj8wk_215",iw="_sbModalClose_zj8wk_222",ow="_sbModalBody_zj8wk_235",aw="_sbLabel_zj8wk_242",lw="_sbTextarea_zj8wk_249",cw="_sbError_zj8wk_266",uw="_sbModalFooter_zj8wk_273",ae={topbar:B_,left:U_,right:V_,backBtn:z_,title:q_,statusChip:H_,savedIndicator:W_,unsaved:K_,iconBtn:Q_,iconBtnLabel:G_,qrDropdown:Y_,qrMenu:X_,reviewBtns:Z_,sourcingBtns:J_,modalOverlay:ew,sbOverlay:tw,sbModal:rw,sbModalHeader:nw,sbModalTitle:sw,sbModalClose:iw,sbModalBody:ow,sbLabel:aw,sbTextarea:lw,sbError:cw,sbModalFooter:uw};function dw(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function fw(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const yc=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const[a,c]=p.useState(""),d=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:ae.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${d}-title`,children:l.jsxs("div",{className:ae.sbModal,children:[l.jsxs("div",{className:ae.sbModalHeader,children:[l.jsx("span",{id:`${d}-title`,className:ae.sbModalTitle,children:e}),l.jsx("button",{className:ae.sbModalClose,onClick:o,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ae.sbModalBody,children:[l.jsxs("label",{className:ae.sbLabel,htmlFor:`${d}-comment`,children:[t," ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:`${d}-comment`,className:ae.sbTextarea,placeholder:r,value:a,onChange:u=>c(u.target.value),rows:4,required:!0,"aria-required":"true"}),a.trim().length===0&&l.jsx("p",{className:ae.sbError,children:"Fill comments"})]}),l.jsxs("div",{className:ae.sbModalFooter,children:[l.jsx(Ie,{variant:"ghost",onClick:o,children:"Cancel"}),l.jsx(Ie,{variant:s,onClick:()=>i(a.trim()),disabled:a.trim().length===0,children:n})]})]})})},hw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(!1);return l.jsx("div",{className:ae.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:ae.sbModal,children:[l.jsxs("div",{className:ae.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:ae.sbModalTitle,children:"Accepting Terms & Conditions"}),l.jsx("button",{className:ae.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsx("div",{className:ae.sbModalBody,children:l.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:1.55},children:[l.jsx("input",{type:"checkbox",checked:r,onChange:s=>n(s.target.checked),style:{marginTop:2}}),l.jsxs("span",{children:["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"," ",l.jsx("a",{className:"sb-color-primary",style:{fontWeight:600},href:"https://creativecommons.org/licenses",target:"_blank",rel:"noreferrer",children:"Creative Commons Framework"})," ","in accordance with the ",l.jsx("strong",{children:"Content Policy"}),". I have made sure that I do not violate others’ copyright or privacy rights."]})]})}),l.jsxs("div",{className:ae.sbModalFooter,children:[l.jsx(Ie,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Ie,{variant:"primary",onClick:e,disabled:!r,children:"Submit"})]})]})})},pw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(""),s=parseInt(r,10),i=!isNaN(s)&&s>=2&&s<=250;return l.jsx("div",{className:ae.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:ae.sbModal,children:[l.jsxs("div",{className:ae.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:ae.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:ae.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ae.sbModalBody,children:[l.jsxs("label",{className:ae.sbLabel,htmlFor:"qr-count",children:["Number of QR Codes ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("input",{id:"qr-count",type:"number",min:2,max:250,className:ae.sbTextarea,style:{resize:"none",height:"40px"},placeholder:"Enter number (2–250)",value:r,onChange:o=>n(o.target.value)}),r&&!i&&l.jsx("p",{className:ae.sbError,children:"Enter a number between 2 and 250."})]}),l.jsxs("div",{className:ae.sbModalFooter,children:[l.jsx(Ie,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Ie,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},gw=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var Ne,ie;const a=Re(ne=>ne.treeData)[0],c=(a==null?void 0:a.name)??"Untitled",d=fw(((Ne=a==null?void 0:a.metadata)==null?void 0:Ne.status)??(a==null?void 0:a.status)),u=ue(ne=>{var le,Le,ze,Te;return((Le=(le=ne.editorConfig)==null?void 0:le.context)==null?void 0:Le.contentId)??((Te=(ze=ne.editorConfig)==null?void 0:ze.context)==null?void 0:Te.identifier)??""}),{activeModal:f,modalData:m,closeModal:g,openModal:_}=Fy(),h=ue(ne=>ne.buttonLoaders),y=ue(ne=>ne.categoryMeta),v=!y||y.schemaDefaults.generateDIALCodes!=="No",[b,x]=p.useState(!1),[w,C]=p.useState(!1),[D,j]=p.useState(!1),[k,$]=p.useState(!1),N=p.useRef(null),[A,U]=p.useState(!1);p.useEffect(()=>{if(!k)return;const ne=le=>{var Le;(Le=N.current)!=null&&Le.contains(le.target)||$(!1)};return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[k]);const[R,B]=p.useState(!1),[F,J]=p.useState(!1),{updateNode:se}=Re(),ge=(ie=a==null?void 0:a.metadata)==null?void 0:ie.qrCodeProcessId,ye=p.useCallback(async ne=>{if(u){U(!1),B(!0);try{const{processId:le,reservedDialcodes:Le}=await F_(u,ne);le&&a&&se(a.id,{qrCodeProcessId:le,reservedDialcodes:Le}),Se.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Se.error("Failed to generate QR Codes. Please try again.")}finally{B(!1)}}},[u,a,se]),ve=p.useCallback(async()=>{if(!ge){Se.error("No QR codes generated yet. Generate QR Codes first.");return}J(!0);try{const ne=await $_(ge);if(ne.status==="in-process"){Se("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const le=ne.url;if(!le){Se.error("QR Codes not ready yet. Please wait and try again.");return}const Le=await fetch(le).then(Ye=>Ye.blob()),ze=await new Promise(Ye=>{const lt=new FileReader;lt.onloadend=()=>Ye(lt.result),lt.readAsDataURL(Le)}),Te=(a==null?void 0:a.metadata)??{},te=Ye=>Array.isArray(Ye)?Ye.join("_"):typeof Ye=="string"?Ye:"",We=[u,te(Te.medium),te(Te.gradeLevel),te(Te.subject)].filter(Boolean),at=new Date().toISOString().replace(/[:.]/g,"-"),vt=`${We.join("_")}_${at}.zip`,qe=document.createElement("a");qe.href=ze,qe.download=vt,qe.style.display="none",document.body.appendChild(qe),qe.click(),document.body.removeChild(qe),Se.success("QR codes downloaded.")}catch{Se.error("Failed to download QR Codes.")}finally{J(!1)}},[ge,a,u]),K=e==="edit",P=e==="review",X=e==="sourcingreview",M=e==="read",G=p.useCallback((ne,le)=>{i({action:ne,data:le})},[i]),W=p.useCallback(()=>{g(),G("publish")},[g,G]),oe=p.useCallback((ne,le)=>{const Le=m==null?void 0:m.action;g(),Le==="approve"?G("sourcingApprove",{comment:ne,score:le}):G("reject",{comment:ne})},[g,G,m]),be=p.useCallback(ne=>{x(!1),G("sendBackForCorrections",{comment:ne})},[G]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:ae.topbar,role:"banner",children:[l.jsxs("div",{className:ae.left,children:[l.jsx("button",{className:ae.backBtn,onClick:()=>G("back"),"aria-label":"Go back",type:"button",children:l.jsx(ry,{size:18})}),l.jsx("h1",{className:ae.title,title:c,children:c}),l.jsx("span",{className:`sbx-chip ${ae.statusChip}`,"aria-label":`Status: ${d}`,children:d})]}),l.jsxs("div",{className:ae.right,children:[t?l.jsx("span",{className:ae.savedIndicator,"aria-live":"polite",children:"Saving…"}):r?l.jsx("span",{className:`${ae.savedIndicator} ${ae.unsaved}`,"aria-live":"polite",children:"Unsaved"}):n?l.jsxs("span",{className:ae.savedIndicator,"aria-live":"polite",children:[l.jsx(Vn,{size:14,"aria-hidden":"true"}),"Saved ",dw(n)]}):null,!M&&!P&&!X&&d!=="Review"&&l.jsx("span",{title:s?void 0:"Fill all required fields before saving",children:l.jsx(Ie,{variant:"ghost",size:"sm",onClick:()=>G("saveCollection"),disabled:!s,children:"Save as Draft"})}),K&&l.jsxs(l.Fragment,{children:[l.jsxs(Ie,{variant:"primary",size:"sm",onClick:()=>j(!0),disabled:h.saveCollection,isLoading:h.saveCollection,children:[l.jsx(vy,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:ae.iconBtn,onClick:()=>_("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx(wy,{size:16,"aria-hidden":"true"})}),v&&l.jsxs("div",{className:ae.qrDropdown,ref:N,children:[l.jsxs("button",{className:ae.iconBtn,onClick:()=>$(ne=>!ne),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":k,children:[l.jsx(ql,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:ae.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),k&&l.jsxs("div",{className:ae.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{$(!1),U(!0)},disabled:R,children:[l.jsx(ql,{size:14}),R?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{$(!1),ve()},disabled:F||!ge,children:[l.jsx(ay,{size:14}),F?"Downloading…":"Download QR Codes"]})]})]})]}),P&&l.jsxs("div",{className:ae.reviewBtns,children:[l.jsxs(Ie,{variant:"primary",size:"sm",onClick:()=>_("publishChecklist"),disabled:h.publishCollection,isLoading:h.publishCollection,children:[l.jsx(Vd,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(Ie,{variant:"danger",size:"sm",onClick:()=>C(!0),disabled:h.rejectCollection,isLoading:h.rejectCollection,children:[l.jsx(oa,{size:14,"aria-hidden":"true"})," Reject"]}),l.jsxs(Ie,{variant:"ghost",size:"sm",onClick:()=>x(!0),children:[l.jsx(my,{size:14,"aria-hidden":"true"})," Send Back"]})]}),X&&l.jsxs("div",{className:ae.sourcingBtns,children:[l.jsxs(Ie,{variant:"primary",size:"sm",onClick:()=>_("qualityParams",{action:"approve"}),children:[l.jsx(by,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(Ie,{variant:"danger",size:"sm",onClick:()=>_("qualityParams",{action:"reject"}),children:[l.jsx(oa,{size:14,"aria-hidden":"true"})," Reject"]})]})]})]}),f==="publishChecklist"&&l.jsx(tv,{contentId:u,onConfirm:W,onCancel:g}),f==="qualityParams"&&l.jsx(rv,{contentId:u,action:(m==null?void 0:m.action)??"reject",onConfirm:oe,onCancel:g}),f==="manageCollaborators"&&l.jsx("div",{className:ae.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(M_,{contentId:u,onClose:g})}),D&&l.jsx(hw,{onConfirm:()=>{j(!1),G("sendForReview")},onCancel:()=>j(!1)}),w&&l.jsx(yc,{titleText:"Reject Content",labelText:"Reason for rejection",placeholderText:"Explain why this content is being rejected",submitLabel:"Reject",submitVariant:"danger",onConfirm:ne=>{C(!1),G("reject",{comment:ne})},onCancel:()=>C(!1)}),b&&l.jsx(yc,{titleText:"Send Back for Corrections",labelText:"Corrections needed",placeholderText:"Describe the corrections the author needs to make",submitLabel:"Send Back",submitVariant:"primary",onConfirm:be,onCancel:()=>x(!1)}),A&&l.jsx(pw,{onConfirm:ye,onCancel:()=>U(!1)})]})},mw=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>Rr.createPortal(l.jsx("div",{className:De.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:De.modal,children:[l.jsxs("div",{className:De.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:De.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:De.modalBody,children:l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:"You have unsaved changes. Would you like to save them before leaving?"})}),l.jsxs("div",{className:De.modalFooter,children:[l.jsx(Ie,{variant:"ghost",onClick:r,disabled:n,children:"Cancel"}),l.jsx(Ie,{variant:"danger",onClick:t,disabled:n,children:"Discard"}),l.jsx(Ie,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:"Save"})]})]})}),document.body);var yw=Qa();const Nf=p.createContext(null);function It(){const e=p.useContext(Nf);if(e===null)throw new Error("No Tree Api Provided");return e}const Tf=p.createContext(null);function vw(){const e=p.useContext(Tf);if(e===null)throw new Error("Provide a NodesContext");return e}const jf=p.createContext(null);function bw(){const e=p.useContext(jf);if(e===null)throw new Error("Provide a DnDContext");return e}const Rf=p.createContext(0);function kf(){p.useContext(Rf)}function ci(e,t,r){return Math.max(Math.min(e,r),t)}function Af(e){return e&&e.isLeaf}function Pf(e){return e&&e.isInternal&&!e.isOpen}function Mf(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const Lf=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},Ff=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function rl(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=rl(r,t);if(n)return n}return null}function Ni(e,t){if(t(e),e.children)for(let r of e.children)Ni(r,t)}function $f(e){const t=Uf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=_w(t,n);break}r==null||r.focus()}function Bf(e){const t=Uf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=ww(t,n);break}r==null||r.focus()}function _w(e,t){return t+1<e.length?e[t+1]:e[0]}function ww(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Uf(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 is(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function bn(e){return typeof e=="string"?e:e.id}function xw(e,...t){if(e)return e(...t)}function Vf(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function zf(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 qf(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const Sw=Object.freeze(Object.defineProperty({__proto__:null,access:is,bound:ci,dfs:rl,focusNextElement:$f,focusPrevElement:Bf,getInsertIndex:zf,getInsertParentId:qf,identify:bn,indexOf:Ff,isClosed:Pf,isDescendant:Lf,isItem:Af,isOpenWithEmptyChildren:Mf,safeRun:xw,waitFor:Vf,walk:Ni},Symbol.toStringTag,{value:"Module"})),Cw={display:"flex",alignItems:"center",zIndex:1},Ow={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},Ew={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},Dw=p.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 l.jsxs("div",{style:Object.assign(Object.assign({},Cw),s),children:[l.jsx("div",{style:Object.assign({},Ew)}),l.jsx("div",{style:Object.assign({},Ow)})]})});function Iw({node:e,attrs:t,innerRef:r,children:n}){return l.jsx("div",Object.assign({},t,{ref:r,onFocus:s=>s.stopPropagation(),onClick:e.handleClick,children:n}))}function Nw(e){return l.jsxs("div",{ref:e.dragHandle,style:e.style,children:[l.jsx("span",{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?"🌳":e.node.isOpen?"🗁":"🗀"})," ",e.node.isEditing?l.jsx(jw,Object.assign({},e)):l.jsx(Tw,Object.assign({},e))]})}function Tw(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function jw({node:e}){const t=p.useRef();return p.useEffect(()=>{var r,n;(r=t.current)===null||r===void 0||r.focus(),(n=t.current)===null||n===void 0||n.select()},[]),l.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 _s="__REACT_ARBORIST_INTERNAL_ROOT__";function vc(e){var t;function r(i,o,a){const c=e.accessId(i),d=new ws({tree:e,data:i,level:o,parent:a,id:c,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),u=e.accessChildren(i);return u&&(d.children=u.map(f=>r(f,o+1,d))),d}const n=new ws({tree:e,id:_s,data:{id:_s},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 ws{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===_s}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 ws(Object.assign({},this))}edit(){return this.tree.edit(this)}}function bo(e){return{type:"EDIT",id:e}}function Rw(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function un(e){return{type:"FOCUS",id:e}}function kw(){return{type:"TREE_BLUR"}}function Aw(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 ga={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 bc(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 Pw(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:bc(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:bc(e.unfiltered,t)}):e}const Ln=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}}},vr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:bn(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(bn)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(bn)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:bn(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:bn(e)})};function Mw(e=Ln().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 Fn={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 Lw(e=Ln().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 Ln().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const Fw={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},$w=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},Bw=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function Hf({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(Uw,{isDragging:s,children:[l.jsx(Vw,{offset:e,children:l.jsx(qw,{id:r,dragIds:n})}),l.jsx(zw,{mouse:t,count:n.length})]})}const Uw=p.memo(function(t){return t.isDragging?l.jsx("div",{style:Fw,children:t.children}):null});function Vw(e){return l.jsx("div",{className:"row preview",style:$w(e.offset),children:e.children})}function zw(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:Bw(r),children:t}):null}const qw=p.memo(function(t){const r=It(),n=r.get(t.id);return n?l.jsx(r.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*r.indent,opacity:.2,background:"transparent"},tree:r}):null});function ma(){return ma=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},ma.apply(null,arguments)}function _c(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ya(e,t){return ya=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},ya(e,t)}function Hw(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ya(e,t)}var wc=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Ww(e,t){return!!(e===t||wc(e)&&wc(t))}function Kw(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!Ww(e[r],t[r]))return!1;return!0}function _o(e,t){t===void 0&&(t=Kw);var r,n=[],s,i=!1;function o(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return i&&r===this&&t(a,n)||(s=e.apply(this,a),i=!0,r=this,n=a),s}return o}var Qw=typeof performance=="object"&&typeof performance.now=="function",xc=Qw?function(){return performance.now()}:function(){return Date.now()};function Sc(e){cancelAnimationFrame(e.id)}function Gw(e,t){var r=xc();function n(){xc()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var wo=-1;function Cc(e){if(e===void 0&&(e=!1),wo===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),wo=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return wo}var dn=null;function Oc(e){if(e===void 0&&(e=!1),dn===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?dn="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?dn="negative":dn="positive-ascending"),document.body.removeChild(t),dn}return dn}process.env.NODE_ENV;var Yw=150,Xw=function(t,r){return t},ui=null,di=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(ui=new WeakSet,di=new WeakSet);function Wf(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,d=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(f){Hw(m,f);function m(_){var h;return h=f.call(this,_)||this,h._instanceProps=c(h.props,_c(h)),h._outerRef=void 0,h._resetIsScrollingTimeoutId=null,h.state={instance:_c(h),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof h.props.initialScrollOffset=="number"?h.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},h._callOnItemsRendered=void 0,h._callOnItemsRendered=_o(function(y,v,b,x){return h.props.onItemsRendered({overscanStartIndex:y,overscanStopIndex:v,visibleStartIndex:b,visibleStopIndex:x})}),h._callOnScroll=void 0,h._callOnScroll=_o(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,x=v.itemSize,w=v.layout,C=h._getItemStyleCache(d&&x,d&&w,d&&b),D;if(C.hasOwnProperty(y))D=C[y];else{var j=r(h.props,y,h._instanceProps),k=s(h.props,y,h._instanceProps),$=b==="horizontal"||w==="horizontal",N=b==="rtl",A=$?j:0;C[y]=D={position:"absolute",left:N?void 0:A,right:N?A:void 0,top:$?0:j,height:$?"100%":k,width:$?k:"100%"}}return D},h._getItemStyleCache=void 0,h._getItemStyleCache=_o(function(y,v,b){return{}}),h._onScrollHorizontal=function(y){var v=y.currentTarget,b=v.clientWidth,x=v.scrollLeft,w=v.scrollWidth;h.setState(function(C){if(C.scrollOffset===x)return null;var D=h.props.direction,j=x;if(D==="rtl")switch(Oc()){case"negative":j=-x;break;case"positive-descending":j=w-b-x;break}return j=Math.max(0,Math.min(j,w-b)),{isScrolling:!0,scrollDirection:C.scrollOffset<j?"forward":"backward",scrollOffset:j,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._onScrollVertical=function(y){var v=y.currentTarget,b=v.clientHeight,x=v.scrollHeight,w=v.scrollTop;h.setState(function(C){if(C.scrollOffset===w)return null;var D=Math.max(0,Math.min(w,x-b));return{isScrolling:!0,scrollDirection:C.scrollOffset<D?"forward":"backward",scrollOffset:D,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&&Sc(h._resetIsScrollingTimeoutId),h._resetIsScrollingTimeoutId=Gw(h._resetIsScrolling,Yw)},h._resetIsScrolling=function(){h._resetIsScrollingTimeoutId=null,h.setState({isScrolling:!1},function(){h._getItemStyleCache(-1,null)})},h}m.getDerivedStateFromProps=function(h,y){return Zw(h,y),u(h),null};var g=m.prototype;return g.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)},g.scrollToItem=function(h,y){y===void 0&&(y="auto");var v=this.props,b=v.itemCount,x=v.layout,w=this.state.scrollOffset;h=Math.max(0,Math.min(h,b-1));var C=0;if(this._outerRef){var D=this._outerRef;x==="vertical"?C=D.scrollWidth>D.clientWidth?Cc():0:C=D.scrollHeight>D.clientHeight?Cc():0}this.scrollTo(i(this.props,h,y,w,this._instanceProps,C))},g.componentDidMount=function(){var h=this.props,y=h.direction,v=h.initialScrollOffset,b=h.layout;if(typeof v=="number"&&this._outerRef!=null){var x=this._outerRef;y==="horizontal"||b==="horizontal"?x.scrollLeft=v:x.scrollTop=v}this._callPropsCallbacks()},g.componentDidUpdate=function(){var h=this.props,y=h.direction,v=h.layout,b=this.state,x=b.scrollOffset,w=b.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var C=this._outerRef;if(y==="horizontal"||v==="horizontal")if(y==="rtl")switch(Oc()){case"negative":C.scrollLeft=-x;break;case"positive-ascending":C.scrollLeft=x;break;default:var D=C.clientWidth,j=C.scrollWidth;C.scrollLeft=j-D-x;break}else C.scrollLeft=x;else C.scrollTop=x}this._callPropsCallbacks()},g.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Sc(this._resetIsScrollingTimeoutId)},g.render=function(){var h=this.props,y=h.children,v=h.className,b=h.direction,x=h.height,w=h.innerRef,C=h.innerElementType,D=h.innerTagName,j=h.itemCount,k=h.itemData,$=h.itemKey,N=$===void 0?Xw:$,A=h.layout,U=h.outerElementType,R=h.outerTagName,B=h.style,F=h.useIsScrolling,J=h.width,se=this.state.isScrolling,ge=b==="horizontal"||A==="horizontal",ye=ge?this._onScrollHorizontal:this._onScrollVertical,ve=this._getRangeToRender(),K=ve[0],P=ve[1],X=[];if(j>0)for(var M=K;M<=P;M++)X.push(p.createElement(y,{data:k,key:N(M,k),index:M,isScrolling:F?se:void 0,style:this._getItemStyle(M)}));var G=n(this.props,this._instanceProps);return p.createElement(U||R||"div",{className:v,onScroll:ye,ref:this._outerRefSetter,style:ma({position:"relative",height:x,width:J,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},B)},p.createElement(C||D||"div",{children:X,ref:w,style:{height:ge?"100%":G,pointerEvents:se?"none":void 0,width:ge?G:"100%"}}))},g._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],x=y[2],w=y[3];this._callOnItemsRendered(v,b,x,w)}}if(typeof this.props.onScroll=="function"){var C=this.state,D=C.scrollDirection,j=C.scrollOffset,k=C.scrollUpdateWasRequested;this._callOnScroll(D,j,k)}},g._getRangeToRender=function(){var h=this.props,y=h.itemCount,v=h.overscanCount,b=this.state,x=b.isScrolling,w=b.scrollDirection,C=b.scrollOffset;if(y===0)return[0,0,0,0];var D=o(this.props,C,this._instanceProps),j=a(this.props,D,C,this._instanceProps),k=!x||w==="backward"?Math.max(1,v):1,$=!x||w==="forward"?Math.max(1,v):1;return[Math.max(0,D-k),Math.max(0,Math.min(y-1,j+$)),D,j]},m}(p.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var Zw=function(t,r){var n=t.children,s=t.direction,i=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,d=t.width,u=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||c!=null)&&di&&!di.has(u)&&(di.add(u),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=s==="horizontal"||o==="horizontal";switch(s){case"horizontal":case"vertical":ui&&!ui.has(u)&&(ui.add(u),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(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" 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(f&&typeof d!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(d===null?"null":typeof d)+'" was specified.'));if(!f&&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.'))}},Jw=50,_n=function(t,r,n){var s=t,i=s.itemSize,o=n.itemMetadataMap,a=n.lastMeasuredIndex;if(r>a){var c=0;if(a>=0){var d=o[a];c=d.offset+d.size}for(var u=a+1;u<=r;u++){var f=i(u);o[u]={offset:c,size:f},c+=f}n.lastMeasuredIndex=r}return o[r]},ex=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?Kf(t,r,i,0,n):tx(t,r,Math.max(0,i),n)},Kf=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=_n(t,o,r).offset;if(a===i)return o;a<i?s=o+1:a>i&&(n=o-1)}return s>0?s-1:0},tx=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&_n(t,n,r).offset<s;)n+=o,o*=2;return Kf(t,r,Math.min(n,i-1),Math.floor(n/2),s)},Ec=function(t,r){var n=t.itemCount,s=r.itemMetadataMap,i=r.estimatedItemSize,o=r.lastMeasuredIndex,a=0;if(o>=n&&(o=n-1),o>=0){var c=s[o];a=c.offset+c.size}var d=n-o-1,u=d*i;return a+u},rx=Wf({getItemOffset:function(t,r,n){return _n(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Ec,getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,d=t.layout,u=t.width,f=a==="horizontal"||d==="horizontal",m=f?u:c,g=_n(t,r,i),_=Ec(t,i),h=Math.max(0,Math.min(_-m,g.offset)),y=Math.max(0,g.offset-m+g.size+o);switch(n==="smart"&&(s>=y-m&&s<=h+m?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 ex(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,o=t.height,a=t.itemCount,c=t.layout,d=t.width,u=i==="horizontal"||c==="horizontal",f=u?d:o,m=_n(t,r,s),g=n+f,_=m.offset+m.size,h=r;h<a-1&&_<g;)h++,_+=_n(t,h,s).size;return h},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||Jw,lastMeasuredIndex:-1};return r.resetAfterIndex=function(o,a){a===void 0&&(a=!0),i.lastMeasuredIndex=Math.min(i.lastMeasuredIndex,o-1),r._getItemStyleCache(-1),a&&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.'))}}),nx=Wf({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,o){var a=t.direction,c=t.height,d=t.itemCount,u=t.itemSize,f=t.layout,m=t.width,g=a==="horizontal"||f==="horizontal",_=g?m:c,h=Math.max(0,d*u-_),y=Math.min(h,r*u),v=Math.max(0,r*u-_+u+o);switch(n==="smart"&&(s>=v-_&&s<=y+_?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(_/2)?0:b>h+Math.floor(_/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,o=t.itemCount,a=t.itemSize,c=t.layout,d=t.width,u=s==="horizontal"||c==="horizontal",f=r*a,m=u?d:i,g=Math.ceil((m+n-f)/a);return Math.max(0,Math.min(o-1,r+g-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 sx(){var e,t;const r=It(),s=bw().cursor;if(!s||s.type!=="line")return null;const i=r.indent,o=r.rowTopPosition(s.index)+((t=(e=r.props.padding)!==null&&e!==void 0?e:r.props.paddingTop)!==null&&t!==void 0?t:0),a=i*s.level,c=r.renderCursor;return l.jsx(c,{top:o,left:a,indent:i})}var ix=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 ox=p.forwardRef(function(t,r){const{children:n}=t,s=ix(t,["children"]),i=It();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(ax,{}),n]}))}),ax=()=>{const e=It();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(sx,{})})};var lx=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 cx=p.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=lx(t,["style"]);const d=It(),u=(s=(n=d.props.padding)!==null&&n!==void 0?n:d.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=d.props.padding)!==null&&i!==void 0?i:d.props.paddingBottom)!==null&&o!==void 0?o:0;return l.jsx("div",Object.assign({ref:r,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+u+f}px`})},c))});var Qf=p.createContext({dragDropManager:void 0}),Ut;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Ut||(Ut={}));function ce(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 o=0;i=new Error(t.replace(/%s/g,function(){return n[o++]})),i.name="Invariant Violation"}throw i.framesToPop=1,i}}var nl="dnd-core/INIT_COORDS",Qi="dnd-core/BEGIN_DRAG",sl="dnd-core/PUBLISH_DRAG_SOURCE",Gi="dnd-core/HOVER",Yi="dnd-core/DROP",Xi="dnd-core/END_DRAG";function Dc(e,t){return{type:nl,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function fi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?fi=function(r){return typeof r}:fi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},fi(e)}function ux(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function dx(e,t){return e.filter(function(r){return r!==t})}function Gf(e){return fi(e)==="object"}function fx(e,t){var r=new Map,n=function(o){r.set(o,r.has(o)?r.get(o)+1:1)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i,o){i===1&&s.push(o)}),s}function hx(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var px={type:nl,payload:{clientOffset:null,sourceClientOffset:null}};function gx(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,o=n.clientOffset,a=n.getSourceClientOffset,c=e.getMonitor(),d=e.getRegistry();e.dispatch(Dc(o)),mx(r,c,d);var u=bx(r,c);if(u===null){e.dispatch(px);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");yx(a),f=a(u)}e.dispatch(Dc(o,f));var m=d.getSource(u),g=m.beginDrag(c,u);if(g!=null){vx(g),d.pinSource(u);var _=d.getSourceType(u);return{type:Qi,payload:{itemType:_,item:g,sourceId:u,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function mx(e,t,r){ce(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){ce(r.getSource(n),"Expected sourceIds to be registered.")})}function yx(e){ce(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function vx(e){ce(Gf(e),"Item must be an object.")}function bx(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 _x(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:sl}}}function va(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function wx(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;xx(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();Sx(i,o,a);var c=o.getItemType();return Cx(i,a,c),Ox(i,o,a),{type:Gi,payload:{targetIds:i,clientOffset:s||null}}}}function xx(e){ce(Array.isArray(e),"Expected targetIds to be an array.")}function Sx(e,t,r){ce(t.isDragging(),"Cannot call hover while not dragging."),ce(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];ce(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);ce(i,"Expected targetIds to be registered.")}}function Cx(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);va(i,r)||e.splice(n,1)}}function Ox(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function Ic(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 Nc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ic(Object(r),!0).forEach(function(n){Ex(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ic(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ex(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dx(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();Ix(n);var i=jx(n);i.forEach(function(o,a){var c=Nx(o,a,s,n),d={type:Yi,payload:{dropResult:Nc(Nc({},r),c)}};e.dispatch(d)})}}function Ix(e){ce(e.isDragging(),"Cannot call drop while not dragging."),ce(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function Nx(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return Tx(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function Tx(e){ce(typeof e>"u"||Gf(e),"Drop result must either be an object or undefined.")}function jx(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Rx(e){return function(){var r=e.getMonitor(),n=e.getRegistry();kx(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:Xi}}}function kx(e){ce(e.isDragging(),"Cannot call endDrag while not dragging.")}function Ax(e){return{beginDrag:gx(e),publishDragSource:_x(e),hover:wx(e),drop:Dx(e),endDrag:Rx(e)}}function Px(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mx(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 Lx(e,t,r){return t&&Mx(e.prototype,t),e}function Xn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Fx=function(){function e(t,r){var n=this;Px(this,e),Xn(this,"store",void 0),Xn(this,"monitor",void 0),Xn(this,"backend",void 0),Xn(this,"isSetUp",!1),Xn(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 Lx(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(o){return function(){for(var a=arguments.length,c=new Array(a),d=0;d<a;d++)c[d]=arguments[d];var u=o.apply(r,c);typeof u<"u"&&n(u)}}var i=Ax(this);return Object.keys(i).reduce(function(o,a){var c=i[a];return o[a]=s(c),o},{})}},{key:"dispatch",value:function(r){this.store.dispatch(r)}}]),e}();function Mt(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 Tc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),jc=function(){return Math.random().toString(36).substring(7).split("").join(".")},Rc={INIT:"@@redux/INIT"+jc(),REPLACE:"@@redux/REPLACE"+jc()};function $x(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 Bx(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(zx(e))return"date";if(Vx(e))return"error";var r=Ux(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 Ux(e){return typeof e.constructor=="function"?e.constructor.name:null}function Vx(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function zx(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function fn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=Bx(e)),t}function Yf(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"?Mt(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"?Mt(1):"Expected the enhancer to be a function. Instead, received: '"+fn(r)+"'");return r(Yf)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Mt(2):"Expected the root reducer to be a function. Instead, received: '"+fn(e)+"'");var s=e,i=t,o=[],a=o,c=!1;function d(){a===o&&(a=o.slice())}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?Mt(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 f(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Mt(4):"Expected the listener to be a function. Instead, received: '"+fn(h)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?Mt(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 d(),a.push(h),function(){if(y){if(c)throw new Error(process.env.NODE_ENV==="production"?Mt(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,d();var b=a.indexOf(h);a.splice(b,1),o=null}}}function m(h){if(!$x(h))throw new Error(process.env.NODE_ENV==="production"?Mt(7):"Actions must be plain objects. Instead, the actual type was: '"+fn(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"?Mt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?Mt(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,h)}finally{c=!1}for(var y=o=a,v=0;v<y.length;v++){var b=y[v];b()}return h}function g(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Mt(10):"Expected the nextReducer to be a function. Instead, received: '"+fn(h));s=h,m({type:Rc.REPLACE})}function _(){var h,y=f;return h={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?Mt(11):"Expected the observer to be an object. Instead, received: '"+fn(b)+"'");function x(){b.next&&b.next(u())}x();var w=y(x);return{unsubscribe:w}}},h[Tc]=function(){return this},h}return m({type:Rc.INIT}),n={dispatch:m,subscribe:f,getState:u,replaceReducer:g},n[Tc]=_,n}var qx=function(t,r){return t===r};function Hx(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Wx(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:qx;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 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 Ac(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){Kx(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 Kx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Pc={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Qx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Pc,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case nl:case Qi:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Gi:return Hx(e.clientOffset,r.clientOffset)?e:Ac(Ac({},e),{},{clientOffset:r.clientOffset});case Xi:case Yi:return Pc;default:return e}}var il="dnd-core/ADD_SOURCE",ol="dnd-core/ADD_TARGET",al="dnd-core/REMOVE_SOURCE",Zi="dnd-core/REMOVE_TARGET";function Gx(e){return{type:il,payload:{sourceId:e}}}function Yx(e){return{type:ol,payload:{targetId:e}}}function Xx(e){return{type:al,payload:{sourceId:e}}}function Zx(e){return{type:Zi,payload:{targetId:e}}}function Mc(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 Lt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Mc(Object(r),!0).forEach(function(n){Jx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Jx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var eS={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function tS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:eS,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Qi:return Lt(Lt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case sl:return Lt(Lt({},e),{},{isSourcePublic:!0});case Gi:return Lt(Lt({},e),{},{targetIds:r.targetIds});case Zi:return e.targetIds.indexOf(r.targetId)===-1?e:Lt(Lt({},e),{},{targetIds:dx(e.targetIds,r.targetId)});case Yi:return Lt(Lt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case Xi:return Lt(Lt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function rS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case il:case ol:return e+1;case al:case Zi:return e-1;default:return e}}var Ti=[],ll=[];Ti.__IS_NONE__=!0;ll.__IS_ALL__=!0;function nS(e,t){if(e===Ti)return!1;if(e===ll||typeof t>"u")return!0;var r=hx(t,e);return r.length>0}function sS(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Gi:break;case il:case ol:case Zi:case al:return Ti;case Qi:case sl:case Xi:case Yi:default:return ll}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=fx(n,i),a=o.length>0||!Wx(n,i);if(!a)return Ti;var c=i[i.length-1],d=n[n.length-1];return c!==d&&(c&&o.push(c),d&&o.push(d)),o}function iS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Lc(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 Fc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Lc(Object(r),!0).forEach(function(n){oS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function oS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:sS(e.dirtyHandlerIds,{type:t.type,payload:Fc(Fc({},t.payload),{},{prevTargetIds:ux(e,"dragOperation.targetIds",[])})}),dragOffset:Qx(e.dragOffset,t),refCount:rS(e.refCount,t),dragOperation:tS(e.dragOperation,t),stateId:iS(e.stateId)}}function lS(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Xf(e,t){return{x:e.x-t.x,y:e.y-t.y}}function cS(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:Xf(lS(t,n),r)}function uS(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:Xf(t,r)}function dS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fS(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 hS(e,t,r){return t&&fS(e.prototype,t),e}function $c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var pS=function(){function e(t,r){dS(this,e),$c(this,"store",void 0),$c(this,"registry",void 0),this.store=t,this.registry=r}return hS(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;ce(typeof r=="function","listener must be a function."),ce(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var d=n.store.getState(),u=d.stateId;try{var f=u===o||u===o+1&&!nS(d.dirtyHandlerIds,i);f||r()}finally{o=u}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;ce(typeof r=="function","listener must be a function.");var s=this.store.getState().dragOffset,i=function(){var a=n.store.getState().dragOffset;a!==s&&(s=a,r())};return this.store.subscribe(i)}},{key:"canDragSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r);return ce(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(ce(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 va(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(ce(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),o=this.getItemType();if(o&&!va(i,o))return!1;var a=this.getTargetIds();if(!a.length)return!1;var c=a.indexOf(r);return s?c===a.length-1:c>-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 cS(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return uS(this.store.getState().dragOffset)}}]),e}(),gS=0;function mS(){return gS++}function hi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?hi=function(r){return typeof r}:hi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},hi(e)}function yS(e){ce(typeof e.canDrag=="function","Expected canDrag to be a function."),ce(typeof e.beginDrag=="function","Expected beginDrag to be a function."),ce(typeof e.endDrag=="function","Expected endDrag to be a function.")}function vS(e){ce(typeof e.canDrop=="function","Expected canDrop to be a function."),ce(typeof e.hover=="function","Expected hover to be a function."),ce(typeof e.drop=="function","Expected beginDrag to be a function.")}function ba(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return ba(r,!1)});return}ce(typeof e=="string"||hi(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 Bc=typeof global<"u"?global:self,Zf=Bc.MutationObserver||Bc.WebKitMutationObserver;function Jf(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function bS(e){let t=1;const r=new Zf(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const _S=typeof Zf=="function"?bS:Jf;class wS{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=_S(this.flush),this.requestErrorThrow=Jf(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class xS{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 SS{create(t){const r=this.freeTasks,n=r.length?r.pop():new xS(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const eh=new wS,CS=new SS(eh.registerPendingError);function OS(e){eh.enqueueTask(CS.create(e))}function ES(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function DS(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 IS(e,t,r){return t&&DS(e.prototype,t),e}function hn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function NS(e,t){return kS(e)||RS(e,t)||jS(e,t)||TS()}function TS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
457
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jS(e,t){if(e){if(typeof e=="string")return Uc(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 Uc(e,t)}}function Uc(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 RS(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function kS(e){if(Array.isArray(e))return e}function AS(e){var t=mS().toString();switch(e){case Ut.SOURCE:return"S".concat(t);case Ut.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Vc(e){switch(e[0]){case"S":return Ut.SOURCE;case"T":return Ut.TARGET;default:ce(!1,"Cannot parse handler ID: ".concat(e))}}function zc(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=NS(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var PS=function(){function e(t){ES(this,e),hn(this,"types",new Map),hn(this,"dragSources",new Map),hn(this,"dropTargets",new Map),hn(this,"pinnedSourceId",null),hn(this,"pinnedSource",null),hn(this,"store",void 0),this.store=t}return IS(e,[{key:"addSource",value:function(r,n){ba(r),yS(n);var s=this.addHandler(Ut.SOURCE,r,n);return this.store.dispatch(Gx(s)),s}},{key:"addTarget",value:function(r,n){ba(r,!0),vS(n);var s=this.addHandler(Ut.TARGET,r,n);return this.store.dispatch(Yx(s)),s}},{key:"containsHandler",value:function(r){return zc(this.dragSources,r)||zc(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;ce(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 ce(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return ce(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return ce(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=Vc(r);return n===Ut.SOURCE}},{key:"isTargetId",value:function(r){var n=Vc(r);return n===Ut.TARGET}},{key:"removeSource",value:function(r){var n=this;ce(this.getSource(r),"Expected an existing source."),this.store.dispatch(Xx(r)),OS(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){ce(this.getTarget(r),"Expected an existing target."),this.store.dispatch(Zx(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);ce(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){ce(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=AS(r);return this.types.set(i,n),r===Ut.SOURCE?this.dragSources.set(i,s):r===Ut.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function MS(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=LS(n),i=new pS(s,new PS(s)),o=new Fx(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function LS(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Yf(aS,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var FS=["children"];function $S(e,t){return zS(e)||VS(e,t)||US(e,t)||BS()}function BS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
458
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function US(e,t){if(e){if(typeof e=="string")return qc(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 qc(e,t)}}function qc(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 VS(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function zS(e){if(Array.isArray(e))return e}function qS(e,t){if(e==null)return{};var r=HS(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 HS(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 Hc=0,pi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),WS=p.memo(function(t){var r=t.children,n=qS(t,FS),s=KS(n),i=$S(s,2),o=i[0],a=i[1];return p.useEffect(function(){if(a){var c=th();return++Hc,function(){--Hc===0&&(c[pi]=null)}}},[]),l.jsx(Qf.Provider,Object.assign({value:o},{children:r}),void 0)});function KS(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=QS(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function QS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:th(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[pi]||(s[pi]={dragDropManager:MS(e,t,r,n)}),s[pi]}function th(){return typeof global<"u"?global:window}function GS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function YS(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 XS(e,t,r){return t&&YS(e.prototype,t),e}function Wc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xo=!1,So=!1,ZS=function(){function e(t){GS(this,e),Wc(this,"internalMonitor",void 0),Wc(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return XS(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){ce(!xo,"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 xo=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{xo=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;ce(!So,"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 So=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{So=!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 JS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function eC(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 tC(e,t,r){return t&&eC(e.prototype,t),e}function Kc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Co=!1,rC=function(){function e(t){JS(this,e),Kc(this,"internalMonitor",void 0),Kc(this,"targetId",null),this.internalMonitor=t.getMonitor()}return tC(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;ce(!Co,"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 Co=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Co=!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 nC(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 sC(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(!p.isValidElement(t)){var n=t;return e(n,r),n}var s=t;nC(s);var i=r?function(o){return e(o,r)}:e;return iC(s,i)}}function rh(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=sC(n);t[r]=function(){return s}}}),t}function Qc(e,t){typeof e=="function"?e(t):e.current=t}function iC(e,t){var r=e.ref;return ce(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?p.cloneElement(e,{ref:function(s){Qc(r,s),Qc(t,s)}}):p.cloneElement(e,{ref:t})}function gi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?gi=function(r){return typeof r}:gi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},gi(e)}function _a(e){return e!==null&&gi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function wa(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),o=Object.keys(t);if(i.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c<i.length;c++){var d=i[c];if(!a(d))return!1;var u=e[d],f=t[d];if(s=void 0,s===!1||s===void 0&&u!==f)return!1}return!0}function oC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aC(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 lC(e,t,r){return t&&aC(e.prototype,t),e}function dt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var cC=function(){function e(t){var r=this;oC(this,e),dt(this,"hooks",rh({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,_a(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,_a(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),dt(this,"handlerId",null),dt(this,"dragSourceRef",null),dt(this,"dragSourceNode",void 0),dt(this,"dragSourceOptionsInternal",null),dt(this,"dragSourceUnsubscribe",void 0),dt(this,"dragPreviewRef",null),dt(this,"dragPreviewNode",void 0),dt(this,"dragPreviewOptionsInternal",null),dt(this,"dragPreviewUnsubscribe",void 0),dt(this,"lastConnectedHandlerId",null),dt(this,"lastConnectedDragSource",null),dt(this,"lastConnectedDragSourceOptions",null),dt(this,"lastConnectedDragPreview",null),dt(this,"lastConnectedDragPreviewOptions",null),dt(this,"backend",void 0),this.backend=t}return lC(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!wa(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!wa(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 uC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dC(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 fC(e,t,r){return t&&dC(e.prototype,t),e}function Jt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var hC=function(){function e(t){var r=this;uC(this,e),Jt(this,"hooks",rh({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,_a(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),Jt(this,"handlerId",null),Jt(this,"dropTargetRef",null),Jt(this,"dropTargetNode",void 0),Jt(this,"dropTargetOptionsInternal",null),Jt(this,"unsubscribeDropTarget",void 0),Jt(this,"lastConnectedHandlerId",null),Jt(this,"lastConnectedDropTarget",null),Jt(this,"lastConnectedDropTargetOptions",null),Jt(this,"backend",void 0),this.backend=t}return fC(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!wa(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 pC(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function gC(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var sn=typeof window<"u"?p.useLayoutEffect:p.useEffect;function mi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?mi=function(r){return typeof r}:mi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},mi(e)}function mC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yC(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 vC(e,t,r){return t&&yC(e.prototype,t),e}function Oo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var bC=function(){function e(t,r,n){mC(this,e),Oo(this,"spec",void 0),Oo(this,"monitor",void 0),Oo(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return vC(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return mi(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,o=s.isDragging;return o?o(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 _C(e,t,r){var n=p.useMemo(function(){return new bC(e,t,r)},[t,r]);return p.useEffect(function(){n.spec=e},[e]),n}function an(){var e=p.useContext(Qf),t=e.dragDropManager;return ce(t!=null,"Expected drag drop context"),t}function wC(e){return p.useMemo(function(){var t=e.type;return ce(t!=null,"spec.type must be defined"),t},[e])}function xC(e,t){return EC(e)||OC(e,t)||CC(e,t)||SC()}function SC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
459
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CC(e,t){if(e){if(typeof e=="string")return Gc(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 Gc(e,t)}}function Gc(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 OC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function EC(e){if(Array.isArray(e))return e}function DC(e,t,r){var n=an(),s=_C(e,t,r),i=wC(e);sn(function(){if(i!=null){var a=gC(i,s,n),c=xC(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u}},[n,t,r,s,i])}function IC(e){return RC(e)||jC(e)||TC(e)||NC()}function NC(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
460
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TC(e,t){if(e){if(typeof e=="string")return xa(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 xa(e,t)}}function jC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function RC(e){if(Array.isArray(e))return xa(e)}function xa(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 nh(e,t){var r=IC(t||[]);return t==null&&typeof e!="function"&&r.push(e),p.useMemo(function(){return typeof e=="function"?e():e},r)}function kC(){var e=an();return p.useMemo(function(){return new ZS(e)},[e])}function AC(e,t){var r=an(),n=p.useMemo(function(){return new cC(r.getBackend())},[r]);return sn(function(){return n.dragSourceOptions=e||null,n.reconnect(),function(){return n.disconnectDragSource()}},[n,e]),sn(function(){return n.dragPreviewOptions=t||null,n.reconnect(),function(){return n.disconnectDragPreview()}},[n,t]),n}var PC=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 o=i[s];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r};const MC=Kd(PC);function LC(e,t){return UC(e)||BC(e,t)||$C(e,t)||FC()}function FC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
461
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $C(e,t){if(e){if(typeof e=="string")return Yc(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 Yc(e,t)}}function Yc(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 BC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function UC(e){if(Array.isArray(e))return e}function sh(e,t,r){var n=p.useState(function(){return t(e)}),s=LC(n,2),i=s[0],o=s[1],a=p.useCallback(function(){var c=t(e);MC(i,c)||(o(c),r&&r())},[i,e,r]);return sn(a),[i,a]}function VC(e,t){return WC(e)||HC(e,t)||qC(e,t)||zC()}function zC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
462
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qC(e,t){if(e){if(typeof e=="string")return Xc(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 Xc(e,t)}}function Xc(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 HC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function WC(e){if(Array.isArray(e))return e}function KC(e,t,r){var n=sh(e,t,r),s=VC(n,2),i=s[0],o=s[1];return sn(function(){var c=e.getHandlerId();if(c!=null)return e.subscribeToStateChange(o,{handlerIds:[c]})},[e,o]),i}function ih(e,t,r){return KC(t,e||function(){return{}},function(){return r.reconnect()})}function QC(e){return p.useMemo(function(){return e.hooks.dragSource()},[e])}function GC(e){return p.useMemo(function(){return e.hooks.dragPreview()},[e])}function YC(e,t){var r=nh(e,t);ce(!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=kC(),s=AC(r.options,r.previewOptions);return DC(r,n,s),[ih(r.collect,n,s),QC(s),GC(s)]}function XC(e){var t=e.accept;return p.useMemo(function(){return ce(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function ZC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function JC(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 e0(e,t,r){return t&&JC(e.prototype,t),e}function Zc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var t0=function(){function e(t,r){ZC(this,e),Zc(this,"spec",void 0),Zc(this,"monitor",void 0),this.spec=t,this.monitor=r}return e0(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 r0(e,t){var r=p.useMemo(function(){return new t0(e,t)},[t]);return p.useEffect(function(){r.spec=e},[e]),r}function n0(e,t){return a0(e)||o0(e,t)||i0(e,t)||s0()}function s0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
463
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i0(e,t){if(e){if(typeof e=="string")return Jc(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 Jc(e,t)}}function Jc(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 o0(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function a0(e){if(Array.isArray(e))return e}function l0(e,t,r){var n=an(),s=r0(e,t),i=XC(e);sn(function(){var a=pC(i,s,n),c=n0(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u},[n,t,s,r,i.map(function(o){return o.toString()}).join("|")])}function c0(){var e=an();return p.useMemo(function(){return new rC(e)},[e])}function u0(e){var t=an(),r=p.useMemo(function(){return new hC(t.getBackend())},[t]);return sn(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function d0(e){return p.useMemo(function(){return e.hooks.dropTarget()},[e])}function oh(e,t){var r=nh(e,t),n=c0(),s=u0(r.options);return l0(r,n,s),[ih(r.collect,n,s),d0(s)]}function f0(e,t){return m0(e)||g0(e,t)||p0(e,t)||h0()}function h0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
464
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function p0(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 g0(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function m0(e){if(Array.isArray(e))return e}function y0(e){var t=an(),r=t.getMonitor(),n=sh(r,e),s=f0(n,2),i=s[0],o=s[1];return p.useEffect(function(){return r.subscribeToOffsetChange(o)}),p.useEffect(function(){return r.subscribeToStateChange(o)}),i}function ah(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function v0(e,t){return e.filter(function(r){return r!==t})}function b0(e,t){var r=new Set,n=function(o){return r.add(o)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i){return s.push(i)}),s}function _0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w0(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 x0(e,t,r){return t&&w0(e.prototype,t),e}function tu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var S0=function(){function e(t){_0(this,e),tu(this,"entered",[]),tu(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return x0(e,[{key:"enter",value:function(r){var n=this,s=this.entered.length,i=function(a){return n.isNodeInDocument(a)&&(!a.contains||a.contains(r))};return this.entered=b0(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=v0(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),C0=ah(function(){return/firefox/i.test(navigator.userAgent)}),lh=ah(function(){return!!window.safari});function O0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E0(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 D0(e,t,r){return t&&E0(e.prototype,t),e}function Zn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ru=function(){function e(t,r){O0(this,e),Zn(this,"xs",void 0),Zn(this,"ys",void 0),Zn(this,"c1s",void 0),Zn(this,"c2s",void 0),Zn(this,"c3s",void 0);for(var n=t.length,s=[],i=0;i<n;i++)s.push(i);s.sort(function(k,$){return t[k]<t[$]?-1:1});for(var o=[],a=[],c,d,u=0;u<n-1;u++)c=t[u+1]-t[u],d=r[u+1]-r[u],o.push(c),a.push(d/c);for(var f=[a[0]],m=0;m<o.length-1;m++){var g=a[m],_=a[m+1];if(g*_<=0)f.push(0);else{c=o[m];var h=o[m+1],y=c+h;f.push(3*y/((y+h)/g+(y+c)/_))}}f.push(a[a.length-1]);for(var v=[],b=[],x,w=0;w<f.length-1;w++){x=a[w];var C=f[w],D=1/o[w],j=C+f[w+1]-x-x;v.push((x-C-j)*D),b.push(j*D*D)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=v,this.c3s=b}return D0(e,[{key:"interpolate",value:function(r){var n=this.xs,s=this.ys,i=this.c1s,o=this.c2s,a=this.c3s,c=n.length-1;if(r===n[c])return s[c];for(var d=0,u=a.length-1,f;d<=u;){f=Math.floor(.5*(d+u));var m=n[f];if(m<r)d=f+1;else if(m>r)u=f-1;else return s[f]}c=Math.max(0,u);var g=r-n[c],_=g*g;return s[c]+i[c]*g+o[c]*_+a[c]*g*_}}]),e}(),I0=1;function ch(e){var t=e.nodeType===I0?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function Qs(e){return{x:e.clientX,y:e.clientY}}function N0(e){var t;return e.nodeName==="IMG"&&(C0()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function T0(e,t,r,n){var s=e?t.width:r,i=e?t.height:n;return lh()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function j0(e,t,r,n,s){var i=N0(t),o=i?e:t,a=ch(o),c={x:r.x-a.x,y:r.y-a.y},d=e.offsetWidth,u=e.offsetHeight,f=n.anchorX,m=n.anchorY,g=T0(i,t,d,u),_=g.dragPreviewWidth,h=g.dragPreviewHeight,y=function(){var j=new ru([0,.5,1],[c.y,c.y/u*h,c.y+h-u]),k=j.interpolate(m);return lh()&&i&&(k+=(window.devicePixelRatio-1)*h),k},v=function(){var j=new ru([0,.5,1],[c.x,c.x/d*_,c.x+_-d]);return j.interpolate(f)},b=s.offsetX,x=s.offsetY,w=b===0||b,C=x===0||x;return{x:w?b:v(),y:C?x:y()}}var uh="__NATIVE_FILE__",dh="__NATIVE_URL__",fh="__NATIVE_TEXT__",hh="__NATIVE_HTML__";const nu=Object.freeze(Object.defineProperty({__proto__:null,FILE:uh,HTML:hh,TEXT:fh,URL:dh},Symbol.toStringTag,{value:"Module"}));function Eo(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var pn;function Gs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Sa=(pn={},Gs(pn,uh,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Gs(pn,hh,{exposeProperties:{html:function(t,r){return Eo(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Gs(pn,dh,{exposeProperties:{urls:function(t,r){return Eo(t,r,"").split(`
465
- `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Gs(pn,fh,{exposeProperties:{text:function(t,r){return Eo(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),pn);function R0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k0(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 A0(e,t,r){return t&&k0(e.prototype,t),e}function su(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var P0=function(){function e(t){R0(this,e),su(this,"item",void 0),su(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return A0(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 M0(e,t){var r=new P0(Sa[e]);return r.loadDataTransfer(t),r}function Do(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(Sa).filter(function(r){var n=Sa[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function L0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F0(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 $0(e,t,r){return t&&F0(e.prototype,t),e}function Io(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var B0=function(){function e(t,r){L0(this,e),Io(this,"ownerDocument",null),Io(this,"globalContext",void 0),Io(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return $0(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 iu(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 ou(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?iu(Object(r),!0).forEach(function(n){pe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function U0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V0(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 z0(e,t,r){return t&&V0(e.prototype,t),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}var q0=function(){function e(t,r,n){var s=this;U0(this,e),pe(this,"options",void 0),pe(this,"actions",void 0),pe(this,"monitor",void 0),pe(this,"registry",void 0),pe(this,"enterLeaveCounter",void 0),pe(this,"sourcePreviewNodes",new Map),pe(this,"sourcePreviewNodeOptions",new Map),pe(this,"sourceNodes",new Map),pe(this,"sourceNodeOptions",new Map),pe(this,"dragStartSourceIds",null),pe(this,"dropTargetIds",[]),pe(this,"dragEnterTargetIds",[]),pe(this,"currentNativeSource",null),pe(this,"currentNativeHandle",null),pe(this,"currentDragSourceNode",null),pe(this,"altKeyPressed",!1),pe(this,"mouseMoveTimeoutTimer",null),pe(this,"asyncEndDragFrameId",null),pe(this,"dragOverTargetIds",null),pe(this,"lastClientOffset",null),pe(this,"hoverRafId",null),pe(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&ch(o)||null}),pe(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),pe(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),pe(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),pe(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),pe(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=Qs(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,d=Do(c);if(s.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var u=s.monitor.getSourceId(),f=s.sourceNodes.get(u),m=s.sourcePreviewNodes.get(u)||f;if(m){var g=s.getCurrentSourcePreviewNodeOptions(),_=g.anchorX,h=g.anchorY,y=g.offsetX,v=g.offsetY,b={anchorX:_,anchorY:h},x={offsetX:y,offsetY:v},w=j0(f,m,a,b,x);c.setDragImage(m,w.x,w.y)}}try{c==null||c.setData("application/json",{})}catch{}s.setCurrentDragSourceNode(i.target);var C=s.getCurrentSourcePreviewNodeOptions(),D=C.captureDraggingState;D?s.actions.publishDragSource():setTimeout(function(){return s.actions.publishDragSource()},0)}else if(d)s.beginDragNativeItem(d);else{if(c&&!c.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}}}),pe(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),pe(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=Do(a);c&&s.beginDragNativeItem(c,a)}}),pe(this,"handleTopDragEnter",function(i){var o=s.dragEnterTargetIds;if(s.dragEnterTargetIds=[],!!s.monitor.isDragging()){s.altKeyPressed=i.altKey,o.length>0&&s.actions.hover(o,{clientOffset:Qs(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),pe(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),pe(this,"handleTopDragOver",function(i){var o=s.dragOverTargetIds;if(s.dragOverTargetIds=[],!s.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}s.altKeyPressed=i.altKey,s.lastClientOffset=Qs(i),s.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(s.hoverRafId=requestAnimationFrame(function(){s.monitor.isDragging()&&s.actions.hover(o||[],{clientOffset:s.lastClientOffset}),s.hoverRafId=null}));var a=(o||[]).some(function(c){return s.monitor.canDropOnTarget(c)});a?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect())):s.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))}),pe(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),pe(this,"handleTopDropCapture",function(i){if(s.dropTargetIds=[],s.isDraggingNativeItem()){var o;i.preventDefault(),(o=s.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else Do(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),pe(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:Qs(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),pe(this,"handleSelectStart",function(i){var o=i.target;typeof o.dragDrop=="function"&&(o.tagName==="INPUT"||o.tagName==="SELECT"||o.tagName==="TEXTAREA"||o.isContentEditable||(i.preventDefault(),o.dragDrop()))}),this.options=new B0(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new S0(this.isNodeInDocument)}return z0(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 o=function(d){return i.handleDragStart(d,r)},a=function(d){return i.handleSelectStart(d)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",o),n.addEventListener("selectstart",a),function(){i.sourceNodes.delete(r),i.sourceNodeOptions.delete(r),n.removeEventListener("dragstart",o),n.removeEventListener("selectstart",a),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(r,n){var s=this,i=function(d){return s.handleDragEnter(d,r)},o=function(d){return s.handleDragOver(d,r)},a=function(d){return s.handleDrop(d,r)};return n.addEventListener("dragenter",i),n.addEventListener("dragover",o),n.addEventListener("drop",a),function(){n.removeEventListener("dragenter",i),n.removeEventListener("dragover",o),n.removeEventListener("drop",a)}}},{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 ou({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 ou({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(nu).some(function(n){return nu[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=M0(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}(),Ys;function H0(){return Ys||(Ys=new Image,Ys.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Ys}var W0=function(t,r,n){return new q0(t,r,n)};function K0(e,t){return typeof e=="function"?e(t):e??"NODE"}function Q0(e){return e.isDraggable&&!e.isEditing}function G0(e){const t=It(),r=t.selectedIds,[n,s,i]=YC(()=>({canDrag:()=>Q0(e),type:K0(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(Fn.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Fn.dragEnd())}}),[r,e,t.props.dragType]);return p.useEffect(()=>{i(H0())},[i]),s}function Y0(e,t){const r=e.getBoundingClientRect(),n=t.x-Math.round(r.x),s=t.y-Math.round(r.y),i=r.height,o=s<i/2,a=!o,c=i/4,d=s>c&&s<i-c;return{x:n,inTopHalf:o,inBottomHalf:a,inMiddle:d,atTop:!d&&o,atBottom:!d&&a}}function X0(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 Xs(e,t){return{parentId:e||null,index:t}}function gn(e,t){return{type:"line",index:e,level:t}}function Z0(e){return{type:"highlight",id:e}}function No(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=Ff(n)+1;return{parentId:s,index:i}}function ph(e){var t;const r=Y0(e.element,e.offset),n=e.indent,s=Math.round(Math.max(0,r.x-n)/n),{node:i,nextNode:o,prevNode:a}=e,[c,d]=X0(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Xs(i.id,null),cursor:Z0(i.id)};if(!c)return{drop:Xs((t=d==null?void 0:d.parent)===null||t===void 0?void 0:t.id,0),cursor:gn(0,0)};if(Af(c)){const u=ci(s,(d==null?void 0:d.level)||0,c.level);return{drop:No(c,u),cursor:gn(c.rowIndex+1,u)}}if(Pf(c)){const u=ci(s,(d==null?void 0:d.level)||0,c.level);return{drop:No(c,u),cursor:gn(c.rowIndex+1,u)}}if(Mf(c)){const u=ci(s,0,c.level+1);return u>c.level?{drop:Xs(c.id,0),cursor:gn(c.rowIndex+1,u)}:{drop:No(c,u),cursor:gn(c.rowIndex+1,u)}}return{drop:Xs(c==null?void 0:c.id,0),cursor:gn(c.rowIndex+1,c.level+1)}}function J0(e,t){const r=It(),[n,s]=oh(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:d}=ph({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});d&&r.dispatch(Fn.hovering(d.parentId,d.index)),o.canDrop()?c&&r.showCursor(c):r.hideCursor()},drop:(i,o)=>{if(!o.canDrop())return null;r.drop()}}),[t,e.current,r.props]);return s}function e1(e){const t=It(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return p.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const au=p.memo(function({index:t,style:r}){kf(),vw();const n=It(),s=e1(t),i=p.useRef(null),o=G0(s),a=J0(i,s),c=p.useCallback(h=>{i.current=h,a(h)},[a]),d=n.indent*s.level,u=p.useMemo(()=>({paddingLeft:d}),[d]),f=p.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]),m={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:f,tabIndex:-1,className:n.props.rowClassName};p.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 g=n.renderNode,_=n.renderRow;return l.jsx(_,{node:s,innerRef:c,attrs:m,children:l.jsx(g,{node:s,tree:n,style:u,dragHandle:o})})});let To="",lu=null;function gh(){kf();const e=It();return l.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 o=i.nextSibling,a=i.parent;e.focus(o||a,{scroll:!1}),e.delete(i)}}return}if(t.key==="Tab"&&!t.shiftKey){t.preventDefault(),$f(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),Bf(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(lu),To+=t.key,lu=setTimeout(()=>{To=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(To):!1});n&&e.focus(n.id)},children:l.jsx(t1,{})})}function t1(){var e,t;const r=It(),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:ox,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:cx,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(rx,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:au})):l.jsx(nx,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:au}))}function cu(e){return e.isFiltered?n1(e.root,e.isMatch.bind(e)):r1(e.root)}function r1(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(mh),t}function n1(e,t){const r={},n=[];function s(o){if(!o.isRoot&&t(o)){r[o.id]=!0;let c=o.parent;for(;c;)r[c.id]=!0,c=c.parent}if(o.children)for(let c of o.children)s(c)}function i(o){var a;o.level>=0&&r[o.id]&&n.push(o),o.isOpen&&((a=o.children)===null||a===void 0||a.forEach(i))}return s(e),i(e),n.forEach(mh),n}function mh(e,t){e.rowIndex=t}const uu=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var jo=function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{d(n.next(u))}catch(f){o(f)}}function c(u){try{d(n.throw(u))}catch(f){o(f)}}function d(u){u.done?i(u.value):s(u.value).then(a,c)}d((n=n.apply(e,t||[])).next())})};const{safeRun:ft}=Sw;class ds{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 o=this.props.rowHeight;if(typeof o=="function"){const a=this.at(i);return a?o(a):this.rowHeight}return o??24},this.rowTopPosition=i=>{if(typeof this.props.rowHeight!="function")return i*this.rowHeight;const o=this.getRowOffsets(),a=Math.max(0,Math.min(i,o.length-1));return o[a]},this.redrawList=(i=0)=>{this.rowOffsets=null;const o=this.list.current;o&&"resetAfterIndex"in o&&o.resetAfterIndex(Math.max(0,i))},this.root=vc(this),this.visibleNodes=cu(this),this.idToIndex=uu(this.visibleNodes)}update(t){this.props=t,this.root=vc(this),this.visibleNodes=cu(this),this.idToIndex=uu(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=is(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=is(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 ws)return t.id;const r=this.props.idAccessor||"id";return is(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 o=Math.min(s,i),a=Math.max(s,i);return this.visibleNodes.slice(o,a+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 jo(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?qf(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:zf(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield ft(this.props.onCreate,{type:o,parentId:s,index:i,parentNode:this.get(s)});a&&(this.focus(a),setTimeout(()=>{this.edit(a).then(()=>{this.select(a),this.activate(a)})}))})}delete(t){return jo(this,void 0,void 0,function*(){if(!t)return;const n=(Array.isArray(t)?t:[t]).map(o=>this.identify(o)),s=n.map(o=>this.get(o)).filter(o=>!!o),i=s.length?Math.min(...s.map(o=>{var a;return(a=o.rowIndex)!==null&&a!==void 0?a:0})):0;yield ft(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(bo(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=>{ds.editPromise=i})}submit(t,r){return jo(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield ft(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(bo(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(bo(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&ft(this.props.onActivate,r)}resolveEdit(t){const r=ds.editPromise;r&&r(t),ds.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(un(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&&ft(this.props.onFocus,this.focusedNode)))}pageUp(){var t,r;const n=this.visibleStartIndex,i=this.visibleStopIndex-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o>n?o=n:o=Math.max(n-i,0),this.focus(this.at(o))}pageDown(){var t,r;const n=this.visibleStartIndex,s=this.visibleStopIndex,i=s-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o<s?o=s:o=Math.min(o+i,this.visibleNodes.length-1),this.focus(this.at(o))}select(t,r={}){var n;if(!t)return;const s=r.focus!==!1,i=this.identify(t);s&&this.dispatch(un(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&&ft(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(vr.remove(r)),ft(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(un(n.id)),n.isSelectable&&(this.dispatch(vr.add(n.id)),this.dispatch(vr.anchor(n.id)),this.dispatch(vr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&&ft(this.props.onFocus,this.focusedNode),ft(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(un(n)),!((r=this.get(n))===null||r===void 0)&&r.isSelectable){const{anchor:s,mostRecent:i}=this.state.nodes.selection,o=this.filterSelectableNodes(this.nodesBetween(s,this.identifyNull(n)));this.dispatch(vr.remove(this.nodesBetween(s,i))),this.dispatch(vr.add(o)),this.dispatch(vr.mostRecent(n))}this.scrollTo(n),this.focusedNode&&ft(this.props.onFocus,this.focusedNode),ft(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(un((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&&ft(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(o=>this.identify(o))),s=this.identifyNull(t.anchor),i=this.identifyNull(t.mostRecent);this.dispatch(vr.set({ids:n,anchor:s,mostRecent:i})),ft(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&&Lf(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;ft(this.props.onMove,{dragIds:n,parentId:t===_s?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Fn.cursor({type:"none"}))}showCursor(t){this.dispatch(Fn.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(ga.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),ft(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(ga.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),ft(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=rl(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(){Ni(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Ni(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),Vf(()=>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===_s)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!is(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(un(t.id))}onBlur(){this.dispatch(kw())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||gh}get renderRow(){return this.props.renderRow||Iw}get renderNode(){return this.props.children||Nw}get renderDragPreview(){return this.props.renderDragPreview||Hf}get renderCursor(){return this.props.renderCursor||Dw}}function ht(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 s1=typeof Symbol=="function"&&Symbol.observable||"@@observable",du=s1,Ro=()=>Math.random().toString(36).substring(7).split("").join("."),i1={INIT:`@@redux/INIT${Ro()}`,REPLACE:`@@redux/REPLACE${Ro()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ro()}`},tn=i1;function yh(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 o1(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(c1(e))return"date";if(l1(e))return"error";const r=a1(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 a1(e){return typeof e.constructor=="function"?e.constructor.name:null}function l1(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function c1(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function wr(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=o1(e)),t}function vh(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?ht(2):`Expected the root reducer to be a function. Instead, received: '${wr(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?ht(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"?ht(1):`Expected the enhancer to be a function. Instead, received: '${wr(r)}'`);return r(vh)(e,t)}let n=e,s=t,i=new Map,o=i,a=0,c=!1;function d(){o===i&&(o=new Map,i.forEach((y,v)=>{o.set(v,y)}))}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?ht(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 f(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?ht(4):`Expected the listener to be a function. Instead, received: '${wr(y)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?ht(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;d();const b=a++;return o.set(b,y),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?ht(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,d(),o.delete(b),i=null}}}function m(y){if(!yh(y))throw new Error(process.env.NODE_ENV==="production"?ht(7):`Actions must be plain objects. Instead, the actual type was: '${wr(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"?ht(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"?ht(17):`Action "type" property must be a string. Instead, the actual type was: '${wr(y.type)}'. Value was: '${y.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?ht(9):"Reducers may not dispatch actions.");try{c=!0,s=n(s,y)}finally{c=!1}return(i=o).forEach(b=>{b()}),y}function g(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?ht(10):`Expected the nextReducer to be a function. Instead, received: '${wr(y)}`);n=y,m({type:tn.REPLACE})}function _(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(process.env.NODE_ENV==="production"?ht(11):`Expected the observer to be an object. Instead, received: '${wr(v)}'`);function b(){const w=v;w.next&&w.next(u())}return b(),{unsubscribe:y(b)}},[du](){return this}}}return m({type:tn.INIT}),{dispatch:m,subscribe:f,getState:u,replaceReducer:g,[du]:_}}function fu(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function u1(e,t,r,n){const s=Object.keys(t),i=r&&r.type===tn.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(!yh(e))return`The ${i} has unexpected type of "${wr(e)}". Expected argument to be an object with the following keys: "${s.join('", "')}"`;const o=Object.keys(e).filter(a=>!t.hasOwnProperty(a)&&!n[a]);if(o.forEach(a=>{n[a]=!0}),!(r&&r.type===tn.REPLACE)&&o.length>0)return`Unexpected ${o.length>1?"keys":"key"} "${o.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${s.join('", "')}". Unexpected keys will be ignored.`}function d1(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:tn.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?ht(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:tn.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?ht(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${tn.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 hu(e){const t=Object.keys(e),r={};for(let o=0;o<t.length;o++){const a=t[o];process.env.NODE_ENV!=="production"&&typeof e[a]>"u"&&fu(`No reducer provided for key "${a}"`),typeof e[a]=="function"&&(r[a]=e[a])}const n=Object.keys(r);let s;process.env.NODE_ENV!=="production"&&(s={});let i;try{d1(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=u1(a,r,c,s);f&&fu(f)}let d=!1;const u={};for(let f=0;f<n.length;f++){const m=n[f],g=r[m],_=a[m],h=g(_,c);if(typeof h>"u"){const y=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?ht(14):`When called with an action of type ${y?`"${String(y)}"`:"(unknown type)"}, the slice reducer for key "${m}" 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.`)}u[m]=h,d=d||h!==_}return d=d||n.length!==Object.keys(a).length,d?u:a}}function f1(e=Ln().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 h1=hu({nodes:hu({focus:Aw,edit:Rw,open:Pw,selection:Mw,drag:f1}),dnd:Lw}),p1=Ln();function g1({treeProps:e,imperativeHandle:t,children:r}){const n=p.useRef(null),s=p.useRef(null),i=p.useRef(vh(h1,Ln(e))),o=yw.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>p1),a=p.useMemo(()=>new ds(i.current,e,n,s),[]),c=p.useRef(0);return p.useMemo(()=>{c.current+=1,a.update(e)},Object.values(e)),p.useMemo(()=>{c.current+=1,a.update(a.props)},[o.nodes.open]),p.useImperativeHandle(t,()=>a),p.useEffect(()=>{a.props.selection?a.select(a.props.selection,{focus:!1}):a.deselectAll()},[a.props.selection]),p.useEffect(()=>{a.props.searchTerm||i.current.dispatch(ga.clear(!0))},[a.props.searchTerm]),l.jsx(Nf.Provider,{value:a,children:l.jsx(Rf.Provider,{value:c.current,children:l.jsx(Tf.Provider,{value:o.nodes,children:l.jsx(jf.Provider,{value:o.dnd,children:l.jsx(WS,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||W0,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function m1(){const e=It(),[,t]=oh(()=>({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:o}=ph({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(Fn.hovering(o.parentId,o.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 y1(e){return m1(),e.children}function v1(){const t=It().props.renderContainer||gh;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function b1(){const e=It(),{offset:t,mouse:r,item:n,isDragging:s}=y0(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||Hf;return l.jsx(i,{offset:t,mouse:r,id:(n==null?void 0:n.id)||null,dragIds:(n==null?void 0:n.dragIds)||[],isDragging:s})}function _1(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 w1{constructor(t,r={}){this.accessors=_1(r),this.root=x1(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 x1(e,t){const r=new bh({},null,t,"ROOT");return r.children=e.map(n=>cl(n,r,t)),r}function cl(e,t,r){const n=new bh(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>cl(i,n,r))),n}class bh{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=cl(t,this,this.accessors);this.children=(n=this.children)!==null&&n!==void 0?n:[],this.children.splice(r,0,i);const o=this.accessors.childrenKey,a=this.data;a[o]=(s=a[o])!==null&&s!==void 0?s:[],a[o].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 S1=0;function C1(e,t={}){const[r,n]=p.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=p.useMemo(()=>new w1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=_=>{for(const h of _.dragIds)o.move({id:h,parentId:_.parentId,index:_.index});n(o.data)},c=({name:_,id:h})=>{o.update({id:h,changes:{name:_}}),n(o.data)},d=typeof s=="string"?s:"id",u=typeof i=="string"?i:"children";return[r,{onMove:a,onRename:c,onCreate:({parentId:_,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={[d]:`simple-tree-id-${S1++}`,name:""};return y==="internal"&&(v[u]=[]),o.create({parentId:_,index:h,data:v}),n(o.data),v},onDelete:_=>{_.ids.forEach(h=>o.drop({id:h})),n(o.data)}}]}function O1(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.
466
- Use the data prop if you want to provide your own handlers.`);if(e.initialData){const[t,r]=C1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function E1(e,t){const r=O1(e);return l.jsxs(g1,{treeProps:r,imperativeHandle:t,children:[l.jsx(y1,{children:l.jsx(v1,{})}),l.jsx(b1,{})]})}const D1=p.forwardRef(E1);function ul(){return Re(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 I1(){return Re(e=>{var s;if(!e.selectedNodeId)return!1;const t=(s=e.treeData[0])==null?void 0:s.id,r=i=>{var o;for(const a of i){if(a.id===e.selectedNodeId)return a;if((o=a.children)!=null&&o.length){const c=r(a.children);if(c)return c}}},n=r(e.treeData);return!!(n!=null&&n.isFolder)&&n.id!==t})}const pu={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},gu={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},mu=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],N1=[{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 T1(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 Ji(e){const t=T1(e);return{key:t,color:pu[t]??pu.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:gu[t]??gu.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const j1="_row_i3qt2_1",R1="_grip_i3qt2_16",k1="_menuBtn_i3qt2_19",A1="_selected_i3qt2_23",P1="_title_i3qt2_28",M1="_dropTarget_i3qt2_33",L1="_toggle_i3qt2_50",F1="_ctIcon_i3qt2_65",$1="_folderIcon_i3qt2_77",B1="_renameInput_i3qt2_92",U1="_dropHere_i3qt2_101",V1="_menuWrap_i3qt2_111",z1="_menu_i3qt2_19",q1="_dangerItem_i3qt2_163",Ct={row:j1,grip:R1,menuBtn:k1,selected:A1,title:P1,dropTarget:M1,toggle:L1,ctIcon:F1,folderIcon:$1,renameInput:B1,dropHere:U1,menuWrap:V1,menu:z1,dangerItem:q1},H1={video:Ka,pdf:Va,h5p:za,scorm:Ha,audio:qa,quiz:Ua,default:zn},W1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=p.useState(!1),[o,a]=p.useState(!1),[c,d]=p.useState(e.data.name),u=p.useRef(null),f=n==="edit",m=ul(),g=Ji(e.data),_=H1[g.key]??zn,h=e.isSelected,y=e.level===0,v=e.data.isFolder??(e.children&&e.children.length>0),b=y?sy:v?cy:_;p.useEffect(()=>{if(!s)return;const C=D=>{var j;(j=u.current)!=null&&j.contains(D.target)||i(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[s]);const x=p.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),w=p.useCallback(C=>{C.key==="Enter"&&x(),C.key==="Escape"&&(d(e.data.name),a(!1))},[x,e.data.name]);return l.jsxs("div",{className:[Ct.row,h?Ct.selected:"",e.state.isOver&&v?Ct.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":v?"true":void 0,role:"treeitem","aria-selected":h,"aria-expanded":v?!e.isClosed:void 0,children:[f&&l.jsx("span",{ref:r,className:Ct.grip,"aria-hidden":"true",children:l.jsx(Hd,{size:14})}),l.jsx("button",{className:Ct.toggle,onClick:C=>{C.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:v?"visible":"hidden"},children:e.isClosed?l.jsx(Ud,{size:14}):l.jsx(ks,{size:14})}),l.jsx("span",{className:`${Ct.ctIcon} ${y||v?Ct.folderIcon:g.bgClass}`,"aria-hidden":"true",children:l.jsx(b,{size:12})}),o?l.jsx("input",{className:Ct.renameInput,value:c,autoFocus:!0,onChange:C=>d(C.target.value),onBlur:x,onKeyDown:w,onClick:C=>C.stopPropagation()}):l.jsx("span",{className:Ct.title,title:e.data.name,onDoubleClick:()=>f&&a(!0),children:e.data.name.length>25?`${e.data.name.slice(0,25)}...`:e.data.name}),e.state.isOver&&v&&l.jsx("span",{className:Ct.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:Ct.menuWrap,ref:u,children:[l.jsx("button",{className:Ct.menuBtn,onClick:C=>{C.stopPropagation(),i(D=>!D)},"aria-label":"Node options",children:l.jsx(zd,{size:14})}),s&&l.jsxs("div",{className:Ct.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(gy,{size:13})," Rename"]}),v&&m&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(qd,{size:13})," Add sub-unit"]}),e.data.parent&&m&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[l.jsx(As,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:Ct.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(Wa,{size:13})," Delete"]})]})]})]})};async function K1(e,t){var i,o;const n=((i=(await Me.post(`/action/content/v3/upload/url/${e}?type=hierarchy`,{request:{content:{fileName:t}}})).data)==null?void 0:i.result)??{},s=((o=n.content)==null?void 0:o.preSignedURL)??n.pre_signed_url??n.preSignedUrl;if(!s)throw new Error("Could not obtain an upload URL");return s}async function Q1(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 G1(e,t){var a;const r=await K1(e,t.name),n=await Q1(r,t),s=new FormData;return s.append("fileUrl",n),s.append("mimeType",t.type||"text/csv"),{processId:(((a=(await Me.post(`/action/collection/v1/import/${e}`,s)).data)==null?void 0:a.result)??{}).processId??""}}async function Y1(e){var r;return((r=(await Me.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function _h(e){var n,s,i;const r=(i=(s=(n=(await Me.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 X1(e){return _h(e)}const Z1="_container_jr3ij_1",J1="_header_jr3ij_13",eO="_title_jr3ij_22",tO="_closeBtn_jr3ij_29",rO="_body_jr3ij_45",nO="_dropZone_jr3ij_54",sO="_dragOver_jr3ij_67",iO="_hasFile_jr3ij_72",oO="_hiddenInput_jr3ij_78",aO="_fileInfo_jr3ij_82",lO="_fileIcon_jr3ij_89",cO="_fileName_jr3ij_93",uO="_fileSize_jr3ij_100",dO="_dropHint_jr3ij_105",fO="_dropIcon_jr3ij_112",hO="_dropText_jr3ij_117",pO="_dropSubtext_jr3ij_124",gO="_sampleLink_jr3ij_130",mO="_statusBar_jr3ij_145",yO="_status_uploading_jr3ij_154",vO="_status_processing_jr3ij_154",bO="_status_done_jr3ij_159",_O="_status_error_jr3ij_164",wO="_successDetail_jr3ij_170",xO="_spinner_jr3ij_175",SO="_spin_jr3ij_175",CO="_errorMsg_jr3ij_191",OO="_failedSection_jr3ij_197",EO="_failedTitle_jr3ij_203",DO="_tableWrap_jr3ij_213",IO="_failedTable_jr3ij_219",NO="_reasonCell_jr3ij_244",TO="_footer_jr3ij_248",Ee={container:Z1,header:J1,title:eO,closeBtn:tO,body:rO,dropZone:nO,dragOver:sO,hasFile:iO,hiddenInput:oO,fileInfo:aO,fileIcon:lO,fileName:cO,fileSize:uO,dropHint:dO,dropIcon:fO,dropText:hO,dropSubtext:pO,sampleLink:gO,statusBar:mO,status_uploading:yO,status_processing:vO,status_done:bO,status_error:_O,successDetail:wO,spinner:xO,spin:SO,errorMsg:CO,failedSection:OO,failedTitle:EO,tableWrap:DO,failedTable:IO,reasonCell:NO,footer:TO},jO=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,d]=p.useState("idle"),[u,f]=p.useState(""),[m,g]=p.useState([]),[_,h]=p.useState(null),y=p.useRef(null),v=p.useRef(null),b=p.useCallback(()=>{v.current!==null&&(clearInterval(v.current),v.current=null)},[]);p.useEffect(()=>()=>b(),[b]);const x=N=>N.name.toLowerCase().endsWith(".csv")?N.size>50*1024*1024?(f("File size must not exceed 50 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=p.useCallback(N=>{f(""),g([]),h(null),d("idle"),x(N)&&i(N)},[]),C=p.useCallback(N=>{N.preventDefault(),a(!1);const A=N.dataTransfer.files[0];A&&w(A)},[w]),D=p.useCallback(N=>{var U;const A=(U=N.target.files)==null?void 0:U[0];A&&w(A),N.target.value=""},[w]),j=p.useCallback(async()=>{try{const N=await X1(e),A=document.createElement("a");A.href=N,A.download="sample_hierarchy.csv",A.target="_blank",A.click()}catch{f("Failed to download sample CSV.")}},[e]),k=p.useCallback(async()=>{if(s){d("uploading"),f(""),g([]);try{const{processId:N}=await G1(e,s);if(!N){d("done"),h(null),setTimeout(t,1500);return}d("processing"),v.current=setInterval(async()=>{try{const A=await Y1(N);A.status==="COMPLETED"?(b(),d("done"),h(A.successCount??null),A.failedRecords&&A.failedRecords.length>0?g(A.failedRecords):setTimeout(t,1500)):A.status==="FAILED"&&(b(),d("error"),f("Upload processing failed. Please check the error rows below."),A.failedRecords&&g(A.failedRecords))}catch{b(),d("error"),f("Lost connection while checking status. Please try again.")}},2e3)}catch{d("error"),f("Upload failed. Please check your file and try again.")}}},[e,s,t,b]),$={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:Ee.container,children:[l.jsxs("div",{className:Ee.header,children:[l.jsx("h2",{className:Ee.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:Ee.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ee.body,children:[l.jsxs("div",{className:`${Ee.dropZone} ${o?Ee.dragOver:""} ${s?Ee.hasFile:""}`,onDragEnter:N=>{N.preventDefault(),a(!0)},onDragOver:N=>{N.preventDefault(),a(!0)},onDragLeave:N=>{N.preventDefault(),a(!1)},onDrop:C,onClick:()=>{var N;return(N=y.current)==null?void 0:N.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:N=>{var A;return N.key==="Enter"&&((A=y.current)==null?void 0:A.click())},children:[l.jsx("input",{ref:y,type:"file",accept:".csv",className:Ee.hiddenInput,onChange:D,"aria-hidden":"true"}),s?l.jsxs("div",{className:Ee.fileInfo,children:[l.jsx("span",{className:Ee.fileIcon,children:"📄"}),l.jsx("span",{className:Ee.fileName,children:s.name}),l.jsxs("span",{className:Ee.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:Ee.dropHint,children:[l.jsx("span",{className:Ee.dropIcon,children:"⬆️"}),l.jsx("p",{className:Ee.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:Ee.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:Ee.sampleLink,onClick:j,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${Ee.statusBar} ${Ee[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:Ee.spinner,"aria-hidden":"true"}),$[c],c==="done"&&_!==null&&l.jsxs("span",{className:Ee.successDetail,children:[" — ",_," item(s) imported"]})]}),u&&l.jsx("p",{className:Ee.errorMsg,role:"alert",children:u}),m.length>0&&l.jsxs("div",{className:Ee.failedSection,children:[l.jsxs("h4",{className:Ee.failedTitle,children:["Failed Rows (",m.length,")"]}),l.jsx("div",{className:Ee.tableWrap,children:l.jsxs("table",{className:Ee.failedTable,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Row"}),l.jsx("th",{children:"Name"}),l.jsx("th",{children:"Reason"})]})}),l.jsx("tbody",{children:m.map((N,A)=>l.jsxs("tr",{children:[l.jsx("td",{children:N.rowNumber??A+1}),l.jsx("td",{children:N.name??"—"}),l.jsx("td",{className:Ee.reasonCell,children:N.reason??"Unknown error"})]},A))})]})})]})]}),l.jsxs("div",{className:Ee.footer,children:[l.jsx(Ie,{variant:"ghost",onClick:r,disabled:c==="uploading"||c==="processing",children:"Cancel"}),l.jsx(Ie,{variant:"primary",isLoading:c==="uploading"||c==="processing",disabled:!s||c==="done",onClick:k,children:c==="done"?"Uploaded":"Upload"})]})]})},RO="_container_1y30m_1",kO="_header_1y30m_8",AO="_headerActions_1y30m_19",PO="_iconBtn_1y30m_25",MO="_menuWrap_1y30m_43",LO="_dropdownMenu_1y30m_47",FO="_treeWrapper_1y30m_79",$O="_csvModal_1y30m_95",BO="_footer_1y30m_105",er={container:RO,header:kO,headerActions:AO,iconBtn:PO,menuWrap:MO,dropdownMenu:LO,treeWrapper:FO,csvModal:$O,footer:BO},UO=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var ve;const n=p.useRef(null),s=p.useRef(null),i=p.useRef(null),[o,a]=p.useState(400),[c,d]=p.useState(!1),[u,f]=p.useState(!1),[m,g]=p.useState("create"),{treeData:_,selectedNodeId:h,selectNode:y,addNode:v,deleteNode:b,reorderChildren:x,moveNode:w,setTreeData:C}=Re(),D=e==="edit",j=ul(),k=D&&j,$=(((ve=_[0])==null?void 0:ve.children)??[]).some(K=>K.isFolder),N=ue(K=>{var P,X,M,G;return((X=(P=K.editorConfig)==null?void 0:P.context)==null?void 0:X.contentId)??((G=(M=K.editorConfig)==null?void 0:M.context)==null?void 0:G.identifier)??""}),A=ue(K=>{var X,M;const P=(M=(X=K.categoryMeta)==null?void 0:X.sourcingSettings)==null?void 0:M.collection;return(P==null?void 0:P.enableBulkUpload)!==!1});p.useEffect(()=>{const K=s.current;if(!K)return;const P=new ResizeObserver(()=>{a(K.clientHeight||400)});return P.observe(K),a(K.clientHeight||400),()=>P.disconnect()},[]),p.useEffect(()=>{if(!c)return;const K=P=>{var X;(X=i.current)!=null&&X.contains(P.target)||d(!1)};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[c]);const U=p.useCallback(K=>{K.length>0&&y(K[0].data.id)},[y]),R=p.useCallback(({parentId:K,index:P,dragIds:X})=>{if(!K)return;const M=X[0],G=Ca(_,M);if(!G)return;const W=G.parent;if(W===K){const oe=Ca(_,K);if(!(oe!=null&&oe.children))return;const be=oe.children.findIndex(Ne=>Ne.id===M);if(be<0)return;x(K,be,P>be?P-1:P)}else w(M,W??"",K)},[_,x,w]),B=p.useCallback(({ids:K})=>{K.forEach(P=>b(P))},[b]),F=p.useCallback(({parentId:K})=>{var M;const P=K??((M=_[0])==null?void 0:M.id)??"";if(!P)return{id:crypto.randomUUID()};const X=v(P,"unit");return X?{id:X}:(Se.error("Maximum depth reached"),{id:crypto.randomUUID()})},[v,_]),J=p.useCallback(()=>{var P;const K=(P=_[0])==null?void 0:P.id;K&&(v(K,"unit")||Se.error("Maximum depth reached"))},[_,v]),se=p.useCallback(()=>{h&&(v(h,"subunit")||Se.error("Maximum depth reached"))},[h,v]),ge=p.useCallback(async()=>{if(d(!1),!!N)try{const K=await _h(N),P=await fetch(K).then(G=>G.blob()),X=URL.createObjectURL(P),M=document.createElement("a");M.href=X,M.download=`${N}-folders.csv`,M.style.display="none",document.body.appendChild(M),M.click(),document.body.removeChild(M),URL.revokeObjectURL(X)}catch{Se.error("Failed to download CSV")}},[N]),ye=p.useCallback(async()=>{if(f(!1),!!N)try{const{rootNode:K}=await If(N);C([K]),Se.success("Course outline refreshed.")}catch{Se.error("Outline could not be refreshed automatically. Please reload the page.")}},[N,C]);return l.jsxs("div",{className:er.container,children:[l.jsx("div",{className:er.header,children:l.jsxs("div",{className:er.headerActions,children:[D&&l.jsxs("div",{className:er.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:er.iconBtn,onClick:()=>d(K=>!K),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(zd,{size:15})}),c&&l.jsx("div",{className:er.dropdownMenu,role:"menu",children:A&&l.jsxs(l.Fragment,{children:[l.jsx("button",{role:"menuitem",type:"button",disabled:$,title:$?'Folders already exist — use "Update" instead':void 0,onClick:()=>{d(!1),g("create"),f(!0)},children:"Create folders using csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!$,title:$?void 0:'No folders yet — use "Create" first',onClick:ge,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!$,title:$?void 0:'No folders yet — use "Create" first',onClick:()=>{d(!1),g("update"),f(!0)},children:"Update folder metadata using csv file"})]})})]}),r&&l.jsx("button",{type:"button",className:er.iconBtn,onClick:r,"aria-label":t?"Expand outline":"Collapse outline",title:t?"Expand outline":"Collapse outline",children:t?l.jsx(hy,{size:15}):l.jsx(fy,{size:15})})]})}),l.jsx("div",{className:er.treeWrapper,ref:s,children:l.jsx(D1,{ref:n,data:_,idAccessor:"id",childrenAccessor:"children",onSelect:U,onMove:D?R:void 0,onDelete:D?B:void 0,onCreate:D?F:void 0,disableEdit:!D,disableDrop:!D,selection:h??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:K=>l.jsx(W1,{...K,editorMode:e})})}),D&&l.jsxs("div",{className:er.footer,children:[l.jsxs(Ie,{variant:"ghost",size:"sm",onClick:J,disabled:!k,children:[l.jsx(As,{size:14})," Add Unit"]}),l.jsxs(Ie,{variant:"ghost",size:"sm",onClick:se,disabled:!k||!h,children:[l.jsx(qd,{size:14})," Add Sub-unit"]})]}),u&&l.jsx("div",{className:er.csvModal,children:l.jsx(jO,{contentId:N,mode:m,onComplete:ye,onClose:()=>f(!1)})})]})};function Ca(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Ca(r.children,t);if(n)return n}}}const VO="_breadcrumb_zd1aj_1",zO="_crumb_zd1aj_10",qO="_sep_zd1aj_26",HO="_current_zd1aj_31",Jn={breadcrumb:VO,crumb:zO,sep:qO,current:HO},WO=({crumbs:e})=>{const t=Re(r=>r.selectNode);return e.length?l.jsxs("nav",{className:Jn.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:Jn.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(uy,{size:13})}),e.map((r,n)=>l.jsxs(p.Fragment,{children:[l.jsx(Ud,{size:13,className:Jn.sep}),n<e.length-1?l.jsx("button",{className:Jn.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:Jn.current,children:r.name})]},r.id))]}):null},KO="_tabBar_qhks1_1",QO="_tab_qhks1_1",GO="_active_qhks1_29",YO="_error_qhks1_35",XO="_errorDot_qhks1_39",es={tabBar:KO,tab:QO,active:GO,error:YO,errorDot:XO},yu=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],ZO=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?yu.filter(i=>n.includes(i.id)):yu;return l.jsx("div",{className:es.tabBar,role:"tablist","aria-label":"Metadata sections",children:s.map(i=>l.jsxs("button",{role:"tab","aria-selected":e===i.id,"aria-controls":`panel-${i.id}`,className:[es.tab,e===i.id?es.active:"",r.includes(i.id)?es.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:es.errorDot,"aria-label":"Has errors"})]},i.id))})};var $s=e=>e.type==="checkbox",zr=e=>e instanceof Date,st=e=>e==null;const wh=e=>typeof e=="object";var Be=e=>!st(e)&&!Array.isArray(e)&&wh(e)&&!zr(e),Oa=e=>Be(e)&&e.target?$s(e.target)?e.target.checked:e.target.value:e,xh=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Sh=e=>{const t=e.constructor&&e.constructor.prototype;return Be(t)&&t.hasOwnProperty("isPrototypeOf")},eo=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ue(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(eo&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Be(e)&&Sh(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Ue(e[s]));return n}const Sr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Wt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},qt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},ko="form",Ch="root",Oh=["__proto__","constructor","prototype"];var Bs=e=>/^\w*$/.test(e),Ae=e=>e===void 0,to=e=>e.split(/[.[\]'"]/g).filter(Boolean),H=(e,t,r)=>{if(!t||!Be(e))return r;const n=Bs(t)?[t]:to(t);if(n.some(i=>Oh.includes(i)))return r;const s=n.reduce((i,o)=>st(i)?void 0:i[o],e);return Ae(s)||s===e?Ae(e[t])?r:e[t]:s},kt=e=>typeof e=="boolean",gt=e=>typeof e=="function",je=(e,t,r)=>{let n=-1;const s=Bs(t)?[t]:to(t),i=s.length,o=i-1;for(;++n<i;){const a=s[n];let c=r;if(n!==o){const d=e[a];c=Be(d)||Array.isArray(d)?d:isNaN(+s[n+1])?{}:[]}if(Oh.includes(a))return;e[a]=c,e=e[a]}};const dl=p.createContext(null);dl.displayName="HookFormControlContext";const fl=()=>p.useContext(dl);var Eh=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Wt.all&&(t._proxyFormState[o]=!n||Wt.all),r&&(r[o]=!0),e[o]}});return s};const hl=eo?p.useLayoutEffect:p.useEffect;function JO(e){const t=fl(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[o,a]=p.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return hl(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:d=>{!n&&a({...r._formState,...d,defaultValues:r._defaultValues})}}),[s,n,i]),p.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),p.useMemo(()=>Eh(o,r,c.current,!1),[o,r])}var mt=e=>typeof e=="string",Ea=(e,t,r,n,s)=>mt(e)?(n&&t.watch.add(e),H(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),H(r,i))):(n&&(t.watchAll=!0),r),Da=e=>st(e)||!wh(e);const vu=(e,t)=>t.length===0&&!Array.isArray(e)&&!Sh(e);function At(e,t,r=new WeakMap){if(e===t)return!0;if(Da(e)||Da(t))return Object.is(e,t);if(zr(e)&&zr(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(vu(e,n)||vu(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 o of n){const a=e[o];if(!(o in t))return!1;if(o!=="ref"){const c=t[o];if(zr(a)&&zr(c)||(Be(a)||Array.isArray(a))&&(Be(c)||Array.isArray(c))?!At(a,c,r):!Object.is(a,c))return!1}}return!0}function eE(e){const t=fl(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=p.useRef(s),d=p.useRef(a),u=p.useRef(void 0),f=p.useRef(r),m=p.useRef(n);d.current=a;const[g,_]=p.useState(()=>{const w=r._getWatch(n,c.current);return d.current?d.current(w):w}),h=p.useCallback(w=>{const C=Ea(n,r._names,w||r._formValues,!1,c.current);return d.current?d.current(C):C},[r._formValues,r._names,n]),y=p.useCallback(w=>{if(!i){const C=Ea(n,r._names,w||r._formValues,!1,c.current);if(d.current){const D=d.current(C);At(D,u.current)||(_(D),u.current=D)}else _(C)}},[r._formValues,r._names,i,n]);hl(()=>((f.current!==r||!At(m.current,n))&&(f.current=r,m.current=n,y()),r._subscribe({name:n,formState:{values:!0},exact:o,callback:w=>{y(w.values)}})),[r,o,n,y]),p.useEffect(()=>r._removeUnmounted());const v=f.current!==r,b=m.current,x=p.useMemo(()=>{if(i)return null;const w=!v&&!At(b,n);return v||w?h():null},[i,v,n,b,h]);return x!==null?x:g}function ro(e){const t=fl(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=xh(s._names.array,r),d=p.useMemo(()=>H(s._formValues,r,H(s._defaultValues,r,o)),[s,r,o]),u=eE({control:s,name:r,defaultValue:d,exact:a}),f=JO({control:s,name:r,exact:a}),m=p.useRef(e),g=p.useRef(null),_=p.useRef(s.register(r,{...e.rules,value:u,...kt(e.disabled)?{disabled:e.disabled}:{}}));m.current=e;const h=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!H(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!H(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!H(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!H(f.validatingFields,r)},error:{enumerable:!0,get:()=>H(f.errors,r)}}),[f,r]),y=p.useCallback(w=>{const C=Oa(w);return H(s._fields,r)||(_.current=s.register(r,{...m.current.rules,value:C})),_.current.onChange({target:{value:Oa(w),name:r},type:Sr.CHANGE})},[r,s]),v=p.useCallback(()=>_.current.onBlur({target:{value:H(s._formValues,r),name:r},type:Sr.BLUR}),[r,s._formValues]),b=p.useCallback(w=>{w&&(g.current={focus:()=>gt(w.focus)&&w.focus(),select:()=>gt(w.select)&&w.select(),setCustomValidity:D=>gt(w.setCustomValidity)&&w.setCustomValidity(D),reportValidity:()=>gt(w.reportValidity)&&w.reportValidity()});const C=H(s._fields,r);C&&C._f&&w&&(C._f.ref=g.current)},[s._fields,r]),x=p.useMemo(()=>({name:r,value:u,...kt(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:y,onBlur:v,ref:b}),[r,n,f.disabled,y,v,b,u]);return p.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...m.current.rules,...kt(m.current.disabled)?{disabled:m.current.disabled}:{}});const C=(D,j)=>{const k=H(s._fields,D);k&&k._f&&(k._f.mount=j)};if(C(r,!0),w){const D=Ue(H(i?s._defaultValues:s._options.values||s._defaultValues,r,H(s._options.defaultValues,r,m.current.defaultValue)));je(s._defaultValues,r,D),Ae(H(s._formValues,r))&&je(s._formValues,r,D)}if(!c&&s.register(r),g.current){const D=H(s._fields,r);D&&D._f&&(D._f.ref=g.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):C(r,!1)}},[r,s,c,i]),p.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),p.useMemo(()=>({field:x,formState:f,fieldState:h}),[x,f,h])}const pl=p.createContext(null);pl.displayName="HookFormContext";const Yt=()=>p.useContext(pl),tE=({children:e,watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:m,unregister:g,control:_,register:h,setFocus:y,subscribe:v})=>{const b=p.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:m,unregister:g,control:_,register:h,setFocus:y,subscribe:v}),[i,_,d,n,r,m,h,f,u,s,y,o,a,v,c,g,t]);return p.createElement(pl.Provider,{value:b},p.createElement(dl.Provider,{value:b.control},e))};var rE=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Dh=e=>Array.isArray(e)?e.filter(Boolean):[],yi=e=>Array.isArray(e)?e:[e],bu=()=>{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 Ih(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&Be(s)&&i){const o=Ih(s,i);Be(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var Je=e=>Be(e)&&!Object.keys(e).length,gl=e=>e.type==="file",ji=e=>{if(!eo)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Nh=e=>e.type==="select-multiple",ml=e=>e.type==="radio",nE=e=>ml(e)||$s(e),Ao=e=>ji(e)&&e.isConnected;function sE(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(st(e)){e=void 0;break}e=e[t[n]],n++}return e}function iE(e){for(const t in e)if(e.hasOwnProperty(t)&&!Ae(e[t]))return!1;return!0}function Ke(e,t){if(mt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Bs(t)?[t]:to(t),n=r.length===1?e:sE(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(Be(n)&&Je(n)||Array.isArray(n)&&iE(n))&&Ke(e,r.slice(0,-1)),e}var oE=e=>{for(const t in e)if(gt(e[t]))return!0;return!1};function Th(e){return Array.isArray(e)||Be(e)&&!oE(e)}function Ia(e,t={}){for(const r in e){const n=e[r];Th(n)?(t[r]=Array.isArray(n)?[]:{},Ia(n,t[r])):Ae(n)||(t[r]=!0)}return t}function Na(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>Na(r));return t.some(r=>r!==void 0)?t:void 0}if(Be(e)){const t={};for(const r in e){const n=Na(e[r]);Ae(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function $r(e,t,r){r||(r=Ia(t));for(const n in e){const s=e[n];if(Th(s))Ae(t)||Da(r[n])?r[n]=Ia(s,Array.isArray(s)?[]:{}):$r(s,st(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!At(s,i)}}return Na(r)||{}}const _u={value:!1,isValid:!1},wu={value:!0,isValid:!0};var jh=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&&!Ae(e[0].attributes.value)?Ae(e[0].value)||e[0].value===""?wu:{value:e[0].value,isValid:!0}:wu:_u}return _u},Rh=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ae(e)?e:t?e===""?NaN:e&&+e:r&&mt(e)?new Date(e):n?n(e):e;const xu={isValid:!1,value:null};var kh=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,xu):xu;function Su(e){const t=e.ref;return gl(t)?t.files:ml(t)?kh(e.refs).value:Nh(t)?[...t.selectedOptions].map(({value:r})=>r):$s(t)?jh(e.refs).value:Rh(Ae(t.value)?e.ref.value:t.value,e)}var aE=(e,t,r,n)=>{const s={};for(const i of e){const o=H(t,i);o&&je(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Ri=e=>e instanceof RegExp,ts=e=>Ae(e)?e:Ri(e)?e.source:Be(e)?Ri(e.value)?e.value.source:e.value:e,Cu=e=>({isOnSubmit:!e||e===Wt.onSubmit,isOnBlur:e===Wt.onBlur,isOnChange:e===Wt.onChange,isOnAll:e===Wt.all,isOnTouch:e===Wt.onTouched});const Ou="AsyncFunction";var lE=e=>!!e&&!!e.validate&&!!(gt(e.validate)&&e.validate.constructor.name===Ou||Be(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Ou)),cE=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Po=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const fs=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=H(e,s);if(i){const{_f:o,...a}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],s)&&!n)return!0;if(o.ref&&t(o.ref,o.name)&&!n)return!0;if(fs(a,t))break}else if(Be(a)&&fs(a,t))break}}};function Eu(e,t,r){const n=H(e,r);if(n||Bs(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),o=H(t,i),a=H(e,i);if(o&&!Array.isArray(o)&&r!==i)return{name:r};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};s.pop()}return{name:r}}var uE=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return Je(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!n||Wt.all))},dE=(e,t,r)=>!e||!t||e===t||yi(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),fE=(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,hE=(e,t)=>!Dh(H(e,t)).length&&Ke(e,t),Du=(e,t,r)=>{const n=H(e,r),s=Array.isArray(n)?n:[];return je(s,Ch,t[r]),je(e,r,s),e};function Iu(e,t,r="validate"){if(mt(e)||Array.isArray(e)&&e.every(mt)||kt(e)&&!e)return{type:r,message:mt(e)?e:"",ref:t}}var mn=e=>Be(e)&&!Ri(e)?e:{value:e,message:""},Nu=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:d,minLength:u,min:f,max:m,pattern:g,validate:_,name:h,valueAsNumber:y,mount:v}=e._f,b=H(r,h);if(!v||t.has(h))return{};const x=a?a[0]:o,w=U=>{if(s&&x.reportValidity){const R=kt(U)?"":U||"";a?a.forEach(B=>B.setCustomValidity(R)):x.setCustomValidity(R),x.reportValidity()}},C={},D=ml(o),j=$s(o),k=D||j,$=(y||gl(o))&&Ae(o.value)&&Ae(b)||ji(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,N=rE.bind(null,h,n,C),A=(U,R,B,F=qt.maxLength,J=qt.minLength)=>{const se=U?R:B;C[h]={type:U?F:J,message:se,ref:o,...N(U?F:J,se)}};if(i?!Array.isArray(b)||!b.length:c&&(!k&&($||st(b))||kt(b)&&!b||j&&!jh(a).isValid||D&&!kh(a).isValid)){const{value:U,message:R}=mt(c)?{value:!!c,message:c}:mn(c);if(U&&(C[h]={type:qt.required,message:R,ref:x,...N(qt.required,R)},!n))return w(R),C}if(!$&&(!st(f)||!st(m))){let U,R;const B=mn(m),F=mn(f);if(!st(b)&&!isNaN(b)){const J=o.valueAsNumber||b&&+b;st(B.value)||(U=J>B.value),st(F.value)||(R=J<F.value)}else{const J=o.valueAsDate||new Date(b),se=ve=>new Date(new Date().toDateString()+" "+ve),ge=o.type=="time",ye=o.type=="week";mt(B.value)&&b&&(U=ge?se(b)>se(B.value):ye?b>B.value:J>new Date(B.value)),mt(F.value)&&b&&(R=ge?se(b)<se(F.value):ye?b<F.value:J<new Date(F.value))}if((U||R)&&(A(!!U,B.message,F.message,qt.max,qt.min),!n))return w(C[h].message),C}if((d||u)&&!$&&(mt(b)||i&&Array.isArray(b))){const U=mn(d),R=mn(u),B=!st(U.value)&&b.length>+U.value,F=!st(R.value)&&b.length<+R.value;if((B||F)&&(A(B,U.message,R.message),!n))return w(C[h].message),C}if(g&&!$&&mt(b)){const{value:U,message:R}=mn(g);if(Ri(U)&&!b.match(U)&&(C[h]={type:qt.pattern,message:R,ref:o,...N(qt.pattern,R)},!n))return w(R),C}if(_){if(gt(_)){const U=await _(b,r),R=Iu(U,x);if(R&&(C[h]={...R,...N(qt.validate,R.message)},!n))return w(R.message),C}else if(Be(_)){let U={};for(const R in _){if(!Je(U)&&!n)break;const B=Iu(await _[R](b,r),x,R);B&&(U={...B,...N(R,B.message)},w(B.message),n&&(C[h]=U))}if(!Je(U)&&(C[h]={ref:x,...U},!n))return C}}return w(!0),C};const pE={mode:Wt.onSubmit,reValidateMode:Wt.onChange,shouldFocusError:!0},Ah={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function gE(e={}){let t={...pE,...e},r={...Ue(Ah),isLoading:gt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=Be(t.defaultValues)||Be(t.values)?Ue(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Ue(s),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...u};let m={...f};const g={array:bu(),state:bu()},_=t.criteriaMode===Wt.all,h=S=>I=>{clearTimeout(d),d=setTimeout(S,I)},y=async S=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||m.isValid||S)){let I;t.resolver?(I=Je((await N()).errors),v()):I=await R({fields:n,onlyCheckValid:!0,eventType:Sr.VALID}),I!==r.isValid&&g.state.next({isValid:I})}},v=(S,I)=>{!t.disabled&&(f.isValidating||f.validatingFields||m.isValidating||m.validatingFields)&&((S||Array.from(a.mount)).forEach(T=>{T&&(I?je(r.validatingFields,T,I):Ke(r.validatingFields,T))}),g.state.next({validatingFields:r.validatingFields,isValidating:!Je(r.validatingFields)}))},b=()=>{r.dirtyFields=$r(s,i)},x=(S,I=[],T,V,z=!0,Q=!0)=>{if(V&&T&&!t.disabled){if(o.action=!0,Q&&Array.isArray(H(n,S))){const q=T(H(n,S),V.argA,V.argB);z&&je(n,S,q)}if(Q&&Array.isArray(H(r.errors,S))){const q=T(H(r.errors,S),V.argA,V.argB);z&&je(r.errors,S,q),hE(r.errors,S)}if((f.touchedFields||m.touchedFields)&&Q&&Array.isArray(H(r.touchedFields,S))){const q=T(H(r.touchedFields,S),V.argA,V.argB);z&&je(r.touchedFields,S,q)}(f.dirtyFields||m.dirtyFields)&&b(),g.state.next({name:S,isDirty:F(S,I),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else je(i,S,I)},w=(S,I)=>{je(r.errors,S,I),r.errors={...r.errors},g.state.next({errors:r.errors})},C=S=>{r.errors=S,g.state.next({errors:r.errors,isValid:!1})},D=S=>{const I=Bs(S)?[S]:to(S);let T=i,V=s;for(let z=0;z<I.length-1;z++){const Q=I[z];if(T=st(T)?T:T[Q],V=st(V)?V:V[Q],T===null&&V!==null)return!0}return!1},j=(S,I,T,V)=>{const z=H(n,S);if(z){if(D(S))return;const Q=Ae(H(i,S)),q=H(i,S,Ae(T)?H(s,S):T);Ae(q)||V&&V.defaultChecked||I?je(i,S,I?q:Su(z._f)):ge(S,q),o.mount&&!o.action&&(y(),Q&&r.isDirty&&(f.isDirty||m.isDirty)&&(F()||(r.isDirty=!1,g.state.next({...r}))),e.shouldUnregister&&Q&&!Ae(H(i,S))&&Po(S,a)&&(o.watch=!0))}},k=(S,I,T,V,z)=>{let Q=!1,q=!1;const ee={name:S};if(!t.disabled){if(!T||V){(f.isDirty||m.isDirty)&&(q=r.isDirty,r.isDirty=ee.isDirty=F(),Q=q!==ee.isDirty);const he=At(H(s,S),I);q=!!H(r.dirtyFields,S),he!==r.isDirty?r.dirtyFields=$r(s,i):he?Ke(r.dirtyFields,S):je(r.dirtyFields,S,!0),ee.dirtyFields=r.dirtyFields,Q=Q||(f.dirtyFields||m.dirtyFields)&&q!==!he}if(T){const he=H(r.touchedFields,S);he||(je(r.touchedFields,S,T),ee.touchedFields=r.touchedFields,Q=Q||(f.touchedFields||m.touchedFields)&&he!==T)}Q&&z&&g.state.next(ee)}return Q?ee:{}},$=(S,I,T,V)=>{const z=H(r.errors,S),Q=(f.isValid||m.isValid)&&kt(I)&&r.isValid!==I;if(t.delayError&&T?(c=h(()=>w(S,T)),c(t.delayError)):(clearTimeout(d),c=null,T?je(r.errors,S,T):Ke(r.errors,S),r.errors={...r.errors}),(T?!At(z,T):z)||!Je(V)||Q){const q={...V,...Q&&kt(I)?{isValid:I}:{},errors:r.errors,name:S};r={...r,...q},g.state.next(q)}},N=async S=>(v(S,!0),await t.resolver(i,t.context,aE(S||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),A=async S=>{const{errors:I}=await N(S);if(v(S),S){for(const T of S){const V=H(I,T);V?a.array.has(T)&&Be(V)&&!Object.keys(V).some(z=>!Number.isNaN(Number(z)))?Du(r.errors,{[T]:V},T):je(r.errors,T,V):Ke(r.errors,T)}r.errors={...r.errors}}else r.errors=I;return I},U=async({name:S,eventType:I})=>{if(e.validate){const T=await e.validate({formValues:i,formState:r,name:S,eventType:I});if(Be(T))for(const V in T){const z=T[V];z&&Ne(`${ko}.${V}`,{message:mt(z.message)?z.message:"",type:z.type||qt.validate})}else mt(T)||!T?Ne(ko,{message:T||"",type:qt.validate}):be(ko);return T}return!0},R=async({fields:S,onlyCheckValid:I,name:T,eventType:V,context:z={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(z.runRootValidation=!0,!await U({name:T,eventType:V})&&(z.valid=!1,I)))return z.valid;for(const Q in S){const q=S[Q];if(q){const{_f:ee,...he}=q;if(ee){const Fe=a.array.has(ee.name),xt=q._f&&lE(q._f),St=f.validatingFields||f.isValidating||m.validatingFields||m.isValidating;xt&&St&&v([ee.name],!0);const lr=await Nu(q,a.disabled,i,_,t.shouldUseNativeValidation&&!I,Fe);if(xt&&St&&v([ee.name]),lr[ee.name]&&(z.valid=!1,I)||(!I&&(H(lr,ee.name)?Fe?Du(r.errors,lr,ee.name):je(r.errors,ee.name,lr[ee.name]):Ke(r.errors,ee.name)),e.shouldUseNativeValidation&&lr[ee.name]))break}!Je(he)&&await R({context:z,onlyCheckValid:I,fields:he,name:Q,eventType:V})}}return z.valid},B=()=>{for(const S of a.unMount){const I=H(n,S);I&&(I._f.refs?I._f.refs.every(T=>!Ao(T)):!Ao(I._f.ref))&&Le(S)}a.unMount=new Set},F=(S,I)=>!t.disabled&&(S&&I&&je(i,S,I),!At(W(),s)),J=(S,I,T)=>Ea(S,a,{...o.mount?i:Ae(I)?s:mt(S)?{[S]:I}:I},T,I),se=S=>Dh(H(o.mount?i:s,S,t.shouldUnregister?H(s,S,[]):[])),ge=(S,I,T={},V=!1)=>{const z=H(n,S);let Q=I;if(z){const q=z._f;q&&(!q.disabled&&je(i,S,Rh(I,q)),Q=ji(q.ref)&&st(I)?"":I,Nh(q.ref)?[...q.ref.options].forEach(ee=>ee.selected=Q.includes(ee.value)):q.refs?$s(q.ref)?q.refs.forEach(ee=>{(!ee.defaultChecked||!ee.disabled)&&(Array.isArray(Q)?ee.checked=!!Q.find(he=>he===ee.value):ee.checked=Q===ee.value||!!Q)}):q.refs.forEach(ee=>ee.checked=ee.value===Q):gl(q.ref)?q.ref.value="":(q.ref.value=Q,q.ref.type||g.state.next({name:S,values:V?i:Ue(i)})))}(T.shouldDirty||T.shouldTouch)&&k(S,Q,T.shouldTouch,T.shouldDirty,!0),T.shouldValidate&&G(S)},ye=(S,I,T,V=!1)=>{for(const z in I){if(!I.hasOwnProperty(z))return;const Q=I[z],q=S+"."+z,ee=H(n,q);(a.array.has(S)||Be(Q)||ee&&!ee._f)&&!zr(Q)?ye(q,Q,T,V):ge(q,Q,T,V)}},ve=(S,I,T,V)=>{const z=H(n,S),Q=a.array.has(S),q=V?I:Ue(I),ee=H(i,S),he=At(ee,q);if(he||je(i,S,q),Q)g.array.next({name:S,values:V?i:Ue(i)}),(f.isDirty||f.dirtyFields||m.isDirty||m.dirtyFields)&&T.shouldDirty&&(b(),g.state.next({name:S,dirtyFields:r.dirtyFields,isDirty:F(S,q)}));else{const Fe=Array.isArray(q)&&!q.length||Je(q);!z||z._f||st(q)||Fe?ge(S,q,T,V):ye(S,q,T,V)}if(!he){const Fe=Po(S,a),xt=V?i:Ue(i);g.state.next({...Fe&&r,name:o.mount||Fe?S:void 0,values:xt})}},K=(S,I,T={})=>ve(S,I,T,!1),P=(S,I={})=>{const T=gt(S)?S(i):S;if(!At(i,T)){i={...i,...T};for(const V of a.mount)ve(V,H(T,V),I,!0);g.state.next({...r,name:void 0,type:void 0,values:i}),I.shouldValidate&&y()}},X=async S=>{o.mount=!0;const I=S.target;let T=I.name,V=!0;const z=H(n,T),Q=he=>{V=Number.isNaN(he)||zr(he)&&isNaN(he.getTime())||At(he,H(i,T,he))},q=Cu(t.mode),ee=Cu(t.reValidateMode);if(z){let he,Fe;const xt=I.type?Su(z._f):Oa(S),St=S.type===Sr.BLUR||S.type===Sr.FOCUS_OUT,lr=!cE(z._f)&&!e.validate&&!t.resolver&&!H(r.errors,T)&&!z._f.deps||fE(St,H(r.touchedFields,T),r.isSubmitted,ee,q),Wn=Po(T,a,St);je(i,T,xt),St?(!I||!I.readOnly)&&(z._f.onBlur&&z._f.onBlur(S),c&&c(0)):z._f.onChange&&z._f.onChange(S);const Mr=k(T,xt,St),Xe=!Je(Mr)||Wn;if(!St&&g.state.next({name:T,type:S.type,values:Ue(i)}),lr)return(f.isValid||m.isValid)&&(t.mode==="onBlur"?St&&y():St||y()),Xe&&g.state.next({name:T,...Wn?{}:Mr});if(!t.resolver&&e.validate&&await U({name:T,eventType:S.type}),!St&&Wn&&g.state.next({...r}),t.resolver){const{errors:ct}=await N([T]);if(v([T]),Q(xt),!V){!Je(Mr)&&g.state.next(Mr);return}const bt=Eu(r.errors,n,T),Vt=Eu(ct,n,bt.name||T);he=Vt.error,T=Vt.name,Fe=Je(ct)}else v([T],!0),he=(await Nu(z,a.disabled,i,_,t.shouldUseNativeValidation))[T],v([T]),Q(xt),V&&(he?Fe=!1:(f.isValid||m.isValid)&&(Fe=await R({fields:n,onlyCheckValid:!0,name:T,eventType:S.type})));V&&(z._f.deps&&(!Array.isArray(z._f.deps)||z._f.deps.length>0)&&G(z._f.deps),$(T,Fe,he,Mr))}},M=(S,I)=>{if(H(r.errors,I)&&S.focus)return S.focus(),1},G=async(S,I={})=>{let T,V;const z=yi(S);if(t.resolver){const Q=await A(Ae(S)?S:z);T=Je(Q),V=S?!z.some(q=>H(Q,q)):T}else S?(V=(await Promise.all(z.map(async Q=>{const q=H(n,Q);return await R({fields:q&&q._f?{[Q]:q}:q,eventType:Sr.TRIGGER})}))).every(Boolean),!(!V&&!r.isValid)&&y()):V=T=await R({fields:n,name:S,eventType:Sr.TRIGGER});return g.state.next({...!mt(S)||(f.isValid||m.isValid)&&T!==r.isValid?{}:{name:S},...t.resolver||!S?{isValid:T}:{},errors:r.errors}),I.shouldFocus&&!V&&fs(n,M,S?z:a.mount),V},W=(S,I)=>{let T={...o.mount?i:s};return I&&(T=Ih(I.dirtyFields?r.dirtyFields:r.touchedFields,T)),Ae(S)?T:mt(S)?H(T,S):S.map(V=>H(T,V))},oe=(S,I)=>({invalid:!!H((I||r).errors,S),isDirty:!!H((I||r).dirtyFields,S),error:H((I||r).errors,S),isValidating:!!H(r.validatingFields,S),isTouched:!!H((I||r).touchedFields,S)}),be=S=>{const I=S?yi(S):void 0;I==null||I.forEach(T=>Ke(r.errors,T)),I?I.forEach(T=>{g.state.next({name:T,errors:r.errors})}):g.state.next({errors:{}})},Ne=(S,I,T)=>{const V=(H(n,S,{_f:{}})._f||{}).ref,z=H(r.errors,S)||{},{ref:Q,message:q,type:ee,...he}=z;je(r.errors,S,{...he,...I,ref:V}),g.state.next({name:S,errors:r.errors,isValid:!1}),T&&T.shouldFocus&&V&&V.focus&&V.focus()},ie=(S,I)=>gt(S)?g.state.subscribe({next:T=>"values"in T&&S(T.values||J(void 0,I),T)}):J(S,I,!0),ne=S=>g.state.subscribe({next:I=>{if(dE(S.name,I.name,S.exact)&&uE(I,S.formState||f,Us,S.reRenderRoot)){const T={...i};S.callback({values:T,...r,...I,defaultValues:s})}}}).unsubscribe,le=S=>(o.mount=!0,m={...m,...S.formState},ne({...S,formState:{...u,...S.formState}})),Le=(S,I={})=>{for(const T of S?yi(S):a.mount)a.mount.delete(T),a.array.delete(T),I.keepValue||(Ke(n,T),Ke(i,T)),!I.keepError&&Ke(r.errors,T),!I.keepDirty&&Ke(r.dirtyFields,T),!I.keepTouched&&Ke(r.touchedFields,T),!I.keepIsValidating&&Ke(r.validatingFields,T),!t.shouldUnregister&&!I.keepDefaultValue&&Ke(s,T);g.state.next({values:Ue(i)}),g.state.next({...r,...I.keepDirty?{isDirty:F()}:{}}),!I.keepIsValid&&y()},ze=({disabled:S,name:I})=>{if(kt(S)&&o.mount||S||a.disabled.has(I)){const z=a.disabled.has(I)!==!!S;S?a.disabled.add(I):a.disabled.delete(I),z&&o.mount&&!o.action&&y()}},Te=(S,I={})=>{let T=H(n,S);const V=kt(I.disabled)||kt(t.disabled),z=!a.registerName.has(S)&&T&&T._f&&!T._f.mount;return je(n,S,{...T||{},_f:{...T&&T._f?T._f:{ref:{name:S}},name:S,mount:!0,...I}}),a.mount.add(S),T&&!z?ze({disabled:kt(I.disabled)?I.disabled:t.disabled,name:S}):j(S,!0,I.value),{...V?{disabled:I.disabled||t.disabled}:{},...t.progressive?{required:!!I.required,min:ts(I.min),max:ts(I.max),minLength:ts(I.minLength),maxLength:ts(I.maxLength),pattern:ts(I.pattern)}:{},name:S,onChange:X,onBlur:X,ref:Q=>{if(Q){a.registerName.add(S),Te(S,I),a.registerName.delete(S),T=H(n,S);const q=Ae(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,ee=nE(q),he=T._f.refs||[];if(ee?he.find(Fe=>Fe===q):q===T._f.ref)return;je(n,S,{_f:{...T._f,...ee?{refs:[...he.filter(Ao),q,...Array.isArray(H(s,S))?[{}]:[]],ref:{type:q.type,name:S}}:{ref:q}}}),j(S,!1,void 0,q)}else T=H(n,S,{}),T._f&&(T._f.mount=!1),(t.shouldUnregister||I.shouldUnregister)&&!(xh(a.array,S)&&o.action)&&a.unMount.add(S)}}},te=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&fs(n,M,a.mount),We=S=>{kt(S)&&(g.state.next({disabled:S}),fs(n,(I,T)=>{const V=H(n,T);V&&(I.disabled=V._f.disabled||S,Array.isArray(V._f.refs)&&V._f.refs.forEach(z=>{z.disabled=V._f.disabled||S}))},0,!1))},at=(S,I)=>async T=>{let V;T&&(T.preventDefault&&T.preventDefault(),T.persist&&T.persist());let z=Ue(i);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:Q,values:q}=await N();v(),r.errors=Q,z=Ue(q)}else await R({fields:n,eventType:Sr.SUBMIT});if(a.disabled.size)for(const Q of a.disabled)Ke(z,Q);if(Ke(r.errors,Ch),Je(r.errors)){g.state.next({errors:{}});try{await S(z,T)}catch(Q){V=Q}}else I&&await I({...r.errors},T),te(),setTimeout(te);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Je(r.errors)&&!V,submitCount:r.submitCount+1,errors:r.errors}),V)throw V},vt=(S,I={})=>{H(n,S)&&(Ae(I.defaultValue)?K(S,Ue(H(s,S))):(K(S,I.defaultValue),je(s,S,Ue(I.defaultValue))),I.keepTouched||Ke(r.touchedFields,S),I.keepDirty||(Ke(r.dirtyFields,S),r.isDirty=I.defaultValue?F(S,Ue(H(s,S))):F()),I.keepError||(Ke(r.errors,S),f.isValid&&y()),g.state.next({...r}))},qe=(S,I={})=>{const T=S?Ue(S):s,V=Ue(T),z=Je(S),Q=V;if(I.keepDefaultValues||(s=T),!I.keepValues){if(I.keepDirtyValues){const q=new Set([...a.mount,...Object.keys($r(s,i))]);for(const ee of Array.from(q)){const he=H(r.dirtyFields,ee),Fe=H(i,ee),xt=H(Q,ee);he&&!Ae(Fe)?je(Q,ee,Fe):!he&&!Ae(xt)&&K(ee,xt)}}else{if(eo&&Ae(S))for(const q of a.mount){const ee=H(n,q);if(ee&&ee._f){const he=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(ji(he)){const Fe=he.closest("form");if(Fe){Fe.reset();break}}}}if(I.keepFieldsRef)for(const q of a.mount)K(q,H(Q,q));else n={}}if(t.shouldUnregister){if(i=I.keepDefaultValues?Ue(s):{},I.keepFieldsRef)for(const q of a.mount)je(i,q,H(Q,q))}else i=Ue(Q);g.array.next({values:{...Q}}),g.state.next({values:{...Q}})}a={mount:I.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!I.keepIsValid||!!I.keepDirtyValues||!t.shouldUnregister&&!Je(Q),o.watch=!!t.shouldUnregister,o.keepIsValid=!!I.keepIsValid,o.action=!1,I.keepErrors||(r.errors={}),g.state.next({submitCount:I.keepSubmitCount?r.submitCount:0,isDirty:z?!1:I.keepDirty?r.isDirty:I.keepValues?F():!!(I.keepDefaultValues&&!At(S,s)),isSubmitted:I.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:z?{}:I.keepDirtyValues?I.keepDefaultValues&&i?$r(s,i):r.dirtyFields:I.keepDefaultValues&&S?$r(s,S):I.keepDirty?r.dirtyFields:{},touchedFields:I.keepTouched?r.touchedFields:{},errors:I.keepErrors?r.errors:{},isSubmitSuccessful:I.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Ye=(S,I)=>qe(gt(S)?S(i):S,{...t.resetOptions,...I}),lt=(S,I={})=>{const T=H(n,S),V=T&&T._f;if(V){const z=V.refs?V.refs[0]:V.ref;z.focus&&setTimeout(()=>{z.focus(),I.shouldSelect&&gt(z.select)&&z.select()})}},Us=S=>{r={...r,...S}},Vs={control:{register:Te,unregister:Le,getFieldState:oe,handleSubmit:at,setError:Ne,_subscribe:ne,_runSchema:N,_updateIsValidating:v,_focusError:te,_getWatch:J,_getDirty:F,_setValid:y,_setFieldArray:x,_setDisabledField:ze,_setErrors:C,_getFieldArray:se,_reset:qe,_resetDefaultValues:()=>gt(t.defaultValues)&&t.defaultValues().then(S=>{Ye(S,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:B,_disableForm:We,_subjects:g,_proxyFormState:f,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(S){o=S},get _defaultValues(){return s},get _names(){return a},set _names(S){a=S},get _formState(){return r},get _options(){return t},set _options(S){t={...t,...S}}},subscribe:le,trigger:G,register:Te,handleSubmit:at,watch:ie,setValue:K,setValues:P,getValues:W,reset:Ye,resetField:vt,resetDefaultValues:(S,I={})=>{if(s=Ue(S),!I.keepDirty){const T=$r(s,i);r.dirtyFields=T,r.isDirty=!Je(T)}I.keepIsValid||y(),g.state.next({...r,defaultValues:s})},clearErrors:be,unregister:Le,setError:Ne,setFocus:lt,getFieldState:oe};return{...Vs,formControl:Vs}}function mE(e={}){const t=p.useRef(void 0),r=p.useRef(void 0),n=p.useRef(e.formControl),[s,i]=p.useState(()=>({...Ue(Ah),isLoading:gt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:gt(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&&!gt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=gE(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,hl(()=>{const a=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),o._formState.isReady=!0,a},[o]),p.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),p.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),p.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),p.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),p.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==s.isDirty&&o._subjects.state.next({isDirty:a})}},[o,s.isDirty]),p.useEffect(()=>{var a;e.values&&!At(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((a=o._options.resetOptions)===null||a===void 0)&&a.keepIsValid||o._setValid(),r.current=e.values,i(c=>({...c}))):o._resetDefaultValues()},[o,e.values]),p.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=p.useMemo(()=>Eh(s,o),[o,s]),t.current}async function Tu(e){var r,n;return(n=(r=(await Me.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}function Ph(e,t){const r=Jo({queryKey:["framework",e],queryFn:()=>Tu(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=Jo({queryKey:["framework",n],queryFn:()=>Tu(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}async function yE(e){var r,n;return(n=(r=(await Me.get(`/api/channel/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.channel}function vE(e){var r,n,s,i,o,a;const t=Jo({queryKey:["channel",e],queryFn:()=>yE(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:(o=t.data)==null?void 0:o.contentAdditionalCategories,defaultLicense:(a=t.data)==null?void 0:a.defaultLicense,isLoading:t.isLoading}}const bE={"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."},"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."}},ju={"First Section":"details","Second Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing"},_E={name:"details",description:"details",keywords:"details",appIcon:"details",primaryCategory:"details",additionalCategories:"details",board:"details",subject:"details",subjectIds:"details",medium:"details",framework:"details",topicsIds:"details",topic:"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"},Mh={board:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},Ru=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function wE(e,t,r,n){if(!(e!=null&&e.length))return NE(t,n,r);const s=new Set;return e.filter(i=>{if(n&&(i.code==="dialCode"||i.code==="dialcode")||i.visible===!1)return!1;const o=i.code;return s.has(o)?!1:(s.add(o),!0)}).map(i=>{const o=i.code??"",a=OE(i),c=EE(i,r,t),d=t[o],u=Lh(d,a);return{code:o,label:i.label??o,inputType:a,required:!!(i.required===!0||Array.isArray(i.validations)&&i.validations.some(f=>f.type==="required")),editable:i.editable!==!1,placeholder:i.placeholder,maxLength:i.maxLength,options:SE(c,u,a,r),depends:i.depends,tab:CE(i),section:i.section,defaultValue:i.defaultValue??i.default,currentValue:u}})}function xE(e){var n,s,i;const t=new Map,r=o=>o==null?void 0:o.forEach(a=>{a.identifier&&t.set(a.identifier,a.name),a.name&&t.set(a.name,a.name)});return(s=(n=e.organisationFramework)==null?void 0:n.categories)==null||s.forEach(o=>r(o.terms)),(i=e.targetFrameworks)==null||i.forEach(o=>{var a;return(a=o.categories)==null?void 0:a.forEach(c=>r(c.terms))}),t}function SE(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]:[],o=new Set(i.map(c=>c.value)),a=xE(n);for(const c of s){const d=String(c);o.has(d)||(i.push({label:a.get(d)??d,value:d}),o.add(d))}return i}function CE(e){const t=e.section;if(t&&ju[t])return ju[t];const r=e.code??"";return _E[r]??"details"}function Lh(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 OE(e){const t=(e.inputType??e.dataType??"").toLowerCase(),n=(e.dataType??"").toLowerCase()==="list";return t==="select"||t==="framework"?"select":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 EE(e,t,r){var a;const n=e.range;if(Array.isArray(n)&&n.length)return typeof n[0]=="string"?n.map(c=>({label:c,value:c})):n.map(c=>({label:c.name,value:c.identifier}));const s=e.enum;if(s!=null&&s.length)return s.map(c=>({label:c,value:c}));const i=e.code??"";if(i==="framework")return t.orgFrameworks;if(i==="additionalCategories")return(a=t.channelAdditionalCategories)==null?void 0:a.map(c=>({label:c,value:c}));const o=e.sourceCategory??Mh[i];if(o)return Fh(i,o,e,t,r)}function Fh(e,t,r,n,s){var f,m,g,_,h;const i=Ru.has(e)||r.output==="identifier"||typeof r.section=="string"&&r.section.includes("Target"),o=y=>({label:y.name,value:i?y.identifier:y.name}),a=(m=(f=n.organisationFramework)==null?void 0:f.categories)==null?void 0:m.find(y=>y.code===t),c=(h=(_=(g=n.targetFrameworks)==null?void 0:g[0])==null?void 0:_.categories)==null?void 0:h.find(y=>y.code===t);let d=(Ru.has(e)?c==null?void 0:c.terms:a==null?void 0:a.terms)??(c==null?void 0:c.terms)??(a==null?void 0:a.terms)??[];const u=r.depends;if(u!=null&&u.length){const y=u.flatMap(v=>{const b=s[v];return Array.isArray(b)?b:b!=null&&b!==""?[b]:[]}).map(String);if(y.length){const v=d.filter(b=>{const x=b.associations;return!x||!x.length?!0:x.some(w=>y.includes(w.identifier)||y.includes(w.code)||y.includes(w.name))});v.length&&(d=v)}}return d.map(o)}function yn(e,t){const r=Mh[e];if(r)return Fh(e,r,{},t,{})}const DE=[{label:"Student",value:"Student"},{label:"Teacher",value:"Teacher"},{label:"Administrator",value:"Administrator"},{label:"Parent",value:"Parent"},{label:"Other",value:"Other"}],IE=[{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-ND 4.0",value:"CC BY-ND 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-NC-ND 4.0",value:"CC BY-NC-ND 4.0"},{label:"CC0 1.0",value:"CC0 1.0"},{label:"All Rights Reserved",value:"All Rights Reserved"}];function nt(e,t,r){return Lh(e[t],r)}function NE(e,t,r){const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:nt(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:nt(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:nt(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:nt(e,"primaryCategory","select"),options:[{label:"Course",value:"Course"},{label:"Digital Textbook",value:"Digital Textbook"},{label:"Teacher Resource",value:"Teacher Resource"},{label:"Learning Resource",value:"Learning Resource"},{label:"Practice Question Set",value:"Practice Question Set"}]},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:nt(e,"additionalCategories","multiselect"),options:[{label:"Lesson Plan",value:"Lesson Plan"},{label:"Textbook",value:"Textbook"},{label:"TV Lesson",value:"TV Lesson"},{label:"Revision Material",value:"Revision Material"}]},{code:"board",label:"Course Type",inputType:"select",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:yn("board",r),currentValue:nt(e,"board","select")},{code:"subject",label:"Subjects covered in the course",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:yn("subject",r),currentValue:nt(e,"subject","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",options:DE,currentValue:nt(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:yn("targetBoardIds",r),currentValue:nt(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:yn("targetMediumIds",r),currentValue:nt(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:yn("targetGradeLevelIds",r),currentValue:nt(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:yn("targetSubjectIds",r),currentValue:nt(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:nt(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:nt(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:nt(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:nt(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",options:IE,currentValue:nt(e,"license","select")})),n}function TE(e,t){const{watch:r,setValue:n}=e;p.useEffect(()=>{const s=r((i,{name:o})=>{o&&t.forEach(a=>{var c;(c=a.depends)!=null&&c.includes(o)&&n(a.code,a.inputType==="multiselect"||a.inputType==="chips"?[]:"",{shouldDirty:!0})})});return()=>s.unsubscribe()},[r,n,t])}const jE="_section_ylgu8_1",RE="_header_ylgu8_11",kE="_title_ylgu8_17",AE="_description_ylgu8_24",PE="_divider_ylgu8_30",ME="_fields_ylgu8_36",vn={section:jE,header:RE,title:kE,description:AE,divider:PE,fields:ME},LE=({title:e,description:t,children:r})=>l.jsxs("div",{className:vn.section,children:[l.jsxs("div",{className:vn.header,children:[l.jsx("h3",{className:vn.title,children:e}),t&&l.jsx("p",{className:vn.description,children:t})]}),l.jsx("hr",{className:vn.divider}),l.jsx("div",{className:vn.fields,children:r})]}),FE="_field_1s288_1",$E="_fullWidth_1s288_7",BE="_label_1s288_11",UE="_required_1s288_19",VE="_input_1s288_24",zE="_textarea_1s288_45",qE="_inputError_1s288_50",HE="_error_1s288_54",WE="_selectBtn_1s288_59",KE="_selectOpen_1s288_83",QE="_placeholder_1s288_87",GE="_selectedVal_1s288_91",YE="_chevronUp_1s288_95",XE="_dropdown_1s288_100",ZE="_option_1s288_116",JE="_optionSelected_1s288_134",eD="_noOpts_1s288_139",tD="_chipGroup_1s288_146",rD="_chipInput_1s288_158",nD="_addChipBtn_1s288_167",sD="_radioGroup_1s288_184",iD="_radioLabel_1s288_191",oD="_iconWrap_1s288_199",aD="_iconPreview_1s288_214",lD="_iconPlaceholder_1s288_220",cD="_removeIconBtn_1s288_233",uD="_tagChip_1s288_252",dD="_tagChipRemove_1s288_264",fD="_nestedSelectRow_1s288_278",hD="_dialcodeRow_1s288_287",pD="_validateBtn_1s288_293",gD="_dialcodeValid_1s288_315",mD="_dialcodeSpinner_1s288_325",L={field:FE,fullWidth:$E,label:BE,required:UE,input:VE,textarea:zE,inputError:qE,error:HE,selectBtn:WE,selectOpen:KE,placeholder:QE,selectedVal:GE,chevronUp:YE,dropdown:XE,option:ZE,optionSelected:JE,noOpts:eD,chipGroup:tD,chipInput:rD,addChipBtn:nD,radioGroup:sD,radioLabel:iD,iconWrap:oD,iconPreview:aD,iconPlaceholder:lD,removeIconBtn:cD,tagChip:uD,tagChipRemove:dD,nestedSelectRow:fD,dialcodeRow:hD,validateBtn:pD,dialcodeValid:gD,dialcodeSpinner:mD},ku=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:o})=>{const{register:a,formState:{errors:c}}=Yt(),d=c[e],u={required:r?`${t} is required`:!1,maxLength:i?{value:i,message:`Max ${i} characters`}:void 0};return l.jsxs("div",{className:[L.field,s?L.fullWidth:""].join(" "),children:[l.jsxs("label",{className:L.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),s?l.jsx("textarea",{id:e,className:[L.input,L.textarea,d?L.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,u)}):l.jsx("input",{id:e,type:"text",className:[L.input,d?L.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,u)}),d&&l.jsx("span",{className:L.error,children:String(d.message)})]})},yD=({name:e,label:t,options:r,required:n,disabled:s})=>{var h;const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Yt(),m=d(e),g=((h=r.find(y=>y.value===m))==null?void 0:h.label)??"Select…",_=f[e];return p.useEffect(()=>{if(!i)return;const y=v=>{var b;(b=a.current)!=null&&b.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),l.jsxs("div",{className:L.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:L.label,children:[t,n&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[L.selectBtn,_?L.inputError:"",i?L.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:m?L.selectedVal:L.placeholder,children:g}),l.jsx(ks,{size:14,className:i?L.chevronUp:""})]}),i&&l.jsxs("div",{className:L.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[L.option,m===y.value?L.optionSelected:""].join(" "),onClick:()=>{u(e,y.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:y.label}),m===y.value&&l.jsx(Vn,{size:13})]},y.value)),!r.length&&l.jsx("span",{className:L.noOpts,children:"No options"})]}),_&&l.jsx("span",{className:L.error,children:String(_.message)})]})},vD=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Yt(),m=d(e)??[],g=f[e],_=m.length?`${m.length} selected`:"Select…";p.useEffect(()=>{if(!i)return;const y=v=>{var b;(b=a.current)!=null&&b.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]);const h=y=>{const v=m.includes(y)?m.filter(b=>b!==y):[...m,y];u(e,v,{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:L.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:L.label,children:[t,n&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[L.selectBtn,g?L.inputError:"",i?L.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:m.length?L.selectedVal:L.placeholder,children:_}),l.jsx(ks,{size:14,className:i?L.chevronUp:""})]}),i&&l.jsxs("div",{className:L.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[L.option,m.includes(y.value)?L.optionSelected:""].join(" "),onClick:()=>h(y.value),children:[l.jsx(Vn,{size:13,style:{opacity:m.includes(y.value)?1:0}}),l.jsx("span",{children:y.label})]},y.value)),!r.length&&l.jsx("span",{className:L.noOpts,children:"No options"})]}),g&&l.jsx("span",{className:L.error,children:String(g.message)})]})},bD=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=p.useState(""),[a,c]=p.useState(!1),d=p.useRef(null),{watch:u,setValue:f,formState:{errors:m}}=Yt(),g=u(e)??[],_=m[e],h=()=>{const v=i.trim();v&&!g.includes(v)&&f(e,[...g,v],{shouldDirty:!0}),o(""),c(!1)},y=v=>f(e,g.filter(b=>b!==v),{shouldDirty:!0});return l.jsxs("div",{className:[L.field,L.fullWidth].join(" "),children:[l.jsxs("label",{className:L.label,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsxs("div",{className:L.chipGroup,children:[g.map(v=>l.jsxs("span",{className:"sbx-chip filled",children:[v,!n&&l.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>y(v),"aria-label":`Remove ${v}`,children:"×"})]},v)),!n&&(a?l.jsx("input",{ref:d,autoFocus:!0,className:L.chipInput,value:i,onChange:v=>o(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),h()),v.key==="Escape"&&(o(""),c(!1))},onBlur:h,placeholder:s}):l.jsxs("button",{type:"button",className:L.addChipBtn,onClick:()=>{c(!0),setTimeout(()=>{var v;return(v=d.current)==null?void 0:v.focus()},50)},children:[l.jsx(As,{size:12})," Add"]}))]}),_&&l.jsx("span",{className:L.error,children:String(_.message)})]})},_D=({name:e,label:t,options:r,required:n,disabled:s})=>{const{register:i,formState:{errors:o}}=Yt(),a=o[e];return l.jsxs("div",{className:L.field,children:[l.jsxs("label",{className:L.label,children:[t,n&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("div",{className:L.radioGroup,children:r.map(c=>l.jsxs("label",{className:L.radioLabel,children:[l.jsx("input",{type:"radio",value:c.value,disabled:s,...i(e,{required:n?`${t} is required`:!1})}),c.label]},c.value))}),a&&l.jsx("span",{className:L.error,children:String(a.message)})]})};async function wD(e,t,r,n){var o,a;const i=(a=(o=(await Me.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:o.result)==null?void 0:a.node_id;if(!i)throw new Error("Asset creation failed: no node_id returned");return i}async function xD(e,t){var s,i;const n=(i=(s=(await Me.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 SD(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 CD(e,t,r){var o,a;const n=new FormData;n.append("fileUrl",t),n.append("mimeType",r);const i=(a=(o=(await Me.post(`/action/asset/v1/upload/${e}`,n,{params:{enctype:"multipart/form-data",processData:!1,contentType:!1,cache:!1}})).data)==null?void 0:o.result)==null?void 0:a.content_url;if(!i)throw new Error("Asset finalize failed: no content_url returned");return i}const OD="_overlay_ga6eh_1",ED="_modal_ga6eh_12",DD="_header_ga6eh_24",ID="_title_ga6eh_33",ND="_closeBtn_ga6eh_39",TD="_tabs_ga6eh_57",jD="_tab_ga6eh_57",RD="_activeTab_ga6eh_83",kD="_body_ga6eh_88",AD="_searchWrap_ga6eh_99",PD="_searchIcon_ga6eh_104",MD="_searchInput_ga6eh_113",LD="_grid_ga6eh_132",FD="_imgCell_ga6eh_148",$D="_imgCellSelected_ga6eh_166",BD="_thumb_ga6eh_171",UD="_noThumb_ga6eh_177",VD="_checkBadge_ga6eh_183",zD="_loadMoreBtn_ga6eh_198",qD="_loadingRow_ga6eh_220",HD="_empty_ga6eh_230",WD="_spinner_ga6eh_237",KD="_uploadArea_ga6eh_247",QD="_dropZone_ga6eh_256",GD="_uploadIcon_ga6eh_277",YD="_dropText_ga6eh_281",XD="_dropSubtext_ga6eh_288",ZD="_uploadPreview_ga6eh_294",JD="_hiddenInput_ga6eh_301",eI="_fileName_ga6eh_305",tI="_errorText_ga6eh_311",rI="_footer_ga6eh_318",nI="_cancelBtn_ga6eh_328",sI="_confirmBtn_ga6eh_345",fe={overlay:OD,modal:ED,header:DD,title:ID,closeBtn:ND,tabs:TD,tab:jD,activeTab:RD,body:kD,searchWrap:AD,searchIcon:PD,searchInput:MD,grid:LD,imgCell:FD,imgCellSelected:$D,thumb:BD,noThumb:UD,checkBadge:VD,loadMoreBtn:zD,loadingRow:qD,empty:HD,spinner:WD,uploadArea:KD,dropZone:QD,uploadIcon:GD,dropText:YD,dropSubtext:XD,uploadPreview:ZD,hiddenInput:JD,fileName:eI,errorText:tI,footer:rI,cancelBtn:nI,confirmBtn:sI},Au=18,$h=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=p.useState("my"),[o,a]=p.useState(""),[c,d]=p.useState([]),[u,f]=p.useState(0),[m,g]=p.useState(!1),[_,h]=p.useState(null),[y,v]=p.useState(0),[b,x]=p.useState(null),[w,C]=p.useState(""),[D,j]=p.useState(!1),[k,$]=p.useState(""),N=p.useRef(null),A=ue(M=>{var G,W;return((W=(G=M.editorConfig)==null?void 0:G.context)==null?void 0:W.channel)??""}),U=ue(M=>{var G,W;return((W=(G=M.editorConfig)==null?void 0:G.context)==null?void 0:W.uid)??""}),R=ue(M=>{var G,W,oe;return((oe=(W=(G=M.editorConfig)==null?void 0:G.context)==null?void 0:W.cloudStorage)==null?void 0:oe.presigned_headers)??{}}),B=ue(M=>{var G,W,oe;return((oe=(W=(G=M.editorConfig)==null?void 0:G.config)==null?void 0:W.assetConfig)==null?void 0:oe.size)??1*1024*1024}),F=ue(M=>{var G,W,oe;return((oe=(W=(G=M.editorConfig)==null?void 0:G.config)==null?void 0:W.assetConfig)==null?void 0:oe.accepted)??"image/png,image/jpeg"}),J=p.useCallback(async(M,G,W=!1)=>{var oe;g(!0);try{const be={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&U&&(be.createdBy=U),A&&(be.channel=A);const ie=((oe=(await Me.post("/action/composite/v3/search",{request:{filters:be,query:M,limit:Au,offset:G,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:oe.result)??{},ne=ie.content??[];f(ie.count??0),d(le=>W?[...le,...ne]:ne)}catch{}finally{g(!1)}},[s,U,A]);p.useEffect(()=>{s!=="upload"&&(d([]),v(0),J(o,0))},[s]);const se=p.useRef(),ge=M=>{a(M),clearTimeout(se.current),se.current=setTimeout(()=>{d([]),v(0),J(M,0)},400)},ye=()=>{const M=y+Au;v(M),J(o,M,!0)},ve=()=>{const M=(_==null?void 0:_.artifactUrl)??(_==null?void 0:_.appIcon)??(_==null?void 0:_.downloadUrl)??"";M&&r(M)};p.useEffect(()=>()=>{w&&URL.revokeObjectURL(w)},[w]);const K=M=>{var oe;const G=(oe=M.target.files)==null?void 0:oe[0];if(M.target.value="",!G)return;const W=F.split(",").map(be=>be.trim());if(!W.includes(G.type)){const be=W.map(Ne=>Ne.replace("image/","").toUpperCase()).join(", ");$(`Only ${be} files are accepted.`);return}if(G.size>B){const be=(B/1048576).toFixed(0);$(`Image must be under ${be} MB.`);return}w&&URL.revokeObjectURL(w),x(G),C(URL.createObjectURL(G)),$("")},P=async()=>{if(b){j(!0),$("");try{const M=await wD(b.name.split(".").slice(0,-1).join(".")||b.name,b.type,U,A),G=await xD(M,b.name);await SD(G,b,R);const W=G.split("?")[0],oe=await CD(M,W,b.type);r(oe)}catch(M){$(M instanceof Error?M.message:"Upload failed.")}finally{j(!1)}}},X=c.length<u;return l.jsx("div",{className:fe.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:fe.modal,children:[l.jsxs("div",{className:fe.header,children:[l.jsx("span",{className:fe.title,children:"Select App Icon"}),l.jsx("button",{className:fe.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(on,{size:18})})]}),l.jsxs("div",{className:fe.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${fe.tab} ${s==="my"?fe.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${fe.tab} ${s==="all"?fe.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${fe.tab} ${s==="upload"?fe.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(Hl,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:fe.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:fe.searchWrap,children:[l.jsx(aa,{size:14,className:fe.searchIcon}),l.jsx("input",{type:"search",className:fe.searchInput,placeholder:"Search images…",value:o,onChange:M=>ge(M.target.value)})]}),m&&c.length===0?l.jsxs("div",{className:fe.loadingRow,children:[l.jsx(si,{size:20,className:fe.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:fe.empty,children:"No images found"}):l.jsx("div",{className:fe.grid,children:c.map(M=>{const G=M.appIcon??M.artifactUrl??M.downloadUrl??"",W=(_==null?void 0:_.identifier)===M.identifier;return l.jsxs("button",{type:"button",className:`${fe.imgCell} ${W?fe.imgCellSelected:""}`,onClick:()=>h(M),title:M.name,children:[G?l.jsx("img",{src:G,alt:M.name,className:fe.thumb}):l.jsx("div",{className:fe.noThumb,children:"IMG"}),W&&l.jsx("div",{className:fe.checkBadge,children:l.jsx(Vn,{size:12})})]},M.identifier)})}),X&&!m&&l.jsx("button",{className:fe.loadMoreBtn,onClick:ye,children:"Load More"}),m&&c.length>0&&l.jsx("div",{className:fe.loadingRow,children:l.jsx(si,{size:16,className:fe.spinner})})]}):l.jsxs("div",{className:fe.uploadArea,children:[l.jsx("div",{className:fe.dropZone,onClick:()=>{var M;return(M=N.current)==null?void 0:M.click()},onDragOver:M=>M.preventDefault(),onDrop:M=>{M.preventDefault();const G=M.dataTransfer.files[0];G&&K({target:{files:[G],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:fe.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(Hl,{size:32,className:fe.uploadIcon}),l.jsx("p",{className:fe.dropText,children:"Drag & drop or click to browse"}),l.jsxs("p",{className:fe.dropSubtext,children:[F.split(",").map(M=>M.replace("image/","").toUpperCase()).join(", ")," · max ",(B/(1024*1024)).toFixed(0)," MB"]})]})}),l.jsx("input",{ref:N,type:"file",accept:F,className:fe.hiddenInput,onChange:K}),b&&l.jsx("p",{className:fe.fileName,children:b.name}),k&&l.jsx("p",{className:fe.errorText,children:k})]})}),l.jsxs("div",{className:fe.footer,children:[l.jsx("button",{className:fe.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:fe.confirmBtn,disabled:!b||D,onClick:P,children:D?l.jsxs(l.Fragment,{children:[l.jsx(si,{size:14,className:fe.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:fe.confirmBtn,disabled:!_,onClick:ve,children:"Use Selected"})]})]})})},iI=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),{watch:a,setValue:c,register:d,formState:{errors:u}}=Yt(),f=a(e),m=u[e],g=h=>{c(e,h,{shouldDirty:!0,shouldValidate:!0}),o(!1)},_=()=>{c(e,"",{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:L.field,children:[l.jsxs("label",{className:L.label,children:[t,n&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("input",{type:"hidden",...d(e,{required:n?`${t} is required`:!1})}),l.jsx("div",{className:L.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":"Select app icon",onClick:()=>!s&&o(!0),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&!s&&o(!0)},children:f?l.jsx("img",{src:f,alt:"App icon",className:L.iconPreview}):l.jsxs("div",{className:L.iconPlaceholder,children:[l.jsx(Wd,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:L.removeIconBtn,onClick:_,"aria-label":"Remove app icon",children:[l.jsx(Wa,{size:13}),l.jsx("span",{children:"Remove"})]}),m&&l.jsx("span",{className:L.error,children:String(m.message)}),i&&l.jsx($h,{nodeId:r,currentValue:f,onSelect:g,onClose:()=>o(!1)})]})},oI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=ro({name:e,control:s,rules:{required:r?`${t} is required`:!1}});return l.jsxs("div",{className:L.field,children:[l.jsxs("label",{className:L.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("input",{id:e,type:"datetime-local",className:[L.input,o?L.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),o&&l.jsx("span",{className:L.error,children:String(o.message)})]})},aI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=ro({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=p.useState(""),d=p.useRef(null),u=i.value??[],f=h=>{const y=h.trim();!y||u.includes(y)||i.onChange([...u,y])},m=h=>{i.onChange(u.filter(y=>y!==h))},g=h=>{h.key==="Enter"||h.key===","?(h.preventDefault(),f(a),c("")):h.key==="Backspace"&&a===""&&u.length>0&&m(u[u.length-1])},_=()=>{a.trim()&&(f(a),c("")),i.onBlur()};return l.jsxs("div",{className:[L.field,L.fullWidth].join(" "),children:[l.jsxs("label",{className:L.label,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsxs("div",{className:[L.chipGroup,o?L.inputError:""].join(" "),onClick:()=>{var h;return!n&&((h=d.current)==null?void 0:h.focus())},style:{cursor:n?"not-allowed":"text"},children:[u.map(h=>l.jsxs("span",{className:L.tagChip,children:[h,!n&&l.jsx("button",{type:"button",className:L.tagChipRemove,onClick:y=>{y.stopPropagation(),m(h)},"aria-label":`Remove ${h}`,children:l.jsx(on,{size:11})})]},h)),!n&&l.jsx("input",{ref:d,className:L.chipInput,value:a,onChange:h=>c(h.target.value),onKeyDown:g,onBlur:_,placeholder:u.length===0?"Type and press Enter or comma…":"",style:{flexGrow:1,minWidth:120}})]}),o&&l.jsx("span",{className:L.error,children:String(o.message)})]})},lI=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Yt(),{field:o,fieldState:{error:a}}=ro({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},d=(u,f,m)=>{const g={};for(let _=0;_<f;_++)g[r[_].code]=c[r[_].code]??"";g[u]=m;for(let _=f+1;_<r.length;_++)g[r[_].code]="";o.onChange(g)};return l.jsxs("div",{className:[L.field,L.fullWidth].join(" "),children:[l.jsxs("label",{className:L.label,children:[t,n&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("div",{className:L.nestedSelectRow,children:r.map((u,f)=>{const m=f>0&&!c[r[f-1].code];return l.jsxs("div",{className:L.field,style:{flex:1},children:[l.jsx("label",{className:L.label,htmlFor:`${e}_${u.code}`,children:u.label}),l.jsxs("select",{id:`${e}_${u.code}`,className:[L.input,a?L.inputError:""].join(" "),disabled:s||m,value:c[u.code]??"",onChange:g=>d(u.code,f,g.target.value),onBlur:o.onBlur,children:[l.jsx("option",{value:"",children:"Select…"}),u.options.map(g=>l.jsx("option",{value:g.value,children:g.label},g.value))]})]},u.code)})}),a&&l.jsx("span",{className:L.error,children:String(a.message)})]})},Pu=[{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"}],cI=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=p.useState(!1),o=p.useRef(null),{register:a,watch:c,setValue:d,formState:{errors:u}}=Yt(),f=c(e),m=Pu.find(h=>h.value===f),g=(m==null?void 0:m.label)??"Select license…",_=u[e];return p.useEffect(()=>{if(!s)return;const h=y=>{var v;(v=o.current)!=null&&v.contains(y.target)||i(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),l.jsxs("div",{className:L.field,ref:o,style:{position:"relative"},children:[l.jsxs("label",{className:L.label,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("input",{type:"hidden",...a(e,{required:r?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:n,className:[L.selectBtn,_?L.inputError:"",s?L.selectOpen:""].join(" "),onClick:()=>i(h=>!h),"aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:f?L.selectedVal:L.placeholder,children:g}),l.jsx(ks,{size:14,className:s?L.chevronUp:""})]}),s&&l.jsx("div",{className:L.dropdown,role:"listbox",children:Pu.map(h=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===h.value,className:[L.option,f===h.value?L.optionSelected:""].join(" "),onClick:()=>{d(e,h.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:h.label}),f===h.value&&l.jsx(Vn,{size:13})]},h.value))}),_&&l.jsx("span",{className:L.error,children:String(_.message)})]})},uI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=ro({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=p.useState("idle"),[d,u]=p.useState(""),f=async()=>{const g=(i.value??"").trim();if(!g){c("invalid"),u("Enter a dial code to validate.");return}c("loading"),u("");try{const _=await L_(g),h=_==null?void 0:_.result,y=h==null?void 0:h.dialcodes;Array.isArray(y)&&y.length>0?(c("valid"),u("Dial code is valid.")):(c("invalid"),u("Dial code not found."))}catch{c("invalid"),u("Validation failed. Please try again.")}},m=()=>a==="loading"?l.jsx(si,{size:16,className:L.dialcodeSpinner}):a==="valid"?l.jsx(Vd,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(oa,{size:16,color:"var(--sbx-error)"}):null;return l.jsxs("div",{className:L.field,children:[l.jsxs("label",{className:L.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsxs("div",{className:L.dialcodeRow,children:[l.jsx("input",{id:e,type:"text",className:[L.input,o?L.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:g=>{i.onChange(g),c("idle"),u("")},onBlur:i.onBlur,ref:i.ref,placeholder:"e.g. A1B2C3",style:{flex:1}}),l.jsx("button",{type:"button",className:L.validateBtn,onClick:f,disabled:n||a==="loading","aria-label":"Validate dial code",children:a==="loading"?"Validating…":"Validate"}),m()]}),o&&l.jsx("span",{className:L.error,children:String(o.message)}),!o&&d&&l.jsx("span",{className:a==="valid"?L.dialcodeValid:L.error,children:d})]})},dI="_form_szqex_1",fI="_ungrouped_szqex_7",hI="_noFields_szqex_18",Mo={form:dI,ungrouped:fI,noFields:hI},pI=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var ge,ye,ve,K;const a=ue(P=>P.editorConfig),c=ue(P=>P.rootFormConfig),d=ue(P=>P.unitFormConfig),{organisationFramework:u,targetFrameworks:f,isLoading:m}=Ph((ge=a==null?void 0:a.context)==null?void 0:ge.framework,(ye=a==null?void 0:a.context)==null?void 0:ye.targetFWIds),{frameworks:g,collectionAdditionalCategories:_}=vE((ve=a==null?void 0:a.context)==null?void 0:ve.channel),h=g==null?void 0:g.map(P=>({label:P.name,value:P.identifier})),y={organisationFramework:u,targetFrameworks:f,orgFrameworks:h,channelAdditionalCategories:_},v=Re(P=>P.selectedNodeId),b=Re(P=>P.treeCache),x=v?b[v]??{}:{},w={...e,...x},C=r?c:d,D=C||(((K=a==null?void 0:a.config.hierarchy)==null?void 0:K.formConfig)??[]),j=wE(D,w,y,r),k=j.filter(P=>P.tab===t&&P.inputType!=="appIcon"),$=mE({mode:"onChange",defaultValues:Object.fromEntries(j.map(P=>{const X=["multiselect","chips","keywords","tagsinput"],M=["nestedselect"];return X.includes(P.inputType)?[P.code,P.currentValue??P.defaultValue??[]]:M.includes(P.inputType)?[P.code,P.currentValue??P.defaultValue??{}]:[P.code,P.currentValue??P.defaultValue??""]}))});TE($,j);const{updateNode:N}=Re(),A=p.useRef(j);A.current=j;const U=p.useRef(v);U.current=v;const R=p.useRef(i);R.current=i;const B=p.useRef(o);B.current=o,p.useEffect(()=>{$.trigger().then(()=>{const P=$.formState.errors,X=A.current,M=Array.from(new Set(Object.keys(P).map(G=>{var W;return(W=X.find(oe=>oe.code===G))==null?void 0:W.tab}).filter(Boolean)));B.current(Object.keys(P).length===0,M)})},[]),p.useEffect(()=>{const P=$.watch((X,{name:M})=>{const G=U.current;if(!G)return;const W=A.current,oe=new Set(W.map(ie=>ie.code));if(M&&oe.has(M)){const ie=$.getValues(M);N(G,{[M]:ie}),R.current({[M]:ie})}else if(!M){const ie=$.getValues(),ne=Object.fromEntries(Object.entries(ie).filter(([le])=>oe.has(le)));Object.keys(ne).length>0&&(N(G,ne),R.current(ne))}const be=$.formState.errors,Ne=Array.from(new Set(Object.keys(be).map(ie=>{var ne;return(ne=W.find(le=>le.code===ie))==null?void 0:ne.tab}).filter(Boolean)));B.current(Object.keys(be).length===0,Ne)});return()=>P.unsubscribe()},[$]);const F=s!=="edit",J=k.reduce((P,X)=>{const M=P[P.length-1];return M&&M.section===X.section?M.fields.push(X):P.push({section:X.section,fields:[X]}),P},[]),se=P=>{const X={key:P.code,name:P.code,label:P.label,required:P.required,disabled:F||P.editable===!1};switch(P.inputType){case"textarea":return l.jsx(ku,{...X,multiline:!0,maxLength:P.maxLength});case"select":return l.jsx(yD,{...X,options:P.options??[]});case"multiselect":return l.jsx(vD,{...X,options:P.options??[]});case"chips":return l.jsx(bD,{...X});case"radio":return l.jsx(_D,{...X,options:P.options??[]});case"appIcon":return l.jsx(iI,{...X,nodeId:v??""});case"datepicker":case"datetime":return l.jsx(oI,{...X});case"keywords":case"tagsinput":return l.jsx(aI,{...X});case"nestedselect":return l.jsx(lI,{...X,levels:P.levels??[]});case"license":return l.jsx(cI,{...X});case"dialcode":return l.jsx(uI,{...X});default:return l.jsx(ku,{...X,maxLength:P.maxLength})}};return l.jsx(tE,{...$,children:l.jsxs("div",{className:Mo.form,children:[J.map((P,X)=>{const M=P.section?bE[P.section]:void 0;return M?l.jsx(LE,{title:M.title,description:M.description,children:P.fields.map(se)},P.section??X):l.jsx("div",{className:Mo.ungrouped,children:P.fields.map(se)},X)}),k.length===0&&!m&&l.jsx("p",{className:Mo.noFields,children:"No fields configured for this tab."})]})})};function Bh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function gI(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function Zs(e){return e!==null&&e>=0}function mI(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 yI(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Uh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=Bh(t,n,r),o=t[s],a=i[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},Js={scaleX:1,scaleY:1},vI=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:s,rects:i,overIndex:o}=e;const a=(t=i[r])!=null?t:n;if(!a)return null;if(s===r){const d=i[o];return d?{x:0,y:r<o?d.top+d.height-(a.top+a.height):d.top-a.top,...Js}:null}const c=bI(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...Js}:s<r&&s>=o?{x:0,y:a.height+c,...Js}:{x:0,y:0,...Js}};function bI(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 Vh="Sortable",zh=p.createContext({activeIndex:-1,containerId:Vh,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Uh,disabled:{draggable:!1,droppable:!1}});function _I(e){let{children:t,id:r,items:n,strategy:s=Uh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:u}=$d(),f=js(Vh,r),m=a.rect!==null,g=p.useMemo(()=>n.map(D=>typeof D=="object"&&"id"in D?D.id:D),[n]),_=o!=null,h=o?g.indexOf(o.id):-1,y=d?g.indexOf(d.id):-1,v=p.useRef(g),b=!mI(g,v.current),x=y!==-1&&h===-1||b,w=yI(i);Kt(()=>{b&&_&&u(g)},[b,g,_,u]),p.useEffect(()=>{v.current=g},[g]);const C=p.useMemo(()=>({activeIndex:h,containerId:f,disabled:w,disableTransforms:x,items:g,overIndex:y,useDragOverlay:m,sortedRects:gI(g,c),strategy:s}),[h,f,w.draggable,w.droppable,x,g,y,c,m,s]);return p.createElement(zh.Provider,{value:C},t)}const wI=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return Bh(r,n,s).indexOf(t)},xI=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:i,newIndex:o,previousItems:a,previousContainerId:c,transition:d}=e;return!d||!n||a!==i&&s===o?!1:r?!0:o!==s&&t===c},SI={duration:200,easing:"ease"},qh="transform",CI=Ar.Transition.toString({property:qh,duration:0,easing:"linear"}),OI={roleDescription:"sortable"};function EI(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=p.useState(null),a=p.useRef(r);return Kt(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const d=Un(n.current,{ignoreTransform:!0}),u={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(u.x||u.y)&&o(u)}}r!==a.current&&(a.current=r)},[t,r,n,s]),p.useEffect(()=>{i&&o(null)},[i]),i}function DI(e){let{animateLayoutChanges:t=xI,attributes:r,disabled:n,data:s,getNewIndex:i=wI,id:o,strategy:a,resizeObserverConfig:c,transition:d=SI}=e;const{items:u,containerId:f,activeIndex:m,disabled:g,disableTransforms:_,sortedRects:h,overIndex:y,useDragOverlay:v,strategy:b}=p.useContext(zh),x=II(n,g),w=u.indexOf(o),C=p.useMemo(()=>({sortable:{containerId:f,index:w,items:u},...s}),[f,s,w,u]),D=p.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:j,node:k,isOver:$,setNodeRef:N}=$m({id:o,data:C,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...c}}),{active:A,activatorEvent:U,activeNodeRect:R,attributes:B,setNodeRef:F,listeners:J,isDragging:se,over:ge,setActivatorNodeRef:ye,transform:ve}=Fd({id:o,data:C,attributes:{...OI,...r},disabled:x.draggable}),K=Cg(N,F),P=!!A,X=P&&!_&&Zs(m)&&Zs(y),M=!v&&se,G=M&&X?ve:null,oe=X?G??(a??b)({rects:h,activeNodeRect:R,activeIndex:m,overIndex:y,index:w}):null,be=Zs(m)&&Zs(y)?i({id:o,items:u,activeIndex:m,overIndex:y}):w,Ne=A==null?void 0:A.id,ie=p.useRef({activeId:Ne,items:u,newIndex:be,containerId:f}),ne=u!==ie.current.items,le=t({active:A,containerId:f,isDragging:se,isSorting:P,id:o,index:w,items:u,newIndex:ie.current.newIndex,previousItems:ie.current.items,previousContainerId:ie.current.containerId,transition:d,wasDragging:ie.current.activeId!=null}),Le=EI({disabled:!le,index:w,node:k,rect:j});return p.useEffect(()=>{P&&ie.current.newIndex!==be&&(ie.current.newIndex=be),f!==ie.current.containerId&&(ie.current.containerId=f),u!==ie.current.items&&(ie.current.items=u)},[P,be,f,u]),p.useEffect(()=>{if(Ne===ie.current.activeId)return;if(Ne&&!ie.current.activeId){ie.current.activeId=Ne;return}const Te=setTimeout(()=>{ie.current.activeId=Ne},50);return()=>clearTimeout(Te)},[Ne]),{active:A,activeIndex:m,attributes:B,data:C,rect:j,index:w,newIndex:be,items:u,isOver:$,isSorting:P,isDragging:se,listeners:J,node:k,overIndex:y,over:ge,setNodeRef:K,setActivatorNodeRef:ye,setDroppableNodeRef:N,setDraggableNodeRef:F,transform:Le??oe,transition:ze()};function ze(){if(Le||ne&&ie.current.newIndex===w)return CI;if(!(M&&!$i(U)||!d)&&(P||le))return Ar.Transition.toString({...d,property:qh})}}function II(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 ki(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 NI=[we.Down,we.Right,we.Up,we.Left],TI=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(NI.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const m=s.get(f.id);if(m)switch(e.code){case we.Down:n.top<m.top&&c.push(f);break;case we.Up:n.top>m.top&&c.push(f);break;case we.Left:n.left>m.left&&c.push(f);break;case we.Right:n.left<m.left&&c.push(f);break}});const d=Ug({collisionRect:n,droppableRects:s,droppableContainers:c});let u=wd(d,"id");if(u===(o==null?void 0:o.id)&&d.length>1&&(u=d[1].id),u!=null){const f=i.get(r.id),m=i.get(u),g=m?s.get(m.id):null,_=m==null?void 0:m.node.current;if(_&&g&&f&&m){const y=Bi(_).some((D,j)=>a[j]!==D),v=Hh(f,m),b=jI(f,m),x=y||!v?{x:0,y:0}:{x:b?n.width-g.width:0,y:b?n.height-g.height:0},w={x:g.left,y:g.top};return x.x&&x.y?w:ys(w,x)}}}};function Hh(e,t){return!ki(e)||!ki(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function jI(e,t){return!ki(e)||!ki(t)||!Hh(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const RI="_row_11nth_1",kI="_removeBtn_11nth_14",AI="_grip_11nth_17",PI="_ctIcon_11nth_34",MI="_info_11nth_38",LI="_name_11nth_46",FI="_meta_11nth_55",Lr={row:RI,removeBtn:kI,grip:AI,ctIcon:PI,info:MI,name:LI,meta:FI},$I={video:Ka,pdf:Va,h5p:za,scorm:Ha,audio:qa,quiz:Ua,default:zn},BI=({item:e,onRemove:t,isEditable:r})=>{const n=Ji(e),s=$I[n.key]??zn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:d,isDragging:u}=DI({id:e.id,disabled:!r}),f={transform:Ar.Transform.toString(c),transition:d,opacity:u?.5:1};return l.jsxs("div",{ref:a,style:f,className:Lr.row,role:"listitem",children:[r&&l.jsx("span",{className:Lr.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(Hd,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Lr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Lr.info,children:[l.jsx("span",{className:Lr.name,title:e.name,children:e.name}),l.jsx("span",{className:Lr.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Lr.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(on,{size:14})})]})},UI="_container_lzvke_1",VI="_header_lzvke_7",zI="_heading_lzvke_13",qI="_count_lzvke_21",HI="_list_lzvke_30",WI="_emptyState_lzvke_36",KI="_addRow_lzvke_52",Fr={container:UI,header:VI,heading:zI,count:qI,list:HI,emptyState:WI,addRow:KI},QI=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=Re(),i=t?r(t):[],o=e==="edit",a=vd(ra(Ui,{activationConstraint:{distance:5}}),ra(Fa,{coordinateGetter:TI})),c=p.useCallback(u=>{const{active:f,over:m}=u;if(!m||f.id===m.id||!t)return;const g=Re.getState().getChildrenOf(t),_=g.findIndex(y=>y.id===f.id),h=g.findIndex(y=>y.id===m.id);_<0||h<0||n(t,_,h)},[t,n]),d=p.useCallback(u=>{window.confirm("Remove this content from the unit?")&&s(u)},[s]);return t?l.jsxs("div",{className:Fr.container,children:[l.jsxs("div",{className:Fr.header,children:[l.jsx("span",{className:Fr.heading,children:"Content in this unit"}),l.jsx("span",{className:Fr.count,children:i.length})]}),i.length>0?l.jsx(Ld,{sensors:a,collisionDetection:Bg,onDragEnd:c,children:l.jsx(_I,{items:i.map(u=>u.id),strategy:vI,children:l.jsx("div",{className:Fr.list,role:"list",children:i.map(u=>l.jsx(BI,{item:u,onRemove:d,isEditable:o},u.id))})})}):l.jsxs("div",{className:Fr.emptyState,children:[l.jsx("p",{children:"No content yet"}),l.jsx("span",{children:"Drag from the library or click Add content"})]}),o&&l.jsxs("button",{className:Fr.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(As,{size:14})," Add content"]})]}):null},GI="_dropZone_ijo5w_1",YI="_active_ijo5w_14",Mu={dropZone:GI,active:YI},XI=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${Mu.dropZone} ${e?Mu.active:""} ${n??""}`,"data-droppable":e?"true":void 0,"data-node-id":r,"aria-label":t,role:"region",children:l.jsx("span",{children:t})});async function ZI(e){var o;const t={status:["Live"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((o=(await Me.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:o.result)??{},s=new Set(["count","facets"]);return{content:Object.entries(n).filter(([a])=>!s.has(a)).flatMap(([,a])=>Array.isArray(a)?a:[]),count:n.count??0}}async function JI(e){var r,n;return(n=(r=(await Me.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}const eN="_contentPlayerRoot_ryh6z_1",tN="_stage_ryh6z_9",rN="_playerHeader_ryh6z_19",nN="_playerHeaderThumb_ryh6z_33",sN="_playerHeaderTitle_ryh6z_43",iN="_typeBadge_ryh6z_53",oN="_typeDot_ryh6z_92",aN="_aspectRatio_ryh6z_99",lN="_playerFrame_ryh6z_112",cN="_coverOverlay_ryh6z_120",uN="_coverHidden_ryh6z_132",dN="_coverThumb_ryh6z_137",fN="_coverPlayRing_ryh6z_146",hN="_coverPlayIcon_ryh6z_159",pN="_coverLabel_ryh6z_168",gN="_coverSkeleton_ryh6z_174",mN="_playerWrapper_ryh6z_200",yN="_infoStrip_ryh6z_210",vN="_infoChip_ryh6z_226",bN="_infoChipLabel_ryh6z_245",_N="_infoChipIcon_ryh6z_254",wN="_playerError_ryh6z_260",xN="_playerErrorIcon_ryh6z_274",SN="_playerErrorMsg_ryh6z_279",CN="_qumlRoot_ryh6z_286",Pe={contentPlayerRoot:eN,stage:tN,playerHeader:rN,playerHeaderThumb:nN,playerHeaderTitle:sN,typeBadge:iN,typeDot:oN,aspectRatio:aN,playerFrame:lN,coverOverlay:cN,coverHidden:uN,coverThumb:dN,coverPlayRing:fN,coverPlayIcon:hN,coverLabel:pN,coverSkeleton:gN,playerWrapper:mN,infoStrip:yN,infoChip:vN,infoChipLabel:bN,infoChipIcon:_N,playerError:wN,playerErrorIcon:xN,playerErrorMsg:SN,qumlRoot:CN},ON=[{key:"video",mimes:["video/mp4","video/webm","video/ogg"],label:"Video",icon:"🎬"},{key:"audio",mimes:["audio/mp3","audio/mpeg","audio/ogg","audio/wav"],label:"Audio",icon:"🎵"},{key:"pdf",mimes:["application/pdf"],label:"PDF",icon:"📄"},{key:"epub",mimes:["application/epub"],label:"ePub",icon:"📖"},{key:"ecml",mimes:["application/vnd.ekstep.ecml-archive"],label:"ECML",icon:"✏️"},{key:"h5p",mimes:["application/vnd.ekstep.h5p-archive"],label:"H5P",icon:"🎮"},{key:"scorm",mimes:["application/vnd.ekstep.content-collection"],label:"SCORM",icon:"📦"}];function EN(e){return ON.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const DN={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},IN={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},NN={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},TN="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function Lo(e){for(const[t,r]of Object.entries(DN))if(r.includes(e))return t;return"default-player"}function jN(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 RN(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 kN(e,t,r=100){await RN(IN[t]??""),!customElements.get(e)&&await new Promise((n,s)=>{let i=0;const o=setInterval(()=>{i++,customElements.get(e)?(clearInterval(o),n()):i>=r&&(clearInterval(o),s(new Error(`Custom element <${e}> did not register`)))},100)})}const AN=[{key:"author",label:"Author",icon:"👤"},{key:"license",label:"License",icon:"⚖️"},{key:"language",label:"Language",icon:"🌐"},{key:"gradeLevel",label:"Class",icon:"🏫"},{key:"subject",label:"Subject",icon:"📚"},{key:"contentType",label:"Type",icon:"🏷️"}];function PN({node:e}){const t=e.metadata??{},r=AN.flatMap(n=>{const s=t[n.key];if(!s)return[];const i=Array.isArray(s)?s.join(", "):String(s);return i?[{...n,val:i}]:[]});return r.length?l.jsx("div",{className:Pe.infoStrip,children:r.map(n=>l.jsxs("div",{className:Pe.infoChip,children:[n.icon&&l.jsx("span",{className:Pe.infoChipIcon,children:n.icon}),l.jsx("span",{className:Pe.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function MN({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${Pe.coverOverlay} ${t?Pe.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:Pe.coverThumb}),l.jsx("div",{className:Pe.coverPlayRing,children:l.jsx("div",{className:Pe.coverPlayIcon})}),l.jsx("span",{className:Pe.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:Pe.coverSkeleton})})}function LN({message:e}){return l.jsxs("div",{className:Pe.playerError,children:[l.jsx("span",{className:Pe.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:Pe.playerErrorMsg,children:e})]})}function FN({mimeType:e}){const t=EN(e);return l.jsxs("span",{className:Pe.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:Pe.typeDot}),t.label]})}const Ta=({node:e,editorMode:t,type:r})=>{var s;if(r==="quml")return l.jsx(BN,{node:e,editorMode:t});const n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return l.jsxs("div",{className:Pe.contentPlayerRoot,children:[l.jsxs("div",{className:Pe.stage,children:[l.jsxs("div",{className:Pe.playerHeader,children:[n&&l.jsx("img",{src:n,alt:"",className:Pe.playerHeaderThumb}),l.jsx("span",{className:Pe.playerHeaderTitle,children:e.name}),l.jsx(FN,{mimeType:e.mimeType??""})]}),l.jsx($N,{node:e})]}),l.jsx(PN,{node:e})]})};function $N({node:e}){var y;const t=ue(v=>v.editorConfig),[r,n]=p.useState(()=>Lo(e.mimeType??"")),[s,i]=p.useState(!1),[o,a]=p.useState(null),[c,d]=p.useState(e.metadata??{}),[u,f]=p.useState(!1),m=p.useRef(null),g=p.useRef(null),_=((y=t==null?void 0:t.config)==null?void 0:y.previewCdnUrl)??TN;p.useEffect(()=>{let v=!1;return f(!1),i(!1),a(null),d(e.metadata??{}),n(Lo(e.mimeType??"")),JI(e.identifier).then(b=>{if(v)return;const x={...e.metadata??{},...b};d(x);const w=b.mimeType??e.mimeType??"";n(Lo(w)),f(!0)}).catch(()=>{v||f(!0)}),()=>{v=!0}},[e.identifier]);const h=jN(e,c,t);return p.useEffect(()=>{if(!u||r!=="default-player")return;const v=m.current;if(!v)return;v.src=_;const b=()=>{try{const w=v.contentWindow;if(typeof(w==null?void 0:w.initializePreview)!="function"){a("Preview player unavailable. Check that /content/preview is reachable.");return}w.initializePreview(h),setTimeout(()=>i(!0),300)}catch(w){console.error("[ContentPlayer] initializePreview failed",w),a("Failed to initialize the content player.")}},x=()=>a("Preview player could not be loaded.");return v.addEventListener("load",b),v.addEventListener("error",x),()=>{v.removeEventListener("load",b),v.removeEventListener("error",x),v.src=""}},[e.identifier,r,_,u]),p.useEffect(()=>{if(!u||r==="default-player")return;const v=g.current;if(!v)return;const b=NN[r];if(!b)return;const x=h;kN(b,r).then(()=>{if(!g.current)return;if(!customElements.get(b)){n("default-player");return}const w=document.createElement(b);w.setAttribute("player-config",JSON.stringify(x)),w.addEventListener("playerEvent",()=>{}),w.addEventListener("telemetryEvent",()=>{}),v.innerHTML="",v.appendChild(w),setTimeout(()=>{try{w.playerConfig=x}catch{}i(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${r} script unavailable, falling back to iframe`),n("default-player")})},[e.identifier,r,u]),l.jsxs("div",{className:Pe.aspectRatio,children:[o?l.jsx(LN,{message:o}):l.jsx(MN,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:m,id:"contentPlayer",title:e.name,className:Pe.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:g,className:Pe.playerFrame})]})}function BN({node:e,editorMode:t}){const r=ue(s=>s.editorConfig),n=p.useRef(null);return p.useEffect(()=>{var a;if(!n.current)return;const s=r==null?void 0:r.context,i={context:{mode:t==="edit"?"edit":"play",pdata:{id:((a=s==null?void 0:s.pdata)==null?void 0:a.id)??"sunbird.portal",ver:"1.0",pid:"sunbird-portal"},contentId:e.identifier,sid:(s==null?void 0:s.sid)??"",uid:(s==null?void 0:s.uid)??"",channel:(s==null?void 0:s.channel)??"",did:(s==null?void 0:s.did)??""},config:{enable:!1,showShare:!1,showDownload:!1,showReplay:!0,showExit:!1},metadata:e.metadata??{},data:{}},o=document.createElement("sunbird-quml-player");o.setAttribute("player-config",JSON.stringify(i)),n.current.innerHTML="",n.current.appendChild(o)},[e.identifier,t]),l.jsx("div",{className:Pe.qumlRoot,children:l.jsx("div",{ref:n,className:Pe.playerWrapper})})}const UN="_overlay_ifddx_1",VN="_modal_ifddx_11",zN="_header_ifddx_21",qN="_body_ifddx_37",HN="_hint_ifddx_43",WN="_list_ifddx_49",KN="_item_ifddx_55",QN="_selected_ifddx_68",GN="_empty_ifddx_73",YN="_footer_ifddx_79",XN="_cancelBtn_ifddx_87",ZN="_moveBtn_ifddx_95",Ft={overlay:UN,modal:VN,header:zN,body:qN,hint:HN,list:WN,item:KN,selected:QN,empty:GN,footer:YN,cancelBtn:XN,moveBtn:ZN};function JN(e,t,r){const n=[],s=i=>{var o;for(const a of i)a.isFolder&&a.id!==r&&a.id!==t&&n.push(a),(o=a.children)!=null&&o.length&&s(a.children)};return s(e),n}const eT=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var u;const{treeData:s,moveNode:i}=Re(),o=JN(s,((u=s[0])==null?void 0:u.id)??"",r),[a,c]=p.useState(null),d=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:Ft.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:Ft.modal,children:[l.jsxs("div",{className:Ft.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(on,{size:16})})]}),l.jsxs("div",{className:Ft.body,children:[l.jsx("p",{className:Ft.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:Ft.list,children:[o.map(f=>l.jsxs("li",{className:`${Ft.item} ${a===f.id?Ft.selected:""}`,onClick:()=>c(f.id),children:[l.jsx(ly,{size:14}),l.jsx("span",{children:f.name})]},f.id)),o.length===0&&l.jsx("li",{className:Ft.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:Ft.footer,children:[l.jsx("button",{className:Ft.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:Ft.moveBtn,onClick:d,disabled:!a,children:"Move here"})]})]})})},tT="_overlay_16at9_1",rT="_modal_16at9_11",nT="_header_16at9_21",sT="_body_16at9_37",iT="_table_16at9_43",oT="_pageInput_16at9_61",aT="_empty_16at9_68",lT="_footer_16at9_74",cT="_cancelBtn_16at9_82",uT="_saveBtn_16at9_90",tr={overlay:tT,modal:rT,header:nT,body:sT,table:iT,pageInput:oT,empty:aT,footer:lT,cancelBtn:cT,saveBtn:uT};function dT(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 fT=({onClose:e})=>{const{treeData:t,updateNode:r}=Re(),n=dT(t),[s,i]=p.useState(()=>Object.fromEntries(n.map(a=>{var c;return[a.id,String(((c=a.metadata)==null?void 0:c.pageNumber)??"")]}))),o=p.useCallback(()=>{for(const[a,c]of Object.entries(s))c!==""&&r(a,{pageNumber:parseInt(c,10)||void 0});e()},[s,r,e]);return l.jsx("div",{className:tr.overlay,role:"dialog","aria-label":"Assign Page Numbers",children:l.jsxs("div",{className:tr.modal,children:[l.jsxs("div",{className:tr.header,children:[l.jsx("span",{children:"Assign Page Numbers"}),l.jsx("button",{onClick:e,"aria-label":"Close",children:l.jsx(on,{size:16})})]}),l.jsx("div",{className:tr.body,children:n.length===0?l.jsx("p",{className:tr.empty,children:"No content items found in this collection."}):l.jsxs("table",{className:tr.table,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Content"}),l.jsx("th",{children:"Page Number"})]})}),l.jsx("tbody",{children:n.map(a=>l.jsxs("tr",{children:[l.jsx("td",{children:a.name}),l.jsx("td",{children:l.jsx("input",{type:"number",min:1,value:s[a.id]??"",onChange:c=>i(d=>({...d,[a.id]:c.target.value})),className:tr.pageInput})})]},a.id))})]})}),l.jsxs("div",{className:tr.footer,children:[l.jsx("button",{className:tr.cancelBtn,onClick:e,children:"Cancel"}),l.jsxs("button",{className:tr.saveBtn,onClick:o,children:[l.jsx(yy,{size:14})," Save"]})]})]})})},hT="_container_1a7t2_1",pT="_panelHeader_1a7t2_10",gT="_panelHeaderLeft_1a7t2_19",mT="_panelCollapseBtn_1a7t2_27",yT="_titleRow_1a7t2_46",vT="_field_1a7t2_47",bT="_moveBtn_1a7t2_64",_T="_icon_1a7t2_84",wT="_nameInput_1a7t2_93",xT="_fieldHeader_1a7t2_118",ST="_label_1a7t2_124",CT="_fieldCount_1a7t2_133",OT="_chips_1a7t2_170",ET="_chip_1a7t2_170",DT="_chipRemove_1a7t2_188",IT="_keywordInput_1a7t2_202",NT="_input_1a7t2_207",TT="_addBtn_1a7t2_220",jT="_radioGroup_1a7t2_234",RT="_radioLabel_1a7t2_239",$e={container:hT,panelHeader:pT,panelHeaderLeft:gT,panelCollapseBtn:mT,titleRow:yT,field:vT,moveBtn:bT,icon:_T,nameInput:wT,fieldHeader:xT,label:ST,fieldCount:CT,chips:OT,chip:ET,chipRemove:DT,keywordInput:IT,input:NT,addBtn:TT,radioGroup:jT,radioLabel:RT},kT=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var A,U;const{updateNode:s,markDirty:i}=Re(),o=t==="edit",a=Ji(e),c=ue(R=>R.relationalFormConfig),d=R=>c==null?void 0:c.find(B=>B.code===R),u=R=>!c||!!d(R),f=(R,B)=>{var F;return((F=d(R))==null?void 0:F.label)||B},[m,g]=p.useState(!0),_=((A=e.metadata)==null?void 0:A.relationalMetadata)??{},[h,y]=p.useState(_.name??e.name??""),[v,b]=p.useState(""),[x,w]=p.useState(Array.isArray(_.keywords)?_.keywords:Array.isArray((U=e.metadata)==null?void 0:U.keywords)?e.metadata.keywords:[]),[C,D]=p.useState(!!_.optional);p.useEffect(()=>{var B,F;const R=((B=e.metadata)==null?void 0:B.relationalMetadata)??{};y(R.name??e.name??""),w(Array.isArray(R.keywords)?R.keywords:Array.isArray((F=e.metadata)==null?void 0:F.keywords)?e.metadata.keywords:[]),D(!!R.optional)},[e.id]);const j=()=>{h.trim()&&h!==e.name&&(s(e.id,{name:h.trim()}),i())},k=()=>{const R=v.trim();if(R&&!x.includes(R)){const B=[...x,R];w(B),s(e.id,{keywords:B}),i()}b("")},$=R=>{const B=x.filter(F=>F!==R);w(B),s(e.id,{keywords:B}),i()},N=R=>{D(R),s(e.id,{optional:R}),i()};return l.jsxs("div",{className:$e.container,children:[l.jsxs("div",{className:$e.panelHeader,children:[l.jsxs("div",{className:$e.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:$e.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:$e.panelCollapseBtn,onClick:()=>g(R=>!R),"aria-expanded":m,"aria-label":m?"Collapse metadata panel":"Expand metadata panel",title:m?"Collapse":"Expand",children:m?l.jsx(ks,{size:15}):l.jsx(iy,{size:15})})]}),m&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:$e.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:$e.icon}),l.jsx("input",{type:"text",className:$e.nameInput,value:h,disabled:!o,onChange:R=>y(R.target.value),onBlur:j,placeholder:"Content name"})]}),u("keywords")&&l.jsxs("div",{className:$e.field,children:[l.jsx("div",{className:$e.fieldHeader,children:l.jsxs("label",{className:$e.label,children:[f("keywords","Keywords"),x.length>0&&l.jsx("span",{className:$e.fieldCount,children:x.length})]})}),x.length>0&&l.jsx("div",{className:$e.chips,children:x.map(R=>l.jsxs("span",{className:$e.chip,children:[R,o&&l.jsx("button",{type:"button",className:$e.chipRemove,onClick:()=>$(R),children:"×"})]},R))}),o&&l.jsxs("div",{className:$e.keywordInput,children:[l.jsx("input",{type:"text",className:$e.input,value:v,placeholder:"Add keyword and press Enter",onChange:R=>b(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),k())}}),l.jsx("button",{type:"button",className:$e.addBtn,onClick:k,children:"Add"})]})]}),u("optional")&&l.jsxs("div",{className:$e.field,children:[l.jsx("label",{className:$e.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:$e.radioGroup,children:[l.jsxs("label",{className:$e.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!0,onChange:()=>N(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:$e.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!1,onChange:()=>N(!1),disabled:!o}),"No"]})]})]})]}),n]})},AT="_iconBtn_vl14u_1",PT="_editable_vl14u_14",MT="_iconImg_vl14u_26",LT="_placeholder_vl14u_34",FT="_removeBtn_vl14u_41",rs={iconBtn:AT,editable:PT,iconImg:MT,placeholder:LT,removeBtn:FT},$T=({nodeId:e,value:t,editable:r})=>{const[n,s]=p.useState(!1),{updateNode:i,markDirty:o}=Re(),a=d=>{i(e,{appIcon:d}),o(),s(!1)},c=d=>{d.stopPropagation(),i(e,{appIcon:""}),o()};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:[rs.iconBtn,r?rs.editable:""].filter(Boolean).join(" "),role:r?"button":void 0,tabIndex:r?0:-1,"aria-label":r?"Select app icon":"App icon",onClick:()=>r&&s(!0),onKeyDown:d=>{r&&(d.key==="Enter"||d.key===" ")&&s(!0)},children:[t?l.jsx("img",{src:t,alt:"App icon",className:rs.iconImg}):l.jsx("div",{className:rs.placeholder,children:l.jsx(Wd,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:rs.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(Wa,{size:11})})]}),n&&l.jsx($h,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},BT="_leafContentLayout_1osey_1",UT="_container_1osey_17",VT="_emptyState_1osey_26",zT="_titleRow_1osey_36",qT="_nodeTitle_1osey_52",HT="_formArea_1osey_74",WT="_contentListArea_1osey_78",KT="_dropZone_1osey_83",QT="_reviewComment_1osey_90",GT="_reviewCommentLabel_1osey_103",YT="_reviewCommentText_1osey_109",zt={leafContentLayout:BT,container:UT,emptyState:VT,titleRow:zT,nodeTitle:qT,formArea:HT,contentListArea:WT,dropZone:KT,reviewComment:QT,reviewCommentLabel:GT,reviewCommentText:YT},XT=["application/vnd.sunbird.questionset"],ZT=({editorMode:e,onToolbarEvent:t})=>{var A,U,R,B;const[r,n]=p.useState("details"),[s,i]=p.useState([]),[o,a]=p.useState(null),[c,d]=p.useState(!1),u=p.useRef(null),f=p.useRef(),{selectedNodeId:m,breadcrumb:g,activeNodeMeta:_,updateNode:h,treeData:y}=Re(),v=ue(F=>{var J,se,ge,ye;return((se=(J=F.editorConfig)==null?void 0:J.context)==null?void 0:se.contentId)??((ye=(ge=F.editorConfig)==null?void 0:ge.context)==null?void 0:ye.identifier)??""}),b=m?Wh(y,m):null,x=!!b&&!b.parent,w=!!(b!=null&&b.isFolder),C=b&&XT.includes(b.mimeType??""),D=b&&!b.isFolder&&!C&&!x,j=((A=b==null?void 0:b.metadata)==null?void 0:A.rejectComment)??(x?(R=(U=y[0])==null?void 0:U.metadata)==null?void 0:R.rejectComment:void 0),k=p.useCallback(()=>{const F=u.current;if(!F||!m)return;const J=F.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{h(m,{name:J})},600)},[m,h]),$=p.useCallback(F=>{t({action:"onFormValueChange",data:F})},[t]),N=p.useCallback((F,J)=>{i(J),t({action:"onFormStatusChange",data:{isValid:F,nodeId:m}})},[t,m]);return b?C?l.jsx(Ta,{node:b,editorMode:e,type:"quml"}):D?l.jsxs("div",{className:zt.leafContentLayout,children:[l.jsx(Ta,{node:b,editorMode:e,type:"content"}),l.jsx(kT,{node:b,editorMode:e,onMoveClick:()=>a(b.identifier),reorderDialog:o?l.jsx(eT,{resourceId:o,resourceName:b.name,currentUnitId:b.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:zt.container,children:[l.jsx(WO,{crumbs:g}),j&&l.jsxs("div",{className:zt.reviewComment,role:"alert",children:[l.jsx("span",{className:zt.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:zt.reviewCommentText,children:j})]}),l.jsxs("div",{className:zt.titleRow,children:[x&&m&&l.jsx($T,{nodeId:m,value:String(b.appIcon??((B=b.metadata)==null?void 0:B.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:u,className:zt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:k,onBlur:k,"data-placeholder":"Untitled","aria-label":"Node title",children:b.name})]}),l.jsx(ZO,{activeTab:r,onChange:F=>n(F),errorTabs:s,visibleTabs:x?void 0:["details"]}),l.jsx("div",{className:zt.formArea,children:l.jsx(pI,{nodeMetadata:_,activeTab:r,isRoot:x,isFolder:w,editorMode:e,onFormValueChange:$,onFormStatusChange:N},`${m??"none"}:${x?"root":"node"}`)}),(w||x)&&r==="details"&&l.jsx("div",{className:zt.contentListArea,children:l.jsx(QI,{editorMode:e})}),l.jsx(XI,{isActive:!1,label:"Drop to add content to this unit",nodeId:m??void 0,className:zt.dropZone}),c&&l.jsx(fT,{contentId:v,onClose:()=>d(!1)})]}):l.jsx("div",{className:zt.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function Wh(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Wh(r.children,t);if(n)return n}}}const Kh=qi((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 o=n.toLowerCase();i=i.filter(a=>[a.mimeType??"",a.primaryCategory??"",a.contentType??""].join(" ").toLowerCase().includes(o))}if(s&&s.trim()!==""){const o=s.toLowerCase().trim();i=i.filter(a=>(a.name??"").toLowerCase().includes(o))}e({filteredContent:i})}})),JT=20;function Qh(){var d;const e=ue(u=>u.editorConfig),t=Re(u=>u.selectedNodeId),r=Re(u=>u.treeData),n=p.useCallback(()=>{if(!t||!r.length)return 0;function u(f,m,g=0){var _;for(const h of f){if(h.id===m)return g;if((_=h.children)!=null&&_.length){const y=u(h.children,m,g+1);if(y>=0)return y}}return-1}return Math.max(0,u(r,t))},[t,r])(),s=(d=e==null?void 0:e.config)==null?void 0:d.hierarchy;if(!s)return[...mu];const i=`level${n}`,o=s[i],a=o==null?void 0:o.children,c=a==null?void 0:a.Content;return c!=null&&c.length?c:[...mu]}function ej(){const e=Kh(),t=ue(f=>{var m,g;return((g=(m=f.editorConfig)==null?void 0:m.context)==null?void 0:g.channel)??""}),r=Qh(),n=p.useRef(),s=p.useCallback(async(f="",m="all",g={},_=!0,h=!1)=>{var y,v,b,x,w;e.setLoading(!0);try{const C={status:["Live"],primaryCategory:m&&m!=="all"?[m]:r};(y=g==null?void 0:g.board)!=null&&y.length&&(C.board=g.board),(v=g==null?void 0:g.medium)!=null&&v.length&&(C.medium=g.medium),(b=g==null?void 0:g.gradeLevel)!=null&&b.length&&(C.gradeLevel=g.gradeLevel),(x=g==null?void 0:g.subject)!=null&&x.length&&(C.subject=g.subject),(w=g==null?void 0:g.primaryCategory)!=null&&w.length&&(C.primaryCategory=g.primaryCategory);const D=_?0:e.offset,{content:j,count:k}=await ZI({filters:C,query:f,limit:f?50:JT,offset:D,channel:t||void 0,sortBy:h?{name:"asc"}:{lastUpdatedOn:"desc"}});_?e.setContent(j,k):e.appendContent(j,k)}catch(C){console.error("[useLibrary] load error:",C)}finally{e.setLoading(!1)}},[r,t]);p.useEffect(()=>{s()},[t]);const i=p.useCallback(f=>{e.setSearch(f),clearTimeout(n.current),n.current=setTimeout(()=>s(f,e.activeFilter,e.advancedFilters,!0,e.sortAZ),300)},[e.activeFilter,e.advancedFilters,e.sortAZ,s]),o=p.useCallback(f=>{e.setFilter(f),s(e.searchQuery,f,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,s]),a=p.useCallback(f=>{e.setAdvancedFilters(f),s(e.searchQuery,e.activeFilter,f,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,s]),c=p.useCallback(()=>{const f=!e.sortAZ;e.setSortAZ(f),s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,f)},[e.sortAZ,e.searchQuery,e.activeFilter,e.advancedFilters,s]),d=p.useCallback(()=>{e.isLoading||s(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,s]),u=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:u,search:i,setFilter:o,applyAdvancedFilters:a,toggleSort:c,loadMore:d,refetch:()=>s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const tj="_card_jzciw_1",rj="_addBtn_jzciw_17",nj="_dragging_jzciw_24",sj="_ctIcon_jzciw_29",ij="_info_jzciw_33",oj="_name_jzciw_41",aj="_meta_jzciw_50",lj="_addBtnMuted_jzciw_78",cj="_added_jzciw_87",uj="_addedBadge_jzciw_96",rr={card:tj,addBtn:rj,dragging:nj,ctIcon:sj,info:ij,name:oj,meta:aj,addBtnMuted:lj,added:cj,addedBadge:uj},dj={video:Ka,pdf:Va,h5p:za,scorm:Ha,audio:qa,quiz:Ua,default:zn},fj=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var h,y;const i=Ji(e),o=dj[i.key]??zn,a=ul(),c=I1(),d=a&&!s&&c,{attributes:u,listeners:f,setNodeRef:m,isDragging:g}=Fd({id:e.identifier,disabled:!n||!a||!c,data:{type:"library-item",item:e}}),_=()=>{r&&r(e)};return l.jsxs("div",{ref:m,className:[rr.card,g?rr.dragging:"",s?rr.added:""].join(" "),"aria-label":e.name,...n?{...u,...f}:{},role:"listitem",onClick:_,children:[l.jsx("span",{className:[`sbx-ct-sq--${i.key}`,rr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(o,{size:14})}),l.jsxs("div",{className:rr.info,children:[l.jsx("span",{className:rr.name,title:e.name,children:e.name}),l.jsxs("span",{className:rr.meta,children:[((h=e.organisation)==null?void 0:h[0])??e.channel??"",(y=e.organisation)!=null&&y[0]&&e.primaryCategory?" · ":"",e.primaryCategory??""]})]}),s&&l.jsx("span",{className:rr.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(Vn,{size:12})}),!s&&l.jsx("button",{type:"button",className:[rr.addBtn,!d&&a?rr.addBtnMuted:""].join(" "),onClick:v=>{v.stopPropagation(),t(e)},disabled:!a,"aria-disabled":!d,"aria-label":`Add ${e.name} to unit`,title:a?c?"Add to unit":"Select a unit to add":"Only Draft content can be added",children:l.jsx(As,{size:14})})]})},hj="_chips_xhhaq_1",pj="_chip_xhhaq_1",Lu={chips:hj,chip:pj},gj=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:Lu.chips,role:"group","aria-label":"Content type filters",children:e.map(n=>l.jsx("button",{type:"button",role:"radio","aria-checked":t===n.value,className:["sbx-chip",t===n.value?"filled":"outline",Lu.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),mj="_panel_1cl11_1",yj="_header_1cl11_10",vj="_headerTitle_1cl11_19",bj="_closeBtn_1cl11_25",_j="_body_1cl11_43",wj="_section_1cl11_59",xj="_sectionLabel_1cl11_65",Sj="_chips_1cl11_73",Cj="_chip_1cl11_73",Oj="_active_1cl11_96",Ej="_footer_1cl11_102",Dj="_resetBtn_1cl11_112",Ij="_applyBtn_1cl11_129",et={panel:mj,header:yj,headerTitle:vj,closeBtn:bj,body:_j,section:wj,sectionLabel:xj,chips:Sj,chip:Cj,active:Oj,footer:Ej,resetBtn:Dj,applyBtn:Ij},Nj=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],Tj=new Set(["board","medium","gradeLevel","subject","topic"]),jj=({local:e,toggle:t})=>{const r=Qh();return r.length?l.jsxs("div",{className:et.section,children:[l.jsx("div",{className:et.sectionLabel,children:"Primary Category"}),l.jsx("div",{className:et.chips,children:r.map(n=>l.jsx("button",{type:"button",className:[et.chip,(e.primaryCategory??[]).includes(n)?et.active:""].join(" "),onClick:()=>t("primaryCategory",n),children:n},n))})]}):null},Rj=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var g,_;const s=ue(h=>h.editorConfig),i=ue(h=>h.searchFormConfig),{organisationFramework:o}=Ph((g=s==null?void 0:s.context)==null?void 0:g.framework,(_=s==null?void 0:s.context)==null?void 0:_.targetFWIds),[a,c]=p.useState(t),d=i!=null&&i.length?i.filter(h=>Tj.has(h.code)).map(h=>({key:h.code,label:h.label||h.code})):Nj;p.useEffect(()=>{c(t)},[t]);const u=(h,y)=>{c(v=>{const b=v[h]??[],x=b.includes(y)?b.filter(w=>w!==y):[...b,y];return{...v,[h]:x}})},f=(o==null?void 0:o.categories)??[],m=h=>{var y;return((y=f.find(v=>v.code===h))==null?void 0:y.terms)??[]};return e?l.jsxs("div",{className:et.panel,role:"dialog","aria-label":"Filter library","aria-modal":"true",children:[l.jsxs("div",{className:et.header,children:[l.jsx("span",{className:et.headerTitle,children:"Filters"}),l.jsx("button",{type:"button",className:et.closeBtn,onClick:n,"aria-label":"Close filters",children:l.jsx(on,{size:16})})]}),l.jsxs("div",{className:et.body,children:[d.map(({key:h,label:y})=>{const v=m(h);return v.length?l.jsxs("div",{className:et.section,children:[l.jsx("div",{className:et.sectionLabel,children:y}),l.jsx("div",{className:et.chips,children:v.slice(0,20).map(b=>l.jsx("button",{type:"button",className:[et.chip,(a[h]??[]).includes(b.name)?et.active:""].join(" "),onClick:()=>u(h,b.name),children:b.name},b.identifier))})]},h):null}),l.jsx(jj,{local:a,toggle:u})]}),l.jsxs("div",{className:et.footer,children:[l.jsx("button",{type:"button",className:et.resetBtn,onClick:()=>c({}),children:"Reset"}),l.jsx("button",{type:"button",className:et.applyBtn,onClick:()=>{r(a),n()},children:"Apply"})]})]}):null},kj="_header_6qdpu_10",Aj="_title_6qdpu_20",Pj="_headerActions_6qdpu_31",Mj="_iconBtn_6qdpu_38",Lj="_playerArea_6qdpu_56",Fj="_footer_6qdpu_64",$j="_addBtn_6qdpu_73",Bj="_modalOverlay_6qdpu_92",Uj="_modalPanel_6qdpu_103",ur={header:kj,title:Aj,headerActions:Pj,iconBtn:Mj,playerArea:Lj,footer:Fj,addBtn:$j,modalOverlay:Bj,modalPanel:Uj},Vj=({content:e,onAdd:t,onClose:r})=>{if(!e)return null;const n={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 Rr.createPortal(l.jsx("div",{className:ur.modalOverlay,role:"dialog","aria-modal":"true","aria-label":"Content preview",onClick:r,children:l.jsxs("div",{className:ur.modalPanel,onClick:s=>s.stopPropagation(),children:[l.jsxs("div",{className:ur.header,children:[l.jsx("span",{className:ur.title,title:e.name,children:e.name}),l.jsx("div",{className:ur.headerActions,children:l.jsx("button",{type:"button",className:ur.iconBtn,onClick:r,"aria-label":"Close preview",children:l.jsx(on,{size:16})})})]}),l.jsx("div",{className:ur.playerArea,children:l.jsx(Ta,{node:n,editorMode:"read",type:"content"})}),l.jsx("div",{className:ur.footer,children:l.jsx("button",{type:"button",className:ur.addBtn,onClick:()=>t(e),children:"+ Add to Unit"})})]})}),document.body)},zj="_dock_1lpg0_1",qj="_header_1lpg0_8",Hj="_headerLeft_1lpg0_17",Wj="_headerTitle_1lpg0_24",Kj="_count_1lpg0_30",Qj="_searchRow_1lpg0_39",Gj="_searchWrap_1lpg0_47",Yj="_searchIcon_1lpg0_53",Xj="_searchInput_1lpg0_62",Zj="_filterToggleBtn_1lpg0_80",Jj="_filterToggleBtnActive_1lpg0_99",eR="_filterBadge_1lpg0_105",tR="_filters_1lpg0_124",rR="_mainArea_1lpg0_134",nR="_sidePanelOverlay_1lpg0_143",sR="_cardList_1lpg0_152",iR="_skeleton_1lpg0_168",oR="_skeletonIcon_1lpg0_178",aR="_skeletonText_1lpg0_186",lR="_skeletonLine_1lpg0_193",cR="_skeletonLineSm_1lpg0_200",uR="_loadMoreBtn_1lpg0_215",dR="_emptyState_1lpg0_240",fR="_collapseBtn_1lpg0_260",ke={dock:zj,header:qj,headerLeft:Hj,headerTitle:Wj,count:Kj,searchRow:Qj,searchWrap:Gj,searchIcon:Yj,searchInput:Xj,filterToggleBtn:Zj,filterToggleBtnActive:Jj,filterBadge:eR,filters:tR,mainArea:rR,sidePanelOverlay:nR,cardList:sR,skeleton:iR,skeletonIcon:oR,skeletonText:aR,skeletonLine:lR,skeletonLineSm:cR,loadMoreBtn:uR,emptyState:dR,collapseBtn:fR};function hR(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 pR=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const{content:n,isLoading:s,totalCount:i,activeFilter:o,searchQuery:a,sortAZ:c,hasMore:d,search:u,setFilter:f,applyAdvancedFilters:m,toggleSort:g,loadMore:_}=ej(),{addResource:h,selectedNodeId:y,treeData:v}=Re(),b=e==="edit",[x,w]=p.useState(!1),[C,D]=p.useState({}),[j,k]=p.useState(null),$=p.useMemo(()=>hR(v),[v]),N=p.useCallback(F=>{var ge;if(!y){Se.error("Select a unit first");return}const J=(ge=v[0])==null?void 0:ge.id;if(y===J){Se("Select a unit from the outline to add content — resources cannot be added directly to the course.",{icon:"ℹ️",duration:4e3});return}if(h(F,y)===!1){Se.error(`"${F.name}" is already in this collection`);return}Se.success(`Added "${F.name}"`)},[y,h,v]),A=p.useCallback(F=>{D(F),m(F)},[m]),U=p.useCallback(F=>{k(F)},[]),R=p.useCallback(F=>{N(F),k(null)},[N]),B=p.useMemo(()=>Object.values(C).reduce((F,J)=>F+((J==null?void 0:J.length)??0),0),[C]);return l.jsxs("div",{className:ke.dock,children:[l.jsx("div",{className:ke.header,children:l.jsxs("div",{className:ke.headerLeft,children:[l.jsx("button",{type:"button",className:ke.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(py,{size:15})}),l.jsx(dy,{size:16}),l.jsx("span",{className:ke.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:ke.count,children:i})]})}),l.jsxs("div",{className:ke.searchRow,children:[l.jsxs("div",{className:ke.searchWrap,children:[l.jsx(aa,{size:14,className:ke.searchIcon}),l.jsx("input",{type:"search",className:ke.searchInput,placeholder:"Search content…",value:a,onChange:F=>u(F.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[ke.filterToggleBtn,c?ke.filterToggleBtnActive:""].join(" "),onClick:g,"aria-label":c?"Sort: A–Z (click for Recent)":"Sort: Recent (click for A–Z)",title:c?"A–Z":"Recent",children:c?l.jsx(ny,{size:15}):l.jsx(oy,{size:15})}),l.jsxs("button",{type:"button",className:[ke.filterToggleBtn,x?ke.filterToggleBtnActive:""].join(" "),onClick:()=>w(F=>!F),"aria-label":"Toggle advanced filters","aria-pressed":x,title:"Advanced filters",children:[l.jsx(_y,{size:15}),B>0&&l.jsx("span",{className:ke.filterBadge,children:B})]})]}),l.jsx("div",{className:ke.filters,children:l.jsx(gj,{filters:N1,active:o,onChange:f})}),l.jsxs("div",{className:ke.mainArea,children:[l.jsx("div",{className:ke.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((F,J)=>l.jsxs("div",{className:ke.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:ke.skeletonIcon}),l.jsxs("div",{className:ke.skeletonText,children:[l.jsx("div",{className:ke.skeletonLine}),l.jsx("div",{className:ke.skeletonLineSm})]})]},J)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(F=>l.jsx(fj,{item:F,onAdd:N,onPreview:U,isDraggable:b,isAdded:$.has(F.identifier)},F.identifier)),d&&l.jsx("button",{type:"button",className:ke.loadMoreBtn,onClick:_,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:ke.emptyState,children:[l.jsx(aa,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),x&&l.jsx("div",{className:ke.sidePanelOverlay,children:l.jsx(Rj,{isOpen:x,filters:C,onApply:A,onClose:()=>w(!1)})}),j&&l.jsx(Vj,{content:j,onAdd:R,onClose:()=>k(null)})]})]})};function gR(e,t,r){const n={},s={},i=new Set(["id","isFolder","children","parent","isNew","breadcrumb","title","relationalMetadata","optional"]),o=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","targetFWIds","targetTopicIds","topic","topicsIds"]),a=new Set(["audience","attributions","targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","medium","gradeLevel","subject","additionalCategories","keywords","language"]),c=new Set(["copyrightYear","compatibilityLevel","version"]);function d(m,g=!1){const _={};for(const[h,y]of Object.entries(m))if(!i.has(h)&&!(g&&o.has(h)))if(a.has(h))Array.isArray(y)?_[h]=y:y!=null&&y!==""?_[h]=[y]:_[h]=[];else if(c.has(h)){const v=Number(y);isNaN(v)||(_[h]=v)}else _[h]=y;return _}function u(m){var _;const g={};for(const h of m.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 x=((_=h.metadata)==null?void 0:_.relationalMetadata)??{};g[h.identifier]={name:h.name,...x,...b}}return g}function f(m,g){var x,w;const _=m.identifier,h=t[_],y=_.startsWith("temp-")||!!(h!=null&&h.isNew),v=!m.isFolder&&!g;if(g||y||h&&!v){let C;if(y)C={mimeType:"application/vnd.ekstep.content-collection",code:_,contentType:((x=m.metadata)==null?void 0:x.contentType)??"CourseUnit",primaryCategory:((w=m.metadata)==null?void 0:w.primaryCategory)??"Course Unit",name:m.name,visibility:"Parent",channel:r,...d(m.metadata??{})};else if(g){const{isNew:D,...j}=h??{};C={...d(m.metadata??{},!0),...d(j,!1),name:m.name}}else{const{isNew:D,...j}=h??{};C={name:m.name,visibility:"Parent",...d(j,!0)}}n[_]={metadata:C,objectType:m.objectType||(m.isFolder?"Collection":"Content"),root:g,isNew:y}}const b=m.isFolder?u(m):{};s[_]={name:m.name,children:(m.children??[]).map(C=>C.identifier),...Object.keys(b).length>0?{relationalMetadata:b}:{},root:g},(m.children??[]).forEach(C=>f(C,!1))}return e.forEach((m,g)=>f(m,g===0)),{nodesModified:n,hierarchy:s}}function mR(){const[e,t]=p.useState(!1),r=Re(u=>u.treeCache),n=Re(u=>u.treeData),s=ue(u=>u.isDirty),i=ue(u=>u.lastSaved),{setIsDirty:o,setLastSaved:a}=ue(),c=ue(u=>u.editorConfig);return{save:p.useCallback(async()=>{if(!c||e)return;const u=c.context.contentId??c.context.identifier??"";if(!u)return;const f=c.context.channel??"",m=c.context.userId??c.context.uid??"";t(!0);try{const{nodesModified:g,hierarchy:_}=gR(n,r,f),{identifiers:h}=await n_(u,g,_,m);h&&Object.keys(h).length>0&&Re.getState().replaceNodeIds(h);const y=new Date().toISOString();a(y),o(!1)}catch(g){console.error("[useSaveHierarchy] save failed:",g),Se.error("Failed to save. Please try again.")}finally{t(!1)}},[c,e,n,r,o,a]),isSaving:e,isDirty:s,lastSaved:i}}function yR(e){const t=ue(o=>o.editorConfig),r=ue(o=>o.setButtonLoader),n=ue(o=>o.validateAllForms),s=Re(o=>o.treeData);return{runAction:p.useCallback(async(o,a)=>{var u,f,m,g;const c=((u=t==null?void 0:t.context)==null?void 0:u.contentId)??((f=t==null?void 0:t.context)==null?void 0:f.identifier)??"";if(!c)return Se.error("No content identifier found."),!1;const d=((m=t==null?void 0:t.context)==null?void 0:m.userId)??((g=t==null?void 0:t.context)==null?void 0:g.uid)??"";try{switch(o){case"sendForReview":return n(s)?(r("saveCollection",!0),await e(),await o_(c),Se.success("Content sent for review"),!0):(Se.error("Some units have missing required fields. Please fill them before sending for review."),!1);case"reject":{r("rejectCollection",!0);const _=(a==null?void 0:a.comment)??"";return await a_(c,_),Se.success("Content rejected and sent back to the author"),!0}case"publish":return n(s)?(r("publishCollection",!0),await e(),await s_(c,d),Se.success("Content published successfully"),!0):(Se.error("Some units have missing required fields. Please fill them before publishing."),!1);default:return!1}}catch(_){console.error(`[useToolbarActions] ${o} failed`,_);const h=o==="sendForReview"?"send for review":o==="reject"?"reject":"publish";return Se.error(`Failed to ${h}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r])}}const vR="_shell_90fon_1",bR="_workspace_90fon_8",_R="_sidebarCollapsed_90fon_16",wR="_dockCollapsed_90fon_19",xR="_dock_90fon_19",SR="_outline_90fon_40",CR="_reopenTab_90fon_45",OR="_outlineHidden_90fon_79",ER="_editor_90fon_86",DR="_dockHidden_90fon_101",IR="_dockReopenTab_90fon_108",NR="_dragChip_90fon_133",TR="_dragChipLabel_90fon_148",Tt={shell:vR,workspace:bR,sidebarCollapsed:_R,dockCollapsed:wR,dock:xR,outline:SR,reopenTab:CR,outlineHidden:OR,editor:ER,dockHidden:DR,dockReopenTab:IR,dragChip:NR,dragChipLabel:TR},jR=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,d]=p.useState(!1),[u,f]=p.useState(!1),{addResource:m,treeData:g}=Re(),_=ue(R=>R.setFormStatus),[h,y]=p.useState(!0),v=Re(R=>R.selectedNodeId),{save:b,isSaving:x,isDirty:w,lastSaved:C}=mR(),{runAction:D}=yR(b);p.useEffect(()=>{if(!w)return;const R=B=>{B.preventDefault(),B.returnValue=""};return window.addEventListener("beforeunload",R),()=>window.removeEventListener("beforeunload",R)},[w]);const j=vd(ra(Ui,{activationConstraint:{distance:8}})),k=p.useCallback(R=>{var F;const B=(F=R.active.data.current)==null?void 0:F.item;B&&i(B)},[]),$=p.useCallback(R=>{var ye,ve;i(null);const B=(ye=R.active.data.current)==null?void 0:ye.item;if(!B)return;const F=R.over,J=(F==null?void 0:F.id)??v??void 0;if(!J){Se.error("Drop onto a unit to add content");return}const se=(ve=g[0])==null?void 0:ve.id;if(J===se){Se.error("Drop content onto a unit, not directly on the course.");return}if(!m(B,J)){Se.error(`"${B.name}" is already in this collection`);return}r==null||r(B,J),Se.success(`Added "${B.name}" to unit`)},[v,m,r]),N=p.useCallback(async R=>{if(R.action==="onFormStatusChange"){const{isValid:B,nodeId:F}=R.data??{},J=B!==!1;y(J),F&&_(F,J);return}if(R.action==="back"&&w){f(!0);return}if(R.action==="saveCollection"){if(!h){Se.error("Please fill the required metadata");return}await b(),n==null||n(g),t==null||t(R);return}if(R.action==="sendForReview"||R.action==="reject"||R.action==="publish"){await D(R.action,R.data)&&(t==null||t(R));return}t==null||t(R)},[b,D,t,n,g,w,h]),A=p.useCallback(async()=>{await b(),f(!1),n==null||n(g),t==null||t({action:"back"})},[b,n,t,g]),U=p.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(Ld,{sensors:j,onDragStart:k,onDragEnd:$,children:[l.jsxs("div",{className:Tt.shell,children:[l.jsx(gw,{editorMode:e,isSaving:x,isDirty:w,lastSaved:C,isFormValid:h,onToolbarEvent:N}),l.jsxs("div",{className:[Tt.workspace,o?Tt.sidebarCollapsed:"",c?Tt.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[Tt.outline,o?Tt.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(UO,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(R=>!R)})}),o&&l.jsx("button",{className:Tt.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:Tt.editor,role:"main","aria-label":"Content editor",children:l.jsx(ZT,{editorMode:e,onToolbarEvent:N})}),l.jsx("aside",{className:[Tt.dock,c?Tt.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(pR,{editorMode:e,collapsed:c,onToggleCollapse:()=>d(R=>!R)})}),c&&l.jsx("button",{className:Tt.dockReopenTab,onClick:()=>d(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(Zm,{dropAnimation:null,children:s?l.jsx("div",{className:Tt.dragChip,children:l.jsx("span",{className:Tt.dragChipLabel,children:s.name})}):null}),u&&l.jsx(mw,{onSave:A,onDiscard:U,onCancel:()=>f(!1),isSaving:x})]})},RR="v1";function kR(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 Fu(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:kR(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 br(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.title??n.name??void 0;for(const i of n.fields)i.code&&r.push(Fu(i,s))}else n.code&&r.push(Fu(n));return r.sort((n,s)=>(n.index??0)-(s.index??0))}function AR(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 PR(e,t,r="Collection",n=RR){var d,u;const i=(u=(d=(await Me.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:d.result)==null?void 0:u.objectCategoryDefinition,o=(i==null?void 0:i.forms)??{},a=(i==null?void 0:i.objectMetadata)??{},c=a.config??{};return{rootForm:br(o.create),unitForm:br(o.unitMetadata),childForm:br(o.childMetadata),searchForm:br(o.search??o.searchConfig),relationalForm:br(o.relationalMetadata),publishChecklist:br(o.publishchecklist),reviewChecklist:br(o.review),rfcChecklist:br(o.requestforchangeschecklist),schemaDefaults:AR(a.schema),frameworkMetadata:c.frameworkMetadata??{},sourcingSettings:c.sourcingSettings??{}}}function MR({config:e,onError:t}){const[r,n]=p.useState(!0),[s,i]=p.useState(null),[o,a]=p.useState(!1),{setEditorConfig:c,setEditorMode:d,setCategoryDefinition:u}=ue(),{setTreeData:f,selectNode:m}=Re();return p.useEffect(()=>{let g=!1;async function _(){var h,y;try{n(!0),i(null),e.apiBaseUrl&&Of(e.apiBaseUrl),c(e),d(e.config.mode);const v=e.context.contentId??e.context.identifier??"";if(v){const{rootNode:b}=await If(v);g||(f(b?[b]:[]),b&&m(b.id));const x=e.config.primaryCategory??"Course",w=e.context.channel??"",C=e.config.categoryDefinitionApiVersion??"v1";try{const D=await PR(x,w,e.config.objectType??"Collection",C);if(!g){u(D);const j=((h=D.sourcingSettings)==null?void 0:h.collection)??{},k={};j.maxDepth&&!e.config.maxDepth&&(k.maxDepth=j.maxDepth),j.children&&!e.config.children&&(k.children=j.children),j.hierarchy&&!((y=e.config.hierarchy)!=null&&y.level1)&&(k.hierarchy={...e.config.hierarchy??{},...j.hierarchy}),Object.keys(k).length>0&&c({...e,config:{...e.config,...k}})}}catch{}}g||a(!0)}catch(v){if(!g){const b=v instanceof Error?v:new Error(String(v));i(b),t==null||t(b)}}finally{g||n(!1)}}return _(),()=>{g=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:o}}const LR="_root_qcpw6_1",FR="_loadingState_qcpw6_10",$R="_loadingSpinner_qcpw6_20",BR="_errorState_qcpw6_34",os={root:LR,loadingState:FR,loadingSpinner:$R,errorState:BR},UR=new xp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class VR extends p.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?l.jsxs("div",{className:os.errorState,children:[l.jsx("h3",{children:"Something went wrong"}),l.jsx("p",{children:this.state.error.message}),l.jsx("button",{onClick:()=>this.setState({error:null}),children:"Retry"})]}):this.props.children}}function zR(e){const{isLoading:t,error:r}=MR({config:e,onError:e.onError}),n=ue(s=>s.editorMode);return t?l.jsxs("div",{className:os.loadingState,children:[l.jsx("div",{className:os.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:os.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${os.root}`,children:l.jsx(jR,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Gh=e=>l.jsx(VR,{onError:e.onError,children:l.jsxs(Cp,{client:UR,children:[l.jsx(zR,{...e}),l.jsx(Sg,{position:"top-right",toastOptions:{duration:3e3}})]})}),Ai=Symbol.for("r2wc.reactRender"),$u=Symbol.for("r2wc.shouldRender"),ei=Symbol.for("r2wc.root");function qR(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function HR(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var Bu={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[Ai]()}}),e[Ai]()}};function WR(e,t,r,n={}){var s={isConnected:"isConnected"in HTMLElement.prototype},i=!1,o=function(){var d=Reflect.construct(HTMLElement,arguments,this.constructor);return typeof n.shadow=="string"?d.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.'),d.attachShadow({mode:"open"})),d},a=Object.create(HTMLElement.prototype);a.constructor=o;var c=new Proxy(a,{has:function(d,u){return u in e.propTypes||u in a},set:function(d,u,f,m){return i&&(s[u]=!0),typeof u=="symbol"||s[u]||u in d?(e.propTypes&&u in e.propTypes&&Bu.expando(m,u,f),Reflect.set(d,u,f,m)):(Bu.expando(m,u,f),!0)},getOwnPropertyDescriptor:function(d,u){var f=Reflect.getOwnPropertyDescriptor(d,u);if(f)return f;if(u in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return o.prototype=c,a.connectedCallback=function(){this[$u]=!0,this[Ai]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[ei].unmount():r.unmountComponentAtNode(this)},a[Ai]=function(){if(this[$u]===!0){var d={};Object.keys(this).forEach(function(m){s[m]!==!1&&(d[m]=this[m])},this),i=!0;const u=n.shadow?this.shadowRoot:this,f=t.createElement(e,d);typeof r.createRoot=="function"?(this[ei]||(this[ei]=r.createRoot(u)),this[ei].render(f)):r.render(f,u),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(d){return qR(d)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(d,u,f){var m=n.dashStyleAttributes?HR(d):d;this[m]=f}),o}var as={},ns=Rr;if(process.env.NODE_ENV==="production")as.createRoot=ns.createRoot,as.hydrateRoot=ns.hydrateRoot;else{var ti=ns.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;as.createRoot=function(e,t){ti.usingClientEntryPoint=!0;try{return ns.createRoot(e,t)}finally{ti.usingClientEntryPoint=!1}},as.hydrateRoot=function(e,t,r){ti.usingClientEntryPoint=!0;try{return ns.hydrateRoot(e,t,r)}finally{ti.usingClientEntryPoint=!1}}}function KR(){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 QR(e="sb-collection-editor"){if(KR(),typeof customElements>"u"||customElements.get(e))return;const t=WR(Gh,p,as,{});customElements.define(e,t)}exports.CollectionEditor=Gh;exports.registerCollectionEditor=QR;exports.setApiBaseUrl=Of;exports.useEditorStore=ue;exports.useLibraryStore=Kh;exports.useTreeStore=Re;
456
+ `+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=nn(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&ci.assertOptions(n,{silentJSONParsing:ut.transitional(ut.boolean),forcedJSONParsing:ut.transitional(ut.boolean),clarifyTimeoutError:ut.transitional(ut.boolean),legacyInterceptorReqResOrdering:ut.transitional(ut.boolean),advertiseZstdAcceptEncoding:ut.transitional(ut.boolean),validateStatusUndefinedResolves:ut.transitional(ut.boolean)},!1),s!=null&&(E.isFunction(s)?r.paramsSerializer={serialize:s}:ci.assertOptions(s,{encode:ut.function,serialize:ut.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),ci.assertOptions(r,{baseUrl:ut.spelling("baseURL"),withXsrfToken:ut.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&E.merge(i.common,i[r.method]);i&&E.forEach(["delete","get","head","post","put","patch","query","common"],_=>{delete i[_]}),r.headers=yt.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(r)===!1)return;c=c&&h.synchronous;const y=r.transitional||Ja;y&&y.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const d=[];this.interceptors.response.forEach(function(h){d.push(h.fulfilled,h.rejected)});let u,f=0,m;if(!c){const _=[mc.bind(this),void 0];for(_.unshift(...a),_.push(...d),m=_.length,u=Promise.resolve(r);f<m;)u=u.then(_[f++],_[f++]);return u}m=a.length;let g=r;for(;f<m;){const _=a[f++],h=a[f++];try{g=_(g)}catch(y){h.call(this,y);break}}try{u=mc.call(this,g)}catch(_){return Promise.reject(_)}for(f=0,m=d.length;f<m;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=nn(this.defaults,t);const r=bf(t.baseURL,t.url,t.allowAbsoluteUrls,t);return pf(r,t.params,t.paramsSerializer)}};E.forEach(["delete","get","head","options"],function(t){en.prototype[t]=function(r,n){return this.request(nn(n||{},{method:t,url:r,data:n&&E.hasOwnProp(n,"data")?n.data:void 0}))}});E.forEach(["post","put","patch","query"],function(t){function r(n){return function(i,o,a){return this.request(nn(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}en.prototype[t]=r(),t!=="query"&&(en.prototype[t+"Form"]=r(!0))});let Zb=class Sf{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 o=new Promise(a=>{n.subscribe(a),i=a}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},t(function(i,o,a){n.reason||(n.reason=new Fs(i,o,a),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 Sf(function(s){t=s}),cancel:t}}};function Jb(e){return function(r){return e.apply(null,r)}}function e_(e){return E.isObject(e)&&e.isAxiosError===!0}const pa={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(pa).forEach(([e,t])=>{pa[t]=e});function Cf(e){const t=new en(e),r=Jd(en.prototype.request,t);return E.extend(r,en.prototype,t,{allOwnKeys:!0}),E.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return Cf(nn(e,s))},r}const He=Cf(Ls);He.Axios=en;He.CanceledError=Fs;He.CancelToken=Zb;He.isCancel=yf;He.VERSION=tl;He.toFormData=Ki;He.AxiosError=Z;He.Cancel=He.CanceledError;He.all=function(t){return Promise.all(t)};He.spread=Jb;He.isAxiosError=e_;He.mergeConfig=nn;He.AxiosHeaders=yt;He.formToJSON=e=>mf(E.isHTMLForm(e)?new FormData(e):e);He.getAdapter=xf.getAdapter;He.HttpStatusCode=pa;He.default=He;const{Axios:ZR,AxiosError:JR,CanceledError:ek,isCancel:tk,CancelToken:rk,VERSION:nk,all:sk,Cancel:ik,isAxiosError:ok,spread:ak,toFormData:lk,AxiosHeaders:ck,HttpStatusCode:uk,formToJSON:dk,getAdapter:fk,mergeConfig:hk,create:pk}=He;let ga="";function Of(e){ga=e}const Me=He.create({timeout:3e4});Me.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>Ay),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),ga&&(e.baseURL=ga),e});const Ef=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function t_(e,t={}){var c,d,u,f;const n={"organisations.roles":[((c=t.objectType)==null?void 0:c.toLowerCase())==="textbook"?"BOOK_CREATOR":"CONTENT_CREATOR"]};t.rootOrgId&&(n.rootOrgId=[t.rootOrgId]);const s=e.includes("@"),i=/^\d{10,}$/.test(e.trim()),o={filters:n,fields:Ef,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(u=(d=(await Me.post("/action/user/v1/search",{request:o},{params:{fields:"orgName"},headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:d.result)==null?void 0:u.response)==null?void 0:f.content)??[]}async function r_(e){var r,n,s;return e.length?((s=(n=(r=(await Me.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Ef,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)??[]:[]}function Df(e,t){const r=e??{},n=r.identifier??"",s=r.objectType??"",o=(r.mimeType??"")==="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",a=r.children,c=Array.isArray(a)?a.map(d=>Df(d,n)):[];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:o,children:c,metadata:r,parent:t}}async function If(e){var s,i,o,a,c,d,u;const t=await Me.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 f=((a=(o=t.data)==null?void 0:o.params)==null?void 0:a.errmsg)||((d=(c=t.data)==null?void 0:c.params)==null?void 0:d.err)||((u=t.data)==null?void 0:u.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${f}`)}const n=Df(r);return{content:r,rootNode:n}}async function n_(e,t,r,n){var i;return((i=(await Me.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:i.result)??{}}async function s_(e,t=""){await Me.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function i_(e){var r,n;return(n=(r=(await Me.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function o_(e){await Me.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function a_(e,t){await Me.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function l_(e,t){await Me.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const c_="_container_r27rp_1",u_="_header_r27rp_13",d_="_title_r27rp_22",f_="_closeBtn_r27rp_29",h_="_body_r27rp_45",p_="_label_r27rp_54",g_="_searchSection_r27rp_62",m_="_searchRow_r27rp_68",y_="_searchInput_r27rp_74",v_="_searchSpinner_r27rp_89",b_="_resultsList_r27rp_105",__="_resultItem_r27rp_118",w_="_userInfo_r27rp_133",x_="_userName_r27rp_141",S_="_userEmail_r27rp_150",C_="_userOrg_r27rp_158",O_="_noResults_r27rp_167",E_="_collabSection_r27rp_174",D_="_sectionTitle_r27rp_179",I_="_badge_r27rp_189",N_="_emptyCollab_r27rp_203",T_="_collabList_r27rp_214",j_="_collabItem_r27rp_223",R_="_userAvatar_r27rp_237",k_="_error_r27rp_251",A_="_success_r27rp_257",P_="_footer_r27rp_263",xe={container:c_,header:u_,title:d_,closeBtn:f_,body:h_,label:p_,searchSection:g_,searchRow:m_,searchInput:y_,searchSpinner:v_,resultsList:b_,resultItem:__,userInfo:w_,userName:x_,userEmail:S_,userOrg:C_,noResults:O_,collabSection:E_,sectionTitle:D_,badge:I_,emptyCollab:N_,collabList:T_,collabItem:j_,userAvatar:R_,error:k_,success:A_,footer:P_},M_=({contentId:e,onClose:t})=>{var k,$;const r=ue(N=>N.editorConfig),n=(k=r==null?void 0:r.context)==null?void 0:k.channel,s=($=r==null?void 0:r.config)==null?void 0:$.objectType,[i,o]=p.useState(""),[a,c]=p.useState([]),[d,u]=p.useState(!1),[f,m]=p.useState([]),[g,_]=p.useState(!1),[h,y]=p.useState(""),[v,b]=p.useState(!1),x=p.useRef(null);p.useEffect(()=>{let N=!1;return(async()=>{try{const A=await i_(e),U=(A==null?void 0:A.collaborators)??[];if(!U.length)return;const R=await r_(U);if(N)return;const B=U.map(F=>R.find(J=>J.identifier===F)??{identifier:F,firstName:F});m(B)}catch{}})(),()=>{N=!0}},[e]),p.useEffect(()=>{x.current&&clearTimeout(x.current);const N=i.trim();if(N.length<2){c([]);return}return x.current=setTimeout(async()=>{u(!0);try{const A=await t_(N,{rootOrgId:n,objectType:s}),U=new Set(f.map(R=>R.identifier));c(A.filter(R=>!U.has(R.identifier)))}catch{c([])}finally{u(!1)}},300),()=>{x.current&&clearTimeout(x.current)}},[i,f,n,s]);const w=p.useCallback(N=>{m(A=>A.find(U=>U.identifier===N.identifier)?A:[...A,N]),c(A=>A.filter(U=>U.identifier!==N.identifier)),b(!1)},[]),C=p.useCallback(N=>{m(A=>A.filter(U=>U.identifier!==N)),b(!1)},[]),D=p.useCallback(async()=>{_(!0),y(""),b(!1);try{await l_(e,f.map(N=>N.identifier)),b(!0)}catch{y("Failed to save collaborators. Please try again.")}finally{_(!1)}},[e,f]),j=N=>`${N.firstName}${N.lastName?` ${N.lastName}`:""}`;return l.jsxs("div",{className:xe.container,children:[l.jsxs("div",{className:xe.header,children:[l.jsx("h2",{className:xe.title,children:"Manage Collaborators"}),l.jsx("button",{className:xe.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:xe.body,children:[l.jsxs("div",{className:xe.searchSection,children:[l.jsx("label",{className:xe.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:xe.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:xe.searchInput,placeholder:"Search by name or email...",value:i,onChange:N=>o(N.target.value)}),d&&l.jsx("span",{className:xe.searchSpinner,"aria-label":"Searching..."})]}),a.length>0&&l.jsx("ul",{className:xe.resultsList,role:"listbox","aria-label":"Search results",children:a.map(N=>{var A,U,R,B;return l.jsxs("li",{className:xe.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:xe.userInfo,children:[l.jsx("span",{className:xe.userName,children:j(N)}),N.email&&l.jsx("span",{className:xe.userEmail,children:N.email}),(((U=(A=N.organisations)==null?void 0:A[0])==null?void 0:U.orgName)??N.rootOrgName)&&l.jsx("span",{className:xe.userOrg,children:((B=(R=N.organisations)==null?void 0:R[0])==null?void 0:B.orgName)??N.rootOrgName})]}),l.jsx(Ie,{variant:"primary",size:"sm",onClick:()=>w(N),children:"Add"})]},N.identifier)})}),i.trim().length>=2&&!d&&a.length===0&&l.jsx("p",{className:xe.noResults,children:"No users found."})]}),l.jsxs("div",{className:xe.collabSection,children:[l.jsxs("h3",{className:xe.sectionTitle,children:["Current Collaborators",f.length>0&&l.jsx("span",{className:xe.badge,children:f.length})]}),f.length===0?l.jsx("p",{className:xe.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:xe.collabList,children:f.map(N=>{var A,U,R,B;return l.jsxs("li",{className:xe.collabItem,children:[l.jsx("div",{className:xe.userAvatar,"aria-hidden":"true",children:j(N).charAt(0).toUpperCase()}),l.jsxs("div",{className:xe.userInfo,children:[l.jsx("span",{className:xe.userName,children:j(N)}),N.email&&l.jsx("span",{className:xe.userEmail,children:N.email}),(((U=(A=N.organisations)==null?void 0:A[0])==null?void 0:U.orgName)??N.rootOrgName)&&l.jsx("span",{className:xe.userOrg,children:((B=(R=N.organisations)==null?void 0:R[0])==null?void 0:B.orgName)??N.rootOrgName})]}),l.jsx(Ie,{variant:"danger",size:"sm",onClick:()=>C(N.identifier),children:"Remove"})]},N.identifier)})})]}),h&&l.jsx("p",{className:xe.error,role:"alert",children:h}),v&&l.jsx("p",{className:xe.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:xe.footer,children:[l.jsx(Ie,{variant:"ghost",onClick:t,disabled:g,children:"Cancel"}),l.jsx(Ie,{variant:"primary",isLoading:g,onClick:D,children:"Save"})]})]})};async function L_(e){return(await Me.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function F_(e,t){var s;const n=((s=(await Me.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 $_(e){var n;const r=((n=(await Me.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 B_="_topbar_zj8wk_1",U_="_left_zj8wk_15",V_="_right_zj8wk_23",z_="_backBtn_zj8wk_30",q_="_title_zj8wk_49",H_="_statusChip_zj8wk_61",W_="_savedIndicator_zj8wk_73",K_="_unsaved_zj8wk_83",Q_="_iconBtn_zj8wk_88",G_="_iconBtnLabel_zj8wk_115",Y_="_qrDropdown_zj8wk_119",X_="_qrMenu_zj8wk_123",Z_="_reviewBtns_zj8wk_158",J_="_sourcingBtns_zj8wk_167",ew="_modalOverlay_zj8wk_176",tw="_sbOverlay_zj8wk_186",rw="_sbModal_zj8wk_196",nw="_sbModalHeader_zj8wk_207",sw="_sbModalTitle_zj8wk_215",iw="_sbModalClose_zj8wk_222",ow="_sbModalBody_zj8wk_235",aw="_sbLabel_zj8wk_242",lw="_sbTextarea_zj8wk_249",cw="_sbError_zj8wk_266",uw="_sbModalFooter_zj8wk_273",ae={topbar:B_,left:U_,right:V_,backBtn:z_,title:q_,statusChip:H_,savedIndicator:W_,unsaved:K_,iconBtn:Q_,iconBtnLabel:G_,qrDropdown:Y_,qrMenu:X_,reviewBtns:Z_,sourcingBtns:J_,modalOverlay:ew,sbOverlay:tw,sbModal:rw,sbModalHeader:nw,sbModalTitle:sw,sbModalClose:iw,sbModalBody:ow,sbLabel:aw,sbTextarea:lw,sbError:cw,sbModalFooter:uw};function dw(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function fw(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const vc=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const[a,c]=p.useState(""),d=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:ae.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${d}-title`,children:l.jsxs("div",{className:ae.sbModal,children:[l.jsxs("div",{className:ae.sbModalHeader,children:[l.jsx("span",{id:`${d}-title`,className:ae.sbModalTitle,children:e}),l.jsx("button",{className:ae.sbModalClose,onClick:o,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ae.sbModalBody,children:[l.jsxs("label",{className:ae.sbLabel,htmlFor:`${d}-comment`,children:[t," ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:`${d}-comment`,className:ae.sbTextarea,placeholder:r,value:a,onChange:u=>c(u.target.value),rows:4,required:!0,"aria-required":"true"}),a.trim().length===0&&l.jsx("p",{className:ae.sbError,children:"Fill comments"})]}),l.jsxs("div",{className:ae.sbModalFooter,children:[l.jsx(Ie,{variant:"ghost",onClick:o,children:"Cancel"}),l.jsx(Ie,{variant:s,onClick:()=>i(a.trim()),disabled:a.trim().length===0,children:n})]})]})})},hw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(!1);return l.jsx("div",{className:ae.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:ae.sbModal,children:[l.jsxs("div",{className:ae.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:ae.sbModalTitle,children:"Accepting Terms & Conditions"}),l.jsx("button",{className:ae.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsx("div",{className:ae.sbModalBody,children:l.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:1.55},children:[l.jsx("input",{type:"checkbox",checked:r,onChange:s=>n(s.target.checked),style:{marginTop:2}}),l.jsxs("span",{children:["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"," ",l.jsx("a",{className:"sb-color-primary",style:{fontWeight:600},href:"https://creativecommons.org/licenses",target:"_blank",rel:"noreferrer",children:"Creative Commons Framework"})," ","in accordance with the ",l.jsx("strong",{children:"Content Policy"}),". I have made sure that I do not violate others’ copyright or privacy rights."]})]})}),l.jsxs("div",{className:ae.sbModalFooter,children:[l.jsx(Ie,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Ie,{variant:"primary",onClick:e,disabled:!r,children:"Submit"})]})]})})},pw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(""),s=parseInt(r,10),i=!isNaN(s)&&s>=2&&s<=250;return l.jsx("div",{className:ae.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:ae.sbModal,children:[l.jsxs("div",{className:ae.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:ae.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:ae.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ae.sbModalBody,children:[l.jsxs("label",{className:ae.sbLabel,htmlFor:"qr-count",children:["Number of QR Codes ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("input",{id:"qr-count",type:"number",min:2,max:250,className:ae.sbTextarea,style:{resize:"none",height:"40px"},placeholder:"Enter number (2–250)",value:r,onChange:o=>n(o.target.value)}),r&&!i&&l.jsx("p",{className:ae.sbError,children:"Enter a number between 2 and 250."})]}),l.jsxs("div",{className:ae.sbModalFooter,children:[l.jsx(Ie,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Ie,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},gw=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var Ne,re;const a=Re(se=>se.treeData)[0],c=(a==null?void 0:a.name)??"Untitled",d=fw(((Ne=a==null?void 0:a.metadata)==null?void 0:Ne.status)??(a==null?void 0:a.status)),u=ue(se=>{var le,Le,ze,Te;return((Le=(le=se.editorConfig)==null?void 0:le.context)==null?void 0:Le.contentId)??((Te=(ze=se.editorConfig)==null?void 0:ze.context)==null?void 0:Te.identifier)??""}),{activeModal:f,modalData:m,closeModal:g,openModal:_}=Fy(),h=ue(se=>se.buttonLoaders),y=ue(se=>se.categoryMeta),v=!y||y.schemaDefaults.generateDIALCodes!=="No",[b,x]=p.useState(!1),[w,C]=p.useState(!1),[D,j]=p.useState(!1),[k,$]=p.useState(!1),N=p.useRef(null),[A,U]=p.useState(!1);p.useEffect(()=>{if(!k)return;const se=le=>{var Le;(Le=N.current)!=null&&Le.contains(le.target)||$(!1)};return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[k]);const[R,B]=p.useState(!1),[F,J]=p.useState(!1),{updateNode:ie}=Re(),me=(re=a==null?void 0:a.metadata)==null?void 0:re.qrCodeProcessId,ve=p.useCallback(async se=>{if(u){U(!1),B(!0);try{const{processId:le,reservedDialcodes:Le}=await F_(u,se);le&&a&&ie(a.id,{qrCodeProcessId:le,reservedDialcodes:Le}),Se.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Se.error("Failed to generate QR Codes. Please try again.")}finally{B(!1)}}},[u,a,ie]),be=p.useCallback(async()=>{if(!me){Se.error("No QR codes generated yet. Generate QR Codes first.");return}J(!0);try{const se=await $_(me);if(se.status==="in-process"){Se("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const le=se.url;if(!le){Se.error("QR Codes not ready yet. Please wait and try again.");return}const Le=await fetch(le).then(Ye=>Ye.blob()),ze=await new Promise(Ye=>{const lt=new FileReader;lt.onloadend=()=>Ye(lt.result),lt.readAsDataURL(Le)}),Te=(a==null?void 0:a.metadata)??{},te=Ye=>Array.isArray(Ye)?Ye.join("_"):typeof Ye=="string"?Ye:"",We=[u,te(Te.medium),te(Te.gradeLevel),te(Te.subject)].filter(Boolean),at=new Date().toISOString().replace(/[:.]/g,"-"),vt=`${We.join("_")}_${at}.zip`,qe=document.createElement("a");qe.href=ze,qe.download=vt,qe.style.display="none",document.body.appendChild(qe),qe.click(),document.body.removeChild(qe),Se.success("QR codes downloaded.")}catch{Se.error("Failed to download QR Codes.")}finally{J(!1)}},[me,a,u]),K=e==="edit",M=e==="review",G=e==="sourcingreview",P=e==="read",Y=p.useCallback((se,le)=>{i({action:se,data:le})},[i]),W=p.useCallback(()=>{g(),Y("publish")},[g,Y]),oe=p.useCallback((se,le)=>{const Le=m==null?void 0:m.action;g(),Le==="approve"?Y("sourcingApprove",{comment:se,score:le}):Y("reject",{comment:se})},[g,Y,m]),pe=p.useCallback(se=>{x(!1),Y("sendBackForCorrections",{comment:se})},[Y]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:ae.topbar,role:"banner",children:[l.jsxs("div",{className:ae.left,children:[l.jsx("button",{className:ae.backBtn,onClick:()=>Y("back"),"aria-label":"Go back",type:"button",children:l.jsx(ry,{size:18})}),l.jsx("h1",{className:ae.title,title:c,children:c}),l.jsx("span",{className:`sbx-chip ${ae.statusChip}`,"aria-label":`Status: ${d}`,children:d})]}),l.jsxs("div",{className:ae.right,children:[t?l.jsx("span",{className:ae.savedIndicator,"aria-live":"polite",children:"Saving…"}):r?l.jsx("span",{className:`${ae.savedIndicator} ${ae.unsaved}`,"aria-live":"polite",children:"Unsaved"}):n?l.jsxs("span",{className:ae.savedIndicator,"aria-live":"polite",children:[l.jsx(Un,{size:14,"aria-hidden":"true"}),"Saved ",dw(n)]}):null,!P&&!M&&!G&&d!=="Review"&&l.jsx("span",{title:s?void 0:"Fill all required fields before saving",children:l.jsx(Ie,{variant:"ghost",size:"sm",onClick:()=>Y("saveCollection"),disabled:!s,children:"Save as Draft"})}),K&&l.jsxs(l.Fragment,{children:[l.jsxs(Ie,{variant:"primary",size:"sm",onClick:()=>j(!0),disabled:h.saveCollection,isLoading:h.saveCollection,children:[l.jsx(vy,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:ae.iconBtn,onClick:()=>_("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx(wy,{size:16,"aria-hidden":"true"})}),v&&l.jsxs("div",{className:ae.qrDropdown,ref:N,children:[l.jsxs("button",{className:ae.iconBtn,onClick:()=>$(se=>!se),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":k,children:[l.jsx(Hl,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:ae.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),k&&l.jsxs("div",{className:ae.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{$(!1),U(!0)},disabled:R,children:[l.jsx(Hl,{size:14}),R?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{$(!1),be()},disabled:F||!me,children:[l.jsx(ay,{size:14}),F?"Downloading…":"Download QR Codes"]})]})]})]}),M&&l.jsxs("div",{className:ae.reviewBtns,children:[l.jsxs(Ie,{variant:"primary",size:"sm",onClick:()=>_("publishChecklist"),disabled:h.publishCollection,isLoading:h.publishCollection,children:[l.jsx(Vd,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(Ie,{variant:"danger",size:"sm",onClick:()=>C(!0),disabled:h.rejectCollection,isLoading:h.rejectCollection,children:[l.jsx(aa,{size:14,"aria-hidden":"true"})," Reject"]}),l.jsxs(Ie,{variant:"ghost",size:"sm",onClick:()=>x(!0),children:[l.jsx(my,{size:14,"aria-hidden":"true"})," Send Back"]})]}),G&&l.jsxs("div",{className:ae.sourcingBtns,children:[l.jsxs(Ie,{variant:"primary",size:"sm",onClick:()=>_("qualityParams",{action:"approve"}),children:[l.jsx(by,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(Ie,{variant:"danger",size:"sm",onClick:()=>_("qualityParams",{action:"reject"}),children:[l.jsx(aa,{size:14,"aria-hidden":"true"})," Reject"]})]})]})]}),f==="publishChecklist"&&l.jsx(tv,{contentId:u,onConfirm:W,onCancel:g}),f==="qualityParams"&&l.jsx(rv,{contentId:u,action:(m==null?void 0:m.action)??"reject",onConfirm:oe,onCancel:g}),f==="manageCollaborators"&&l.jsx("div",{className:ae.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(M_,{contentId:u,onClose:g})}),D&&l.jsx(hw,{onConfirm:()=>{j(!1),Y("sendForReview")},onCancel:()=>j(!1)}),w&&l.jsx(vc,{titleText:"Reject Content",labelText:"Reason for rejection",placeholderText:"Explain why this content is being rejected",submitLabel:"Reject",submitVariant:"danger",onConfirm:se=>{C(!1),Y("reject",{comment:se})},onCancel:()=>C(!1)}),b&&l.jsx(vc,{titleText:"Send Back for Corrections",labelText:"Corrections needed",placeholderText:"Describe the corrections the author needs to make",submitLabel:"Send Back",submitVariant:"primary",onConfirm:pe,onCancel:()=>x(!1)}),A&&l.jsx(pw,{onConfirm:ve,onCancel:()=>U(!1)})]})},mw=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>Rr.createPortal(l.jsx("div",{className:De.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:De.modal,children:[l.jsxs("div",{className:De.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:De.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:De.modalBody,children:l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:"You have unsaved changes. Would you like to save them before leaving?"})}),l.jsxs("div",{className:De.modalFooter,children:[l.jsx(Ie,{variant:"ghost",onClick:r,disabled:n,children:"Cancel"}),l.jsx(Ie,{variant:"danger",onClick:t,disabled:n,children:"Discard"}),l.jsx(Ie,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:"Save"})]})]})}),document.body);var yw=Ga();const Nf=p.createContext(null);function It(){const e=p.useContext(Nf);if(e===null)throw new Error("No Tree Api Provided");return e}const Tf=p.createContext(null);function vw(){const e=p.useContext(Tf);if(e===null)throw new Error("Provide a NodesContext");return e}const jf=p.createContext(null);function bw(){const e=p.useContext(jf);if(e===null)throw new Error("Provide a DnDContext");return e}const Rf=p.createContext(0);function kf(){p.useContext(Rf)}function ui(e,t,r){return Math.max(Math.min(e,r),t)}function Af(e){return e&&e.isLeaf}function Pf(e){return e&&e.isInternal&&!e.isOpen}function Mf(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const Lf=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},Ff=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function nl(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=nl(r,t);if(n)return n}return null}function Ti(e,t){if(t(e),e.children)for(let r of e.children)Ti(r,t)}function $f(e){const t=Uf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=_w(t,n);break}r==null||r.focus()}function Bf(e){const t=Uf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=ww(t,n);break}r==null||r.focus()}function _w(e,t){return t+1<e.length?e[t+1]:e[0]}function ww(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Uf(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 is(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function vn(e){return typeof e=="string"?e:e.id}function xw(e,...t){if(e)return e(...t)}function Vf(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function zf(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 qf(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const Sw=Object.freeze(Object.defineProperty({__proto__:null,access:is,bound:ui,dfs:nl,focusNextElement:$f,focusPrevElement:Bf,getInsertIndex:zf,getInsertParentId:qf,identify:vn,indexOf:Ff,isClosed:Pf,isDescendant:Lf,isItem:Af,isOpenWithEmptyChildren:Mf,safeRun:xw,waitFor:Vf,walk:Ti},Symbol.toStringTag,{value:"Module"})),Cw={display:"flex",alignItems:"center",zIndex:1},Ow={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},Ew={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},Dw=p.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 l.jsxs("div",{style:Object.assign(Object.assign({},Cw),s),children:[l.jsx("div",{style:Object.assign({},Ew)}),l.jsx("div",{style:Object.assign({},Ow)})]})});function Iw({node:e,attrs:t,innerRef:r,children:n}){return l.jsx("div",Object.assign({},t,{ref:r,onFocus:s=>s.stopPropagation(),onClick:e.handleClick,children:n}))}function Nw(e){return l.jsxs("div",{ref:e.dragHandle,style:e.style,children:[l.jsx("span",{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?"🌳":e.node.isOpen?"🗁":"🗀"})," ",e.node.isEditing?l.jsx(jw,Object.assign({},e)):l.jsx(Tw,Object.assign({},e))]})}function Tw(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function jw({node:e}){const t=p.useRef();return p.useEffect(()=>{var r,n;(r=t.current)===null||r===void 0||r.focus(),(n=t.current)===null||n===void 0||n.select()},[]),l.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 _s="__REACT_ARBORIST_INTERNAL_ROOT__";function bc(e){var t;function r(i,o,a){const c=e.accessId(i),d=new ws({tree:e,data:i,level:o,parent:a,id:c,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),u=e.accessChildren(i);return u&&(d.children=u.map(f=>r(f,o+1,d))),d}const n=new ws({tree:e,id:_s,data:{id:_s},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 ws{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===_s}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 ws(Object.assign({},this))}edit(){return this.tree.edit(this)}}function _o(e){return{type:"EDIT",id:e}}function Rw(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function un(e){return{type:"FOCUS",id:e}}function kw(){return{type:"TREE_BLUR"}}function Aw(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 ma={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 _c(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 Pw(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:_c(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:_c(e.unfiltered,t)}):e}const Mn=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}}},vr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:vn(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(vn)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(vn)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:vn(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:vn(e)})};function Mw(e=Mn().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 Ln={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 Lw(e=Mn().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 Mn().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const Fw={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},$w=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},Bw=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function Hf({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(Uw,{isDragging:s,children:[l.jsx(Vw,{offset:e,children:l.jsx(qw,{id:r,dragIds:n})}),l.jsx(zw,{mouse:t,count:n.length})]})}const Uw=p.memo(function(t){return t.isDragging?l.jsx("div",{style:Fw,children:t.children}):null});function Vw(e){return l.jsx("div",{className:"row preview",style:$w(e.offset),children:e.children})}function zw(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:Bw(r),children:t}):null}const qw=p.memo(function(t){const r=It(),n=r.get(t.id);return n?l.jsx(r.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*r.indent,opacity:.2,background:"transparent"},tree:r}):null});function ya(){return ya=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},ya.apply(null,arguments)}function wc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function va(e,t){return va=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},va(e,t)}function Hw(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,va(e,t)}var xc=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Ww(e,t){return!!(e===t||xc(e)&&xc(t))}function Kw(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!Ww(e[r],t[r]))return!1;return!0}function wo(e,t){t===void 0&&(t=Kw);var r,n=[],s,i=!1;function o(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return i&&r===this&&t(a,n)||(s=e.apply(this,a),i=!0,r=this,n=a),s}return o}var Qw=typeof performance=="object"&&typeof performance.now=="function",Sc=Qw?function(){return performance.now()}:function(){return Date.now()};function Cc(e){cancelAnimationFrame(e.id)}function Gw(e,t){var r=Sc();function n(){Sc()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var xo=-1;function Oc(e){if(e===void 0&&(e=!1),xo===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),xo=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return xo}var dn=null;function Ec(e){if(e===void 0&&(e=!1),dn===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?dn="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?dn="negative":dn="positive-ascending"),document.body.removeChild(t),dn}return dn}process.env.NODE_ENV;var Yw=150,Xw=function(t,r){return t},di=null,fi=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(di=new WeakSet,fi=new WeakSet);function Wf(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,d=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(f){Hw(m,f);function m(_){var h;return h=f.call(this,_)||this,h._instanceProps=c(h.props,wc(h)),h._outerRef=void 0,h._resetIsScrollingTimeoutId=null,h.state={instance:wc(h),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof h.props.initialScrollOffset=="number"?h.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},h._callOnItemsRendered=void 0,h._callOnItemsRendered=wo(function(y,v,b,x){return h.props.onItemsRendered({overscanStartIndex:y,overscanStopIndex:v,visibleStartIndex:b,visibleStopIndex:x})}),h._callOnScroll=void 0,h._callOnScroll=wo(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,x=v.itemSize,w=v.layout,C=h._getItemStyleCache(d&&x,d&&w,d&&b),D;if(C.hasOwnProperty(y))D=C[y];else{var j=r(h.props,y,h._instanceProps),k=s(h.props,y,h._instanceProps),$=b==="horizontal"||w==="horizontal",N=b==="rtl",A=$?j:0;C[y]=D={position:"absolute",left:N?void 0:A,right:N?A:void 0,top:$?0:j,height:$?"100%":k,width:$?k:"100%"}}return D},h._getItemStyleCache=void 0,h._getItemStyleCache=wo(function(y,v,b){return{}}),h._onScrollHorizontal=function(y){var v=y.currentTarget,b=v.clientWidth,x=v.scrollLeft,w=v.scrollWidth;h.setState(function(C){if(C.scrollOffset===x)return null;var D=h.props.direction,j=x;if(D==="rtl")switch(Ec()){case"negative":j=-x;break;case"positive-descending":j=w-b-x;break}return j=Math.max(0,Math.min(j,w-b)),{isScrolling:!0,scrollDirection:C.scrollOffset<j?"forward":"backward",scrollOffset:j,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._onScrollVertical=function(y){var v=y.currentTarget,b=v.clientHeight,x=v.scrollHeight,w=v.scrollTop;h.setState(function(C){if(C.scrollOffset===w)return null;var D=Math.max(0,Math.min(w,x-b));return{isScrolling:!0,scrollDirection:C.scrollOffset<D?"forward":"backward",scrollOffset:D,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&&Cc(h._resetIsScrollingTimeoutId),h._resetIsScrollingTimeoutId=Gw(h._resetIsScrolling,Yw)},h._resetIsScrolling=function(){h._resetIsScrollingTimeoutId=null,h.setState({isScrolling:!1},function(){h._getItemStyleCache(-1,null)})},h}m.getDerivedStateFromProps=function(h,y){return Zw(h,y),u(h),null};var g=m.prototype;return g.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)},g.scrollToItem=function(h,y){y===void 0&&(y="auto");var v=this.props,b=v.itemCount,x=v.layout,w=this.state.scrollOffset;h=Math.max(0,Math.min(h,b-1));var C=0;if(this._outerRef){var D=this._outerRef;x==="vertical"?C=D.scrollWidth>D.clientWidth?Oc():0:C=D.scrollHeight>D.clientHeight?Oc():0}this.scrollTo(i(this.props,h,y,w,this._instanceProps,C))},g.componentDidMount=function(){var h=this.props,y=h.direction,v=h.initialScrollOffset,b=h.layout;if(typeof v=="number"&&this._outerRef!=null){var x=this._outerRef;y==="horizontal"||b==="horizontal"?x.scrollLeft=v:x.scrollTop=v}this._callPropsCallbacks()},g.componentDidUpdate=function(){var h=this.props,y=h.direction,v=h.layout,b=this.state,x=b.scrollOffset,w=b.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var C=this._outerRef;if(y==="horizontal"||v==="horizontal")if(y==="rtl")switch(Ec()){case"negative":C.scrollLeft=-x;break;case"positive-ascending":C.scrollLeft=x;break;default:var D=C.clientWidth,j=C.scrollWidth;C.scrollLeft=j-D-x;break}else C.scrollLeft=x;else C.scrollTop=x}this._callPropsCallbacks()},g.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Cc(this._resetIsScrollingTimeoutId)},g.render=function(){var h=this.props,y=h.children,v=h.className,b=h.direction,x=h.height,w=h.innerRef,C=h.innerElementType,D=h.innerTagName,j=h.itemCount,k=h.itemData,$=h.itemKey,N=$===void 0?Xw:$,A=h.layout,U=h.outerElementType,R=h.outerTagName,B=h.style,F=h.useIsScrolling,J=h.width,ie=this.state.isScrolling,me=b==="horizontal"||A==="horizontal",ve=me?this._onScrollHorizontal:this._onScrollVertical,be=this._getRangeToRender(),K=be[0],M=be[1],G=[];if(j>0)for(var P=K;P<=M;P++)G.push(p.createElement(y,{data:k,key:N(P,k),index:P,isScrolling:F?ie:void 0,style:this._getItemStyle(P)}));var Y=n(this.props,this._instanceProps);return p.createElement(U||R||"div",{className:v,onScroll:ve,ref:this._outerRefSetter,style:ya({position:"relative",height:x,width:J,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},B)},p.createElement(C||D||"div",{children:G,ref:w,style:{height:me?"100%":Y,pointerEvents:ie?"none":void 0,width:me?Y:"100%"}}))},g._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],x=y[2],w=y[3];this._callOnItemsRendered(v,b,x,w)}}if(typeof this.props.onScroll=="function"){var C=this.state,D=C.scrollDirection,j=C.scrollOffset,k=C.scrollUpdateWasRequested;this._callOnScroll(D,j,k)}},g._getRangeToRender=function(){var h=this.props,y=h.itemCount,v=h.overscanCount,b=this.state,x=b.isScrolling,w=b.scrollDirection,C=b.scrollOffset;if(y===0)return[0,0,0,0];var D=o(this.props,C,this._instanceProps),j=a(this.props,D,C,this._instanceProps),k=!x||w==="backward"?Math.max(1,v):1,$=!x||w==="forward"?Math.max(1,v):1;return[Math.max(0,D-k),Math.max(0,Math.min(y-1,j+$)),D,j]},m}(p.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var Zw=function(t,r){var n=t.children,s=t.direction,i=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,d=t.width,u=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||c!=null)&&fi&&!fi.has(u)&&(fi.add(u),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=s==="horizontal"||o==="horizontal";switch(s){case"horizontal":case"vertical":di&&!di.has(u)&&(di.add(u),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(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" 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(f&&typeof d!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(d===null?"null":typeof d)+'" was specified.'));if(!f&&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.'))}},Jw=50,bn=function(t,r,n){var s=t,i=s.itemSize,o=n.itemMetadataMap,a=n.lastMeasuredIndex;if(r>a){var c=0;if(a>=0){var d=o[a];c=d.offset+d.size}for(var u=a+1;u<=r;u++){var f=i(u);o[u]={offset:c,size:f},c+=f}n.lastMeasuredIndex=r}return o[r]},ex=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?Kf(t,r,i,0,n):tx(t,r,Math.max(0,i),n)},Kf=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=bn(t,o,r).offset;if(a===i)return o;a<i?s=o+1:a>i&&(n=o-1)}return s>0?s-1:0},tx=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&bn(t,n,r).offset<s;)n+=o,o*=2;return Kf(t,r,Math.min(n,i-1),Math.floor(n/2),s)},Dc=function(t,r){var n=t.itemCount,s=r.itemMetadataMap,i=r.estimatedItemSize,o=r.lastMeasuredIndex,a=0;if(o>=n&&(o=n-1),o>=0){var c=s[o];a=c.offset+c.size}var d=n-o-1,u=d*i;return a+u},rx=Wf({getItemOffset:function(t,r,n){return bn(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Dc,getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,d=t.layout,u=t.width,f=a==="horizontal"||d==="horizontal",m=f?u:c,g=bn(t,r,i),_=Dc(t,i),h=Math.max(0,Math.min(_-m,g.offset)),y=Math.max(0,g.offset-m+g.size+o);switch(n==="smart"&&(s>=y-m&&s<=h+m?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 ex(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,o=t.height,a=t.itemCount,c=t.layout,d=t.width,u=i==="horizontal"||c==="horizontal",f=u?d:o,m=bn(t,r,s),g=n+f,_=m.offset+m.size,h=r;h<a-1&&_<g;)h++,_+=bn(t,h,s).size;return h},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||Jw,lastMeasuredIndex:-1};return r.resetAfterIndex=function(o,a){a===void 0&&(a=!0),i.lastMeasuredIndex=Math.min(i.lastMeasuredIndex,o-1),r._getItemStyleCache(-1),a&&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.'))}}),nx=Wf({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,o){var a=t.direction,c=t.height,d=t.itemCount,u=t.itemSize,f=t.layout,m=t.width,g=a==="horizontal"||f==="horizontal",_=g?m:c,h=Math.max(0,d*u-_),y=Math.min(h,r*u),v=Math.max(0,r*u-_+u+o);switch(n==="smart"&&(s>=v-_&&s<=y+_?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(_/2)?0:b>h+Math.floor(_/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,o=t.itemCount,a=t.itemSize,c=t.layout,d=t.width,u=s==="horizontal"||c==="horizontal",f=r*a,m=u?d:i,g=Math.ceil((m+n-f)/a);return Math.max(0,Math.min(o-1,r+g-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 sx(){var e,t;const r=It(),s=bw().cursor;if(!s||s.type!=="line")return null;const i=r.indent,o=r.rowTopPosition(s.index)+((t=(e=r.props.padding)!==null&&e!==void 0?e:r.props.paddingTop)!==null&&t!==void 0?t:0),a=i*s.level,c=r.renderCursor;return l.jsx(c,{top:o,left:a,indent:i})}var ix=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 ox=p.forwardRef(function(t,r){const{children:n}=t,s=ix(t,["children"]),i=It();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(ax,{}),n]}))}),ax=()=>{const e=It();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(sx,{})})};var lx=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 cx=p.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=lx(t,["style"]);const d=It(),u=(s=(n=d.props.padding)!==null&&n!==void 0?n:d.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=d.props.padding)!==null&&i!==void 0?i:d.props.paddingBottom)!==null&&o!==void 0?o:0;return l.jsx("div",Object.assign({ref:r,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+u+f}px`})},c))});var Qf=p.createContext({dragDropManager:void 0}),Ut;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Ut||(Ut={}));function ce(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 o=0;i=new Error(t.replace(/%s/g,function(){return n[o++]})),i.name="Invariant Violation"}throw i.framesToPop=1,i}}var sl="dnd-core/INIT_COORDS",Gi="dnd-core/BEGIN_DRAG",il="dnd-core/PUBLISH_DRAG_SOURCE",Yi="dnd-core/HOVER",Xi="dnd-core/DROP",Zi="dnd-core/END_DRAG";function Ic(e,t){return{type:sl,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function hi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?hi=function(r){return typeof r}:hi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},hi(e)}function ux(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function dx(e,t){return e.filter(function(r){return r!==t})}function Gf(e){return hi(e)==="object"}function fx(e,t){var r=new Map,n=function(o){r.set(o,r.has(o)?r.get(o)+1:1)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i,o){i===1&&s.push(o)}),s}function hx(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var px={type:sl,payload:{clientOffset:null,sourceClientOffset:null}};function gx(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,o=n.clientOffset,a=n.getSourceClientOffset,c=e.getMonitor(),d=e.getRegistry();e.dispatch(Ic(o)),mx(r,c,d);var u=bx(r,c);if(u===null){e.dispatch(px);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");yx(a),f=a(u)}e.dispatch(Ic(o,f));var m=d.getSource(u),g=m.beginDrag(c,u);if(g!=null){vx(g),d.pinSource(u);var _=d.getSourceType(u);return{type:Gi,payload:{itemType:_,item:g,sourceId:u,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function mx(e,t,r){ce(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){ce(r.getSource(n),"Expected sourceIds to be registered.")})}function yx(e){ce(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function vx(e){ce(Gf(e),"Item must be an object.")}function bx(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 _x(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:il}}}function ba(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function wx(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;xx(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();Sx(i,o,a);var c=o.getItemType();return Cx(i,a,c),Ox(i,o,a),{type:Yi,payload:{targetIds:i,clientOffset:s||null}}}}function xx(e){ce(Array.isArray(e),"Expected targetIds to be an array.")}function Sx(e,t,r){ce(t.isDragging(),"Cannot call hover while not dragging."),ce(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];ce(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);ce(i,"Expected targetIds to be registered.")}}function Cx(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);ba(i,r)||e.splice(n,1)}}function Ox(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function Nc(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 Tc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Nc(Object(r),!0).forEach(function(n){Ex(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ex(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dx(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();Ix(n);var i=jx(n);i.forEach(function(o,a){var c=Nx(o,a,s,n),d={type:Xi,payload:{dropResult:Tc(Tc({},r),c)}};e.dispatch(d)})}}function Ix(e){ce(e.isDragging(),"Cannot call drop while not dragging."),ce(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function Nx(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return Tx(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function Tx(e){ce(typeof e>"u"||Gf(e),"Drop result must either be an object or undefined.")}function jx(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Rx(e){return function(){var r=e.getMonitor(),n=e.getRegistry();kx(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:Zi}}}function kx(e){ce(e.isDragging(),"Cannot call endDrag while not dragging.")}function Ax(e){return{beginDrag:gx(e),publishDragSource:_x(e),hover:wx(e),drop:Dx(e),endDrag:Rx(e)}}function Px(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mx(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 Lx(e,t,r){return t&&Mx(e.prototype,t),e}function Yn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Fx=function(){function e(t,r){var n=this;Px(this,e),Yn(this,"store",void 0),Yn(this,"monitor",void 0),Yn(this,"backend",void 0),Yn(this,"isSetUp",!1),Yn(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 Lx(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(o){return function(){for(var a=arguments.length,c=new Array(a),d=0;d<a;d++)c[d]=arguments[d];var u=o.apply(r,c);typeof u<"u"&&n(u)}}var i=Ax(this);return Object.keys(i).reduce(function(o,a){var c=i[a];return o[a]=s(c),o},{})}},{key:"dispatch",value:function(r){this.store.dispatch(r)}}]),e}();function Mt(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 jc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Rc=function(){return Math.random().toString(36).substring(7).split("").join(".")},kc={INIT:"@@redux/INIT"+Rc(),REPLACE:"@@redux/REPLACE"+Rc()};function $x(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 Bx(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(zx(e))return"date";if(Vx(e))return"error";var r=Ux(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 Ux(e){return typeof e.constructor=="function"?e.constructor.name:null}function Vx(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function zx(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function fn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=Bx(e)),t}function Yf(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"?Mt(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"?Mt(1):"Expected the enhancer to be a function. Instead, received: '"+fn(r)+"'");return r(Yf)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Mt(2):"Expected the root reducer to be a function. Instead, received: '"+fn(e)+"'");var s=e,i=t,o=[],a=o,c=!1;function d(){a===o&&(a=o.slice())}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?Mt(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 f(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Mt(4):"Expected the listener to be a function. Instead, received: '"+fn(h)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?Mt(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 d(),a.push(h),function(){if(y){if(c)throw new Error(process.env.NODE_ENV==="production"?Mt(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,d();var b=a.indexOf(h);a.splice(b,1),o=null}}}function m(h){if(!$x(h))throw new Error(process.env.NODE_ENV==="production"?Mt(7):"Actions must be plain objects. Instead, the actual type was: '"+fn(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"?Mt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?Mt(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,h)}finally{c=!1}for(var y=o=a,v=0;v<y.length;v++){var b=y[v];b()}return h}function g(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Mt(10):"Expected the nextReducer to be a function. Instead, received: '"+fn(h));s=h,m({type:kc.REPLACE})}function _(){var h,y=f;return h={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?Mt(11):"Expected the observer to be an object. Instead, received: '"+fn(b)+"'");function x(){b.next&&b.next(u())}x();var w=y(x);return{unsubscribe:w}}},h[jc]=function(){return this},h}return m({type:kc.INIT}),n={dispatch:m,subscribe:f,getState:u,replaceReducer:g},n[jc]=_,n}var qx=function(t,r){return t===r};function Hx(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Wx(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:qx;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 Ac(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 Pc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ac(Object(r),!0).forEach(function(n){Kx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ac(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Kx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Mc={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Qx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Mc,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case sl:case Gi:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Yi:return Hx(e.clientOffset,r.clientOffset)?e:Pc(Pc({},e),{},{clientOffset:r.clientOffset});case Zi:case Xi:return Mc;default:return e}}var ol="dnd-core/ADD_SOURCE",al="dnd-core/ADD_TARGET",ll="dnd-core/REMOVE_SOURCE",Ji="dnd-core/REMOVE_TARGET";function Gx(e){return{type:ol,payload:{sourceId:e}}}function Yx(e){return{type:al,payload:{targetId:e}}}function Xx(e){return{type:ll,payload:{sourceId:e}}}function Zx(e){return{type:Ji,payload:{targetId:e}}}function Lc(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 Lt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Lc(Object(r),!0).forEach(function(n){Jx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Jx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var eS={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function tS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:eS,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Gi:return Lt(Lt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case il:return Lt(Lt({},e),{},{isSourcePublic:!0});case Yi:return Lt(Lt({},e),{},{targetIds:r.targetIds});case Ji:return e.targetIds.indexOf(r.targetId)===-1?e:Lt(Lt({},e),{},{targetIds:dx(e.targetIds,r.targetId)});case Xi:return Lt(Lt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case Zi:return Lt(Lt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function rS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case ol:case al:return e+1;case ll:case Ji:return e-1;default:return e}}var ji=[],cl=[];ji.__IS_NONE__=!0;cl.__IS_ALL__=!0;function nS(e,t){if(e===ji)return!1;if(e===cl||typeof t>"u")return!0;var r=hx(t,e);return r.length>0}function sS(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Yi:break;case ol:case al:case Ji:case ll:return ji;case Gi:case il:case Zi:case Xi:default:return cl}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=fx(n,i),a=o.length>0||!Wx(n,i);if(!a)return ji;var c=i[i.length-1],d=n[n.length-1];return c!==d&&(c&&o.push(c),d&&o.push(d)),o}function iS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Fc(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 $c(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fc(Object(r),!0).forEach(function(n){oS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function oS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:sS(e.dirtyHandlerIds,{type:t.type,payload:$c($c({},t.payload),{},{prevTargetIds:ux(e,"dragOperation.targetIds",[])})}),dragOffset:Qx(e.dragOffset,t),refCount:rS(e.refCount,t),dragOperation:tS(e.dragOperation,t),stateId:iS(e.stateId)}}function lS(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Xf(e,t){return{x:e.x-t.x,y:e.y-t.y}}function cS(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:Xf(lS(t,n),r)}function uS(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:Xf(t,r)}function dS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fS(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 hS(e,t,r){return t&&fS(e.prototype,t),e}function Bc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var pS=function(){function e(t,r){dS(this,e),Bc(this,"store",void 0),Bc(this,"registry",void 0),this.store=t,this.registry=r}return hS(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;ce(typeof r=="function","listener must be a function."),ce(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var d=n.store.getState(),u=d.stateId;try{var f=u===o||u===o+1&&!nS(d.dirtyHandlerIds,i);f||r()}finally{o=u}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;ce(typeof r=="function","listener must be a function.");var s=this.store.getState().dragOffset,i=function(){var a=n.store.getState().dragOffset;a!==s&&(s=a,r())};return this.store.subscribe(i)}},{key:"canDragSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r);return ce(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(ce(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 ba(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(ce(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),o=this.getItemType();if(o&&!ba(i,o))return!1;var a=this.getTargetIds();if(!a.length)return!1;var c=a.indexOf(r);return s?c===a.length-1:c>-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 cS(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return uS(this.store.getState().dragOffset)}}]),e}(),gS=0;function mS(){return gS++}function pi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?pi=function(r){return typeof r}:pi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},pi(e)}function yS(e){ce(typeof e.canDrag=="function","Expected canDrag to be a function."),ce(typeof e.beginDrag=="function","Expected beginDrag to be a function."),ce(typeof e.endDrag=="function","Expected endDrag to be a function.")}function vS(e){ce(typeof e.canDrop=="function","Expected canDrop to be a function."),ce(typeof e.hover=="function","Expected hover to be a function."),ce(typeof e.drop=="function","Expected beginDrag to be a function.")}function _a(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return _a(r,!1)});return}ce(typeof e=="string"||pi(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 Uc=typeof global<"u"?global:self,Zf=Uc.MutationObserver||Uc.WebKitMutationObserver;function Jf(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function bS(e){let t=1;const r=new Zf(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const _S=typeof Zf=="function"?bS:Jf;class wS{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=_S(this.flush),this.requestErrorThrow=Jf(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class xS{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 SS{create(t){const r=this.freeTasks,n=r.length?r.pop():new xS(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const eh=new wS,CS=new SS(eh.registerPendingError);function OS(e){eh.enqueueTask(CS.create(e))}function ES(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function DS(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 IS(e,t,r){return t&&DS(e.prototype,t),e}function hn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function NS(e,t){return kS(e)||RS(e,t)||jS(e,t)||TS()}function TS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
457
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jS(e,t){if(e){if(typeof e=="string")return Vc(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 Vc(e,t)}}function Vc(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 RS(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function kS(e){if(Array.isArray(e))return e}function AS(e){var t=mS().toString();switch(e){case Ut.SOURCE:return"S".concat(t);case Ut.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function zc(e){switch(e[0]){case"S":return Ut.SOURCE;case"T":return Ut.TARGET;default:ce(!1,"Cannot parse handler ID: ".concat(e))}}function qc(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=NS(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var PS=function(){function e(t){ES(this,e),hn(this,"types",new Map),hn(this,"dragSources",new Map),hn(this,"dropTargets",new Map),hn(this,"pinnedSourceId",null),hn(this,"pinnedSource",null),hn(this,"store",void 0),this.store=t}return IS(e,[{key:"addSource",value:function(r,n){_a(r),yS(n);var s=this.addHandler(Ut.SOURCE,r,n);return this.store.dispatch(Gx(s)),s}},{key:"addTarget",value:function(r,n){_a(r,!0),vS(n);var s=this.addHandler(Ut.TARGET,r,n);return this.store.dispatch(Yx(s)),s}},{key:"containsHandler",value:function(r){return qc(this.dragSources,r)||qc(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;ce(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 ce(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return ce(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return ce(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=zc(r);return n===Ut.SOURCE}},{key:"isTargetId",value:function(r){var n=zc(r);return n===Ut.TARGET}},{key:"removeSource",value:function(r){var n=this;ce(this.getSource(r),"Expected an existing source."),this.store.dispatch(Xx(r)),OS(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){ce(this.getTarget(r),"Expected an existing target."),this.store.dispatch(Zx(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);ce(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){ce(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=AS(r);return this.types.set(i,n),r===Ut.SOURCE?this.dragSources.set(i,s):r===Ut.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function MS(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=LS(n),i=new pS(s,new PS(s)),o=new Fx(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function LS(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Yf(aS,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var FS=["children"];function $S(e,t){return zS(e)||VS(e,t)||US(e,t)||BS()}function BS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
458
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function US(e,t){if(e){if(typeof e=="string")return Hc(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 Hc(e,t)}}function Hc(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 VS(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function zS(e){if(Array.isArray(e))return e}function qS(e,t){if(e==null)return{};var r=HS(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 HS(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 Wc=0,gi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),WS=p.memo(function(t){var r=t.children,n=qS(t,FS),s=KS(n),i=$S(s,2),o=i[0],a=i[1];return p.useEffect(function(){if(a){var c=th();return++Wc,function(){--Wc===0&&(c[gi]=null)}}},[]),l.jsx(Qf.Provider,Object.assign({value:o},{children:r}),void 0)});function KS(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=QS(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function QS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:th(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[gi]||(s[gi]={dragDropManager:MS(e,t,r,n)}),s[gi]}function th(){return typeof global<"u"?global:window}function GS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function YS(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 XS(e,t,r){return t&&YS(e.prototype,t),e}function Kc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var So=!1,Co=!1,ZS=function(){function e(t){GS(this,e),Kc(this,"internalMonitor",void 0),Kc(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return XS(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){ce(!So,"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 So=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{So=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;ce(!Co,"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 Co=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Co=!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 JS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function eC(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 tC(e,t,r){return t&&eC(e.prototype,t),e}function Qc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Oo=!1,rC=function(){function e(t){JS(this,e),Qc(this,"internalMonitor",void 0),Qc(this,"targetId",null),this.internalMonitor=t.getMonitor()}return tC(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;ce(!Oo,"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 Oo=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Oo=!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 nC(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 sC(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(!p.isValidElement(t)){var n=t;return e(n,r),n}var s=t;nC(s);var i=r?function(o){return e(o,r)}:e;return iC(s,i)}}function rh(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=sC(n);t[r]=function(){return s}}}),t}function Gc(e,t){typeof e=="function"?e(t):e.current=t}function iC(e,t){var r=e.ref;return ce(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?p.cloneElement(e,{ref:function(s){Gc(r,s),Gc(t,s)}}):p.cloneElement(e,{ref:t})}function mi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?mi=function(r){return typeof r}:mi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},mi(e)}function wa(e){return e!==null&&mi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function xa(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),o=Object.keys(t);if(i.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c<i.length;c++){var d=i[c];if(!a(d))return!1;var u=e[d],f=t[d];if(s=void 0,s===!1||s===void 0&&u!==f)return!1}return!0}function oC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aC(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 lC(e,t,r){return t&&aC(e.prototype,t),e}function dt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var cC=function(){function e(t){var r=this;oC(this,e),dt(this,"hooks",rh({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,wa(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,wa(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),dt(this,"handlerId",null),dt(this,"dragSourceRef",null),dt(this,"dragSourceNode",void 0),dt(this,"dragSourceOptionsInternal",null),dt(this,"dragSourceUnsubscribe",void 0),dt(this,"dragPreviewRef",null),dt(this,"dragPreviewNode",void 0),dt(this,"dragPreviewOptionsInternal",null),dt(this,"dragPreviewUnsubscribe",void 0),dt(this,"lastConnectedHandlerId",null),dt(this,"lastConnectedDragSource",null),dt(this,"lastConnectedDragSourceOptions",null),dt(this,"lastConnectedDragPreview",null),dt(this,"lastConnectedDragPreviewOptions",null),dt(this,"backend",void 0),this.backend=t}return lC(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!xa(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!xa(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 uC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dC(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 fC(e,t,r){return t&&dC(e.prototype,t),e}function Jt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var hC=function(){function e(t){var r=this;uC(this,e),Jt(this,"hooks",rh({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,wa(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),Jt(this,"handlerId",null),Jt(this,"dropTargetRef",null),Jt(this,"dropTargetNode",void 0),Jt(this,"dropTargetOptionsInternal",null),Jt(this,"unsubscribeDropTarget",void 0),Jt(this,"lastConnectedHandlerId",null),Jt(this,"lastConnectedDropTarget",null),Jt(this,"lastConnectedDropTargetOptions",null),Jt(this,"backend",void 0),this.backend=t}return fC(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!xa(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 pC(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function gC(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var sn=typeof window<"u"?p.useLayoutEffect:p.useEffect;function yi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?yi=function(r){return typeof r}:yi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},yi(e)}function mC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yC(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 vC(e,t,r){return t&&yC(e.prototype,t),e}function Eo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var bC=function(){function e(t,r,n){mC(this,e),Eo(this,"spec",void 0),Eo(this,"monitor",void 0),Eo(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return vC(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return yi(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,o=s.isDragging;return o?o(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 _C(e,t,r){var n=p.useMemo(function(){return new bC(e,t,r)},[t,r]);return p.useEffect(function(){n.spec=e},[e]),n}function an(){var e=p.useContext(Qf),t=e.dragDropManager;return ce(t!=null,"Expected drag drop context"),t}function wC(e){return p.useMemo(function(){var t=e.type;return ce(t!=null,"spec.type must be defined"),t},[e])}function xC(e,t){return EC(e)||OC(e,t)||CC(e,t)||SC()}function SC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
459
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CC(e,t){if(e){if(typeof e=="string")return Yc(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 Yc(e,t)}}function Yc(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 OC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function EC(e){if(Array.isArray(e))return e}function DC(e,t,r){var n=an(),s=_C(e,t,r),i=wC(e);sn(function(){if(i!=null){var a=gC(i,s,n),c=xC(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u}},[n,t,r,s,i])}function IC(e){return RC(e)||jC(e)||TC(e)||NC()}function NC(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
460
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TC(e,t){if(e){if(typeof e=="string")return Sa(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 Sa(e,t)}}function jC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function RC(e){if(Array.isArray(e))return Sa(e)}function Sa(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 nh(e,t){var r=IC(t||[]);return t==null&&typeof e!="function"&&r.push(e),p.useMemo(function(){return typeof e=="function"?e():e},r)}function kC(){var e=an();return p.useMemo(function(){return new ZS(e)},[e])}function AC(e,t){var r=an(),n=p.useMemo(function(){return new cC(r.getBackend())},[r]);return sn(function(){return n.dragSourceOptions=e||null,n.reconnect(),function(){return n.disconnectDragSource()}},[n,e]),sn(function(){return n.dragPreviewOptions=t||null,n.reconnect(),function(){return n.disconnectDragPreview()}},[n,t]),n}var PC=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 o=i[s];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r};const MC=Kd(PC);function LC(e,t){return UC(e)||BC(e,t)||$C(e,t)||FC()}function FC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
461
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $C(e,t){if(e){if(typeof e=="string")return Xc(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 Xc(e,t)}}function Xc(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 BC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function UC(e){if(Array.isArray(e))return e}function sh(e,t,r){var n=p.useState(function(){return t(e)}),s=LC(n,2),i=s[0],o=s[1],a=p.useCallback(function(){var c=t(e);MC(i,c)||(o(c),r&&r())},[i,e,r]);return sn(a),[i,a]}function VC(e,t){return WC(e)||HC(e,t)||qC(e,t)||zC()}function zC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
462
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qC(e,t){if(e){if(typeof e=="string")return Zc(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 Zc(e,t)}}function Zc(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 HC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function WC(e){if(Array.isArray(e))return e}function KC(e,t,r){var n=sh(e,t,r),s=VC(n,2),i=s[0],o=s[1];return sn(function(){var c=e.getHandlerId();if(c!=null)return e.subscribeToStateChange(o,{handlerIds:[c]})},[e,o]),i}function ih(e,t,r){return KC(t,e||function(){return{}},function(){return r.reconnect()})}function QC(e){return p.useMemo(function(){return e.hooks.dragSource()},[e])}function GC(e){return p.useMemo(function(){return e.hooks.dragPreview()},[e])}function YC(e,t){var r=nh(e,t);ce(!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=kC(),s=AC(r.options,r.previewOptions);return DC(r,n,s),[ih(r.collect,n,s),QC(s),GC(s)]}function XC(e){var t=e.accept;return p.useMemo(function(){return ce(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function ZC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function JC(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 e0(e,t,r){return t&&JC(e.prototype,t),e}function Jc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var t0=function(){function e(t,r){ZC(this,e),Jc(this,"spec",void 0),Jc(this,"monitor",void 0),this.spec=t,this.monitor=r}return e0(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 r0(e,t){var r=p.useMemo(function(){return new t0(e,t)},[t]);return p.useEffect(function(){r.spec=e},[e]),r}function n0(e,t){return a0(e)||o0(e,t)||i0(e,t)||s0()}function s0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
463
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i0(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 o0(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function a0(e){if(Array.isArray(e))return e}function l0(e,t,r){var n=an(),s=r0(e,t),i=XC(e);sn(function(){var a=pC(i,s,n),c=n0(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u},[n,t,s,r,i.map(function(o){return o.toString()}).join("|")])}function c0(){var e=an();return p.useMemo(function(){return new rC(e)},[e])}function u0(e){var t=an(),r=p.useMemo(function(){return new hC(t.getBackend())},[t]);return sn(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function d0(e){return p.useMemo(function(){return e.hooks.dropTarget()},[e])}function oh(e,t){var r=nh(e,t),n=c0(),s=u0(r.options);return l0(r,n,s),[ih(r.collect,n,s),d0(s)]}function f0(e,t){return m0(e)||g0(e,t)||p0(e,t)||h0()}function h0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
464
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function p0(e,t){if(e){if(typeof e=="string")return tu(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 tu(e,t)}}function tu(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 g0(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function m0(e){if(Array.isArray(e))return e}function y0(e){var t=an(),r=t.getMonitor(),n=sh(r,e),s=f0(n,2),i=s[0],o=s[1];return p.useEffect(function(){return r.subscribeToOffsetChange(o)}),p.useEffect(function(){return r.subscribeToStateChange(o)}),i}function ah(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function v0(e,t){return e.filter(function(r){return r!==t})}function b0(e,t){var r=new Set,n=function(o){return r.add(o)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i){return s.push(i)}),s}function _0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w0(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 x0(e,t,r){return t&&w0(e.prototype,t),e}function ru(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var S0=function(){function e(t){_0(this,e),ru(this,"entered",[]),ru(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return x0(e,[{key:"enter",value:function(r){var n=this,s=this.entered.length,i=function(a){return n.isNodeInDocument(a)&&(!a.contains||a.contains(r))};return this.entered=b0(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=v0(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),C0=ah(function(){return/firefox/i.test(navigator.userAgent)}),lh=ah(function(){return!!window.safari});function O0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E0(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 D0(e,t,r){return t&&E0(e.prototype,t),e}function Xn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var nu=function(){function e(t,r){O0(this,e),Xn(this,"xs",void 0),Xn(this,"ys",void 0),Xn(this,"c1s",void 0),Xn(this,"c2s",void 0),Xn(this,"c3s",void 0);for(var n=t.length,s=[],i=0;i<n;i++)s.push(i);s.sort(function(k,$){return t[k]<t[$]?-1:1});for(var o=[],a=[],c,d,u=0;u<n-1;u++)c=t[u+1]-t[u],d=r[u+1]-r[u],o.push(c),a.push(d/c);for(var f=[a[0]],m=0;m<o.length-1;m++){var g=a[m],_=a[m+1];if(g*_<=0)f.push(0);else{c=o[m];var h=o[m+1],y=c+h;f.push(3*y/((y+h)/g+(y+c)/_))}}f.push(a[a.length-1]);for(var v=[],b=[],x,w=0;w<f.length-1;w++){x=a[w];var C=f[w],D=1/o[w],j=C+f[w+1]-x-x;v.push((x-C-j)*D),b.push(j*D*D)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=v,this.c3s=b}return D0(e,[{key:"interpolate",value:function(r){var n=this.xs,s=this.ys,i=this.c1s,o=this.c2s,a=this.c3s,c=n.length-1;if(r===n[c])return s[c];for(var d=0,u=a.length-1,f;d<=u;){f=Math.floor(.5*(d+u));var m=n[f];if(m<r)d=f+1;else if(m>r)u=f-1;else return s[f]}c=Math.max(0,u);var g=r-n[c],_=g*g;return s[c]+i[c]*g+o[c]*_+a[c]*g*_}}]),e}(),I0=1;function ch(e){var t=e.nodeType===I0?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function Qs(e){return{x:e.clientX,y:e.clientY}}function N0(e){var t;return e.nodeName==="IMG"&&(C0()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function T0(e,t,r,n){var s=e?t.width:r,i=e?t.height:n;return lh()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function j0(e,t,r,n,s){var i=N0(t),o=i?e:t,a=ch(o),c={x:r.x-a.x,y:r.y-a.y},d=e.offsetWidth,u=e.offsetHeight,f=n.anchorX,m=n.anchorY,g=T0(i,t,d,u),_=g.dragPreviewWidth,h=g.dragPreviewHeight,y=function(){var j=new nu([0,.5,1],[c.y,c.y/u*h,c.y+h-u]),k=j.interpolate(m);return lh()&&i&&(k+=(window.devicePixelRatio-1)*h),k},v=function(){var j=new nu([0,.5,1],[c.x,c.x/d*_,c.x+_-d]);return j.interpolate(f)},b=s.offsetX,x=s.offsetY,w=b===0||b,C=x===0||x;return{x:w?b:v(),y:C?x:y()}}var uh="__NATIVE_FILE__",dh="__NATIVE_URL__",fh="__NATIVE_TEXT__",hh="__NATIVE_HTML__";const su=Object.freeze(Object.defineProperty({__proto__:null,FILE:uh,HTML:hh,TEXT:fh,URL:dh},Symbol.toStringTag,{value:"Module"}));function Do(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var pn;function Gs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ca=(pn={},Gs(pn,uh,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Gs(pn,hh,{exposeProperties:{html:function(t,r){return Do(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Gs(pn,dh,{exposeProperties:{urls:function(t,r){return Do(t,r,"").split(`
465
+ `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Gs(pn,fh,{exposeProperties:{text:function(t,r){return Do(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),pn);function R0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k0(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 A0(e,t,r){return t&&k0(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 P0=function(){function e(t){R0(this,e),iu(this,"item",void 0),iu(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return A0(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 M0(e,t){var r=new P0(Ca[e]);return r.loadDataTransfer(t),r}function Io(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(Ca).filter(function(r){var n=Ca[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function L0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F0(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 $0(e,t,r){return t&&F0(e.prototype,t),e}function No(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var B0=function(){function e(t,r){L0(this,e),No(this,"ownerDocument",null),No(this,"globalContext",void 0),No(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return $0(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 ou(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 au(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ou(Object(r),!0).forEach(function(n){ge(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ou(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function U0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V0(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 z0(e,t,r){return t&&V0(e.prototype,t),e}function ge(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var q0=function(){function e(t,r,n){var s=this;U0(this,e),ge(this,"options",void 0),ge(this,"actions",void 0),ge(this,"monitor",void 0),ge(this,"registry",void 0),ge(this,"enterLeaveCounter",void 0),ge(this,"sourcePreviewNodes",new Map),ge(this,"sourcePreviewNodeOptions",new Map),ge(this,"sourceNodes",new Map),ge(this,"sourceNodeOptions",new Map),ge(this,"dragStartSourceIds",null),ge(this,"dropTargetIds",[]),ge(this,"dragEnterTargetIds",[]),ge(this,"currentNativeSource",null),ge(this,"currentNativeHandle",null),ge(this,"currentDragSourceNode",null),ge(this,"altKeyPressed",!1),ge(this,"mouseMoveTimeoutTimer",null),ge(this,"asyncEndDragFrameId",null),ge(this,"dragOverTargetIds",null),ge(this,"lastClientOffset",null),ge(this,"hoverRafId",null),ge(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&ch(o)||null}),ge(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),ge(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),ge(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),ge(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),ge(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=Qs(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,d=Io(c);if(s.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var u=s.monitor.getSourceId(),f=s.sourceNodes.get(u),m=s.sourcePreviewNodes.get(u)||f;if(m){var g=s.getCurrentSourcePreviewNodeOptions(),_=g.anchorX,h=g.anchorY,y=g.offsetX,v=g.offsetY,b={anchorX:_,anchorY:h},x={offsetX:y,offsetY:v},w=j0(f,m,a,b,x);c.setDragImage(m,w.x,w.y)}}try{c==null||c.setData("application/json",{})}catch{}s.setCurrentDragSourceNode(i.target);var C=s.getCurrentSourcePreviewNodeOptions(),D=C.captureDraggingState;D?s.actions.publishDragSource():setTimeout(function(){return s.actions.publishDragSource()},0)}else if(d)s.beginDragNativeItem(d);else{if(c&&!c.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}}}),ge(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),ge(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=Io(a);c&&s.beginDragNativeItem(c,a)}}),ge(this,"handleTopDragEnter",function(i){var o=s.dragEnterTargetIds;if(s.dragEnterTargetIds=[],!!s.monitor.isDragging()){s.altKeyPressed=i.altKey,o.length>0&&s.actions.hover(o,{clientOffset:Qs(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),ge(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),ge(this,"handleTopDragOver",function(i){var o=s.dragOverTargetIds;if(s.dragOverTargetIds=[],!s.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}s.altKeyPressed=i.altKey,s.lastClientOffset=Qs(i),s.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(s.hoverRafId=requestAnimationFrame(function(){s.monitor.isDragging()&&s.actions.hover(o||[],{clientOffset:s.lastClientOffset}),s.hoverRafId=null}));var a=(o||[]).some(function(c){return s.monitor.canDropOnTarget(c)});a?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect())):s.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))}),ge(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),ge(this,"handleTopDropCapture",function(i){if(s.dropTargetIds=[],s.isDraggingNativeItem()){var o;i.preventDefault(),(o=s.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else Io(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),ge(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:Qs(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),ge(this,"handleSelectStart",function(i){var o=i.target;typeof o.dragDrop=="function"&&(o.tagName==="INPUT"||o.tagName==="SELECT"||o.tagName==="TEXTAREA"||o.isContentEditable||(i.preventDefault(),o.dragDrop()))}),this.options=new B0(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new S0(this.isNodeInDocument)}return z0(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 o=function(d){return i.handleDragStart(d,r)},a=function(d){return i.handleSelectStart(d)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",o),n.addEventListener("selectstart",a),function(){i.sourceNodes.delete(r),i.sourceNodeOptions.delete(r),n.removeEventListener("dragstart",o),n.removeEventListener("selectstart",a),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(r,n){var s=this,i=function(d){return s.handleDragEnter(d,r)},o=function(d){return s.handleDragOver(d,r)},a=function(d){return s.handleDrop(d,r)};return n.addEventListener("dragenter",i),n.addEventListener("dragover",o),n.addEventListener("drop",a),function(){n.removeEventListener("dragenter",i),n.removeEventListener("dragover",o),n.removeEventListener("drop",a)}}},{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 au({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 au({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(su).some(function(n){return su[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=M0(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}(),Ys;function H0(){return Ys||(Ys=new Image,Ys.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Ys}var W0=function(t,r,n){return new q0(t,r,n)};function K0(e,t){return typeof e=="function"?e(t):e??"NODE"}function Q0(e){return e.isDraggable&&!e.isEditing}function G0(e){const t=It(),r=t.selectedIds,[n,s,i]=YC(()=>({canDrag:()=>Q0(e),type:K0(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(Ln.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Ln.dragEnd())}}),[r,e,t.props.dragType]);return p.useEffect(()=>{i(H0())},[i]),s}function Y0(e,t){const r=e.getBoundingClientRect(),n=t.x-Math.round(r.x),s=t.y-Math.round(r.y),i=r.height,o=s<i/2,a=!o,c=i/4,d=s>c&&s<i-c;return{x:n,inTopHalf:o,inBottomHalf:a,inMiddle:d,atTop:!d&&o,atBottom:!d&&a}}function X0(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 Xs(e,t){return{parentId:e||null,index:t}}function gn(e,t){return{type:"line",index:e,level:t}}function Z0(e){return{type:"highlight",id:e}}function To(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=Ff(n)+1;return{parentId:s,index:i}}function ph(e){var t;const r=Y0(e.element,e.offset),n=e.indent,s=Math.round(Math.max(0,r.x-n)/n),{node:i,nextNode:o,prevNode:a}=e,[c,d]=X0(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Xs(i.id,null),cursor:Z0(i.id)};if(!c)return{drop:Xs((t=d==null?void 0:d.parent)===null||t===void 0?void 0:t.id,0),cursor:gn(0,0)};if(Af(c)){const u=ui(s,(d==null?void 0:d.level)||0,c.level);return{drop:To(c,u),cursor:gn(c.rowIndex+1,u)}}if(Pf(c)){const u=ui(s,(d==null?void 0:d.level)||0,c.level);return{drop:To(c,u),cursor:gn(c.rowIndex+1,u)}}if(Mf(c)){const u=ui(s,0,c.level+1);return u>c.level?{drop:Xs(c.id,0),cursor:gn(c.rowIndex+1,u)}:{drop:To(c,u),cursor:gn(c.rowIndex+1,u)}}return{drop:Xs(c==null?void 0:c.id,0),cursor:gn(c.rowIndex+1,c.level+1)}}function J0(e,t){const r=It(),[n,s]=oh(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:d}=ph({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});d&&r.dispatch(Ln.hovering(d.parentId,d.index)),o.canDrop()?c&&r.showCursor(c):r.hideCursor()},drop:(i,o)=>{if(!o.canDrop())return null;r.drop()}}),[t,e.current,r.props]);return s}function e1(e){const t=It(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return p.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const lu=p.memo(function({index:t,style:r}){kf(),vw();const n=It(),s=e1(t),i=p.useRef(null),o=G0(s),a=J0(i,s),c=p.useCallback(h=>{i.current=h,a(h)},[a]),d=n.indent*s.level,u=p.useMemo(()=>({paddingLeft:d}),[d]),f=p.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]),m={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:f,tabIndex:-1,className:n.props.rowClassName};p.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 g=n.renderNode,_=n.renderRow;return l.jsx(_,{node:s,innerRef:c,attrs:m,children:l.jsx(g,{node:s,tree:n,style:u,dragHandle:o})})});let jo="",cu=null;function gh(){kf();const e=It();return l.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 o=i.nextSibling,a=i.parent;e.focus(o||a,{scroll:!1}),e.delete(i)}}return}if(t.key==="Tab"&&!t.shiftKey){t.preventDefault(),$f(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),Bf(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),jo+=t.key,cu=setTimeout(()=>{jo=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(jo):!1});n&&e.focus(n.id)},children:l.jsx(t1,{})})}function t1(){var e,t;const r=It(),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:ox,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:cx,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(rx,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:lu})):l.jsx(nx,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:lu}))}function uu(e){return e.isFiltered?n1(e.root,e.isMatch.bind(e)):r1(e.root)}function r1(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(mh),t}function n1(e,t){const r={},n=[];function s(o){if(!o.isRoot&&t(o)){r[o.id]=!0;let c=o.parent;for(;c;)r[c.id]=!0,c=c.parent}if(o.children)for(let c of o.children)s(c)}function i(o){var a;o.level>=0&&r[o.id]&&n.push(o),o.isOpen&&((a=o.children)===null||a===void 0||a.forEach(i))}return s(e),i(e),n.forEach(mh),n}function mh(e,t){e.rowIndex=t}const du=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var Ro=function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{d(n.next(u))}catch(f){o(f)}}function c(u){try{d(n.throw(u))}catch(f){o(f)}}function d(u){u.done?i(u.value):s(u.value).then(a,c)}d((n=n.apply(e,t||[])).next())})};const{safeRun:ft}=Sw;class ds{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 o=this.props.rowHeight;if(typeof o=="function"){const a=this.at(i);return a?o(a):this.rowHeight}return o??24},this.rowTopPosition=i=>{if(typeof this.props.rowHeight!="function")return i*this.rowHeight;const o=this.getRowOffsets(),a=Math.max(0,Math.min(i,o.length-1));return o[a]},this.redrawList=(i=0)=>{this.rowOffsets=null;const o=this.list.current;o&&"resetAfterIndex"in o&&o.resetAfterIndex(Math.max(0,i))},this.root=bc(this),this.visibleNodes=uu(this),this.idToIndex=du(this.visibleNodes)}update(t){this.props=t,this.root=bc(this),this.visibleNodes=uu(this),this.idToIndex=du(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=is(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=is(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 ws)return t.id;const r=this.props.idAccessor||"id";return is(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 o=Math.min(s,i),a=Math.max(s,i);return this.visibleNodes.slice(o,a+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 Ro(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?qf(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:zf(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield ft(this.props.onCreate,{type:o,parentId:s,index:i,parentNode:this.get(s)});a&&(this.focus(a),setTimeout(()=>{this.edit(a).then(()=>{this.select(a),this.activate(a)})}))})}delete(t){return Ro(this,void 0,void 0,function*(){if(!t)return;const n=(Array.isArray(t)?t:[t]).map(o=>this.identify(o)),s=n.map(o=>this.get(o)).filter(o=>!!o),i=s.length?Math.min(...s.map(o=>{var a;return(a=o.rowIndex)!==null&&a!==void 0?a:0})):0;yield ft(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(_o(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=>{ds.editPromise=i})}submit(t,r){return Ro(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield ft(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(_o(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(_o(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&ft(this.props.onActivate,r)}resolveEdit(t){const r=ds.editPromise;r&&r(t),ds.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(un(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&&ft(this.props.onFocus,this.focusedNode)))}pageUp(){var t,r;const n=this.visibleStartIndex,i=this.visibleStopIndex-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o>n?o=n:o=Math.max(n-i,0),this.focus(this.at(o))}pageDown(){var t,r;const n=this.visibleStartIndex,s=this.visibleStopIndex,i=s-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o<s?o=s:o=Math.min(o+i,this.visibleNodes.length-1),this.focus(this.at(o))}select(t,r={}){var n;if(!t)return;const s=r.focus!==!1,i=this.identify(t);s&&this.dispatch(un(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&&ft(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(vr.remove(r)),ft(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(un(n.id)),n.isSelectable&&(this.dispatch(vr.add(n.id)),this.dispatch(vr.anchor(n.id)),this.dispatch(vr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&&ft(this.props.onFocus,this.focusedNode),ft(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(un(n)),!((r=this.get(n))===null||r===void 0)&&r.isSelectable){const{anchor:s,mostRecent:i}=this.state.nodes.selection,o=this.filterSelectableNodes(this.nodesBetween(s,this.identifyNull(n)));this.dispatch(vr.remove(this.nodesBetween(s,i))),this.dispatch(vr.add(o)),this.dispatch(vr.mostRecent(n))}this.scrollTo(n),this.focusedNode&&ft(this.props.onFocus,this.focusedNode),ft(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(un((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&&ft(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(o=>this.identify(o))),s=this.identifyNull(t.anchor),i=this.identifyNull(t.mostRecent);this.dispatch(vr.set({ids:n,anchor:s,mostRecent:i})),ft(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&&Lf(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;ft(this.props.onMove,{dragIds:n,parentId:t===_s?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Ln.cursor({type:"none"}))}showCursor(t){this.dispatch(Ln.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(ma.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),ft(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(ma.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),ft(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=nl(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(){Ti(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Ti(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),Vf(()=>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===_s)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!is(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(un(t.id))}onBlur(){this.dispatch(kw())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||gh}get renderRow(){return this.props.renderRow||Iw}get renderNode(){return this.props.children||Nw}get renderDragPreview(){return this.props.renderDragPreview||Hf}get renderCursor(){return this.props.renderCursor||Dw}}function ht(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 s1=typeof Symbol=="function"&&Symbol.observable||"@@observable",fu=s1,ko=()=>Math.random().toString(36).substring(7).split("").join("."),i1={INIT:`@@redux/INIT${ko()}`,REPLACE:`@@redux/REPLACE${ko()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${ko()}`},tn=i1;function yh(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 o1(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(c1(e))return"date";if(l1(e))return"error";const r=a1(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 a1(e){return typeof e.constructor=="function"?e.constructor.name:null}function l1(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function c1(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function wr(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=o1(e)),t}function vh(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?ht(2):`Expected the root reducer to be a function. Instead, received: '${wr(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?ht(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"?ht(1):`Expected the enhancer to be a function. Instead, received: '${wr(r)}'`);return r(vh)(e,t)}let n=e,s=t,i=new Map,o=i,a=0,c=!1;function d(){o===i&&(o=new Map,i.forEach((y,v)=>{o.set(v,y)}))}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?ht(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 f(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?ht(4):`Expected the listener to be a function. Instead, received: '${wr(y)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?ht(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;d();const b=a++;return o.set(b,y),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?ht(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,d(),o.delete(b),i=null}}}function m(y){if(!yh(y))throw new Error(process.env.NODE_ENV==="production"?ht(7):`Actions must be plain objects. Instead, the actual type was: '${wr(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"?ht(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"?ht(17):`Action "type" property must be a string. Instead, the actual type was: '${wr(y.type)}'. Value was: '${y.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?ht(9):"Reducers may not dispatch actions.");try{c=!0,s=n(s,y)}finally{c=!1}return(i=o).forEach(b=>{b()}),y}function g(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?ht(10):`Expected the nextReducer to be a function. Instead, received: '${wr(y)}`);n=y,m({type:tn.REPLACE})}function _(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(process.env.NODE_ENV==="production"?ht(11):`Expected the observer to be an object. Instead, received: '${wr(v)}'`);function b(){const w=v;w.next&&w.next(u())}return b(),{unsubscribe:y(b)}},[fu](){return this}}}return m({type:tn.INIT}),{dispatch:m,subscribe:f,getState:u,replaceReducer:g,[fu]:_}}function hu(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function u1(e,t,r,n){const s=Object.keys(t),i=r&&r.type===tn.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(!yh(e))return`The ${i} has unexpected type of "${wr(e)}". Expected argument to be an object with the following keys: "${s.join('", "')}"`;const o=Object.keys(e).filter(a=>!t.hasOwnProperty(a)&&!n[a]);if(o.forEach(a=>{n[a]=!0}),!(r&&r.type===tn.REPLACE)&&o.length>0)return`Unexpected ${o.length>1?"keys":"key"} "${o.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${s.join('", "')}". Unexpected keys will be ignored.`}function d1(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:tn.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?ht(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:tn.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?ht(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${tn.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 pu(e){const t=Object.keys(e),r={};for(let o=0;o<t.length;o++){const a=t[o];process.env.NODE_ENV!=="production"&&typeof e[a]>"u"&&hu(`No reducer provided for key "${a}"`),typeof e[a]=="function"&&(r[a]=e[a])}const n=Object.keys(r);let s;process.env.NODE_ENV!=="production"&&(s={});let i;try{d1(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=u1(a,r,c,s);f&&hu(f)}let d=!1;const u={};for(let f=0;f<n.length;f++){const m=n[f],g=r[m],_=a[m],h=g(_,c);if(typeof h>"u"){const y=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?ht(14):`When called with an action of type ${y?`"${String(y)}"`:"(unknown type)"}, the slice reducer for key "${m}" 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.`)}u[m]=h,d=d||h!==_}return d=d||n.length!==Object.keys(a).length,d?u:a}}function f1(e=Mn().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 h1=pu({nodes:pu({focus:Aw,edit:Rw,open:Pw,selection:Mw,drag:f1}),dnd:Lw}),p1=Mn();function g1({treeProps:e,imperativeHandle:t,children:r}){const n=p.useRef(null),s=p.useRef(null),i=p.useRef(vh(h1,Mn(e))),o=yw.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>p1),a=p.useMemo(()=>new ds(i.current,e,n,s),[]),c=p.useRef(0);return p.useMemo(()=>{c.current+=1,a.update(e)},Object.values(e)),p.useMemo(()=>{c.current+=1,a.update(a.props)},[o.nodes.open]),p.useImperativeHandle(t,()=>a),p.useEffect(()=>{a.props.selection?a.select(a.props.selection,{focus:!1}):a.deselectAll()},[a.props.selection]),p.useEffect(()=>{a.props.searchTerm||i.current.dispatch(ma.clear(!0))},[a.props.searchTerm]),l.jsx(Nf.Provider,{value:a,children:l.jsx(Rf.Provider,{value:c.current,children:l.jsx(Tf.Provider,{value:o.nodes,children:l.jsx(jf.Provider,{value:o.dnd,children:l.jsx(WS,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||W0,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function m1(){const e=It(),[,t]=oh(()=>({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:o}=ph({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(Ln.hovering(o.parentId,o.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 y1(e){return m1(),e.children}function v1(){const t=It().props.renderContainer||gh;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function b1(){const e=It(),{offset:t,mouse:r,item:n,isDragging:s}=y0(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||Hf;return l.jsx(i,{offset:t,mouse:r,id:(n==null?void 0:n.id)||null,dragIds:(n==null?void 0:n.dragIds)||[],isDragging:s})}function _1(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 w1{constructor(t,r={}){this.accessors=_1(r),this.root=x1(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 x1(e,t){const r=new bh({},null,t,"ROOT");return r.children=e.map(n=>ul(n,r,t)),r}function ul(e,t,r){const n=new bh(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>ul(i,n,r))),n}class bh{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=ul(t,this,this.accessors);this.children=(n=this.children)!==null&&n!==void 0?n:[],this.children.splice(r,0,i);const o=this.accessors.childrenKey,a=this.data;a[o]=(s=a[o])!==null&&s!==void 0?s:[],a[o].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 S1=0;function C1(e,t={}){const[r,n]=p.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=p.useMemo(()=>new w1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=_=>{for(const h of _.dragIds)o.move({id:h,parentId:_.parentId,index:_.index});n(o.data)},c=({name:_,id:h})=>{o.update({id:h,changes:{name:_}}),n(o.data)},d=typeof s=="string"?s:"id",u=typeof i=="string"?i:"children";return[r,{onMove:a,onRename:c,onCreate:({parentId:_,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={[d]:`simple-tree-id-${S1++}`,name:""};return y==="internal"&&(v[u]=[]),o.create({parentId:_,index:h,data:v}),n(o.data),v},onDelete:_=>{_.ids.forEach(h=>o.drop({id:h})),n(o.data)}}]}function O1(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.
466
+ Use the data prop if you want to provide your own handlers.`);if(e.initialData){const[t,r]=C1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function E1(e,t){const r=O1(e);return l.jsxs(g1,{treeProps:r,imperativeHandle:t,children:[l.jsx(y1,{children:l.jsx(v1,{})}),l.jsx(b1,{})]})}const D1=p.forwardRef(E1);function dl(){return Re(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 I1(){return Re(e=>{var s;if(!e.selectedNodeId)return!1;const t=(s=e.treeData[0])==null?void 0:s.id,r=i=>{var o;for(const a of i){if(a.id===e.selectedNodeId)return a;if((o=a.children)!=null&&o.length){const c=r(a.children);if(c)return c}}},n=r(e.treeData);return!!(n!=null&&n.isFolder)&&n.id!==t})}const gu={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},mu={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},yu=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],N1=[{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 T1(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 eo(e){const t=T1(e);return{key:t,color:gu[t]??gu.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:mu[t]??mu.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const j1="_row_i3qt2_1",R1="_grip_i3qt2_16",k1="_menuBtn_i3qt2_19",A1="_selected_i3qt2_23",P1="_title_i3qt2_28",M1="_dropTarget_i3qt2_33",L1="_toggle_i3qt2_50",F1="_ctIcon_i3qt2_65",$1="_folderIcon_i3qt2_77",B1="_renameInput_i3qt2_92",U1="_dropHere_i3qt2_101",V1="_menuWrap_i3qt2_111",z1="_menu_i3qt2_19",q1="_dangerItem_i3qt2_163",Ct={row:j1,grip:R1,menuBtn:k1,selected:A1,title:P1,dropTarget:M1,toggle:L1,ctIcon:F1,folderIcon:$1,renameInput:B1,dropHere:U1,menuWrap:V1,menu:z1,dangerItem:q1},H1={video:Qa,pdf:za,h5p:qa,scorm:Wa,audio:Ha,quiz:Va,default:Vn},W1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=p.useState(!1),[o,a]=p.useState(!1),[c,d]=p.useState(e.data.name),u=p.useRef(null),f=n==="edit",m=dl(),g=eo(e.data),_=H1[g.key]??Vn,h=e.isSelected,y=e.level===0,v=e.data.isFolder??(e.children&&e.children.length>0),b=y?sy:v?cy:_;p.useEffect(()=>{if(!s)return;const C=D=>{var j;(j=u.current)!=null&&j.contains(D.target)||i(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[s]);const x=p.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),w=p.useCallback(C=>{C.key==="Enter"&&x(),C.key==="Escape"&&(d(e.data.name),a(!1))},[x,e.data.name]);return l.jsxs("div",{className:[Ct.row,h?Ct.selected:"",e.state.isOver&&v?Ct.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":v?"true":void 0,role:"treeitem","aria-selected":h,"aria-expanded":v?!e.isClosed:void 0,children:[f&&l.jsx("span",{ref:r,className:Ct.grip,"aria-hidden":"true",children:l.jsx(Hd,{size:14})}),l.jsx("button",{className:Ct.toggle,onClick:C=>{C.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:v?"visible":"hidden"},children:e.isClosed?l.jsx(Ud,{size:14}):l.jsx(ks,{size:14})}),l.jsx("span",{className:`${Ct.ctIcon} ${y||v?Ct.folderIcon:g.bgClass}`,"aria-hidden":"true",children:l.jsx(b,{size:12})}),o?l.jsx("input",{className:Ct.renameInput,value:c,autoFocus:!0,onChange:C=>d(C.target.value),onBlur:x,onKeyDown:w,onClick:C=>C.stopPropagation()}):l.jsx("span",{className:Ct.title,title:e.data.name,onDoubleClick:()=>f&&a(!0),children:e.data.name.length>25?`${e.data.name.slice(0,25)}...`:e.data.name}),e.state.isOver&&v&&l.jsx("span",{className:Ct.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:Ct.menuWrap,ref:u,children:[l.jsx("button",{className:Ct.menuBtn,onClick:C=>{C.stopPropagation(),i(D=>!D)},"aria-label":"Node options",children:l.jsx(zd,{size:14})}),s&&l.jsxs("div",{className:Ct.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(gy,{size:13})," Rename"]}),v&&m&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(qd,{size:13})," Add sub-unit"]}),e.data.parent&&m&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[l.jsx(As,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:Ct.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(Ka,{size:13})," Delete"]})]})]})]})};async function K1(e,t){var i,o;const n=((i=(await Me.post(`/action/content/v3/upload/url/${e}?type=hierarchy`,{request:{content:{fileName:t}}})).data)==null?void 0:i.result)??{},s=((o=n.content)==null?void 0:o.preSignedURL)??n.pre_signed_url??n.preSignedUrl;if(!s)throw new Error("Could not obtain an upload URL");return s}async function Q1(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 G1(e,t){var a;const r=await K1(e,t.name),n=await Q1(r,t),s=new FormData;return s.append("fileUrl",n),s.append("mimeType",t.type||"text/csv"),{processId:(((a=(await Me.post(`/action/collection/v1/import/${e}`,s)).data)==null?void 0:a.result)??{}).processId??""}}async function Y1(e){var r;return((r=(await Me.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function _h(e){var n,s,i;const r=(i=(s=(n=(await Me.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 X1(e){return _h(e)}const Z1="_container_jr3ij_1",J1="_header_jr3ij_13",eO="_title_jr3ij_22",tO="_closeBtn_jr3ij_29",rO="_body_jr3ij_45",nO="_dropZone_jr3ij_54",sO="_dragOver_jr3ij_67",iO="_hasFile_jr3ij_72",oO="_hiddenInput_jr3ij_78",aO="_fileInfo_jr3ij_82",lO="_fileIcon_jr3ij_89",cO="_fileName_jr3ij_93",uO="_fileSize_jr3ij_100",dO="_dropHint_jr3ij_105",fO="_dropIcon_jr3ij_112",hO="_dropText_jr3ij_117",pO="_dropSubtext_jr3ij_124",gO="_sampleLink_jr3ij_130",mO="_statusBar_jr3ij_145",yO="_status_uploading_jr3ij_154",vO="_status_processing_jr3ij_154",bO="_status_done_jr3ij_159",_O="_status_error_jr3ij_164",wO="_successDetail_jr3ij_170",xO="_spinner_jr3ij_175",SO="_spin_jr3ij_175",CO="_errorMsg_jr3ij_191",OO="_failedSection_jr3ij_197",EO="_failedTitle_jr3ij_203",DO="_tableWrap_jr3ij_213",IO="_failedTable_jr3ij_219",NO="_reasonCell_jr3ij_244",TO="_footer_jr3ij_248",Ee={container:Z1,header:J1,title:eO,closeBtn:tO,body:rO,dropZone:nO,dragOver:sO,hasFile:iO,hiddenInput:oO,fileInfo:aO,fileIcon:lO,fileName:cO,fileSize:uO,dropHint:dO,dropIcon:fO,dropText:hO,dropSubtext:pO,sampleLink:gO,statusBar:mO,status_uploading:yO,status_processing:vO,status_done:bO,status_error:_O,successDetail:wO,spinner:xO,spin:SO,errorMsg:CO,failedSection:OO,failedTitle:EO,tableWrap:DO,failedTable:IO,reasonCell:NO,footer:TO},jO=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,d]=p.useState("idle"),[u,f]=p.useState(""),[m,g]=p.useState([]),[_,h]=p.useState(null),y=p.useRef(null),v=p.useRef(null),b=p.useCallback(()=>{v.current!==null&&(clearInterval(v.current),v.current=null)},[]);p.useEffect(()=>()=>b(),[b]);const x=N=>N.name.toLowerCase().endsWith(".csv")?N.size>50*1024*1024?(f("File size must not exceed 50 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=p.useCallback(N=>{f(""),g([]),h(null),d("idle"),x(N)&&i(N)},[]),C=p.useCallback(N=>{N.preventDefault(),a(!1);const A=N.dataTransfer.files[0];A&&w(A)},[w]),D=p.useCallback(N=>{var U;const A=(U=N.target.files)==null?void 0:U[0];A&&w(A),N.target.value=""},[w]),j=p.useCallback(async()=>{try{const N=await X1(e),A=document.createElement("a");A.href=N,A.download="sample_hierarchy.csv",A.target="_blank",A.click()}catch{f("Failed to download sample CSV.")}},[e]),k=p.useCallback(async()=>{if(s){d("uploading"),f(""),g([]);try{const{processId:N}=await G1(e,s);if(!N){d("done"),h(null),setTimeout(t,1500);return}d("processing"),v.current=setInterval(async()=>{try{const A=await Y1(N);A.status==="COMPLETED"?(b(),d("done"),h(A.successCount??null),A.failedRecords&&A.failedRecords.length>0?g(A.failedRecords):setTimeout(t,1500)):A.status==="FAILED"&&(b(),d("error"),f("Upload processing failed. Please check the error rows below."),A.failedRecords&&g(A.failedRecords))}catch{b(),d("error"),f("Lost connection while checking status. Please try again.")}},2e3)}catch{d("error"),f("Upload failed. Please check your file and try again.")}}},[e,s,t,b]),$={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:Ee.container,children:[l.jsxs("div",{className:Ee.header,children:[l.jsx("h2",{className:Ee.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:Ee.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ee.body,children:[l.jsxs("div",{className:`${Ee.dropZone} ${o?Ee.dragOver:""} ${s?Ee.hasFile:""}`,onDragEnter:N=>{N.preventDefault(),a(!0)},onDragOver:N=>{N.preventDefault(),a(!0)},onDragLeave:N=>{N.preventDefault(),a(!1)},onDrop:C,onClick:()=>{var N;return(N=y.current)==null?void 0:N.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:N=>{var A;return N.key==="Enter"&&((A=y.current)==null?void 0:A.click())},children:[l.jsx("input",{ref:y,type:"file",accept:".csv",className:Ee.hiddenInput,onChange:D,"aria-hidden":"true"}),s?l.jsxs("div",{className:Ee.fileInfo,children:[l.jsx("span",{className:Ee.fileIcon,children:"📄"}),l.jsx("span",{className:Ee.fileName,children:s.name}),l.jsxs("span",{className:Ee.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:Ee.dropHint,children:[l.jsx("span",{className:Ee.dropIcon,children:"⬆️"}),l.jsx("p",{className:Ee.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:Ee.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:Ee.sampleLink,onClick:j,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${Ee.statusBar} ${Ee[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:Ee.spinner,"aria-hidden":"true"}),$[c],c==="done"&&_!==null&&l.jsxs("span",{className:Ee.successDetail,children:[" — ",_," item(s) imported"]})]}),u&&l.jsx("p",{className:Ee.errorMsg,role:"alert",children:u}),m.length>0&&l.jsxs("div",{className:Ee.failedSection,children:[l.jsxs("h4",{className:Ee.failedTitle,children:["Failed Rows (",m.length,")"]}),l.jsx("div",{className:Ee.tableWrap,children:l.jsxs("table",{className:Ee.failedTable,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Row"}),l.jsx("th",{children:"Name"}),l.jsx("th",{children:"Reason"})]})}),l.jsx("tbody",{children:m.map((N,A)=>l.jsxs("tr",{children:[l.jsx("td",{children:N.rowNumber??A+1}),l.jsx("td",{children:N.name??"—"}),l.jsx("td",{className:Ee.reasonCell,children:N.reason??"Unknown error"})]},A))})]})})]})]}),l.jsxs("div",{className:Ee.footer,children:[l.jsx(Ie,{variant:"ghost",onClick:r,disabled:c==="uploading"||c==="processing",children:"Cancel"}),l.jsx(Ie,{variant:"primary",isLoading:c==="uploading"||c==="processing",disabled:!s||c==="done",onClick:k,children:c==="done"?"Uploaded":"Upload"})]})]})},RO="_container_1y30m_1",kO="_header_1y30m_8",AO="_headerActions_1y30m_19",PO="_iconBtn_1y30m_25",MO="_menuWrap_1y30m_43",LO="_dropdownMenu_1y30m_47",FO="_treeWrapper_1y30m_79",$O="_csvModal_1y30m_95",BO="_footer_1y30m_105",er={container:RO,header:kO,headerActions:AO,iconBtn:PO,menuWrap:MO,dropdownMenu:LO,treeWrapper:FO,csvModal:$O,footer:BO},UO=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var be;const n=p.useRef(null),s=p.useRef(null),i=p.useRef(null),[o,a]=p.useState(400),[c,d]=p.useState(!1),[u,f]=p.useState(!1),[m,g]=p.useState("create"),{treeData:_,selectedNodeId:h,selectNode:y,addNode:v,deleteNode:b,reorderChildren:x,moveNode:w,setTreeData:C}=Re(),D=e==="edit",j=dl(),k=D&&j,$=(((be=_[0])==null?void 0:be.children)??[]).some(K=>K.isFolder),N=ue(K=>{var M,G,P,Y;return((G=(M=K.editorConfig)==null?void 0:M.context)==null?void 0:G.contentId)??((Y=(P=K.editorConfig)==null?void 0:P.context)==null?void 0:Y.identifier)??""}),A=ue(K=>{var G,P;const M=(P=(G=K.categoryMeta)==null?void 0:G.sourcingSettings)==null?void 0:P.collection;return(M==null?void 0:M.enableBulkUpload)!==!1});p.useEffect(()=>{const K=s.current;if(!K)return;const M=new ResizeObserver(()=>{a(K.clientHeight||400)});return M.observe(K),a(K.clientHeight||400),()=>M.disconnect()},[]),p.useEffect(()=>{if(!c)return;const K=M=>{var G;(G=i.current)!=null&&G.contains(M.target)||d(!1)};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[c]);const U=p.useCallback(K=>{K.length>0&&y(K[0].data.id)},[y]),R=p.useCallback(({parentId:K,index:M,dragIds:G})=>{if(!K)return;const P=G[0],Y=Oa(_,P);if(!Y)return;const W=Y.parent;if(W===K){const oe=Oa(_,K);if(!(oe!=null&&oe.children))return;const pe=oe.children.findIndex(Ne=>Ne.id===P);if(pe<0)return;x(K,pe,M>pe?M-1:M)}else w(P,W??"",K)},[_,x,w]),B=p.useCallback(({ids:K})=>{K.forEach(M=>b(M))},[b]),F=p.useCallback(({parentId:K})=>{var P;const M=K??((P=_[0])==null?void 0:P.id)??"";if(!M)return{id:crypto.randomUUID()};const G=v(M,"unit");return G?{id:G}:(Se.error("Maximum depth reached"),{id:crypto.randomUUID()})},[v,_]),J=p.useCallback(()=>{var M;const K=(M=_[0])==null?void 0:M.id;K&&(v(K,"unit")||Se.error("Maximum depth reached"))},[_,v]),ie=p.useCallback(()=>{h&&(v(h,"subunit")||Se.error("Maximum depth reached"))},[h,v]),me=p.useCallback(async()=>{if(d(!1),!!N)try{const K=await _h(N),M=await fetch(K).then(Y=>Y.blob()),G=URL.createObjectURL(M),P=document.createElement("a");P.href=G,P.download=`${N}-folders.csv`,P.style.display="none",document.body.appendChild(P),P.click(),document.body.removeChild(P),URL.revokeObjectURL(G)}catch{Se.error("Failed to download CSV")}},[N]),ve=p.useCallback(async()=>{if(f(!1),!!N)try{const{rootNode:K}=await If(N);C([K]),Se.success("Course outline refreshed.")}catch{Se.error("Outline could not be refreshed automatically. Please reload the page.")}},[N,C]);return l.jsxs("div",{className:er.container,children:[l.jsx("div",{className:er.header,children:l.jsxs("div",{className:er.headerActions,children:[D&&l.jsxs("div",{className:er.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:er.iconBtn,onClick:()=>d(K=>!K),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(zd,{size:15})}),c&&l.jsx("div",{className:er.dropdownMenu,role:"menu",children:A&&l.jsxs(l.Fragment,{children:[l.jsx("button",{role:"menuitem",type:"button",disabled:$,title:$?'Folders already exist — use "Update" instead':void 0,onClick:()=>{d(!1),g("create"),f(!0)},children:"Create folders using csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!$,title:$?void 0:'No folders yet — use "Create" first',onClick:me,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!$,title:$?void 0:'No folders yet — use "Create" first',onClick:()=>{d(!1),g("update"),f(!0)},children:"Update folder metadata using csv file"})]})})]}),r&&l.jsx("button",{type:"button",className:er.iconBtn,onClick:r,"aria-label":t?"Expand outline":"Collapse outline",title:t?"Expand outline":"Collapse outline",children:t?l.jsx(hy,{size:15}):l.jsx(fy,{size:15})})]})}),l.jsx("div",{className:er.treeWrapper,ref:s,children:l.jsx(D1,{ref:n,data:_,idAccessor:"id",childrenAccessor:"children",onSelect:U,onMove:D?R:void 0,onDelete:D?B:void 0,onCreate:D?F:void 0,disableEdit:!D,disableDrop:!D,selection:h??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:K=>l.jsx(W1,{...K,editorMode:e})})}),D&&l.jsxs("div",{className:er.footer,children:[l.jsxs(Ie,{variant:"ghost",size:"sm",onClick:J,disabled:!k,children:[l.jsx(As,{size:14})," Add Unit"]}),l.jsxs(Ie,{variant:"ghost",size:"sm",onClick:ie,disabled:!k||!h,children:[l.jsx(qd,{size:14})," Add Sub-unit"]})]}),u&&l.jsx("div",{className:er.csvModal,children:l.jsx(jO,{contentId:N,mode:m,onComplete:ve,onClose:()=>f(!1)})})]})};function Oa(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Oa(r.children,t);if(n)return n}}}const VO="_breadcrumb_zd1aj_1",zO="_crumb_zd1aj_10",qO="_sep_zd1aj_26",HO="_current_zd1aj_31",Zn={breadcrumb:VO,crumb:zO,sep:qO,current:HO},WO=({crumbs:e})=>{const t=Re(r=>r.selectNode);return e.length?l.jsxs("nav",{className:Zn.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:Zn.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(uy,{size:13})}),e.map((r,n)=>l.jsxs(p.Fragment,{children:[l.jsx(Ud,{size:13,className:Zn.sep}),n<e.length-1?l.jsx("button",{className:Zn.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:Zn.current,children:r.name})]},r.id))]}):null},KO="_tabBar_qhks1_1",QO="_tab_qhks1_1",GO="_active_qhks1_29",YO="_error_qhks1_35",XO="_errorDot_qhks1_39",Jn={tabBar:KO,tab:QO,active:GO,error:YO,errorDot:XO},vu=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],ZO=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?vu.filter(i=>n.includes(i.id)):vu;return l.jsx("div",{className:Jn.tabBar,role:"tablist","aria-label":"Metadata sections",children:s.map(i=>l.jsxs("button",{role:"tab","aria-selected":e===i.id,"aria-controls":`panel-${i.id}`,className:[Jn.tab,e===i.id?Jn.active:"",r.includes(i.id)?Jn.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:Jn.errorDot,"aria-label":"Has errors"})]},i.id))})};var $s=e=>e.type==="checkbox",zr=e=>e instanceof Date,st=e=>e==null;const wh=e=>typeof e=="object";var Be=e=>!st(e)&&!Array.isArray(e)&&wh(e)&&!zr(e),Ea=e=>Be(e)&&e.target?$s(e.target)?e.target.checked:e.target.value:e,xh=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Sh=e=>{const t=e.constructor&&e.constructor.prototype;return Be(t)&&t.hasOwnProperty("isPrototypeOf")},to=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ue(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(to&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Be(e)&&Sh(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Ue(e[s]));return n}const Sr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Wt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},qt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ao="form",Ch="root",Oh=["__proto__","constructor","prototype"];var Bs=e=>/^\w*$/.test(e),Ae=e=>e===void 0,ro=e=>e.split(/[.[\]'"]/g).filter(Boolean),H=(e,t,r)=>{if(!t||!Be(e))return r;const n=Bs(t)?[t]:ro(t);if(n.some(i=>Oh.includes(i)))return r;const s=n.reduce((i,o)=>st(i)?void 0:i[o],e);return Ae(s)||s===e?Ae(e[t])?r:e[t]:s},kt=e=>typeof e=="boolean",gt=e=>typeof e=="function",je=(e,t,r)=>{let n=-1;const s=Bs(t)?[t]:ro(t),i=s.length,o=i-1;for(;++n<i;){const a=s[n];let c=r;if(n!==o){const d=e[a];c=Be(d)||Array.isArray(d)?d:isNaN(+s[n+1])?{}:[]}if(Oh.includes(a))return;e[a]=c,e=e[a]}};const fl=p.createContext(null);fl.displayName="HookFormControlContext";const hl=()=>p.useContext(fl);var Eh=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Wt.all&&(t._proxyFormState[o]=!n||Wt.all),r&&(r[o]=!0),e[o]}});return s};const pl=to?p.useLayoutEffect:p.useEffect;function JO(e){const t=hl(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[o,a]=p.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return pl(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:d=>{!n&&a({...r._formState,...d,defaultValues:r._defaultValues})}}),[s,n,i]),p.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),p.useMemo(()=>Eh(o,r,c.current,!1),[o,r])}var mt=e=>typeof e=="string",Da=(e,t,r,n,s)=>mt(e)?(n&&t.watch.add(e),H(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),H(r,i))):(n&&(t.watchAll=!0),r),Ia=e=>st(e)||!wh(e);const bu=(e,t)=>t.length===0&&!Array.isArray(e)&&!Sh(e);function At(e,t,r=new WeakMap){if(e===t)return!0;if(Ia(e)||Ia(t))return Object.is(e,t);if(zr(e)&&zr(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(bu(e,n)||bu(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 o of n){const a=e[o];if(!(o in t))return!1;if(o!=="ref"){const c=t[o];if(zr(a)&&zr(c)||(Be(a)||Array.isArray(a))&&(Be(c)||Array.isArray(c))?!At(a,c,r):!Object.is(a,c))return!1}}return!0}function eE(e){const t=hl(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=p.useRef(s),d=p.useRef(a),u=p.useRef(void 0),f=p.useRef(r),m=p.useRef(n);d.current=a;const[g,_]=p.useState(()=>{const w=r._getWatch(n,c.current);return d.current?d.current(w):w}),h=p.useCallback(w=>{const C=Da(n,r._names,w||r._formValues,!1,c.current);return d.current?d.current(C):C},[r._formValues,r._names,n]),y=p.useCallback(w=>{if(!i){const C=Da(n,r._names,w||r._formValues,!1,c.current);if(d.current){const D=d.current(C);At(D,u.current)||(_(D),u.current=D)}else _(C)}},[r._formValues,r._names,i,n]);pl(()=>((f.current!==r||!At(m.current,n))&&(f.current=r,m.current=n,y()),r._subscribe({name:n,formState:{values:!0},exact:o,callback:w=>{y(w.values)}})),[r,o,n,y]),p.useEffect(()=>r._removeUnmounted());const v=f.current!==r,b=m.current,x=p.useMemo(()=>{if(i)return null;const w=!v&&!At(b,n);return v||w?h():null},[i,v,n,b,h]);return x!==null?x:g}function no(e){const t=hl(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=xh(s._names.array,r),d=p.useMemo(()=>H(s._formValues,r,H(s._defaultValues,r,o)),[s,r,o]),u=eE({control:s,name:r,defaultValue:d,exact:a}),f=JO({control:s,name:r,exact:a}),m=p.useRef(e),g=p.useRef(null),_=p.useRef(s.register(r,{...e.rules,value:u,...kt(e.disabled)?{disabled:e.disabled}:{}}));m.current=e;const h=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!H(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!H(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!H(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!H(f.validatingFields,r)},error:{enumerable:!0,get:()=>H(f.errors,r)}}),[f,r]),y=p.useCallback(w=>{const C=Ea(w);return H(s._fields,r)||(_.current=s.register(r,{...m.current.rules,value:C})),_.current.onChange({target:{value:Ea(w),name:r},type:Sr.CHANGE})},[r,s]),v=p.useCallback(()=>_.current.onBlur({target:{value:H(s._formValues,r),name:r},type:Sr.BLUR}),[r,s._formValues]),b=p.useCallback(w=>{w&&(g.current={focus:()=>gt(w.focus)&&w.focus(),select:()=>gt(w.select)&&w.select(),setCustomValidity:D=>gt(w.setCustomValidity)&&w.setCustomValidity(D),reportValidity:()=>gt(w.reportValidity)&&w.reportValidity()});const C=H(s._fields,r);C&&C._f&&w&&(C._f.ref=g.current)},[s._fields,r]),x=p.useMemo(()=>({name:r,value:u,...kt(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:y,onBlur:v,ref:b}),[r,n,f.disabled,y,v,b,u]);return p.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...m.current.rules,...kt(m.current.disabled)?{disabled:m.current.disabled}:{}});const C=(D,j)=>{const k=H(s._fields,D);k&&k._f&&(k._f.mount=j)};if(C(r,!0),w){const D=Ue(H(i?s._defaultValues:s._options.values||s._defaultValues,r,H(s._options.defaultValues,r,m.current.defaultValue)));je(s._defaultValues,r,D),Ae(H(s._formValues,r))&&je(s._formValues,r,D)}if(!c&&s.register(r),g.current){const D=H(s._fields,r);D&&D._f&&(D._f.ref=g.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):C(r,!1)}},[r,s,c,i]),p.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),p.useMemo(()=>({field:x,formState:f,fieldState:h}),[x,f,h])}const gl=p.createContext(null);gl.displayName="HookFormContext";const Yt=()=>p.useContext(gl),tE=({children:e,watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:m,unregister:g,control:_,register:h,setFocus:y,subscribe:v})=>{const b=p.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:m,unregister:g,control:_,register:h,setFocus:y,subscribe:v}),[i,_,d,n,r,m,h,f,u,s,y,o,a,v,c,g,t]);return p.createElement(gl.Provider,{value:b},p.createElement(fl.Provider,{value:b.control},e))};var rE=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Dh=e=>Array.isArray(e)?e.filter(Boolean):[],vi=e=>Array.isArray(e)?e:[e],_u=()=>{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 Ih(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&Be(s)&&i){const o=Ih(s,i);Be(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var Je=e=>Be(e)&&!Object.keys(e).length,ml=e=>e.type==="file",Ri=e=>{if(!to)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Nh=e=>e.type==="select-multiple",yl=e=>e.type==="radio",nE=e=>yl(e)||$s(e),Po=e=>Ri(e)&&e.isConnected;function sE(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(st(e)){e=void 0;break}e=e[t[n]],n++}return e}function iE(e){for(const t in e)if(e.hasOwnProperty(t)&&!Ae(e[t]))return!1;return!0}function Ke(e,t){if(mt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Bs(t)?[t]:ro(t),n=r.length===1?e:sE(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(Be(n)&&Je(n)||Array.isArray(n)&&iE(n))&&Ke(e,r.slice(0,-1)),e}var oE=e=>{for(const t in e)if(gt(e[t]))return!0;return!1};function Th(e){return Array.isArray(e)||Be(e)&&!oE(e)}function Na(e,t={}){for(const r in e){const n=e[r];Th(n)?(t[r]=Array.isArray(n)?[]:{},Na(n,t[r])):Ae(n)||(t[r]=!0)}return t}function Ta(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>Ta(r));return t.some(r=>r!==void 0)?t:void 0}if(Be(e)){const t={};for(const r in e){const n=Ta(e[r]);Ae(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function $r(e,t,r){r||(r=Na(t));for(const n in e){const s=e[n];if(Th(s))Ae(t)||Ia(r[n])?r[n]=Na(s,Array.isArray(s)?[]:{}):$r(s,st(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!At(s,i)}}return Ta(r)||{}}const wu={value:!1,isValid:!1},xu={value:!0,isValid:!0};var jh=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&&!Ae(e[0].attributes.value)?Ae(e[0].value)||e[0].value===""?xu:{value:e[0].value,isValid:!0}:xu:wu}return wu},Rh=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ae(e)?e:t?e===""?NaN:e&&+e:r&&mt(e)?new Date(e):n?n(e):e;const Su={isValid:!1,value:null};var kh=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Su):Su;function Cu(e){const t=e.ref;return ml(t)?t.files:yl(t)?kh(e.refs).value:Nh(t)?[...t.selectedOptions].map(({value:r})=>r):$s(t)?jh(e.refs).value:Rh(Ae(t.value)?e.ref.value:t.value,e)}var aE=(e,t,r,n)=>{const s={};for(const i of e){const o=H(t,i);o&&je(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},ki=e=>e instanceof RegExp,es=e=>Ae(e)?e:ki(e)?e.source:Be(e)?ki(e.value)?e.value.source:e.value:e,Ou=e=>({isOnSubmit:!e||e===Wt.onSubmit,isOnBlur:e===Wt.onBlur,isOnChange:e===Wt.onChange,isOnAll:e===Wt.all,isOnTouch:e===Wt.onTouched});const Eu="AsyncFunction";var lE=e=>!!e&&!!e.validate&&!!(gt(e.validate)&&e.validate.constructor.name===Eu||Be(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Eu)),cE=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Mo=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const fs=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=H(e,s);if(i){const{_f:o,...a}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],s)&&!n)return!0;if(o.ref&&t(o.ref,o.name)&&!n)return!0;if(fs(a,t))break}else if(Be(a)&&fs(a,t))break}}};function Du(e,t,r){const n=H(e,r);if(n||Bs(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),o=H(t,i),a=H(e,i);if(o&&!Array.isArray(o)&&r!==i)return{name:r};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};s.pop()}return{name:r}}var uE=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return Je(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!n||Wt.all))},dE=(e,t,r)=>!e||!t||e===t||vi(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),fE=(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,hE=(e,t)=>!Dh(H(e,t)).length&&Ke(e,t),Iu=(e,t,r)=>{const n=H(e,r),s=Array.isArray(n)?n:[];return je(s,Ch,t[r]),je(e,r,s),e};function Nu(e,t,r="validate"){if(mt(e)||Array.isArray(e)&&e.every(mt)||kt(e)&&!e)return{type:r,message:mt(e)?e:"",ref:t}}var mn=e=>Be(e)&&!ki(e)?e:{value:e,message:""},Tu=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:d,minLength:u,min:f,max:m,pattern:g,validate:_,name:h,valueAsNumber:y,mount:v}=e._f,b=H(r,h);if(!v||t.has(h))return{};const x=a?a[0]:o,w=U=>{if(s&&x.reportValidity){const R=kt(U)?"":U||"";a?a.forEach(B=>B.setCustomValidity(R)):x.setCustomValidity(R),x.reportValidity()}},C={},D=yl(o),j=$s(o),k=D||j,$=(y||ml(o))&&Ae(o.value)&&Ae(b)||Ri(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,N=rE.bind(null,h,n,C),A=(U,R,B,F=qt.maxLength,J=qt.minLength)=>{const ie=U?R:B;C[h]={type:U?F:J,message:ie,ref:o,...N(U?F:J,ie)}};if(i?!Array.isArray(b)||!b.length:c&&(!k&&($||st(b))||kt(b)&&!b||j&&!jh(a).isValid||D&&!kh(a).isValid)){const{value:U,message:R}=mt(c)?{value:!!c,message:c}:mn(c);if(U&&(C[h]={type:qt.required,message:R,ref:x,...N(qt.required,R)},!n))return w(R),C}if(!$&&(!st(f)||!st(m))){let U,R;const B=mn(m),F=mn(f);if(!st(b)&&!isNaN(b)){const J=o.valueAsNumber||b&&+b;st(B.value)||(U=J>B.value),st(F.value)||(R=J<F.value)}else{const J=o.valueAsDate||new Date(b),ie=be=>new Date(new Date().toDateString()+" "+be),me=o.type=="time",ve=o.type=="week";mt(B.value)&&b&&(U=me?ie(b)>ie(B.value):ve?b>B.value:J>new Date(B.value)),mt(F.value)&&b&&(R=me?ie(b)<ie(F.value):ve?b<F.value:J<new Date(F.value))}if((U||R)&&(A(!!U,B.message,F.message,qt.max,qt.min),!n))return w(C[h].message),C}if((d||u)&&!$&&(mt(b)||i&&Array.isArray(b))){const U=mn(d),R=mn(u),B=!st(U.value)&&b.length>+U.value,F=!st(R.value)&&b.length<+R.value;if((B||F)&&(A(B,U.message,R.message),!n))return w(C[h].message),C}if(g&&!$&&mt(b)){const{value:U,message:R}=mn(g);if(ki(U)&&!b.match(U)&&(C[h]={type:qt.pattern,message:R,ref:o,...N(qt.pattern,R)},!n))return w(R),C}if(_){if(gt(_)){const U=await _(b,r),R=Nu(U,x);if(R&&(C[h]={...R,...N(qt.validate,R.message)},!n))return w(R.message),C}else if(Be(_)){let U={};for(const R in _){if(!Je(U)&&!n)break;const B=Nu(await _[R](b,r),x,R);B&&(U={...B,...N(R,B.message)},w(B.message),n&&(C[h]=U))}if(!Je(U)&&(C[h]={ref:x,...U},!n))return C}}return w(!0),C};const pE={mode:Wt.onSubmit,reValidateMode:Wt.onChange,shouldFocusError:!0},Ah={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function gE(e={}){let t={...pE,...e},r={...Ue(Ah),isLoading:gt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=Be(t.defaultValues)||Be(t.values)?Ue(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Ue(s),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...u};let m={...f};const g={array:_u(),state:_u()},_=t.criteriaMode===Wt.all,h=S=>I=>{clearTimeout(d),d=setTimeout(S,I)},y=async S=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||m.isValid||S)){let I;t.resolver?(I=Je((await N()).errors),v()):I=await R({fields:n,onlyCheckValid:!0,eventType:Sr.VALID}),I!==r.isValid&&g.state.next({isValid:I})}},v=(S,I)=>{!t.disabled&&(f.isValidating||f.validatingFields||m.isValidating||m.validatingFields)&&((S||Array.from(a.mount)).forEach(T=>{T&&(I?je(r.validatingFields,T,I):Ke(r.validatingFields,T))}),g.state.next({validatingFields:r.validatingFields,isValidating:!Je(r.validatingFields)}))},b=()=>{r.dirtyFields=$r(s,i)},x=(S,I=[],T,V,z=!0,Q=!0)=>{if(V&&T&&!t.disabled){if(o.action=!0,Q&&Array.isArray(H(n,S))){const q=T(H(n,S),V.argA,V.argB);z&&je(n,S,q)}if(Q&&Array.isArray(H(r.errors,S))){const q=T(H(r.errors,S),V.argA,V.argB);z&&je(r.errors,S,q),hE(r.errors,S)}if((f.touchedFields||m.touchedFields)&&Q&&Array.isArray(H(r.touchedFields,S))){const q=T(H(r.touchedFields,S),V.argA,V.argB);z&&je(r.touchedFields,S,q)}(f.dirtyFields||m.dirtyFields)&&b(),g.state.next({name:S,isDirty:F(S,I),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else je(i,S,I)},w=(S,I)=>{je(r.errors,S,I),r.errors={...r.errors},g.state.next({errors:r.errors})},C=S=>{r.errors=S,g.state.next({errors:r.errors,isValid:!1})},D=S=>{const I=Bs(S)?[S]:ro(S);let T=i,V=s;for(let z=0;z<I.length-1;z++){const Q=I[z];if(T=st(T)?T:T[Q],V=st(V)?V:V[Q],T===null&&V!==null)return!0}return!1},j=(S,I,T,V)=>{const z=H(n,S);if(z){if(D(S))return;const Q=Ae(H(i,S)),q=H(i,S,Ae(T)?H(s,S):T);Ae(q)||V&&V.defaultChecked||I?je(i,S,I?q:Cu(z._f)):me(S,q),o.mount&&!o.action&&(y(),Q&&r.isDirty&&(f.isDirty||m.isDirty)&&(F()||(r.isDirty=!1,g.state.next({...r}))),e.shouldUnregister&&Q&&!Ae(H(i,S))&&Mo(S,a)&&(o.watch=!0))}},k=(S,I,T,V,z)=>{let Q=!1,q=!1;const ee={name:S};if(!t.disabled){if(!T||V){(f.isDirty||m.isDirty)&&(q=r.isDirty,r.isDirty=ee.isDirty=F(),Q=q!==ee.isDirty);const he=At(H(s,S),I);q=!!H(r.dirtyFields,S),he!==r.isDirty?r.dirtyFields=$r(s,i):he?Ke(r.dirtyFields,S):je(r.dirtyFields,S,!0),ee.dirtyFields=r.dirtyFields,Q=Q||(f.dirtyFields||m.dirtyFields)&&q!==!he}if(T){const he=H(r.touchedFields,S);he||(je(r.touchedFields,S,T),ee.touchedFields=r.touchedFields,Q=Q||(f.touchedFields||m.touchedFields)&&he!==T)}Q&&z&&g.state.next(ee)}return Q?ee:{}},$=(S,I,T,V)=>{const z=H(r.errors,S),Q=(f.isValid||m.isValid)&&kt(I)&&r.isValid!==I;if(t.delayError&&T?(c=h(()=>w(S,T)),c(t.delayError)):(clearTimeout(d),c=null,T?je(r.errors,S,T):Ke(r.errors,S),r.errors={...r.errors}),(T?!At(z,T):z)||!Je(V)||Q){const q={...V,...Q&&kt(I)?{isValid:I}:{},errors:r.errors,name:S};r={...r,...q},g.state.next(q)}},N=async S=>(v(S,!0),await t.resolver(i,t.context,aE(S||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),A=async S=>{const{errors:I}=await N(S);if(v(S),S){for(const T of S){const V=H(I,T);V?a.array.has(T)&&Be(V)&&!Object.keys(V).some(z=>!Number.isNaN(Number(z)))?Iu(r.errors,{[T]:V},T):je(r.errors,T,V):Ke(r.errors,T)}r.errors={...r.errors}}else r.errors=I;return I},U=async({name:S,eventType:I})=>{if(e.validate){const T=await e.validate({formValues:i,formState:r,name:S,eventType:I});if(Be(T))for(const V in T){const z=T[V];z&&Ne(`${Ao}.${V}`,{message:mt(z.message)?z.message:"",type:z.type||qt.validate})}else mt(T)||!T?Ne(Ao,{message:T||"",type:qt.validate}):pe(Ao);return T}return!0},R=async({fields:S,onlyCheckValid:I,name:T,eventType:V,context:z={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(z.runRootValidation=!0,!await U({name:T,eventType:V})&&(z.valid=!1,I)))return z.valid;for(const Q in S){const q=S[Q];if(q){const{_f:ee,...he}=q;if(ee){const Fe=a.array.has(ee.name),xt=q._f&&lE(q._f),St=f.validatingFields||f.isValidating||m.validatingFields||m.isValidating;xt&&St&&v([ee.name],!0);const lr=await Tu(q,a.disabled,i,_,t.shouldUseNativeValidation&&!I,Fe);if(xt&&St&&v([ee.name]),lr[ee.name]&&(z.valid=!1,I)||(!I&&(H(lr,ee.name)?Fe?Iu(r.errors,lr,ee.name):je(r.errors,ee.name,lr[ee.name]):Ke(r.errors,ee.name)),e.shouldUseNativeValidation&&lr[ee.name]))break}!Je(he)&&await R({context:z,onlyCheckValid:I,fields:he,name:Q,eventType:V})}}return z.valid},B=()=>{for(const S of a.unMount){const I=H(n,S);I&&(I._f.refs?I._f.refs.every(T=>!Po(T)):!Po(I._f.ref))&&Le(S)}a.unMount=new Set},F=(S,I)=>!t.disabled&&(S&&I&&je(i,S,I),!At(W(),s)),J=(S,I,T)=>Da(S,a,{...o.mount?i:Ae(I)?s:mt(S)?{[S]:I}:I},T,I),ie=S=>Dh(H(o.mount?i:s,S,t.shouldUnregister?H(s,S,[]):[])),me=(S,I,T={},V=!1)=>{const z=H(n,S);let Q=I;if(z){const q=z._f;q&&(!q.disabled&&je(i,S,Rh(I,q)),Q=Ri(q.ref)&&st(I)?"":I,Nh(q.ref)?[...q.ref.options].forEach(ee=>ee.selected=Q.includes(ee.value)):q.refs?$s(q.ref)?q.refs.forEach(ee=>{(!ee.defaultChecked||!ee.disabled)&&(Array.isArray(Q)?ee.checked=!!Q.find(he=>he===ee.value):ee.checked=Q===ee.value||!!Q)}):q.refs.forEach(ee=>ee.checked=ee.value===Q):ml(q.ref)?q.ref.value="":(q.ref.value=Q,q.ref.type||g.state.next({name:S,values:V?i:Ue(i)})))}(T.shouldDirty||T.shouldTouch)&&k(S,Q,T.shouldTouch,T.shouldDirty,!0),T.shouldValidate&&Y(S)},ve=(S,I,T,V=!1)=>{for(const z in I){if(!I.hasOwnProperty(z))return;const Q=I[z],q=S+"."+z,ee=H(n,q);(a.array.has(S)||Be(Q)||ee&&!ee._f)&&!zr(Q)?ve(q,Q,T,V):me(q,Q,T,V)}},be=(S,I,T,V)=>{const z=H(n,S),Q=a.array.has(S),q=V?I:Ue(I),ee=H(i,S),he=At(ee,q);if(he||je(i,S,q),Q)g.array.next({name:S,values:V?i:Ue(i)}),(f.isDirty||f.dirtyFields||m.isDirty||m.dirtyFields)&&T.shouldDirty&&(b(),g.state.next({name:S,dirtyFields:r.dirtyFields,isDirty:F(S,q)}));else{const Fe=Array.isArray(q)&&!q.length||Je(q);!z||z._f||st(q)||Fe?me(S,q,T,V):ve(S,q,T,V)}if(!he){const Fe=Mo(S,a),xt=V?i:Ue(i);g.state.next({...Fe&&r,name:o.mount||Fe?S:void 0,values:xt})}},K=(S,I,T={})=>be(S,I,T,!1),M=(S,I={})=>{const T=gt(S)?S(i):S;if(!At(i,T)){i={...i,...T};for(const V of a.mount)be(V,H(T,V),I,!0);g.state.next({...r,name:void 0,type:void 0,values:i}),I.shouldValidate&&y()}},G=async S=>{o.mount=!0;const I=S.target;let T=I.name,V=!0;const z=H(n,T),Q=he=>{V=Number.isNaN(he)||zr(he)&&isNaN(he.getTime())||At(he,H(i,T,he))},q=Ou(t.mode),ee=Ou(t.reValidateMode);if(z){let he,Fe;const xt=I.type?Cu(z._f):Ea(S),St=S.type===Sr.BLUR||S.type===Sr.FOCUS_OUT,lr=!cE(z._f)&&!e.validate&&!t.resolver&&!H(r.errors,T)&&!z._f.deps||fE(St,H(r.touchedFields,T),r.isSubmitted,ee,q),Hn=Mo(T,a,St);je(i,T,xt),St?(!I||!I.readOnly)&&(z._f.onBlur&&z._f.onBlur(S),c&&c(0)):z._f.onChange&&z._f.onChange(S);const Mr=k(T,xt,St),Xe=!Je(Mr)||Hn;if(!St&&g.state.next({name:T,type:S.type,values:Ue(i)}),lr)return(f.isValid||m.isValid)&&(t.mode==="onBlur"?St&&y():St||y()),Xe&&g.state.next({name:T,...Hn?{}:Mr});if(!t.resolver&&e.validate&&await U({name:T,eventType:S.type}),!St&&Hn&&g.state.next({...r}),t.resolver){const{errors:ct}=await N([T]);if(v([T]),Q(xt),!V){!Je(Mr)&&g.state.next(Mr);return}const bt=Du(r.errors,n,T),Vt=Du(ct,n,bt.name||T);he=Vt.error,T=Vt.name,Fe=Je(ct)}else v([T],!0),he=(await Tu(z,a.disabled,i,_,t.shouldUseNativeValidation))[T],v([T]),Q(xt),V&&(he?Fe=!1:(f.isValid||m.isValid)&&(Fe=await R({fields:n,onlyCheckValid:!0,name:T,eventType:S.type})));V&&(z._f.deps&&(!Array.isArray(z._f.deps)||z._f.deps.length>0)&&Y(z._f.deps),$(T,Fe,he,Mr))}},P=(S,I)=>{if(H(r.errors,I)&&S.focus)return S.focus(),1},Y=async(S,I={})=>{let T,V;const z=vi(S);if(t.resolver){const Q=await A(Ae(S)?S:z);T=Je(Q),V=S?!z.some(q=>H(Q,q)):T}else S?(V=(await Promise.all(z.map(async Q=>{const q=H(n,Q);return await R({fields:q&&q._f?{[Q]:q}:q,eventType:Sr.TRIGGER})}))).every(Boolean),!(!V&&!r.isValid)&&y()):V=T=await R({fields:n,name:S,eventType:Sr.TRIGGER});return g.state.next({...!mt(S)||(f.isValid||m.isValid)&&T!==r.isValid?{}:{name:S},...t.resolver||!S?{isValid:T}:{},errors:r.errors}),I.shouldFocus&&!V&&fs(n,P,S?z:a.mount),V},W=(S,I)=>{let T={...o.mount?i:s};return I&&(T=Ih(I.dirtyFields?r.dirtyFields:r.touchedFields,T)),Ae(S)?T:mt(S)?H(T,S):S.map(V=>H(T,V))},oe=(S,I)=>({invalid:!!H((I||r).errors,S),isDirty:!!H((I||r).dirtyFields,S),error:H((I||r).errors,S),isValidating:!!H(r.validatingFields,S),isTouched:!!H((I||r).touchedFields,S)}),pe=S=>{const I=S?vi(S):void 0;I==null||I.forEach(T=>Ke(r.errors,T)),I?I.forEach(T=>{g.state.next({name:T,errors:r.errors})}):g.state.next({errors:{}})},Ne=(S,I,T)=>{const V=(H(n,S,{_f:{}})._f||{}).ref,z=H(r.errors,S)||{},{ref:Q,message:q,type:ee,...he}=z;je(r.errors,S,{...he,...I,ref:V}),g.state.next({name:S,errors:r.errors,isValid:!1}),T&&T.shouldFocus&&V&&V.focus&&V.focus()},re=(S,I)=>gt(S)?g.state.subscribe({next:T=>"values"in T&&S(T.values||J(void 0,I),T)}):J(S,I,!0),se=S=>g.state.subscribe({next:I=>{if(dE(S.name,I.name,S.exact)&&uE(I,S.formState||f,Us,S.reRenderRoot)){const T={...i};S.callback({values:T,...r,...I,defaultValues:s})}}}).unsubscribe,le=S=>(o.mount=!0,m={...m,...S.formState},se({...S,formState:{...u,...S.formState}})),Le=(S,I={})=>{for(const T of S?vi(S):a.mount)a.mount.delete(T),a.array.delete(T),I.keepValue||(Ke(n,T),Ke(i,T)),!I.keepError&&Ke(r.errors,T),!I.keepDirty&&Ke(r.dirtyFields,T),!I.keepTouched&&Ke(r.touchedFields,T),!I.keepIsValidating&&Ke(r.validatingFields,T),!t.shouldUnregister&&!I.keepDefaultValue&&Ke(s,T);g.state.next({values:Ue(i)}),g.state.next({...r,...I.keepDirty?{isDirty:F()}:{}}),!I.keepIsValid&&y()},ze=({disabled:S,name:I})=>{if(kt(S)&&o.mount||S||a.disabled.has(I)){const z=a.disabled.has(I)!==!!S;S?a.disabled.add(I):a.disabled.delete(I),z&&o.mount&&!o.action&&y()}},Te=(S,I={})=>{let T=H(n,S);const V=kt(I.disabled)||kt(t.disabled),z=!a.registerName.has(S)&&T&&T._f&&!T._f.mount;return je(n,S,{...T||{},_f:{...T&&T._f?T._f:{ref:{name:S}},name:S,mount:!0,...I}}),a.mount.add(S),T&&!z?ze({disabled:kt(I.disabled)?I.disabled:t.disabled,name:S}):j(S,!0,I.value),{...V?{disabled:I.disabled||t.disabled}:{},...t.progressive?{required:!!I.required,min:es(I.min),max:es(I.max),minLength:es(I.minLength),maxLength:es(I.maxLength),pattern:es(I.pattern)}:{},name:S,onChange:G,onBlur:G,ref:Q=>{if(Q){a.registerName.add(S),Te(S,I),a.registerName.delete(S),T=H(n,S);const q=Ae(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,ee=nE(q),he=T._f.refs||[];if(ee?he.find(Fe=>Fe===q):q===T._f.ref)return;je(n,S,{_f:{...T._f,...ee?{refs:[...he.filter(Po),q,...Array.isArray(H(s,S))?[{}]:[]],ref:{type:q.type,name:S}}:{ref:q}}}),j(S,!1,void 0,q)}else T=H(n,S,{}),T._f&&(T._f.mount=!1),(t.shouldUnregister||I.shouldUnregister)&&!(xh(a.array,S)&&o.action)&&a.unMount.add(S)}}},te=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&fs(n,P,a.mount),We=S=>{kt(S)&&(g.state.next({disabled:S}),fs(n,(I,T)=>{const V=H(n,T);V&&(I.disabled=V._f.disabled||S,Array.isArray(V._f.refs)&&V._f.refs.forEach(z=>{z.disabled=V._f.disabled||S}))},0,!1))},at=(S,I)=>async T=>{let V;T&&(T.preventDefault&&T.preventDefault(),T.persist&&T.persist());let z=Ue(i);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:Q,values:q}=await N();v(),r.errors=Q,z=Ue(q)}else await R({fields:n,eventType:Sr.SUBMIT});if(a.disabled.size)for(const Q of a.disabled)Ke(z,Q);if(Ke(r.errors,Ch),Je(r.errors)){g.state.next({errors:{}});try{await S(z,T)}catch(Q){V=Q}}else I&&await I({...r.errors},T),te(),setTimeout(te);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Je(r.errors)&&!V,submitCount:r.submitCount+1,errors:r.errors}),V)throw V},vt=(S,I={})=>{H(n,S)&&(Ae(I.defaultValue)?K(S,Ue(H(s,S))):(K(S,I.defaultValue),je(s,S,Ue(I.defaultValue))),I.keepTouched||Ke(r.touchedFields,S),I.keepDirty||(Ke(r.dirtyFields,S),r.isDirty=I.defaultValue?F(S,Ue(H(s,S))):F()),I.keepError||(Ke(r.errors,S),f.isValid&&y()),g.state.next({...r}))},qe=(S,I={})=>{const T=S?Ue(S):s,V=Ue(T),z=Je(S),Q=V;if(I.keepDefaultValues||(s=T),!I.keepValues){if(I.keepDirtyValues){const q=new Set([...a.mount,...Object.keys($r(s,i))]);for(const ee of Array.from(q)){const he=H(r.dirtyFields,ee),Fe=H(i,ee),xt=H(Q,ee);he&&!Ae(Fe)?je(Q,ee,Fe):!he&&!Ae(xt)&&K(ee,xt)}}else{if(to&&Ae(S))for(const q of a.mount){const ee=H(n,q);if(ee&&ee._f){const he=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(Ri(he)){const Fe=he.closest("form");if(Fe){Fe.reset();break}}}}if(I.keepFieldsRef)for(const q of a.mount)K(q,H(Q,q));else n={}}if(t.shouldUnregister){if(i=I.keepDefaultValues?Ue(s):{},I.keepFieldsRef)for(const q of a.mount)je(i,q,H(Q,q))}else i=Ue(Q);g.array.next({values:{...Q}}),g.state.next({values:{...Q}})}a={mount:I.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!I.keepIsValid||!!I.keepDirtyValues||!t.shouldUnregister&&!Je(Q),o.watch=!!t.shouldUnregister,o.keepIsValid=!!I.keepIsValid,o.action=!1,I.keepErrors||(r.errors={}),g.state.next({submitCount:I.keepSubmitCount?r.submitCount:0,isDirty:z?!1:I.keepDirty?r.isDirty:I.keepValues?F():!!(I.keepDefaultValues&&!At(S,s)),isSubmitted:I.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:z?{}:I.keepDirtyValues?I.keepDefaultValues&&i?$r(s,i):r.dirtyFields:I.keepDefaultValues&&S?$r(s,S):I.keepDirty?r.dirtyFields:{},touchedFields:I.keepTouched?r.touchedFields:{},errors:I.keepErrors?r.errors:{},isSubmitSuccessful:I.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Ye=(S,I)=>qe(gt(S)?S(i):S,{...t.resetOptions,...I}),lt=(S,I={})=>{const T=H(n,S),V=T&&T._f;if(V){const z=V.refs?V.refs[0]:V.ref;z.focus&&setTimeout(()=>{z.focus(),I.shouldSelect&&gt(z.select)&&z.select()})}},Us=S=>{r={...r,...S}},Vs={control:{register:Te,unregister:Le,getFieldState:oe,handleSubmit:at,setError:Ne,_subscribe:se,_runSchema:N,_updateIsValidating:v,_focusError:te,_getWatch:J,_getDirty:F,_setValid:y,_setFieldArray:x,_setDisabledField:ze,_setErrors:C,_getFieldArray:ie,_reset:qe,_resetDefaultValues:()=>gt(t.defaultValues)&&t.defaultValues().then(S=>{Ye(S,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:B,_disableForm:We,_subjects:g,_proxyFormState:f,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(S){o=S},get _defaultValues(){return s},get _names(){return a},set _names(S){a=S},get _formState(){return r},get _options(){return t},set _options(S){t={...t,...S}}},subscribe:le,trigger:Y,register:Te,handleSubmit:at,watch:re,setValue:K,setValues:M,getValues:W,reset:Ye,resetField:vt,resetDefaultValues:(S,I={})=>{if(s=Ue(S),!I.keepDirty){const T=$r(s,i);r.dirtyFields=T,r.isDirty=!Je(T)}I.keepIsValid||y(),g.state.next({...r,defaultValues:s})},clearErrors:pe,unregister:Le,setError:Ne,setFocus:lt,getFieldState:oe};return{...Vs,formControl:Vs}}function mE(e={}){const t=p.useRef(void 0),r=p.useRef(void 0),n=p.useRef(e.formControl),[s,i]=p.useState(()=>({...Ue(Ah),isLoading:gt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:gt(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&&!gt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=gE(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,pl(()=>{const a=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),o._formState.isReady=!0,a},[o]),p.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),p.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),p.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),p.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),p.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==s.isDirty&&o._subjects.state.next({isDirty:a})}},[o,s.isDirty]),p.useEffect(()=>{var a;e.values&&!At(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((a=o._options.resetOptions)===null||a===void 0)&&a.keepIsValid||o._setValid(),r.current=e.values,i(c=>({...c}))):o._resetDefaultValues()},[o,e.values]),p.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=p.useMemo(()=>Eh(s,o),[o,s]),t.current}async function ju(e){var r,n;return(n=(r=(await Me.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}function Ph(e,t){const r=ea({queryKey:["framework",e],queryFn:()=>ju(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=ea({queryKey:["framework",n],queryFn:()=>ju(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}async function yE(e){var r,n;return(n=(r=(await Me.get(`/api/channel/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.channel}function vE(e){var r,n,s,i,o,a;const t=ea({queryKey:["channel",e],queryFn:()=>yE(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:(o=t.data)==null?void 0:o.contentAdditionalCategories,defaultLicense:(a=t.data)==null?void 0:a.defaultLicense,isLoading:t.isLoading}}const bE={"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."}},Zs={"First Section":"details","Second Section":"details","Third Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing","Sixth Section":"licensing"},_E={Categorisation:"Second Section","Basic Information":"First Section","Licensing & Attribution":"Fourth Section",Curriculum:"Organisation Framework Terms","Target Audience":"Target Framework Terms"},wE={name:"details",description:"details",keywords:"details",appIcon:"details",primaryCategory:"details",additionalCategories:"details",board:"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"},Mh={board:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},Ru=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function xE(e,t,r,n){if(!(e!=null&&e.length))return IE(t,n,r);const s=new Set;return e.filter(i=>{if(n&&(i.code==="dialCode"||i.code==="dialcode")||i.visible===!1)return!1;const o=i.code;return s.has(o)?!1:(s.add(o),!0)}).map(i=>{const o=i.code??"",a=EE(i),c=DE(i,r,t),d=t[o],u=Lh(d,a),f={code:o,label:i.label??o,inputType:a,required:!!(i.required===!0||Array.isArray(i.validations)&&i.validations.some(m=>m.type==="required")),editable:i.editable!==!1,placeholder:i.placeholder,maxLength:i.maxLength,options:CE(c,u,a,r),depends:i.depends,tab:OE(i),section:i.section,defaultValue:i.defaultValue??i.default,currentValue:u};if(o==="dialcodes"){const m=t.dialcodeRequired==="Yes";return{...f,required:m,visible:m}}return f})}function SE(e){var n,s,i;const t=new Map,r=o=>o==null?void 0:o.forEach(a=>{a.identifier&&t.set(a.identifier,a.name),a.name&&t.set(a.name,a.name)});return(s=(n=e.organisationFramework)==null?void 0:n.categories)==null||s.forEach(o=>r(o.terms)),(i=e.targetFrameworks)==null||i.forEach(o=>{var a;return(a=o.categories)==null?void 0:a.forEach(c=>r(c.terms))}),t}function CE(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]:[],o=new Set(i.map(c=>c.value)),a=SE(n);for(const c of s){const d=String(c);o.has(d)||(i.push({label:a.get(d)??d,value:d}),o.add(d))}return i}function OE(e){const t=e.section;if(t){if(Zs[t])return Zs[t];const n=_E[t];if(n&&Zs[n])return Zs[n]}const r=e.code??"";return wE[r]??"details"}function Lh(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 EE(e){const t=(e.inputType??e.dataType??"").toLowerCase(),n=(e.dataType??"").toLowerCase()==="list";return t==="select"||t==="framework"?"select":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 DE(e,t,r){var a;const n=e.range;if(Array.isArray(n)&&n.length)return typeof n[0]=="string"?n.map(c=>({label:c,value:c})):n.map(c=>({label:c.name,value:c.identifier}));const s=e.enum;if(s!=null&&s.length)return s.map(c=>({label:c,value:c}));const i=e.code??"";if(i==="framework")return t.orgFrameworks;if(i==="additionalCategories")return(a=t.channelAdditionalCategories)==null?void 0:a.map(c=>({label:c,value:c}));const o=e.sourceCategory??Mh[i];if(o)return Fh(i,o,e,t,r)}function Fh(e,t,r,n,s){var f,m,g,_,h;const i=Ru.has(e)||r.output==="identifier"||typeof r.section=="string"&&r.section.includes("Target"),o=y=>({label:y.name,value:i?y.identifier:y.name}),a=(m=(f=n.organisationFramework)==null?void 0:f.categories)==null?void 0:m.find(y=>y.code===t),c=(h=(_=(g=n.targetFrameworks)==null?void 0:g[0])==null?void 0:_.categories)==null?void 0:h.find(y=>y.code===t);let d=(Ru.has(e)?c==null?void 0:c.terms:a==null?void 0:a.terms)??(c==null?void 0:c.terms)??(a==null?void 0:a.terms)??[];const u=r.depends;if(u!=null&&u.length){const y=u.flatMap(v=>{const b=s[v];return Array.isArray(b)?b:b!=null&&b!==""?[b]:[]}).map(String);if(y.length){const v=d.filter(b=>{const x=b.associations;return!x||!x.length?!0:x.some(w=>y.includes(w.identifier)||y.includes(w.code)||y.includes(w.name))});v.length&&(d=v)}}return d.map(o)}function ts(e,t){const r=Mh[e];if(r)return Fh(e,r,{},t,{})}function nt(e,t,r){return Lh(e[t],r)}function IE(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:nt(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:nt(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:nt(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:nt(e,"primaryCategory","select")},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:nt(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:nt(e,"framework","select")},{code:"subjectIds",label:"Subjects covered",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:ts("subjectIds",r),currentValue:nt(e,"subjectIds","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",currentValue:nt(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:ts("targetBoardIds",r),currentValue:nt(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:ts("targetMediumIds",r),currentValue:nt(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:ts("targetGradeLevelIds",r),currentValue:nt(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:ts("targetSubjectIds",r),currentValue:nt(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:nt(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:nt(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:nt(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:nt(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:nt(e,"license","select")})),n}function NE(e,t){const{watch:r,setValue:n}=e;p.useEffect(()=>{const s=r((i,{name:o})=>{o&&t.forEach(a=>{var c;(c=a.depends)!=null&&c.includes(o)&&n(a.code,a.inputType==="multiselect"||a.inputType==="chips"?[]:"",{shouldDirty:!0})})});return()=>s.unsubscribe()},[r,n,t])}const TE="_section_ylgu8_1",jE="_header_ylgu8_11",RE="_title_ylgu8_17",kE="_description_ylgu8_24",AE="_divider_ylgu8_30",PE="_fields_ylgu8_36",yn={section:TE,header:jE,title:RE,description:kE,divider:AE,fields:PE},ME=({title:e,description:t,children:r})=>l.jsxs("div",{className:yn.section,children:[l.jsxs("div",{className:yn.header,children:[l.jsx("h3",{className:yn.title,children:e}),t&&l.jsx("p",{className:yn.description,children:t})]}),l.jsx("hr",{className:yn.divider}),l.jsx("div",{className:yn.fields,children:r})]}),LE="_field_1s288_1",FE="_fullWidth_1s288_7",$E="_label_1s288_11",BE="_required_1s288_19",UE="_input_1s288_24",VE="_textarea_1s288_45",zE="_inputError_1s288_50",qE="_error_1s288_54",HE="_selectBtn_1s288_59",WE="_selectOpen_1s288_83",KE="_placeholder_1s288_87",QE="_selectedVal_1s288_91",GE="_chevronUp_1s288_95",YE="_dropdown_1s288_100",XE="_option_1s288_116",ZE="_optionSelected_1s288_134",JE="_noOpts_1s288_139",eD="_chipGroup_1s288_146",tD="_chipInput_1s288_158",rD="_addChipBtn_1s288_167",nD="_radioGroup_1s288_184",sD="_radioLabel_1s288_191",iD="_iconWrap_1s288_199",oD="_iconPreview_1s288_214",aD="_iconPlaceholder_1s288_220",lD="_removeIconBtn_1s288_233",cD="_tagChip_1s288_252",uD="_tagChipRemove_1s288_264",dD="_nestedSelectRow_1s288_278",fD="_dialcodeRow_1s288_287",hD="_validateBtn_1s288_293",pD="_dialcodeValid_1s288_315",gD="_dialcodeSpinner_1s288_325",L={field:LE,fullWidth:FE,label:$E,required:BE,input:UE,textarea:VE,inputError:zE,error:qE,selectBtn:HE,selectOpen:WE,placeholder:KE,selectedVal:QE,chevronUp:GE,dropdown:YE,option:XE,optionSelected:ZE,noOpts:JE,chipGroup:eD,chipInput:tD,addChipBtn:rD,radioGroup:nD,radioLabel:sD,iconWrap:iD,iconPreview:oD,iconPlaceholder:aD,removeIconBtn:lD,tagChip:cD,tagChipRemove:uD,nestedSelectRow:dD,dialcodeRow:fD,validateBtn:hD,dialcodeValid:pD,dialcodeSpinner:gD},ku=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:o})=>{const{register:a,formState:{errors:c}}=Yt(),d=c[e],u={required:r?`${t} is required`:!1,maxLength:i?{value:i,message:`Max ${i} characters`}:void 0};return l.jsxs("div",{className:[L.field,s?L.fullWidth:""].join(" "),children:[l.jsxs("label",{className:L.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),s?l.jsx("textarea",{id:e,className:[L.input,L.textarea,d?L.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,u)}):l.jsx("input",{id:e,type:"text",className:[L.input,d?L.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,u)}),d&&l.jsx("span",{className:L.error,children:String(d.message)})]})},mD=({name:e,label:t,options:r,required:n,disabled:s})=>{var h;const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Yt(),m=d(e),g=((h=r.find(y=>y.value===m))==null?void 0:h.label)??"Select…",_=f[e];return p.useEffect(()=>{if(!i)return;const y=v=>{var b;(b=a.current)!=null&&b.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),l.jsxs("div",{className:L.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:L.label,children:[t,n&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[L.selectBtn,_?L.inputError:"",i?L.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:m?L.selectedVal:L.placeholder,children:g}),l.jsx(ks,{size:14,className:i?L.chevronUp:""})]}),i&&l.jsxs("div",{className:L.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[L.option,m===y.value?L.optionSelected:""].join(" "),onClick:()=>{u(e,y.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:y.label}),m===y.value&&l.jsx(Un,{size:13})]},y.value)),!r.length&&l.jsx("span",{className:L.noOpts,children:"No options"})]}),_&&l.jsx("span",{className:L.error,children:String(_.message)})]})},yD=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Yt(),m=d(e)??[],g=f[e],_=m.length?`${m.length} selected`:"Select…";p.useEffect(()=>{if(!i)return;const y=v=>{var b;(b=a.current)!=null&&b.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]);const h=y=>{const v=m.includes(y)?m.filter(b=>b!==y):[...m,y];u(e,v,{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:L.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:L.label,children:[t,n&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[L.selectBtn,g?L.inputError:"",i?L.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:m.length?L.selectedVal:L.placeholder,children:_}),l.jsx(ks,{size:14,className:i?L.chevronUp:""})]}),i&&l.jsxs("div",{className:L.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[L.option,m.includes(y.value)?L.optionSelected:""].join(" "),onClick:()=>h(y.value),children:[l.jsx(Un,{size:13,style:{opacity:m.includes(y.value)?1:0}}),l.jsx("span",{children:y.label})]},y.value)),!r.length&&l.jsx("span",{className:L.noOpts,children:"No options"})]}),g&&l.jsx("span",{className:L.error,children:String(g.message)})]})},vD=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=p.useState(""),[a,c]=p.useState(!1),d=p.useRef(null),{watch:u,setValue:f,formState:{errors:m}}=Yt(),g=u(e)??[],_=m[e],h=()=>{const v=i.trim();v&&!g.includes(v)&&f(e,[...g,v],{shouldDirty:!0}),o(""),c(!1)},y=v=>f(e,g.filter(b=>b!==v),{shouldDirty:!0});return l.jsxs("div",{className:[L.field,L.fullWidth].join(" "),children:[l.jsxs("label",{className:L.label,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsxs("div",{className:L.chipGroup,children:[g.map(v=>l.jsxs("span",{className:"sbx-chip filled",children:[v,!n&&l.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>y(v),"aria-label":`Remove ${v}`,children:"×"})]},v)),!n&&(a?l.jsx("input",{ref:d,autoFocus:!0,className:L.chipInput,value:i,onChange:v=>o(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),h()),v.key==="Escape"&&(o(""),c(!1))},onBlur:h,placeholder:s}):l.jsxs("button",{type:"button",className:L.addChipBtn,onClick:()=>{c(!0),setTimeout(()=>{var v;return(v=d.current)==null?void 0:v.focus()},50)},children:[l.jsx(As,{size:12})," Add"]}))]}),_&&l.jsx("span",{className:L.error,children:String(_.message)})]})},bD=({name:e,label:t,options:r,required:n,disabled:s})=>{const{register:i,formState:{errors:o}}=Yt(),a=o[e];return l.jsxs("div",{className:L.field,children:[l.jsxs("label",{className:L.label,children:[t,n&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("div",{className:L.radioGroup,children:r.map(c=>l.jsxs("label",{className:L.radioLabel,children:[l.jsx("input",{type:"radio",value:c.value,disabled:s,...i(e,{required:n?`${t} is required`:!1})}),c.label]},c.value))}),a&&l.jsx("span",{className:L.error,children:String(a.message)})]})};async function _D(e,t,r,n){var o,a;const i=(a=(o=(await Me.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:o.result)==null?void 0:a.node_id;if(!i)throw new Error("Asset creation failed: no node_id returned");return i}async function wD(e,t){var s,i;const n=(i=(s=(await Me.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 xD(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 SD(e,t,r){var o,a;const n=new FormData;n.append("fileUrl",t),n.append("mimeType",r);const i=(a=(o=(await Me.post(`/action/asset/v1/upload/${e}`,n,{params:{enctype:"multipart/form-data",processData:!1,contentType:!1,cache:!1}})).data)==null?void 0:o.result)==null?void 0:a.content_url;if(!i)throw new Error("Asset finalize failed: no content_url returned");return i}const CD="_overlay_ga6eh_1",OD="_modal_ga6eh_12",ED="_header_ga6eh_24",DD="_title_ga6eh_33",ID="_closeBtn_ga6eh_39",ND="_tabs_ga6eh_57",TD="_tab_ga6eh_57",jD="_activeTab_ga6eh_83",RD="_body_ga6eh_88",kD="_searchWrap_ga6eh_99",AD="_searchIcon_ga6eh_104",PD="_searchInput_ga6eh_113",MD="_grid_ga6eh_132",LD="_imgCell_ga6eh_148",FD="_imgCellSelected_ga6eh_166",$D="_thumb_ga6eh_171",BD="_noThumb_ga6eh_177",UD="_checkBadge_ga6eh_183",VD="_loadMoreBtn_ga6eh_198",zD="_loadingRow_ga6eh_220",qD="_empty_ga6eh_230",HD="_spinner_ga6eh_237",WD="_uploadArea_ga6eh_247",KD="_dropZone_ga6eh_256",QD="_uploadIcon_ga6eh_277",GD="_dropText_ga6eh_281",YD="_dropSubtext_ga6eh_288",XD="_uploadPreview_ga6eh_294",ZD="_hiddenInput_ga6eh_301",JD="_fileName_ga6eh_305",eI="_errorText_ga6eh_311",tI="_footer_ga6eh_318",rI="_cancelBtn_ga6eh_328",nI="_confirmBtn_ga6eh_345",fe={overlay:CD,modal:OD,header:ED,title:DD,closeBtn:ID,tabs:ND,tab:TD,activeTab:jD,body:RD,searchWrap:kD,searchIcon:AD,searchInput:PD,grid:MD,imgCell:LD,imgCellSelected:FD,thumb:$D,noThumb:BD,checkBadge:UD,loadMoreBtn:VD,loadingRow:zD,empty:qD,spinner:HD,uploadArea:WD,dropZone:KD,uploadIcon:QD,dropText:GD,dropSubtext:YD,uploadPreview:XD,hiddenInput:ZD,fileName:JD,errorText:eI,footer:tI,cancelBtn:rI,confirmBtn:nI},Au=18,$h=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=p.useState("my"),[o,a]=p.useState(""),[c,d]=p.useState([]),[u,f]=p.useState(0),[m,g]=p.useState(!1),[_,h]=p.useState(null),[y,v]=p.useState(0),[b,x]=p.useState(null),[w,C]=p.useState(""),[D,j]=p.useState(!1),[k,$]=p.useState(""),N=p.useRef(null),A=ue(P=>{var Y,W;return((W=(Y=P.editorConfig)==null?void 0:Y.context)==null?void 0:W.channel)??""}),U=ue(P=>{var Y,W;return((W=(Y=P.editorConfig)==null?void 0:Y.context)==null?void 0:W.uid)??""}),R=ue(P=>{var Y,W,oe;return((oe=(W=(Y=P.editorConfig)==null?void 0:Y.context)==null?void 0:W.cloudStorage)==null?void 0:oe.presigned_headers)??{}}),B=ue(P=>{var Y,W,oe;return((oe=(W=(Y=P.editorConfig)==null?void 0:Y.config)==null?void 0:W.assetConfig)==null?void 0:oe.size)??1*1024*1024}),F=ue(P=>{var Y,W,oe;return((oe=(W=(Y=P.editorConfig)==null?void 0:Y.config)==null?void 0:W.assetConfig)==null?void 0:oe.accepted)??"image/png,image/jpeg"}),J=p.useCallback(async(P,Y,W=!1)=>{var oe;g(!0);try{const pe={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&U&&(pe.createdBy=U),A&&(pe.channel=A);const re=((oe=(await Me.post("/action/composite/v3/search",{request:{filters:pe,query:P,limit:Au,offset:Y,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:oe.result)??{},se=re.content??[];f(re.count??0),d(le=>W?[...le,...se]:se)}catch{}finally{g(!1)}},[s,U,A]);p.useEffect(()=>{s!=="upload"&&(d([]),v(0),J(o,0))},[s]);const ie=p.useRef(),me=P=>{a(P),clearTimeout(ie.current),ie.current=setTimeout(()=>{d([]),v(0),J(P,0)},400)},ve=()=>{const P=y+Au;v(P),J(o,P,!0)},be=()=>{const P=(_==null?void 0:_.artifactUrl)??(_==null?void 0:_.appIcon)??(_==null?void 0:_.downloadUrl)??"";P&&r(P)};p.useEffect(()=>()=>{w&&URL.revokeObjectURL(w)},[w]);const K=P=>{var oe;const Y=(oe=P.target.files)==null?void 0:oe[0];if(P.target.value="",!Y)return;const W=F.split(",").map(pe=>pe.trim());if(!W.includes(Y.type)){const pe=W.map(Ne=>Ne.replace("image/","").toUpperCase()).join(", ");$(`Only ${pe} files are accepted.`);return}if(Y.size>B){const pe=(B/1048576).toFixed(0);$(`Image must be under ${pe} MB.`);return}w&&URL.revokeObjectURL(w),x(Y),C(URL.createObjectURL(Y)),$("")},M=async()=>{if(b){j(!0),$("");try{const P=await _D(b.name.split(".").slice(0,-1).join(".")||b.name,b.type,U,A),Y=await wD(P,b.name);await xD(Y,b,R);const W=Y.split("?")[0],oe=await SD(P,W,b.type);r(oe)}catch(P){$(P instanceof Error?P.message:"Upload failed.")}finally{j(!1)}}},G=c.length<u;return l.jsx("div",{className:fe.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:fe.modal,children:[l.jsxs("div",{className:fe.header,children:[l.jsx("span",{className:fe.title,children:"Select App Icon"}),l.jsx("button",{className:fe.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(on,{size:18})})]}),l.jsxs("div",{className:fe.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${fe.tab} ${s==="my"?fe.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${fe.tab} ${s==="all"?fe.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${fe.tab} ${s==="upload"?fe.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(Wl,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:fe.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:fe.searchWrap,children:[l.jsx(la,{size:14,className:fe.searchIcon}),l.jsx("input",{type:"search",className:fe.searchInput,placeholder:"Search images…",value:o,onChange:P=>me(P.target.value)})]}),m&&c.length===0?l.jsxs("div",{className:fe.loadingRow,children:[l.jsx(ii,{size:20,className:fe.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:fe.empty,children:"No images found"}):l.jsx("div",{className:fe.grid,children:c.map(P=>{const Y=P.appIcon??P.artifactUrl??P.downloadUrl??"",W=(_==null?void 0:_.identifier)===P.identifier;return l.jsxs("button",{type:"button",className:`${fe.imgCell} ${W?fe.imgCellSelected:""}`,onClick:()=>h(P),title:P.name,children:[Y?l.jsx("img",{src:Y,alt:P.name,className:fe.thumb}):l.jsx("div",{className:fe.noThumb,children:"IMG"}),W&&l.jsx("div",{className:fe.checkBadge,children:l.jsx(Un,{size:12})})]},P.identifier)})}),G&&!m&&l.jsx("button",{className:fe.loadMoreBtn,onClick:ve,children:"Load More"}),m&&c.length>0&&l.jsx("div",{className:fe.loadingRow,children:l.jsx(ii,{size:16,className:fe.spinner})})]}):l.jsxs("div",{className:fe.uploadArea,children:[l.jsx("div",{className:fe.dropZone,onClick:()=>{var P;return(P=N.current)==null?void 0:P.click()},onDragOver:P=>P.preventDefault(),onDrop:P=>{P.preventDefault();const Y=P.dataTransfer.files[0];Y&&K({target:{files:[Y],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:fe.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(Wl,{size:32,className:fe.uploadIcon}),l.jsx("p",{className:fe.dropText,children:"Drag & drop or click to browse"}),l.jsxs("p",{className:fe.dropSubtext,children:[F.split(",").map(P=>P.replace("image/","").toUpperCase()).join(", ")," · max ",(B/(1024*1024)).toFixed(0)," MB"]})]})}),l.jsx("input",{ref:N,type:"file",accept:F,className:fe.hiddenInput,onChange:K}),b&&l.jsx("p",{className:fe.fileName,children:b.name}),k&&l.jsx("p",{className:fe.errorText,children:k})]})}),l.jsxs("div",{className:fe.footer,children:[l.jsx("button",{className:fe.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:fe.confirmBtn,disabled:!b||D,onClick:M,children:D?l.jsxs(l.Fragment,{children:[l.jsx(ii,{size:14,className:fe.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:fe.confirmBtn,disabled:!_,onClick:be,children:"Use Selected"})]})]})})},sI=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),{watch:a,setValue:c,register:d,formState:{errors:u}}=Yt(),f=a(e),m=u[e],g=h=>{c(e,h,{shouldDirty:!0,shouldValidate:!0}),o(!1)},_=()=>{c(e,"",{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:L.field,children:[l.jsxs("label",{className:L.label,children:[t,n&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("input",{type:"hidden",...d(e,{required:n?`${t} is required`:!1})}),l.jsx("div",{className:L.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":"Select app icon",onClick:()=>!s&&o(!0),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&!s&&o(!0)},children:f?l.jsx("img",{src:f,alt:"App icon",className:L.iconPreview}):l.jsxs("div",{className:L.iconPlaceholder,children:[l.jsx(Wd,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:L.removeIconBtn,onClick:_,"aria-label":"Remove app icon",children:[l.jsx(Ka,{size:13}),l.jsx("span",{children:"Remove"})]}),m&&l.jsx("span",{className:L.error,children:String(m.message)}),i&&l.jsx($h,{nodeId:r,currentValue:f,onSelect:g,onClose:()=>o(!1)})]})},iI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=no({name:e,control:s,rules:{required:r?`${t} is required`:!1}});return l.jsxs("div",{className:L.field,children:[l.jsxs("label",{className:L.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("input",{id:e,type:"datetime-local",className:[L.input,o?L.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),o&&l.jsx("span",{className:L.error,children:String(o.message)})]})},oI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=no({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=p.useState(""),d=p.useRef(null),u=i.value??[],f=h=>{const y=h.trim();!y||u.includes(y)||i.onChange([...u,y])},m=h=>{i.onChange(u.filter(y=>y!==h))},g=h=>{h.key==="Enter"||h.key===","?(h.preventDefault(),f(a),c("")):h.key==="Backspace"&&a===""&&u.length>0&&m(u[u.length-1])},_=()=>{a.trim()&&(f(a),c("")),i.onBlur()};return l.jsxs("div",{className:[L.field,L.fullWidth].join(" "),children:[l.jsxs("label",{className:L.label,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsxs("div",{className:[L.chipGroup,o?L.inputError:""].join(" "),onClick:()=>{var h;return!n&&((h=d.current)==null?void 0:h.focus())},style:{cursor:n?"not-allowed":"text"},children:[u.map(h=>l.jsxs("span",{className:L.tagChip,children:[h,!n&&l.jsx("button",{type:"button",className:L.tagChipRemove,onClick:y=>{y.stopPropagation(),m(h)},"aria-label":`Remove ${h}`,children:l.jsx(on,{size:11})})]},h)),!n&&l.jsx("input",{ref:d,className:L.chipInput,value:a,onChange:h=>c(h.target.value),onKeyDown:g,onBlur:_,placeholder:u.length===0?"Type and press Enter or comma…":"",style:{flexGrow:1,minWidth:120}})]}),o&&l.jsx("span",{className:L.error,children:String(o.message)})]})},aI=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Yt(),{field:o,fieldState:{error:a}}=no({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},d=(u,f,m)=>{const g={};for(let _=0;_<f;_++)g[r[_].code]=c[r[_].code]??"";g[u]=m;for(let _=f+1;_<r.length;_++)g[r[_].code]="";o.onChange(g)};return l.jsxs("div",{className:[L.field,L.fullWidth].join(" "),children:[l.jsxs("label",{className:L.label,children:[t,n&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("div",{className:L.nestedSelectRow,children:r.map((u,f)=>{const m=f>0&&!c[r[f-1].code];return l.jsxs("div",{className:L.field,style:{flex:1},children:[l.jsx("label",{className:L.label,htmlFor:`${e}_${u.code}`,children:u.label}),l.jsxs("select",{id:`${e}_${u.code}`,className:[L.input,a?L.inputError:""].join(" "),disabled:s||m,value:c[u.code]??"",onChange:g=>d(u.code,f,g.target.value),onBlur:o.onBlur,children:[l.jsx("option",{value:"",children:"Select…"}),u.options.map(g=>l.jsx("option",{value:g.value,children:g.label},g.value))]})]},u.code)})}),a&&l.jsx("span",{className:L.error,children:String(a.message)})]})},Pu=[{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"}],lI=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=p.useState(!1),o=p.useRef(null),{register:a,watch:c,setValue:d,formState:{errors:u}}=Yt(),f=c(e),m=Pu.find(h=>h.value===f),g=(m==null?void 0:m.label)??"Select license…",_=u[e];return p.useEffect(()=>{if(!s)return;const h=y=>{var v;(v=o.current)!=null&&v.contains(y.target)||i(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),l.jsxs("div",{className:L.field,ref:o,style:{position:"relative"},children:[l.jsxs("label",{className:L.label,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("input",{type:"hidden",...a(e,{required:r?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:n,className:[L.selectBtn,_?L.inputError:"",s?L.selectOpen:""].join(" "),onClick:()=>i(h=>!h),"aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:f?L.selectedVal:L.placeholder,children:g}),l.jsx(ks,{size:14,className:s?L.chevronUp:""})]}),s&&l.jsx("div",{className:L.dropdown,role:"listbox",children:Pu.map(h=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===h.value,className:[L.option,f===h.value?L.optionSelected:""].join(" "),onClick:()=>{d(e,h.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:h.label}),f===h.value&&l.jsx(Un,{size:13})]},h.value))}),_&&l.jsx("span",{className:L.error,children:String(_.message)})]})},cI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=no({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=p.useState("idle"),[d,u]=p.useState(""),f=async()=>{const g=(i.value??"").trim();if(!g){c("invalid"),u("Enter a dial code to validate.");return}c("loading"),u("");try{const _=await L_(g),h=_==null?void 0:_.result,y=h==null?void 0:h.dialcodes;Array.isArray(y)&&y.length>0?(c("valid"),u("Dial code is valid.")):(c("invalid"),u("Dial code not found."))}catch{c("invalid"),u("Validation failed. Please try again.")}},m=()=>a==="loading"?l.jsx(ii,{size:16,className:L.dialcodeSpinner}):a==="valid"?l.jsx(Vd,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(aa,{size:16,color:"var(--sbx-error)"}):null;return l.jsxs("div",{className:L.field,children:[l.jsxs("label",{className:L.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsxs("div",{className:L.dialcodeRow,children:[l.jsx("input",{id:e,type:"text",className:[L.input,o?L.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:g=>{i.onChange(g),c("idle"),u("")},onBlur:i.onBlur,ref:i.ref,placeholder:"e.g. A1B2C3",style:{flex:1}}),l.jsx("button",{type:"button",className:L.validateBtn,onClick:f,disabled:n||a==="loading","aria-label":"Validate dial code",children:a==="loading"?"Validating…":"Validate"}),m()]}),o&&l.jsx("span",{className:L.error,children:String(o.message)}),!o&&d&&l.jsx("span",{className:a==="valid"?L.dialcodeValid:L.error,children:d})]})},uI="_form_szqex_1",dI="_ungrouped_szqex_7",fI="_noFields_szqex_18",Lo={form:uI,ungrouped:dI,noFields:fI},hI=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var me,ve,be,K;const a=ue(M=>M.editorConfig),c=ue(M=>M.rootFormConfig),d=ue(M=>M.unitFormConfig),{organisationFramework:u,targetFrameworks:f,isLoading:m}=Ph((me=a==null?void 0:a.context)==null?void 0:me.framework,(ve=a==null?void 0:a.context)==null?void 0:ve.targetFWIds),{frameworks:g,collectionAdditionalCategories:_}=vE((be=a==null?void 0:a.context)==null?void 0:be.channel),h=g==null?void 0:g.map(M=>({label:M.name,value:M.identifier})),y={organisationFramework:u,targetFrameworks:f,orgFrameworks:h,channelAdditionalCategories:_},v=Re(M=>M.selectedNodeId),b=Re(M=>M.treeCache),x=v?b[v]??{}:{},w={...e,...x},C=r?c:d,D=C||(((K=a==null?void 0:a.config.hierarchy)==null?void 0:K.formConfig)??[]),j=xE(D,w,y,r),k=j.filter(M=>M.tab===t&&M.inputType!=="appIcon"&&M.visible!==!1),$=mE({mode:"onChange",defaultValues:Object.fromEntries(j.map(M=>{const G=["multiselect","chips","keywords","tagsinput"],P=["nestedselect"];return G.includes(M.inputType)?[M.code,M.currentValue??M.defaultValue??[]]:P.includes(M.inputType)?[M.code,M.currentValue??M.defaultValue??{}]:[M.code,M.currentValue??M.defaultValue??""]}))});NE($,j);const{updateNode:N}=Re(),A=p.useRef(j);A.current=j;const U=p.useRef(v);U.current=v;const R=p.useRef(i);R.current=i;const B=p.useRef(o);B.current=o,p.useEffect(()=>{const M=U.current;if(M){const G=Object.fromEntries(A.current.filter(P=>P.currentValue!==void 0&&P.currentValue!==null).map(P=>[P.code,P.currentValue]));Object.keys(G).length>0&&N(M,G)}$.trigger().then(()=>{const G=$.formState.errors,P=A.current,Y=Array.from(new Set(Object.keys(G).map(W=>{var oe;return(oe=P.find(pe=>pe.code===W))==null?void 0:oe.tab}).filter(Boolean)));B.current(Object.keys(G).length===0,Y)})},[]),p.useEffect(()=>{const M=$.watch((G,{name:P})=>{const Y=U.current;if(!Y)return;const W=A.current,oe=new Set(W.map(re=>re.code));if(P&&oe.has(P)){let re=$.getValues(P);P==="dialcodes"&&(re=Array.isArray(re)?re:re?[re]:[]),N(Y,{[P]:re}),R.current({[P]:re})}else if(!P){const re=$.getValues(),se=Object.fromEntries(Object.entries(re).filter(([le])=>oe.has(le)));Object.keys(se).length>0&&(N(Y,se),R.current(se))}const pe=$.formState.errors,Ne=Array.from(new Set(Object.keys(pe).map(re=>{var se;return(se=W.find(le=>le.code===re))==null?void 0:se.tab}).filter(Boolean)));B.current(Object.keys(pe).length===0,Ne)});return()=>M.unsubscribe()},[$]);const F=s!=="edit",J=k.reduce((M,G)=>{const P=M[M.length-1];return P&&P.section===G.section?P.fields.push(G):M.push({section:G.section,fields:[G]}),M},[]),ie=M=>{const G={key:M.code,name:M.code,label:M.label,required:M.required,disabled:F||M.editable===!1};switch(M.inputType){case"textarea":return l.jsx(ku,{...G,multiline:!0,maxLength:M.maxLength});case"select":return l.jsx(mD,{...G,options:M.options??[]});case"multiselect":return l.jsx(yD,{...G,options:M.options??[]});case"chips":return l.jsx(vD,{...G});case"radio":return l.jsx(bD,{...G,options:M.options??[]});case"appIcon":return l.jsx(sI,{...G,nodeId:v??""});case"datepicker":case"datetime":return l.jsx(iI,{...G});case"keywords":case"tagsinput":return l.jsx(oI,{...G});case"nestedselect":return l.jsx(aI,{...G,levels:M.levels??[]});case"license":return l.jsx(lI,{...G});case"dialcode":return l.jsx(cI,{...G});default:return l.jsx(ku,{...G,maxLength:M.maxLength})}};return l.jsx(tE,{...$,children:l.jsxs("div",{className:Lo.form,children:[J.map((M,G)=>{const P=M.section?bE[M.section]:void 0;return P?l.jsx(ME,{title:P.title,description:P.description,children:M.fields.map(ie)},M.section??G):l.jsx("div",{className:Lo.ungrouped,children:M.fields.map(ie)},G)}),k.length===0&&!m&&l.jsx("p",{className:Lo.noFields,children:"No fields configured for this tab."})]})})};function Bh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function pI(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function Js(e){return e!==null&&e>=0}function gI(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 mI(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Uh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=Bh(t,n,r),o=t[s],a=i[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},ei={scaleX:1,scaleY:1},yI=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:s,rects:i,overIndex:o}=e;const a=(t=i[r])!=null?t:n;if(!a)return null;if(s===r){const d=i[o];return d?{x:0,y:r<o?d.top+d.height-(a.top+a.height):d.top-a.top,...ei}:null}const c=vI(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...ei}:s<r&&s>=o?{x:0,y:a.height+c,...ei}:{x:0,y:0,...ei}};function vI(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 Vh="Sortable",zh=p.createContext({activeIndex:-1,containerId:Vh,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Uh,disabled:{draggable:!1,droppable:!1}});function bI(e){let{children:t,id:r,items:n,strategy:s=Uh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:u}=$d(),f=js(Vh,r),m=a.rect!==null,g=p.useMemo(()=>n.map(D=>typeof D=="object"&&"id"in D?D.id:D),[n]),_=o!=null,h=o?g.indexOf(o.id):-1,y=d?g.indexOf(d.id):-1,v=p.useRef(g),b=!gI(g,v.current),x=y!==-1&&h===-1||b,w=mI(i);Kt(()=>{b&&_&&u(g)},[b,g,_,u]),p.useEffect(()=>{v.current=g},[g]);const C=p.useMemo(()=>({activeIndex:h,containerId:f,disabled:w,disableTransforms:x,items:g,overIndex:y,useDragOverlay:m,sortedRects:pI(g,c),strategy:s}),[h,f,w.draggable,w.droppable,x,g,y,c,m,s]);return p.createElement(zh.Provider,{value:C},t)}const _I=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return Bh(r,n,s).indexOf(t)},wI=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:i,newIndex:o,previousItems:a,previousContainerId:c,transition:d}=e;return!d||!n||a!==i&&s===o?!1:r?!0:o!==s&&t===c},xI={duration:200,easing:"ease"},qh="transform",SI=Ar.Transition.toString({property:qh,duration:0,easing:"linear"}),CI={roleDescription:"sortable"};function OI(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=p.useState(null),a=p.useRef(r);return Kt(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const d=Bn(n.current,{ignoreTransform:!0}),u={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(u.x||u.y)&&o(u)}}r!==a.current&&(a.current=r)},[t,r,n,s]),p.useEffect(()=>{i&&o(null)},[i]),i}function EI(e){let{animateLayoutChanges:t=wI,attributes:r,disabled:n,data:s,getNewIndex:i=_I,id:o,strategy:a,resizeObserverConfig:c,transition:d=xI}=e;const{items:u,containerId:f,activeIndex:m,disabled:g,disableTransforms:_,sortedRects:h,overIndex:y,useDragOverlay:v,strategy:b}=p.useContext(zh),x=DI(n,g),w=u.indexOf(o),C=p.useMemo(()=>({sortable:{containerId:f,index:w,items:u},...s}),[f,s,w,u]),D=p.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:j,node:k,isOver:$,setNodeRef:N}=$m({id:o,data:C,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...c}}),{active:A,activatorEvent:U,activeNodeRect:R,attributes:B,setNodeRef:F,listeners:J,isDragging:ie,over:me,setActivatorNodeRef:ve,transform:be}=Fd({id:o,data:C,attributes:{...CI,...r},disabled:x.draggable}),K=Cg(N,F),M=!!A,G=M&&!_&&Js(m)&&Js(y),P=!v&&ie,Y=P&&G?be:null,oe=G?Y??(a??b)({rects:h,activeNodeRect:R,activeIndex:m,overIndex:y,index:w}):null,pe=Js(m)&&Js(y)?i({id:o,items:u,activeIndex:m,overIndex:y}):w,Ne=A==null?void 0:A.id,re=p.useRef({activeId:Ne,items:u,newIndex:pe,containerId:f}),se=u!==re.current.items,le=t({active:A,containerId:f,isDragging:ie,isSorting:M,id:o,index:w,items:u,newIndex:re.current.newIndex,previousItems:re.current.items,previousContainerId:re.current.containerId,transition:d,wasDragging:re.current.activeId!=null}),Le=OI({disabled:!le,index:w,node:k,rect:j});return p.useEffect(()=>{M&&re.current.newIndex!==pe&&(re.current.newIndex=pe),f!==re.current.containerId&&(re.current.containerId=f),u!==re.current.items&&(re.current.items=u)},[M,pe,f,u]),p.useEffect(()=>{if(Ne===re.current.activeId)return;if(Ne&&!re.current.activeId){re.current.activeId=Ne;return}const Te=setTimeout(()=>{re.current.activeId=Ne},50);return()=>clearTimeout(Te)},[Ne]),{active:A,activeIndex:m,attributes:B,data:C,rect:j,index:w,newIndex:pe,items:u,isOver:$,isSorting:M,isDragging:ie,listeners:J,node:k,overIndex:y,over:me,setNodeRef:K,setActivatorNodeRef:ve,setDroppableNodeRef:N,setDraggableNodeRef:F,transform:Le??oe,transition:ze()};function ze(){if(Le||se&&re.current.newIndex===w)return SI;if(!(P&&!Bi(U)||!d)&&(M||le))return Ar.Transition.toString({...d,property:qh})}}function DI(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 Ai(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 II=[we.Down,we.Right,we.Up,we.Left],NI=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(II.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const m=s.get(f.id);if(m)switch(e.code){case we.Down:n.top<m.top&&c.push(f);break;case we.Up:n.top>m.top&&c.push(f);break;case we.Left:n.left>m.left&&c.push(f);break;case we.Right:n.left<m.left&&c.push(f);break}});const d=Ug({collisionRect:n,droppableRects:s,droppableContainers:c});let u=wd(d,"id");if(u===(o==null?void 0:o.id)&&d.length>1&&(u=d[1].id),u!=null){const f=i.get(r.id),m=i.get(u),g=m?s.get(m.id):null,_=m==null?void 0:m.node.current;if(_&&g&&f&&m){const y=Ui(_).some((D,j)=>a[j]!==D),v=Hh(f,m),b=TI(f,m),x=y||!v?{x:0,y:0}:{x:b?n.width-g.width:0,y:b?n.height-g.height:0},w={x:g.left,y:g.top};return x.x&&x.y?w:ys(w,x)}}}};function Hh(e,t){return!Ai(e)||!Ai(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function TI(e,t){return!Ai(e)||!Ai(t)||!Hh(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const jI="_row_11nth_1",RI="_removeBtn_11nth_14",kI="_grip_11nth_17",AI="_ctIcon_11nth_34",PI="_info_11nth_38",MI="_name_11nth_46",LI="_meta_11nth_55",Lr={row:jI,removeBtn:RI,grip:kI,ctIcon:AI,info:PI,name:MI,meta:LI},FI={video:Qa,pdf:za,h5p:qa,scorm:Wa,audio:Ha,quiz:Va,default:Vn},$I=({item:e,onRemove:t,isEditable:r})=>{const n=eo(e),s=FI[n.key]??Vn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:d,isDragging:u}=EI({id:e.id,disabled:!r}),f={transform:Ar.Transform.toString(c),transition:d,opacity:u?.5:1};return l.jsxs("div",{ref:a,style:f,className:Lr.row,role:"listitem",children:[r&&l.jsx("span",{className:Lr.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(Hd,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Lr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Lr.info,children:[l.jsx("span",{className:Lr.name,title:e.name,children:e.name}),l.jsx("span",{className:Lr.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Lr.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(on,{size:14})})]})},BI="_container_lzvke_1",UI="_header_lzvke_7",VI="_heading_lzvke_13",zI="_count_lzvke_21",qI="_list_lzvke_30",HI="_emptyState_lzvke_36",WI="_addRow_lzvke_52",Fr={container:BI,header:UI,heading:VI,count:zI,list:qI,emptyState:HI,addRow:WI},KI=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=Re(),i=t?r(t):[],o=e==="edit",a=vd(na(Vi,{activationConstraint:{distance:5}}),na($a,{coordinateGetter:NI})),c=p.useCallback(u=>{const{active:f,over:m}=u;if(!m||f.id===m.id||!t)return;const g=Re.getState().getChildrenOf(t),_=g.findIndex(y=>y.id===f.id),h=g.findIndex(y=>y.id===m.id);_<0||h<0||n(t,_,h)},[t,n]),d=p.useCallback(u=>{window.confirm("Remove this content from the unit?")&&s(u)},[s]);return t?l.jsxs("div",{className:Fr.container,children:[l.jsxs("div",{className:Fr.header,children:[l.jsx("span",{className:Fr.heading,children:"Content in this unit"}),l.jsx("span",{className:Fr.count,children:i.length})]}),i.length>0?l.jsx(Ld,{sensors:a,collisionDetection:Bg,onDragEnd:c,children:l.jsx(bI,{items:i.map(u=>u.id),strategy:yI,children:l.jsx("div",{className:Fr.list,role:"list",children:i.map(u=>l.jsx($I,{item:u,onRemove:d,isEditable:o},u.id))})})}):l.jsxs("div",{className:Fr.emptyState,children:[l.jsx("p",{children:"No content yet"}),l.jsx("span",{children:"Drag from the library or click Add content"})]}),o&&l.jsxs("button",{className:Fr.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(As,{size:14})," Add content"]})]}):null},QI="_dropZone_ijo5w_1",GI="_active_ijo5w_14",Mu={dropZone:QI,active:GI},YI=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${Mu.dropZone} ${e?Mu.active:""} ${n??""}`,"data-droppable":e?"true":void 0,"data-node-id":r,"aria-label":t,role:"region",children:l.jsx("span",{children:t})});async function XI(e){var o;const t={status:["Live"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((o=(await Me.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:o.result)??{},s=new Set(["count","facets"]);return{content:Object.entries(n).filter(([a])=>!s.has(a)).flatMap(([,a])=>Array.isArray(a)?a:[]),count:n.count??0}}async function ZI(e){var r,n;return(n=(r=(await Me.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}const JI="_contentPlayerRoot_ryh6z_1",eN="_stage_ryh6z_9",tN="_playerHeader_ryh6z_19",rN="_playerHeaderThumb_ryh6z_33",nN="_playerHeaderTitle_ryh6z_43",sN="_typeBadge_ryh6z_53",iN="_typeDot_ryh6z_92",oN="_aspectRatio_ryh6z_99",aN="_playerFrame_ryh6z_112",lN="_coverOverlay_ryh6z_120",cN="_coverHidden_ryh6z_132",uN="_coverThumb_ryh6z_137",dN="_coverPlayRing_ryh6z_146",fN="_coverPlayIcon_ryh6z_159",hN="_coverLabel_ryh6z_168",pN="_coverSkeleton_ryh6z_174",gN="_playerWrapper_ryh6z_200",mN="_infoStrip_ryh6z_210",yN="_infoChip_ryh6z_226",vN="_infoChipLabel_ryh6z_245",bN="_infoChipIcon_ryh6z_254",_N="_playerError_ryh6z_260",wN="_playerErrorIcon_ryh6z_274",xN="_playerErrorMsg_ryh6z_279",SN="_qumlRoot_ryh6z_286",Pe={contentPlayerRoot:JI,stage:eN,playerHeader:tN,playerHeaderThumb:rN,playerHeaderTitle:nN,typeBadge:sN,typeDot:iN,aspectRatio:oN,playerFrame:aN,coverOverlay:lN,coverHidden:cN,coverThumb:uN,coverPlayRing:dN,coverPlayIcon:fN,coverLabel:hN,coverSkeleton:pN,playerWrapper:gN,infoStrip:mN,infoChip:yN,infoChipLabel:vN,infoChipIcon:bN,playerError:_N,playerErrorIcon:wN,playerErrorMsg:xN,qumlRoot:SN},CN=[{key:"video",mimes:["video/mp4","video/webm","video/ogg"],label:"Video",icon:"🎬"},{key:"audio",mimes:["audio/mp3","audio/mpeg","audio/ogg","audio/wav"],label:"Audio",icon:"🎵"},{key:"pdf",mimes:["application/pdf"],label:"PDF",icon:"📄"},{key:"epub",mimes:["application/epub"],label:"ePub",icon:"📖"},{key:"ecml",mimes:["application/vnd.ekstep.ecml-archive"],label:"ECML",icon:"✏️"},{key:"h5p",mimes:["application/vnd.ekstep.h5p-archive"],label:"H5P",icon:"🎮"},{key:"scorm",mimes:["application/vnd.ekstep.content-collection"],label:"SCORM",icon:"📦"}];function ON(e){return CN.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const EN={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},DN={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},IN={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},NN="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function Fo(e){for(const[t,r]of Object.entries(EN))if(r.includes(e))return t;return"default-player"}function TN(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 jN(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 RN(e,t,r=100){await jN(DN[t]??""),!customElements.get(e)&&await new Promise((n,s)=>{let i=0;const o=setInterval(()=>{i++,customElements.get(e)?(clearInterval(o),n()):i>=r&&(clearInterval(o),s(new Error(`Custom element <${e}> did not register`)))},100)})}const kN=[{key:"author",label:"Author",icon:"👤"},{key:"license",label:"License",icon:"⚖️"},{key:"language",label:"Language",icon:"🌐"},{key:"gradeLevel",label:"Class",icon:"🏫"},{key:"subject",label:"Subject",icon:"📚"},{key:"contentType",label:"Type",icon:"🏷️"}];function AN({node:e}){const t=e.metadata??{},r=kN.flatMap(n=>{const s=t[n.key];if(!s)return[];const i=Array.isArray(s)?s.join(", "):String(s);return i?[{...n,val:i}]:[]});return r.length?l.jsx("div",{className:Pe.infoStrip,children:r.map(n=>l.jsxs("div",{className:Pe.infoChip,children:[n.icon&&l.jsx("span",{className:Pe.infoChipIcon,children:n.icon}),l.jsx("span",{className:Pe.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function PN({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${Pe.coverOverlay} ${t?Pe.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:Pe.coverThumb}),l.jsx("div",{className:Pe.coverPlayRing,children:l.jsx("div",{className:Pe.coverPlayIcon})}),l.jsx("span",{className:Pe.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:Pe.coverSkeleton})})}function MN({message:e}){return l.jsxs("div",{className:Pe.playerError,children:[l.jsx("span",{className:Pe.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:Pe.playerErrorMsg,children:e})]})}function LN({mimeType:e}){const t=ON(e);return l.jsxs("span",{className:Pe.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:Pe.typeDot}),t.label]})}const ja=({node:e,editorMode:t,type:r})=>{var s;if(r==="quml")return l.jsx($N,{node:e,editorMode:t});const n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return l.jsxs("div",{className:Pe.contentPlayerRoot,children:[l.jsxs("div",{className:Pe.stage,children:[l.jsxs("div",{className:Pe.playerHeader,children:[n&&l.jsx("img",{src:n,alt:"",className:Pe.playerHeaderThumb}),l.jsx("span",{className:Pe.playerHeaderTitle,children:e.name}),l.jsx(LN,{mimeType:e.mimeType??""})]}),l.jsx(FN,{node:e})]}),l.jsx(AN,{node:e})]})};function FN({node:e}){var y;const t=ue(v=>v.editorConfig),[r,n]=p.useState(()=>Fo(e.mimeType??"")),[s,i]=p.useState(!1),[o,a]=p.useState(null),[c,d]=p.useState(e.metadata??{}),[u,f]=p.useState(!1),m=p.useRef(null),g=p.useRef(null),_=((y=t==null?void 0:t.config)==null?void 0:y.previewCdnUrl)??NN;p.useEffect(()=>{let v=!1;return f(!1),i(!1),a(null),d(e.metadata??{}),n(Fo(e.mimeType??"")),ZI(e.identifier).then(b=>{if(v)return;const x={...e.metadata??{},...b};d(x);const w=b.mimeType??e.mimeType??"";n(Fo(w)),f(!0)}).catch(()=>{v||f(!0)}),()=>{v=!0}},[e.identifier]);const h=TN(e,c,t);return p.useEffect(()=>{if(!u||r!=="default-player")return;const v=m.current;if(!v)return;v.src=_;const b=()=>{try{const w=v.contentWindow;if(typeof(w==null?void 0:w.initializePreview)!="function"){a("Preview player unavailable. Check that /content/preview is reachable.");return}w.initializePreview(h),setTimeout(()=>i(!0),300)}catch(w){console.error("[ContentPlayer] initializePreview failed",w),a("Failed to initialize the content player.")}},x=()=>a("Preview player could not be loaded.");return v.addEventListener("load",b),v.addEventListener("error",x),()=>{v.removeEventListener("load",b),v.removeEventListener("error",x),v.src=""}},[e.identifier,r,_,u]),p.useEffect(()=>{if(!u||r==="default-player")return;const v=g.current;if(!v)return;const b=IN[r];if(!b)return;const x=h;RN(b,r).then(()=>{if(!g.current)return;if(!customElements.get(b)){n("default-player");return}const w=document.createElement(b);w.setAttribute("player-config",JSON.stringify(x)),w.addEventListener("playerEvent",()=>{}),w.addEventListener("telemetryEvent",()=>{}),v.innerHTML="",v.appendChild(w),setTimeout(()=>{try{w.playerConfig=x}catch{}i(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${r} script unavailable, falling back to iframe`),n("default-player")})},[e.identifier,r,u]),l.jsxs("div",{className:Pe.aspectRatio,children:[o?l.jsx(MN,{message:o}):l.jsx(PN,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:m,id:"contentPlayer",title:e.name,className:Pe.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:g,className:Pe.playerFrame})]})}function $N({node:e,editorMode:t}){const r=ue(s=>s.editorConfig),n=p.useRef(null);return p.useEffect(()=>{var a;if(!n.current)return;const s=r==null?void 0:r.context,i={context:{mode:t==="edit"?"edit":"play",pdata:{id:((a=s==null?void 0:s.pdata)==null?void 0:a.id)??"sunbird.portal",ver:"1.0",pid:"sunbird-portal"},contentId:e.identifier,sid:(s==null?void 0:s.sid)??"",uid:(s==null?void 0:s.uid)??"",channel:(s==null?void 0:s.channel)??"",did:(s==null?void 0:s.did)??""},config:{enable:!1,showShare:!1,showDownload:!1,showReplay:!0,showExit:!1},metadata:e.metadata??{},data:{}},o=document.createElement("sunbird-quml-player");o.setAttribute("player-config",JSON.stringify(i)),n.current.innerHTML="",n.current.appendChild(o)},[e.identifier,t]),l.jsx("div",{className:Pe.qumlRoot,children:l.jsx("div",{ref:n,className:Pe.playerWrapper})})}const BN="_overlay_ifddx_1",UN="_modal_ifddx_11",VN="_header_ifddx_21",zN="_body_ifddx_37",qN="_hint_ifddx_43",HN="_list_ifddx_49",WN="_item_ifddx_55",KN="_selected_ifddx_68",QN="_empty_ifddx_73",GN="_footer_ifddx_79",YN="_cancelBtn_ifddx_87",XN="_moveBtn_ifddx_95",Ft={overlay:BN,modal:UN,header:VN,body:zN,hint:qN,list:HN,item:WN,selected:KN,empty:QN,footer:GN,cancelBtn:YN,moveBtn:XN};function ZN(e,t,r){const n=[],s=i=>{var o;for(const a of i)a.isFolder&&a.id!==r&&a.id!==t&&n.push(a),(o=a.children)!=null&&o.length&&s(a.children)};return s(e),n}const JN=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var u;const{treeData:s,moveNode:i}=Re(),o=ZN(s,((u=s[0])==null?void 0:u.id)??"",r),[a,c]=p.useState(null),d=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:Ft.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:Ft.modal,children:[l.jsxs("div",{className:Ft.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(on,{size:16})})]}),l.jsxs("div",{className:Ft.body,children:[l.jsx("p",{className:Ft.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:Ft.list,children:[o.map(f=>l.jsxs("li",{className:`${Ft.item} ${a===f.id?Ft.selected:""}`,onClick:()=>c(f.id),children:[l.jsx(ly,{size:14}),l.jsx("span",{children:f.name})]},f.id)),o.length===0&&l.jsx("li",{className:Ft.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:Ft.footer,children:[l.jsx("button",{className:Ft.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:Ft.moveBtn,onClick:d,disabled:!a,children:"Move here"})]})]})})},eT="_overlay_16at9_1",tT="_modal_16at9_11",rT="_header_16at9_21",nT="_body_16at9_37",sT="_table_16at9_43",iT="_pageInput_16at9_61",oT="_empty_16at9_68",aT="_footer_16at9_74",lT="_cancelBtn_16at9_82",cT="_saveBtn_16at9_90",tr={overlay:eT,modal:tT,header:rT,body:nT,table:sT,pageInput:iT,empty:oT,footer:aT,cancelBtn:lT,saveBtn:cT};function uT(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 dT=({onClose:e})=>{const{treeData:t,updateNode:r}=Re(),n=uT(t),[s,i]=p.useState(()=>Object.fromEntries(n.map(a=>{var c;return[a.id,String(((c=a.metadata)==null?void 0:c.pageNumber)??"")]}))),o=p.useCallback(()=>{for(const[a,c]of Object.entries(s))c!==""&&r(a,{pageNumber:parseInt(c,10)||void 0});e()},[s,r,e]);return l.jsx("div",{className:tr.overlay,role:"dialog","aria-label":"Assign Page Numbers",children:l.jsxs("div",{className:tr.modal,children:[l.jsxs("div",{className:tr.header,children:[l.jsx("span",{children:"Assign Page Numbers"}),l.jsx("button",{onClick:e,"aria-label":"Close",children:l.jsx(on,{size:16})})]}),l.jsx("div",{className:tr.body,children:n.length===0?l.jsx("p",{className:tr.empty,children:"No content items found in this collection."}):l.jsxs("table",{className:tr.table,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Content"}),l.jsx("th",{children:"Page Number"})]})}),l.jsx("tbody",{children:n.map(a=>l.jsxs("tr",{children:[l.jsx("td",{children:a.name}),l.jsx("td",{children:l.jsx("input",{type:"number",min:1,value:s[a.id]??"",onChange:c=>i(d=>({...d,[a.id]:c.target.value})),className:tr.pageInput})})]},a.id))})]})}),l.jsxs("div",{className:tr.footer,children:[l.jsx("button",{className:tr.cancelBtn,onClick:e,children:"Cancel"}),l.jsxs("button",{className:tr.saveBtn,onClick:o,children:[l.jsx(yy,{size:14})," Save"]})]})]})})},fT="_container_1a7t2_1",hT="_panelHeader_1a7t2_10",pT="_panelHeaderLeft_1a7t2_19",gT="_panelCollapseBtn_1a7t2_27",mT="_titleRow_1a7t2_46",yT="_field_1a7t2_47",vT="_moveBtn_1a7t2_64",bT="_icon_1a7t2_84",_T="_nameInput_1a7t2_93",wT="_fieldHeader_1a7t2_118",xT="_label_1a7t2_124",ST="_fieldCount_1a7t2_133",CT="_chips_1a7t2_170",OT="_chip_1a7t2_170",ET="_chipRemove_1a7t2_188",DT="_keywordInput_1a7t2_202",IT="_input_1a7t2_207",NT="_addBtn_1a7t2_220",TT="_radioGroup_1a7t2_234",jT="_radioLabel_1a7t2_239",$e={container:fT,panelHeader:hT,panelHeaderLeft:pT,panelCollapseBtn:gT,titleRow:mT,field:yT,moveBtn:vT,icon:bT,nameInput:_T,fieldHeader:wT,label:xT,fieldCount:ST,chips:CT,chip:OT,chipRemove:ET,keywordInput:DT,input:IT,addBtn:NT,radioGroup:TT,radioLabel:jT},RT=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var A,U;const{updateNode:s,markDirty:i}=Re(),o=t==="edit",a=eo(e),c=ue(R=>R.relationalFormConfig),d=R=>c==null?void 0:c.find(B=>B.code===R),u=R=>!c||!!d(R),f=(R,B)=>{var F;return((F=d(R))==null?void 0:F.label)||B},[m,g]=p.useState(!0),_=((A=e.metadata)==null?void 0:A.relationalMetadata)??{},[h,y]=p.useState(_.name??e.name??""),[v,b]=p.useState(""),[x,w]=p.useState(Array.isArray(_.keywords)?_.keywords:Array.isArray((U=e.metadata)==null?void 0:U.keywords)?e.metadata.keywords:[]),[C,D]=p.useState(!!_.optional);p.useEffect(()=>{var B,F;const R=((B=e.metadata)==null?void 0:B.relationalMetadata)??{};y(R.name??e.name??""),w(Array.isArray(R.keywords)?R.keywords:Array.isArray((F=e.metadata)==null?void 0:F.keywords)?e.metadata.keywords:[]),D(!!R.optional)},[e.id]);const j=()=>{h.trim()&&h!==e.name&&(s(e.id,{name:h.trim()}),i())},k=()=>{const R=v.trim();if(R&&!x.includes(R)){const B=[...x,R];w(B),s(e.id,{keywords:B}),i()}b("")},$=R=>{const B=x.filter(F=>F!==R);w(B),s(e.id,{keywords:B}),i()},N=R=>{D(R),s(e.id,{optional:R}),i()};return l.jsxs("div",{className:$e.container,children:[l.jsxs("div",{className:$e.panelHeader,children:[l.jsxs("div",{className:$e.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:$e.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:$e.panelCollapseBtn,onClick:()=>g(R=>!R),"aria-expanded":m,"aria-label":m?"Collapse metadata panel":"Expand metadata panel",title:m?"Collapse":"Expand",children:m?l.jsx(ks,{size:15}):l.jsx(iy,{size:15})})]}),m&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:$e.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:$e.icon}),l.jsx("input",{type:"text",className:$e.nameInput,value:h,disabled:!o,onChange:R=>y(R.target.value),onBlur:j,placeholder:"Content name"})]}),u("keywords")&&l.jsxs("div",{className:$e.field,children:[l.jsx("div",{className:$e.fieldHeader,children:l.jsxs("label",{className:$e.label,children:[f("keywords","Keywords"),x.length>0&&l.jsx("span",{className:$e.fieldCount,children:x.length})]})}),x.length>0&&l.jsx("div",{className:$e.chips,children:x.map(R=>l.jsxs("span",{className:$e.chip,children:[R,o&&l.jsx("button",{type:"button",className:$e.chipRemove,onClick:()=>$(R),children:"×"})]},R))}),o&&l.jsxs("div",{className:$e.keywordInput,children:[l.jsx("input",{type:"text",className:$e.input,value:v,placeholder:"Add keyword and press Enter",onChange:R=>b(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),k())}}),l.jsx("button",{type:"button",className:$e.addBtn,onClick:k,children:"Add"})]})]}),u("optional")&&l.jsxs("div",{className:$e.field,children:[l.jsx("label",{className:$e.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:$e.radioGroup,children:[l.jsxs("label",{className:$e.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!0,onChange:()=>N(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:$e.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!1,onChange:()=>N(!1),disabled:!o}),"No"]})]})]})]}),n]})},kT="_iconBtn_vl14u_1",AT="_editable_vl14u_14",PT="_iconImg_vl14u_26",MT="_placeholder_vl14u_34",LT="_removeBtn_vl14u_41",rs={iconBtn:kT,editable:AT,iconImg:PT,placeholder:MT,removeBtn:LT},FT=({nodeId:e,value:t,editable:r})=>{const[n,s]=p.useState(!1),{updateNode:i,markDirty:o}=Re(),a=d=>{i(e,{appIcon:d}),o(),s(!1)},c=d=>{d.stopPropagation(),i(e,{appIcon:""}),o()};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:[rs.iconBtn,r?rs.editable:""].filter(Boolean).join(" "),role:r?"button":void 0,tabIndex:r?0:-1,"aria-label":r?"Select app icon":"App icon",onClick:()=>r&&s(!0),onKeyDown:d=>{r&&(d.key==="Enter"||d.key===" ")&&s(!0)},children:[t?l.jsx("img",{src:t,alt:"App icon",className:rs.iconImg}):l.jsx("div",{className:rs.placeholder,children:l.jsx(Wd,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:rs.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(Ka,{size:11})})]}),n&&l.jsx($h,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},$T="_leafContentLayout_1osey_1",BT="_container_1osey_17",UT="_emptyState_1osey_26",VT="_titleRow_1osey_36",zT="_nodeTitle_1osey_52",qT="_formArea_1osey_74",HT="_contentListArea_1osey_78",WT="_dropZone_1osey_83",KT="_reviewComment_1osey_90",QT="_reviewCommentLabel_1osey_103",GT="_reviewCommentText_1osey_109",zt={leafContentLayout:$T,container:BT,emptyState:UT,titleRow:VT,nodeTitle:zT,formArea:qT,contentListArea:HT,dropZone:WT,reviewComment:KT,reviewCommentLabel:QT,reviewCommentText:GT},YT=["application/vnd.sunbird.questionset"],XT=({editorMode:e,onToolbarEvent:t})=>{var A,U,R,B;const[r,n]=p.useState("details"),[s,i]=p.useState([]),[o,a]=p.useState(null),[c,d]=p.useState(!1),u=p.useRef(null),f=p.useRef(),{selectedNodeId:m,breadcrumb:g,activeNodeMeta:_,updateNode:h,treeData:y}=Re(),v=ue(F=>{var J,ie,me,ve;return((ie=(J=F.editorConfig)==null?void 0:J.context)==null?void 0:ie.contentId)??((ve=(me=F.editorConfig)==null?void 0:me.context)==null?void 0:ve.identifier)??""}),b=m?Wh(y,m):null,x=!!b&&!b.parent,w=!!(b!=null&&b.isFolder),C=b&&YT.includes(b.mimeType??""),D=b&&!b.isFolder&&!C&&!x,j=((A=b==null?void 0:b.metadata)==null?void 0:A.rejectComment)??(x?(R=(U=y[0])==null?void 0:U.metadata)==null?void 0:R.rejectComment:void 0),k=p.useCallback(()=>{const F=u.current;if(!F||!m)return;const J=F.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{h(m,{name:J})},600)},[m,h]),$=p.useCallback(F=>{t({action:"onFormValueChange",data:F})},[t]),N=p.useCallback((F,J)=>{i(J),t({action:"onFormStatusChange",data:{isValid:F,nodeId:m}})},[t,m]);return b?C?l.jsx(ja,{node:b,editorMode:e,type:"quml"}):D?l.jsxs("div",{className:zt.leafContentLayout,children:[l.jsx(ja,{node:b,editorMode:e,type:"content"}),l.jsx(RT,{node:b,editorMode:e,onMoveClick:()=>a(b.identifier),reorderDialog:o?l.jsx(JN,{resourceId:o,resourceName:b.name,currentUnitId:b.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:zt.container,children:[l.jsx(WO,{crumbs:g}),j&&l.jsxs("div",{className:zt.reviewComment,role:"alert",children:[l.jsx("span",{className:zt.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:zt.reviewCommentText,children:j})]}),l.jsxs("div",{className:zt.titleRow,children:[x&&m&&l.jsx(FT,{nodeId:m,value:String(b.appIcon??((B=b.metadata)==null?void 0:B.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:u,className:zt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:k,onBlur:k,"data-placeholder":"Untitled","aria-label":"Node title",children:b.name})]}),l.jsx(ZO,{activeTab:r,onChange:F=>n(F),errorTabs:s,visibleTabs:x?void 0:["details"]}),l.jsx("div",{className:zt.formArea,children:l.jsx(hI,{nodeMetadata:_,activeTab:r,isRoot:x,isFolder:w,editorMode:e,onFormValueChange:$,onFormStatusChange:N},`${m??"none"}:${x?"root":"node"}`)}),(w||x)&&r==="details"&&l.jsx("div",{className:zt.contentListArea,children:l.jsx(KI,{editorMode:e})}),l.jsx(YI,{isActive:!1,label:"Drop to add content to this unit",nodeId:m??void 0,className:zt.dropZone}),c&&l.jsx(dT,{contentId:v,onClose:()=>d(!1)})]}):l.jsx("div",{className:zt.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function Wh(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Wh(r.children,t);if(n)return n}}}const Kh=Hi((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 o=n.toLowerCase();i=i.filter(a=>[a.mimeType??"",a.primaryCategory??"",a.contentType??""].join(" ").toLowerCase().includes(o))}if(s&&s.trim()!==""){const o=s.toLowerCase().trim();i=i.filter(a=>(a.name??"").toLowerCase().includes(o))}e({filteredContent:i})}})),ZT=20;function Qh(){var d;const e=ue(u=>u.editorConfig),t=Re(u=>u.selectedNodeId),r=Re(u=>u.treeData),n=p.useCallback(()=>{if(!t||!r.length)return 0;function u(f,m,g=0){var _;for(const h of f){if(h.id===m)return g;if((_=h.children)!=null&&_.length){const y=u(h.children,m,g+1);if(y>=0)return y}}return-1}return Math.max(0,u(r,t))},[t,r])(),s=(d=e==null?void 0:e.config)==null?void 0:d.hierarchy;if(!s)return[...yu];const i=`level${n}`,o=s[i],a=o==null?void 0:o.children,c=a==null?void 0:a.Content;return c!=null&&c.length?c:[...yu]}function JT(){const e=Kh(),t=ue(f=>{var m,g;return((g=(m=f.editorConfig)==null?void 0:m.context)==null?void 0:g.channel)??""}),r=Qh(),n=p.useRef(),s=p.useCallback(async(f="",m="all",g={},_=!0,h=!1)=>{var y,v,b,x,w;e.setLoading(!0);try{const C={status:["Live"],primaryCategory:m&&m!=="all"?[m]:r};(y=g==null?void 0:g.board)!=null&&y.length&&(C.board=g.board),(v=g==null?void 0:g.medium)!=null&&v.length&&(C.medium=g.medium),(b=g==null?void 0:g.gradeLevel)!=null&&b.length&&(C.gradeLevel=g.gradeLevel),(x=g==null?void 0:g.subject)!=null&&x.length&&(C.subject=g.subject),(w=g==null?void 0:g.primaryCategory)!=null&&w.length&&(C.primaryCategory=g.primaryCategory);const D=_?0:e.offset,{content:j,count:k}=await XI({filters:C,query:f,limit:f?50:ZT,offset:D,channel:t||void 0,sortBy:h?{name:"asc"}:{lastUpdatedOn:"desc"}});_?e.setContent(j,k):e.appendContent(j,k)}catch(C){console.error("[useLibrary] load error:",C)}finally{e.setLoading(!1)}},[r,t]);p.useEffect(()=>{s()},[t]);const i=p.useCallback(f=>{e.setSearch(f),clearTimeout(n.current),n.current=setTimeout(()=>s(f,e.activeFilter,e.advancedFilters,!0,e.sortAZ),300)},[e.activeFilter,e.advancedFilters,e.sortAZ,s]),o=p.useCallback(f=>{e.setFilter(f),s(e.searchQuery,f,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,s]),a=p.useCallback(f=>{e.setAdvancedFilters(f),s(e.searchQuery,e.activeFilter,f,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,s]),c=p.useCallback(()=>{const f=!e.sortAZ;e.setSortAZ(f),s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,f)},[e.sortAZ,e.searchQuery,e.activeFilter,e.advancedFilters,s]),d=p.useCallback(()=>{e.isLoading||s(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,s]),u=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:u,search:i,setFilter:o,applyAdvancedFilters:a,toggleSort:c,loadMore:d,refetch:()=>s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const ej="_card_jzciw_1",tj="_addBtn_jzciw_17",rj="_dragging_jzciw_24",nj="_ctIcon_jzciw_29",sj="_info_jzciw_33",ij="_name_jzciw_41",oj="_meta_jzciw_50",aj="_addBtnMuted_jzciw_78",lj="_added_jzciw_87",cj="_addedBadge_jzciw_96",rr={card:ej,addBtn:tj,dragging:rj,ctIcon:nj,info:sj,name:ij,meta:oj,addBtnMuted:aj,added:lj,addedBadge:cj},uj={video:Qa,pdf:za,h5p:qa,scorm:Wa,audio:Ha,quiz:Va,default:Vn},dj=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var h,y;const i=eo(e),o=uj[i.key]??Vn,a=dl(),c=I1(),d=a&&!s&&c,{attributes:u,listeners:f,setNodeRef:m,isDragging:g}=Fd({id:e.identifier,disabled:!n||!a||!c,data:{type:"library-item",item:e}}),_=()=>{r&&r(e)};return l.jsxs("div",{ref:m,className:[rr.card,g?rr.dragging:"",s?rr.added:""].join(" "),"aria-label":e.name,...n?{...u,...f}:{},role:"listitem",onClick:_,children:[l.jsx("span",{className:[`sbx-ct-sq--${i.key}`,rr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(o,{size:14})}),l.jsxs("div",{className:rr.info,children:[l.jsx("span",{className:rr.name,title:e.name,children:e.name}),l.jsxs("span",{className:rr.meta,children:[((h=e.organisation)==null?void 0:h[0])??e.channel??"",(y=e.organisation)!=null&&y[0]&&e.primaryCategory?" · ":"",e.primaryCategory??""]})]}),s&&l.jsx("span",{className:rr.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(Un,{size:12})}),!s&&l.jsx("button",{type:"button",className:[rr.addBtn,!d&&a?rr.addBtnMuted:""].join(" "),onClick:v=>{v.stopPropagation(),t(e)},disabled:!a,"aria-disabled":!d,"aria-label":`Add ${e.name} to unit`,title:a?c?"Add to unit":"Select a unit to add":"Only Draft content can be added",children:l.jsx(As,{size:14})})]})},fj="_chips_xhhaq_1",hj="_chip_xhhaq_1",Lu={chips:fj,chip:hj},pj=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:Lu.chips,role:"group","aria-label":"Content type filters",children:e.map(n=>l.jsx("button",{type:"button",role:"radio","aria-checked":t===n.value,className:["sbx-chip",t===n.value?"filled":"outline",Lu.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),gj="_panel_1cl11_1",mj="_header_1cl11_10",yj="_headerTitle_1cl11_19",vj="_closeBtn_1cl11_25",bj="_body_1cl11_43",_j="_section_1cl11_59",wj="_sectionLabel_1cl11_65",xj="_chips_1cl11_73",Sj="_chip_1cl11_73",Cj="_active_1cl11_96",Oj="_footer_1cl11_102",Ej="_resetBtn_1cl11_112",Dj="_applyBtn_1cl11_129",et={panel:gj,header:mj,headerTitle:yj,closeBtn:vj,body:bj,section:_j,sectionLabel:wj,chips:xj,chip:Sj,active:Cj,footer:Oj,resetBtn:Ej,applyBtn:Dj},Ij=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],Nj=new Set(["board","medium","gradeLevel","subject","topic"]),Tj=({local:e,toggle:t})=>{const r=Qh();return r.length?l.jsxs("div",{className:et.section,children:[l.jsx("div",{className:et.sectionLabel,children:"Primary Category"}),l.jsx("div",{className:et.chips,children:r.map(n=>l.jsx("button",{type:"button",className:[et.chip,(e.primaryCategory??[]).includes(n)?et.active:""].join(" "),onClick:()=>t("primaryCategory",n),children:n},n))})]}):null},jj=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var g,_;const s=ue(h=>h.editorConfig),i=ue(h=>h.searchFormConfig),{organisationFramework:o}=Ph((g=s==null?void 0:s.context)==null?void 0:g.framework,(_=s==null?void 0:s.context)==null?void 0:_.targetFWIds),[a,c]=p.useState(t),d=i!=null&&i.length?i.filter(h=>Nj.has(h.code)).map(h=>({key:h.code,label:h.label||h.code})):Ij;p.useEffect(()=>{c(t)},[t]);const u=(h,y)=>{c(v=>{const b=v[h]??[],x=b.includes(y)?b.filter(w=>w!==y):[...b,y];return{...v,[h]:x}})},f=(o==null?void 0:o.categories)??[],m=h=>{var y;return((y=f.find(v=>v.code===h))==null?void 0:y.terms)??[]};return e?l.jsxs("div",{className:et.panel,role:"dialog","aria-label":"Filter library","aria-modal":"true",children:[l.jsxs("div",{className:et.header,children:[l.jsx("span",{className:et.headerTitle,children:"Filters"}),l.jsx("button",{type:"button",className:et.closeBtn,onClick:n,"aria-label":"Close filters",children:l.jsx(on,{size:16})})]}),l.jsxs("div",{className:et.body,children:[d.map(({key:h,label:y})=>{const v=m(h);return v.length?l.jsxs("div",{className:et.section,children:[l.jsx("div",{className:et.sectionLabel,children:y}),l.jsx("div",{className:et.chips,children:v.slice(0,20).map(b=>l.jsx("button",{type:"button",className:[et.chip,(a[h]??[]).includes(b.name)?et.active:""].join(" "),onClick:()=>u(h,b.name),children:b.name},b.identifier))})]},h):null}),l.jsx(Tj,{local:a,toggle:u})]}),l.jsxs("div",{className:et.footer,children:[l.jsx("button",{type:"button",className:et.resetBtn,onClick:()=>c({}),children:"Reset"}),l.jsx("button",{type:"button",className:et.applyBtn,onClick:()=>{r(a),n()},children:"Apply"})]})]}):null},Rj="_header_6qdpu_10",kj="_title_6qdpu_20",Aj="_headerActions_6qdpu_31",Pj="_iconBtn_6qdpu_38",Mj="_playerArea_6qdpu_56",Lj="_footer_6qdpu_64",Fj="_addBtn_6qdpu_73",$j="_modalOverlay_6qdpu_92",Bj="_modalPanel_6qdpu_103",ur={header:Rj,title:kj,headerActions:Aj,iconBtn:Pj,playerArea:Mj,footer:Lj,addBtn:Fj,modalOverlay:$j,modalPanel:Bj},Uj=({content:e,onAdd:t,onClose:r})=>{if(!e)return null;const n={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 Rr.createPortal(l.jsx("div",{className:ur.modalOverlay,role:"dialog","aria-modal":"true","aria-label":"Content preview",onClick:r,children:l.jsxs("div",{className:ur.modalPanel,onClick:s=>s.stopPropagation(),children:[l.jsxs("div",{className:ur.header,children:[l.jsx("span",{className:ur.title,title:e.name,children:e.name}),l.jsx("div",{className:ur.headerActions,children:l.jsx("button",{type:"button",className:ur.iconBtn,onClick:r,"aria-label":"Close preview",children:l.jsx(on,{size:16})})})]}),l.jsx("div",{className:ur.playerArea,children:l.jsx(ja,{node:n,editorMode:"read",type:"content"})}),l.jsx("div",{className:ur.footer,children:l.jsx("button",{type:"button",className:ur.addBtn,onClick:()=>t(e),children:"+ Add to Unit"})})]})}),document.body)},Vj="_dock_1lpg0_1",zj="_header_1lpg0_8",qj="_headerLeft_1lpg0_17",Hj="_headerTitle_1lpg0_24",Wj="_count_1lpg0_30",Kj="_searchRow_1lpg0_39",Qj="_searchWrap_1lpg0_47",Gj="_searchIcon_1lpg0_53",Yj="_searchInput_1lpg0_62",Xj="_filterToggleBtn_1lpg0_80",Zj="_filterToggleBtnActive_1lpg0_99",Jj="_filterBadge_1lpg0_105",eR="_filters_1lpg0_124",tR="_mainArea_1lpg0_134",rR="_sidePanelOverlay_1lpg0_143",nR="_cardList_1lpg0_152",sR="_skeleton_1lpg0_168",iR="_skeletonIcon_1lpg0_178",oR="_skeletonText_1lpg0_186",aR="_skeletonLine_1lpg0_193",lR="_skeletonLineSm_1lpg0_200",cR="_loadMoreBtn_1lpg0_215",uR="_emptyState_1lpg0_240",dR="_collapseBtn_1lpg0_260",ke={dock:Vj,header:zj,headerLeft:qj,headerTitle:Hj,count:Wj,searchRow:Kj,searchWrap:Qj,searchIcon:Gj,searchInput:Yj,filterToggleBtn:Xj,filterToggleBtnActive:Zj,filterBadge:Jj,filters:eR,mainArea:tR,sidePanelOverlay:rR,cardList:nR,skeleton:sR,skeletonIcon:iR,skeletonText:oR,skeletonLine:aR,skeletonLineSm:lR,loadMoreBtn:cR,emptyState:uR,collapseBtn:dR};function fR(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 hR=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const{content:n,isLoading:s,totalCount:i,activeFilter:o,searchQuery:a,sortAZ:c,hasMore:d,search:u,setFilter:f,applyAdvancedFilters:m,toggleSort:g,loadMore:_}=JT(),{addResource:h,selectedNodeId:y,treeData:v}=Re(),b=e==="edit",[x,w]=p.useState(!1),[C,D]=p.useState({}),[j,k]=p.useState(null),$=p.useMemo(()=>fR(v),[v]),N=p.useCallback(F=>{var me;if(!y){Se.error("Select a unit first");return}const J=(me=v[0])==null?void 0:me.id;if(y===J){Se("Select a unit from the outline to add content — resources cannot be added directly to the course.",{icon:"ℹ️",duration:4e3});return}if(h(F,y)===!1){Se.error(`"${F.name}" is already in this collection`);return}Se.success(`Added "${F.name}"`)},[y,h,v]),A=p.useCallback(F=>{D(F),m(F)},[m]),U=p.useCallback(F=>{k(F)},[]),R=p.useCallback(F=>{N(F),k(null)},[N]),B=p.useMemo(()=>Object.values(C).reduce((F,J)=>F+((J==null?void 0:J.length)??0),0),[C]);return l.jsxs("div",{className:ke.dock,children:[l.jsx("div",{className:ke.header,children:l.jsxs("div",{className:ke.headerLeft,children:[l.jsx("button",{type:"button",className:ke.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(py,{size:15})}),l.jsx(dy,{size:16}),l.jsx("span",{className:ke.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:ke.count,children:i})]})}),l.jsxs("div",{className:ke.searchRow,children:[l.jsxs("div",{className:ke.searchWrap,children:[l.jsx(la,{size:14,className:ke.searchIcon}),l.jsx("input",{type:"search",className:ke.searchInput,placeholder:"Search content…",value:a,onChange:F=>u(F.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[ke.filterToggleBtn,c?ke.filterToggleBtnActive:""].join(" "),onClick:g,"aria-label":c?"Sort: A–Z (click for Recent)":"Sort: Recent (click for A–Z)",title:c?"A–Z":"Recent",children:c?l.jsx(ny,{size:15}):l.jsx(oy,{size:15})}),l.jsxs("button",{type:"button",className:[ke.filterToggleBtn,x?ke.filterToggleBtnActive:""].join(" "),onClick:()=>w(F=>!F),"aria-label":"Toggle advanced filters","aria-pressed":x,title:"Advanced filters",children:[l.jsx(_y,{size:15}),B>0&&l.jsx("span",{className:ke.filterBadge,children:B})]})]}),l.jsx("div",{className:ke.filters,children:l.jsx(pj,{filters:N1,active:o,onChange:f})}),l.jsxs("div",{className:ke.mainArea,children:[l.jsx("div",{className:ke.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((F,J)=>l.jsxs("div",{className:ke.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:ke.skeletonIcon}),l.jsxs("div",{className:ke.skeletonText,children:[l.jsx("div",{className:ke.skeletonLine}),l.jsx("div",{className:ke.skeletonLineSm})]})]},J)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(F=>l.jsx(dj,{item:F,onAdd:N,onPreview:U,isDraggable:b,isAdded:$.has(F.identifier)},F.identifier)),d&&l.jsx("button",{type:"button",className:ke.loadMoreBtn,onClick:_,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:ke.emptyState,children:[l.jsx(la,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),x&&l.jsx("div",{className:ke.sidePanelOverlay,children:l.jsx(jj,{isOpen:x,filters:C,onApply:A,onClose:()=>w(!1)})}),j&&l.jsx(Uj,{content:j,onAdd:R,onClose:()=>k(null)})]})]})};function pR(e,t,r){const n={},s={},i=new Set(["id","isFolder","children","parent","isNew","breadcrumb","title","relationalMetadata","optional"]),o=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","targetFWIds","targetTopicIds","topic","topicsIds"]),a=new Set(["audience","attributions","targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","medium","gradeLevel","subject","additionalCategories","keywords","language"]),c=new Set(["copyrightYear","compatibilityLevel","version"]);function d(m,g=!1){const _={};for(const[h,y]of Object.entries(m))if(!i.has(h)&&!(g&&o.has(h)))if(a.has(h))Array.isArray(y)?_[h]=y:y!=null&&y!==""?_[h]=[y]:_[h]=[];else if(c.has(h)){const v=Number(y);isNaN(v)||(_[h]=v)}else _[h]=y;return _}function u(m){var _;const g={};for(const h of m.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 x=((_=h.metadata)==null?void 0:_.relationalMetadata)??{};g[h.identifier]={name:h.name,...x,...b}}return g}function f(m,g){var x,w;const _=m.identifier,h=t[_],y=_.startsWith("temp-")||!!(h!=null&&h.isNew),v=!m.isFolder&&!g;if(g||y||h&&!v){let C;if(y)C={mimeType:"application/vnd.ekstep.content-collection",code:_,contentType:((x=m.metadata)==null?void 0:x.contentType)??"CourseUnit",primaryCategory:((w=m.metadata)==null?void 0:w.primaryCategory)??"Course Unit",name:m.name,visibility:"Parent",channel:r,...d(m.metadata??{})};else if(g){const{isNew:D,...j}=h??{};C={...d(m.metadata??{},!0),...d(j,!1),name:m.name}}else{const{isNew:D,...j}=h??{};C={name:m.name,visibility:"Parent",...d(j,!0)}}n[_]={metadata:C,objectType:m.objectType||(m.isFolder?"Collection":"Content"),root:g,isNew:y}}const b=m.isFolder?u(m):{};s[_]={name:m.name,children:(m.children??[]).map(C=>C.identifier),...Object.keys(b).length>0?{relationalMetadata:b}:{},root:g},(m.children??[]).forEach(C=>f(C,!1))}return e.forEach((m,g)=>f(m,g===0)),{nodesModified:n,hierarchy:s}}function gR(){const[e,t]=p.useState(!1),r=Re(u=>u.treeCache),n=Re(u=>u.treeData),s=ue(u=>u.isDirty),i=ue(u=>u.lastSaved),{setIsDirty:o,setLastSaved:a}=ue(),c=ue(u=>u.editorConfig);return{save:p.useCallback(async()=>{if(!c||e)return;const u=c.context.contentId??c.context.identifier??"";if(!u)return;const f=c.context.channel??"",m=c.context.userId??c.context.uid??"";t(!0);try{const{nodesModified:g,hierarchy:_}=pR(n,r,f),{identifiers:h}=await n_(u,g,_,m);h&&Object.keys(h).length>0&&Re.getState().replaceNodeIds(h);const y=new Date().toISOString();a(y),o(!1)}catch(g){console.error("[useSaveHierarchy] save failed:",g),Se.error("Failed to save. Please try again.")}finally{t(!1)}},[c,e,n,r,o,a]),isSaving:e,isDirty:s,lastSaved:i}}function mR(e){const t=ue(o=>o.editorConfig),r=ue(o=>o.setButtonLoader),n=ue(o=>o.validateAllForms),s=Re(o=>o.treeData);return{runAction:p.useCallback(async(o,a)=>{var u,f,m,g;const c=((u=t==null?void 0:t.context)==null?void 0:u.contentId)??((f=t==null?void 0:t.context)==null?void 0:f.identifier)??"";if(!c)return Se.error("No content identifier found."),!1;const d=((m=t==null?void 0:t.context)==null?void 0:m.userId)??((g=t==null?void 0:t.context)==null?void 0:g.uid)??"";try{switch(o){case"sendForReview":return n(s)?(r("saveCollection",!0),await e(),await o_(c),Se.success("Content sent for review"),!0):(Se.error("Some units have missing required fields. Please fill them before sending for review."),!1);case"reject":{r("rejectCollection",!0);const _=(a==null?void 0:a.comment)??"";return await a_(c,_),Se.success("Content rejected and sent back to the author"),!0}case"publish":return n(s)?(r("publishCollection",!0),await e(),await s_(c,d),Se.success("Content published successfully"),!0):(Se.error("Some units have missing required fields. Please fill them before publishing."),!1);default:return!1}}catch(_){console.error(`[useToolbarActions] ${o} failed`,_);const h=o==="sendForReview"?"send for review":o==="reject"?"reject":"publish";return Se.error(`Failed to ${h}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r])}}const yR="_shell_90fon_1",vR="_workspace_90fon_8",bR="_sidebarCollapsed_90fon_16",_R="_dockCollapsed_90fon_19",wR="_dock_90fon_19",xR="_outline_90fon_40",SR="_reopenTab_90fon_45",CR="_outlineHidden_90fon_79",OR="_editor_90fon_86",ER="_dockHidden_90fon_101",DR="_dockReopenTab_90fon_108",IR="_dragChip_90fon_133",NR="_dragChipLabel_90fon_148",Tt={shell:yR,workspace:vR,sidebarCollapsed:bR,dockCollapsed:_R,dock:wR,outline:xR,reopenTab:SR,outlineHidden:CR,editor:OR,dockHidden:ER,dockReopenTab:DR,dragChip:IR,dragChipLabel:NR},TR=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,d]=p.useState(!1),[u,f]=p.useState(!1),{addResource:m,treeData:g}=Re(),_=ue(R=>R.setFormStatus),[h,y]=p.useState(!0),v=Re(R=>R.selectedNodeId),{save:b,isSaving:x,isDirty:w,lastSaved:C}=gR(),{runAction:D}=mR(b);p.useEffect(()=>{if(!w)return;const R=B=>{B.preventDefault(),B.returnValue=""};return window.addEventListener("beforeunload",R),()=>window.removeEventListener("beforeunload",R)},[w]);const j=vd(na(Vi,{activationConstraint:{distance:8}})),k=p.useCallback(R=>{var F;const B=(F=R.active.data.current)==null?void 0:F.item;B&&i(B)},[]),$=p.useCallback(R=>{var ve,be;i(null);const B=(ve=R.active.data.current)==null?void 0:ve.item;if(!B)return;const F=R.over,J=(F==null?void 0:F.id)??v??void 0;if(!J){Se.error("Drop onto a unit to add content");return}const ie=(be=g[0])==null?void 0:be.id;if(J===ie){Se.error("Drop content onto a unit, not directly on the course.");return}if(!m(B,J)){Se.error(`"${B.name}" is already in this collection`);return}r==null||r(B,J),Se.success(`Added "${B.name}" to unit`)},[v,m,r]),N=p.useCallback(async R=>{if(R.action==="onFormStatusChange"){const{isValid:B,nodeId:F}=R.data??{},J=B!==!1;y(J),F&&_(F,J);return}if(R.action==="back"&&w){f(!0);return}if(R.action==="saveCollection"){if(!h){Se.error("Please fill the required metadata");return}await b(),n==null||n(g),t==null||t(R);return}if(R.action==="sendForReview"||R.action==="reject"||R.action==="publish"){await D(R.action,R.data)&&(t==null||t(R));return}t==null||t(R)},[b,D,t,n,g,w,h]),A=p.useCallback(async()=>{await b(),f(!1),n==null||n(g),t==null||t({action:"back"})},[b,n,t,g]),U=p.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(Ld,{sensors:j,onDragStart:k,onDragEnd:$,children:[l.jsxs("div",{className:Tt.shell,children:[l.jsx(gw,{editorMode:e,isSaving:x,isDirty:w,lastSaved:C,isFormValid:h,onToolbarEvent:N}),l.jsxs("div",{className:[Tt.workspace,o?Tt.sidebarCollapsed:"",c?Tt.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[Tt.outline,o?Tt.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(UO,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(R=>!R)})}),o&&l.jsx("button",{className:Tt.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:Tt.editor,role:"main","aria-label":"Content editor",children:l.jsx(XT,{editorMode:e,onToolbarEvent:N})}),l.jsx("aside",{className:[Tt.dock,c?Tt.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(hR,{editorMode:e,collapsed:c,onToggleCollapse:()=>d(R=>!R)})}),c&&l.jsx("button",{className:Tt.dockReopenTab,onClick:()=>d(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(Zm,{dropAnimation:null,children:s?l.jsx("div",{className:Tt.dragChip,children:l.jsx("span",{className:Tt.dragChipLabel,children:s.name})}):null}),u&&l.jsx(mw,{onSave:A,onDiscard:U,onCancel:()=>f(!1),isSaving:x})]})},jR="v1";function RR(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 Fu(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:RR(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 br(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(o=>!!o.code).sort((o,a)=>(o.index??0)-(a.index??0));for(const o of i)r.push(Fu(o,s))}else n.code&&r.push(Fu(n));return r}function kR(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 AR(e,t,r="Collection",n=jR){var d,u;const i=(u=(d=(await Me.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:d.result)==null?void 0:u.objectCategoryDefinition,o=(i==null?void 0:i.forms)??{},a=(i==null?void 0:i.objectMetadata)??{},c=a.config??{};return{rootForm:br(o.create),unitForm:br(o.unitMetadata),childForm:br(o.childMetadata),searchForm:br(o.search??o.searchConfig),relationalForm:br(o.relationalMetadata),publishChecklist:br(o.publishchecklist),reviewChecklist:br(o.review),rfcChecklist:br(o.requestforchangeschecklist),schemaDefaults:kR(a.schema),frameworkMetadata:c.frameworkMetadata??{},sourcingSettings:c.sourcingSettings??{}}}function PR({config:e,onError:t}){const[r,n]=p.useState(!0),[s,i]=p.useState(null),[o,a]=p.useState(!1),{setEditorConfig:c,setEditorMode:d,setCategoryDefinition:u}=ue(),{setTreeData:f,selectNode:m}=Re();return p.useEffect(()=>{let g=!1;async function _(){var h,y;try{n(!0),i(null),e.apiBaseUrl&&Of(e.apiBaseUrl),c(e),d(e.config.mode);const v=e.context.contentId??e.context.identifier??"";if(v){const{rootNode:b}=await If(v);g||(f(b?[b]:[]),b&&m(b.id));const x=e.config.primaryCategory??"Course",w=e.context.channel??"",C=e.config.categoryDefinitionApiVersion??"v1";try{const D=await AR(x,w,e.config.objectType??"Collection",C);if(!g){u(D);const j=((h=D.sourcingSettings)==null?void 0:h.collection)??{},k={};j.maxDepth&&!e.config.maxDepth&&(k.maxDepth=j.maxDepth),j.children&&!e.config.children&&(k.children=j.children),j.hierarchy&&!((y=e.config.hierarchy)!=null&&y.level1)&&(k.hierarchy={...e.config.hierarchy??{},...j.hierarchy}),Object.keys(k).length>0&&c({...e,config:{...e.config,...k}})}}catch{}}g||a(!0)}catch(v){if(!g){const b=v instanceof Error?v:new Error(String(v));i(b),t==null||t(b)}}finally{g||n(!1)}}return _(),()=>{g=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:o}}const MR="_root_qcpw6_1",LR="_loadingState_qcpw6_10",FR="_loadingSpinner_qcpw6_20",$R="_errorState_qcpw6_34",os={root:MR,loadingState:LR,loadingSpinner:FR,errorState:$R},BR=new xp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class UR extends p.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?l.jsxs("div",{className:os.errorState,children:[l.jsx("h3",{children:"Something went wrong"}),l.jsx("p",{children:this.state.error.message}),l.jsx("button",{onClick:()=>this.setState({error:null}),children:"Retry"})]}):this.props.children}}function VR(e){const{isLoading:t,error:r}=PR({config:e,onError:e.onError}),n=ue(s=>s.editorMode);return t?l.jsxs("div",{className:os.loadingState,children:[l.jsx("div",{className:os.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:os.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${os.root}`,children:l.jsx(TR,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Gh=e=>l.jsx(UR,{onError:e.onError,children:l.jsxs(Cp,{client:BR,children:[l.jsx(VR,{...e}),l.jsx(Sg,{position:"top-right",toastOptions:{duration:3e3}})]})}),Pi=Symbol.for("r2wc.reactRender"),$u=Symbol.for("r2wc.shouldRender"),ti=Symbol.for("r2wc.root");function zR(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function qR(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var Bu={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[Pi]()}}),e[Pi]()}};function HR(e,t,r,n={}){var s={isConnected:"isConnected"in HTMLElement.prototype},i=!1,o=function(){var d=Reflect.construct(HTMLElement,arguments,this.constructor);return typeof n.shadow=="string"?d.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.'),d.attachShadow({mode:"open"})),d},a=Object.create(HTMLElement.prototype);a.constructor=o;var c=new Proxy(a,{has:function(d,u){return u in e.propTypes||u in a},set:function(d,u,f,m){return i&&(s[u]=!0),typeof u=="symbol"||s[u]||u in d?(e.propTypes&&u in e.propTypes&&Bu.expando(m,u,f),Reflect.set(d,u,f,m)):(Bu.expando(m,u,f),!0)},getOwnPropertyDescriptor:function(d,u){var f=Reflect.getOwnPropertyDescriptor(d,u);if(f)return f;if(u in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return o.prototype=c,a.connectedCallback=function(){this[$u]=!0,this[Pi]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[ti].unmount():r.unmountComponentAtNode(this)},a[Pi]=function(){if(this[$u]===!0){var d={};Object.keys(this).forEach(function(m){s[m]!==!1&&(d[m]=this[m])},this),i=!0;const u=n.shadow?this.shadowRoot:this,f=t.createElement(e,d);typeof r.createRoot=="function"?(this[ti]||(this[ti]=r.createRoot(u)),this[ti].render(f)):r.render(f,u),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(d){return zR(d)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(d,u,f){var m=n.dashStyleAttributes?qR(d):d;this[m]=f}),o}var as={},ns=Rr;if(process.env.NODE_ENV==="production")as.createRoot=ns.createRoot,as.hydrateRoot=ns.hydrateRoot;else{var ri=ns.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;as.createRoot=function(e,t){ri.usingClientEntryPoint=!0;try{return ns.createRoot(e,t)}finally{ri.usingClientEntryPoint=!1}},as.hydrateRoot=function(e,t,r){ri.usingClientEntryPoint=!0;try{return ns.hydrateRoot(e,t,r)}finally{ri.usingClientEntryPoint=!1}}}function WR(){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 KR(e="sb-collection-editor"){if(WR(),typeof customElements>"u"||customElements.get(e))return;const t=HR(Gh,p,as,{});customElements.define(e,t)}exports.CollectionEditor=Gh;exports.registerCollectionEditor=KR;exports.setApiBaseUrl=Of;exports.useEditorStore=ue;exports.useLibraryStore=Kh;exports.useTreeStore=Re;