ode-explorer 1.4.19-develop.202410281019 → 1.4.19-develop.202410281848

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.js CHANGED
@@ -1,4 +1,4 @@
1
- var sP=t=>{throw TypeError(t)};var OB=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var _b=(t,e,r)=>e.has(t)||sP("Cannot "+r);var Y=(t,e,r)=>(_b(t,e,"read from private field"),r?r.call(t):e.get(t)),Ke=(t,e,r)=>e.has(t)?sP("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Ne=(t,e,r,n)=>(_b(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),lt=(t,e,r)=>(_b(t,e,"access private method"),r);var xg=(t,e,r,n)=>({set _(i){Ne(t,e,i,r)},get _(){return Y(t,e,n)}});import{odeServices as Ie,FOLDER as Tr,LAYER_NAME as DB,SnipletsService as Sb,DocumentHelper as zk,StringUtils as NB,ERROR_CODE as Hk,SORT_ORDER as LB,ResourceService as Vk,ACTION as Gr}from"/assets/js/edifice-ts-client/index.js?v=6fb741cc";var Xme=OB((Jme,v1)=>{function Gk(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var rr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Co(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Wk(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Xk={exports:{}},Vy={},qk={exports:{}},ft={};/**
1
+ var sP=t=>{throw TypeError(t)};var OB=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var _b=(t,e,r)=>e.has(t)||sP("Cannot "+r);var Y=(t,e,r)=>(_b(t,e,"read from private field"),r?r.call(t):e.get(t)),Ke=(t,e,r)=>e.has(t)?sP("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Ne=(t,e,r,n)=>(_b(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),lt=(t,e,r)=>(_b(t,e,"access private method"),r);var xg=(t,e,r,n)=>({set _(i){Ne(t,e,i,r)},get _(){return Y(t,e,n)}});import{odeServices as Ie,FOLDER as Tr,LAYER_NAME as DB,SnipletsService as Sb,DocumentHelper as zk,StringUtils as NB,ERROR_CODE as Hk,SORT_ORDER as LB,ResourceService as Vk,ACTION as Gr}from"/assets/js/edifice-ts-client/index.js?v=9806693d";var Xme=OB((Jme,v1)=>{function Gk(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var rr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Co(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Wk(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Xk={exports:{}},Vy={},qk={exports:{}},ft={};/**
2
2
  * @license React
3
3
  * react.production.min.js
4
4
  *
@@ -1387,7 +1387,7 @@ void main()
1387
1387
  Use "options.replacer" or "options.ignoreUnknown"
1388
1388
  `)},domwindow(){return n("domwindow")},bigint(i){return n("bigint:"+i.toString())},process(){return n("process")},timer(){return n("timer")},pipe(){return n("pipe")},tcp(){return n("tcp")},udp(){return n("udp")},tty(){return n("tty")},statwatcher(){return n("statwatcher")},securecontext(){return n("securecontext")},connection(){return n("connection")},zlib(){return n("zlib")},context(){return n("context")},nodescript(){return n("nodescript")},httpparser(){return n("httpparser")},dataview(){return n("dataview")},signal(){return n("signal")},fsevent(){return n("fsevent")},tlswrap(){return n("tlswrap")}}}const a6="[native code] }",Roe=a6.length;function ek(t){return typeof t!="function"?!1:Function.prototype.toString.call(t).slice(-Roe)===a6}class El{constructor(e,r){e=this.words=e||[],this.sigBytes=r===void 0?e.length*4:r}toString(e){return(e||Poe).stringify(this)}concat(e){if(this.clamp(),this.sigBytes%4)for(let r=0;r<e.sigBytes;r++){const n=e.words[r>>>2]>>>24-r%4*8&255;this.words[this.sigBytes+r>>>2]|=n<<24-(this.sigBytes+r)%4*8}else for(let r=0;r<e.sigBytes;r+=4)this.words[this.sigBytes+r>>>2]=e.words[r>>>2];return this.sigBytes+=e.sigBytes,this}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new El([...this.words])}}const Poe={stringify(t){const e=[];for(let r=0;r<t.sigBytes;r++){const n=t.words[r>>>2]>>>24-r%4*8&255;e.push((n>>>4).toString(16),(n&15).toString(16))}return e.join("")}},Ioe={stringify(t){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=[];for(let n=0;n<t.sigBytes;n+=3){const i=t.words[n>>>2]>>>24-n%4*8&255,s=t.words[n+1>>>2]>>>24-(n+1)%4*8&255,o=t.words[n+2>>>2]>>>24-(n+2)%4*8&255,a=i<<16|s<<8|o;for(let l=0;l<4&&n*8+l*6<t.sigBytes*8;l++)r.push(e.charAt(a>>>6*(3-l)&63))}return r.join("")}},Moe={parse(t){const e=t.length,r=[];for(let n=0;n<e;n++)r[n>>>2]|=(t.charCodeAt(n)&255)<<24-n%4*8;return new El(r,e)}},koe={parse(t){return Moe.parse(unescape(encodeURIComponent(t)))}};class Ooe{constructor(){this._data=new El,this._nDataBytes=0,this._minBufferSize=0,this.blockSize=512/32}reset(){this._data=new El,this._nDataBytes=0}_append(e){typeof e=="string"&&(e=koe.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes}_doProcessBlock(e,r){}_process(e){let r,n=this._data.sigBytes/(this.blockSize*4);e?n=Math.ceil(n):n=Math.max((n|0)-this._minBufferSize,0);const i=n*this.blockSize,s=Math.min(i*4,this._data.sigBytes);if(i){for(let o=0;o<i;o+=this.blockSize)this._doProcessBlock(this._data.words,o);r=this._data.words.splice(0,i),this._data.sigBytes-=s}return new El(r,s)}}class Doe extends Ooe{update(e){return this._append(e),this._process(),this}finalize(e){e&&this._append(e)}}const tk=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],Noe=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],cu=[];class Loe extends Doe{constructor(){super(...arguments),this._hash=new El([...tk])}reset(){super.reset(),this._hash=new El([...tk])}_doProcessBlock(e,r){const n=this._hash.words;let i=n[0],s=n[1],o=n[2],a=n[3],l=n[4],u=n[5],c=n[6],h=n[7];for(let f=0;f<64;f++){if(f<16)cu[f]=e[r+f]|0;else{const w=cu[f-15],E=(w<<25|w>>>7)^(w<<14|w>>>18)^w>>>3,A=cu[f-2],I=(A<<15|A>>>17)^(A<<13|A>>>19)^A>>>10;cu[f]=E+cu[f-7]+I+cu[f-16]}const m=l&u^~l&c,y=i&s^i&o^s&o,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),x=(l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25),b=h+x+m+Noe[f]+cu[f],_=v+y;h=c,c=u,u=l,l=a+b|0,a=o,o=s,s=i,i=b+_|0}n[0]=n[0]+i|0,n[1]=n[1]+s|0,n[2]=n[2]+o|0,n[3]=n[3]+a|0,n[4]=n[4]+l|0,n[5]=n[5]+u|0,n[6]=n[6]+c|0,n[7]=n[7]+h|0}finalize(e){super.finalize(e);const r=this._nDataBytes*8,n=this._data.sigBytes*8;return this._data.words[n>>>5]|=128<<24-n%32,this._data.words[(n+64>>>9<<4)+14]=Math.floor(r/4294967296),this._data.words[(n+64>>>9<<4)+15]=r,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}}function Foe(t){return new Loe().finalize(t).toString(Ioe)}function rk(t,e={}){const r=typeof t=="string"?t:Coe(t,e);return Foe(r).slice(0,10)}var l6={};Object.defineProperty(l6,"__esModule",{value:!0});const joe=t=>{const e="ÀÁÂÃÄÅĄĀàáâãäåąāÒÓÔÕÕÖØòóôõöøÈÉÊËĘĒèéêëðęēÇĆČçćčÐÌÍÎÏĪìíîïīÙÚÛÜŪùúûüūÑŅñņŠŚšśŸÿýŽŹŻžźżŁĻłļŃŅńņàáãảạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệđùúủũụưừứửữựòóỏõọôồốổỗộơờớởỡợìíỉĩịäëïîüûñçýỳỹỵỷğışĞİŞĢģĶķ",r="AAAAAAAAaaaaaaaaOOOOOOOooooooEEEEEEeeeeeeeCCCcccDIIIIIiiiiiUUUUUuuuuuNNnnSSssYyyZZZzzzLLllNNnnaaaaaaaaaaaaaaaaaeeeeeeeeeeeduuuuuuuuuuuoooooooooooooooooiiiiiaeiiuuncyyyyygisGISGgKk",n=e.split("").join("|"),i=new RegExp(`(${n})`,"g");function s(o){return r[e.indexOf(o)]||""}return t.replace(i,s)},Boe=t=>t.split("").map(e=>`\\${e}`).join(""),nk=(t,e,r=!1)=>{const n=joe(t).trim().toLowerCase(),i=Boe(e);return r?n.replace(/\s+/g,e):n.replace(new RegExp(`[^a-z0-9${i}]+`,"g"),e).replace(new RegExp(`${i}+`,"g"),e).replace(new RegExp(`^${i}`,"g"),"").replace(new RegExp(`${i}$`,"g"),"")},Mf=(t,e={delimiter:"-",prefix:""})=>{if(e.delimiter||(e.delimiter="-"),e.prefix||(e.prefix=""),!t||typeof t=="boolean")return"";const{delimiter:r,prefix:n}=e;if(typeof t=="boolean")return"";if(typeof t=="string"||typeof t=="number"){const i=nk(n,r,!0),s=nk(String(t),r);return i?`${i}${r}${s}`:s}return"children"in t?Mf(t.children):"type"in t?Mf(t.props.children,e):Symbol.iterator in t?Mf(Array.from(t).map(i=>Mf(i,{delimiter:r})).join(r),e):""};var ik=l6.default=Mf;Tt.Down,Tt.Right,Tt.Up,Tt.Left;var YC={},QC={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Doctype=t.CDATA=t.Tag=t.Style=t.Script=t.Comment=t.Directive=t.Text=t.Root=t.isTag=t.ElementType=void 0;var e;(function(n){n.Root="root",n.Text="text",n.Directive="directive",n.Comment="comment",n.Script="script",n.Style="style",n.Tag="tag",n.CDATA="cdata",n.Doctype="doctype"})(e=t.ElementType||(t.ElementType={}));function r(n){return n.type===e.Tag||n.type===e.Script||n.type===e.Style}t.isTag=r,t.Root=e.Root,t.Text=e.Text,t.Directive=e.Directive,t.Comment=e.Comment,t.Script=e.Script,t.Style=e.Style,t.Tag=e.Tag,t.CDATA=e.CDATA,t.Doctype=e.Doctype})(QC);var dt={},zl=rr&&rr.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),sp=rr&&rr.__assign||function(){return sp=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},sp.apply(this,arguments)};Object.defineProperty(dt,"__esModule",{value:!0});dt.cloneNode=dt.hasChildren=dt.isDocument=dt.isDirective=dt.isComment=dt.isText=dt.isCDATA=dt.isTag=dt.Element=dt.Document=dt.CDATA=dt.NodeWithChildren=dt.ProcessingInstruction=dt.Comment=dt.Text=dt.DataNode=dt.Node=void 0;var Kn=QC,KC=function(){function t(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.parent},set:function(e){this.parent=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"previousSibling",{get:function(){return this.prev},set:function(e){this.prev=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"nextSibling",{get:function(){return this.next},set:function(e){this.next=e},enumerable:!1,configurable:!0}),t.prototype.cloneNode=function(e){return e===void 0&&(e=!1),ZC(this,e)},t}();dt.Node=KC;var V1=function(t){zl(e,t);function e(r){var n=t.call(this)||this;return n.data=r,n}return Object.defineProperty(e.prototype,"nodeValue",{get:function(){return this.data},set:function(r){this.data=r},enumerable:!1,configurable:!0}),e}(KC);dt.DataNode=V1;var u6=function(t){zl(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=Kn.ElementType.Text,r}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),e}(V1);dt.Text=u6;var c6=function(t){zl(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=Kn.ElementType.Comment,r}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),e}(V1);dt.Comment=c6;var d6=function(t){zl(e,t);function e(r,n){var i=t.call(this,n)||this;return i.name=r,i.type=Kn.ElementType.Directive,i}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),e}(V1);dt.ProcessingInstruction=d6;var G1=function(t){zl(e,t);function e(r){var n=t.call(this)||this;return n.children=r,n}return Object.defineProperty(e.prototype,"firstChild",{get:function(){var r;return(r=this.children[0])!==null&&r!==void 0?r:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"childNodes",{get:function(){return this.children},set:function(r){this.children=r},enumerable:!1,configurable:!0}),e}(KC);dt.NodeWithChildren=G1;var h6=function(t){zl(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=Kn.ElementType.CDATA,r}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),e}(G1);dt.CDATA=h6;var f6=function(t){zl(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=Kn.ElementType.Root,r}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),e}(G1);dt.Document=f6;var p6=function(t){zl(e,t);function e(r,n,i,s){i===void 0&&(i=[]),s===void 0&&(s=r==="script"?Kn.ElementType.Script:r==="style"?Kn.ElementType.Style:Kn.ElementType.Tag);var o=t.call(this,i)||this;return o.name=r,o.attribs=n,o.type=s,o}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tagName",{get:function(){return this.name},set:function(r){this.name=r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"attributes",{get:function(){var r=this;return Object.keys(this.attribs).map(function(n){var i,s;return{name:n,value:r.attribs[n],namespace:(i=r["x-attribsNamespace"])===null||i===void 0?void 0:i[n],prefix:(s=r["x-attribsPrefix"])===null||s===void 0?void 0:s[n]}})},enumerable:!1,configurable:!0}),e}(G1);dt.Element=p6;function m6(t){return(0,Kn.isTag)(t)}dt.isTag=m6;function g6(t){return t.type===Kn.ElementType.CDATA}dt.isCDATA=g6;function v6(t){return t.type===Kn.ElementType.Text}dt.isText=v6;function y6(t){return t.type===Kn.ElementType.Comment}dt.isComment=y6;function x6(t){return t.type===Kn.ElementType.Directive}dt.isDirective=x6;function b6(t){return t.type===Kn.ElementType.Root}dt.isDocument=b6;function Uoe(t){return Object.prototype.hasOwnProperty.call(t,"children")}dt.hasChildren=Uoe;function ZC(t,e){e===void 0&&(e=!1);var r;if(v6(t))r=new u6(t.data);else if(y6(t))r=new c6(t.data);else if(m6(t)){var n=e?f_(t.children):[],i=new p6(t.name,sp({},t.attribs),n);n.forEach(function(l){return l.parent=i}),t.namespace!=null&&(i.namespace=t.namespace),t["x-attribsNamespace"]&&(i["x-attribsNamespace"]=sp({},t["x-attribsNamespace"])),t["x-attribsPrefix"]&&(i["x-attribsPrefix"]=sp({},t["x-attribsPrefix"])),r=i}else if(g6(t)){var n=e?f_(t.children):[],s=new h6(n);n.forEach(function(u){return u.parent=s}),r=s}else if(b6(t)){var n=e?f_(t.children):[],o=new f6(n);n.forEach(function(u){return u.parent=o}),t["x-mode"]&&(o["x-mode"]=t["x-mode"]),r=o}else if(x6(t)){var a=new d6(t.name,t.data);t["x-name"]!=null&&(a["x-name"]=t["x-name"],a["x-publicId"]=t["x-publicId"],a["x-systemId"]=t["x-systemId"]),r=a}else throw new Error("Not implemented yet: ".concat(t.type));return r.startIndex=t.startIndex,r.endIndex=t.endIndex,t.sourceCodeLocation!=null&&(r.sourceCodeLocation=t.sourceCodeLocation),r}dt.cloneNode=ZC;function f_(t){for(var e=t.map(function(n){return ZC(n,!0)}),r=1;r<e.length;r++)e[r].prev=e[r-1],e[r-1].next=e[r];return e}(function(t){var e=rr&&rr.__createBinding||(Object.create?function(a,l,u,c){c===void 0&&(c=u);var h=Object.getOwnPropertyDescriptor(l,u);(!h||("get"in h?!l.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return l[u]}}),Object.defineProperty(a,c,h)}:function(a,l,u,c){c===void 0&&(c=u),a[c]=l[u]}),r=rr&&rr.__exportStar||function(a,l){for(var u in a)u!=="default"&&!Object.prototype.hasOwnProperty.call(l,u)&&e(l,a,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.DomHandler=void 0;var n=QC,i=dt;r(dt,t);var s={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},o=function(){function a(l,u,c){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof u=="function"&&(c=u,u=s),typeof l=="object"&&(u=l,l=void 0),this.callback=l??null,this.options=u??s,this.elementCB=c??null}return a.prototype.onparserinit=function(l){this.parser=l},a.prototype.onreset=function(){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},a.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},a.prototype.onerror=function(l){this.handleCallback(l)},a.prototype.onclosetag=function(){this.lastNode=null;var l=this.tagStack.pop();this.options.withEndIndices&&(l.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(l)},a.prototype.onopentag=function(l,u){var c=this.options.xmlMode?n.ElementType.Tag:void 0,h=new i.Element(l,u,void 0,c);this.addNode(h),this.tagStack.push(h)},a.prototype.ontext=function(l){var u=this.lastNode;if(u&&u.type===n.ElementType.Text)u.data+=l,this.options.withEndIndices&&(u.endIndex=this.parser.endIndex);else{var c=new i.Text(l);this.addNode(c),this.lastNode=c}},a.prototype.oncomment=function(l){if(this.lastNode&&this.lastNode.type===n.ElementType.Comment){this.lastNode.data+=l;return}var u=new i.Comment(l);this.addNode(u),this.lastNode=u},a.prototype.oncommentend=function(){this.lastNode=null},a.prototype.oncdatastart=function(){var l=new i.Text(""),u=new i.CDATA([l]);this.addNode(u),l.parent=u,this.lastNode=l},a.prototype.oncdataend=function(){this.lastNode=null},a.prototype.onprocessinginstruction=function(l,u){var c=new i.ProcessingInstruction(l,u);this.addNode(c)},a.prototype.handleCallback=function(l){if(typeof this.callback=="function")this.callback(l,this.dom);else if(l)throw l},a.prototype.addNode=function(l){var u=this.tagStack[this.tagStack.length-1],c=u.children[u.children.length-1];this.options.withStartIndices&&(l.startIndex=this.parser.startIndex),this.options.withEndIndices&&(l.endIndex=this.parser.endIndex),u.children.push(l),c&&(l.prev=c,c.next=l),l.parent=u,this.lastNode=null},a}();t.DomHandler=o,t.default=o})(YC);var sk="html",ok="head",C0="body",$oe=/<([a-zA-Z]+[0-9]?)/,ak=/<head[^]*>/i,lk=/<body[^]*>/i,zy=function(){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},S2=function(){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},uk=typeof window=="object"&&window.DOMParser;if(typeof uk=="function"){var zoe=new uk,Hoe="text/html";S2=function(t,e){return e&&(t="<"+e+">"+t+"</"+e+">"),zoe.parseFromString(t,Hoe)},zy=S2}if(typeof document=="object"&&document.implementation){var A0=document.implementation.createHTMLDocument();zy=function(t,e){if(e){var r=A0.documentElement.querySelector(e);return r.innerHTML=t,A0}return A0.documentElement.innerHTML=t,A0}}var p_=typeof document=="object"?document.createElement("template"):{},E2;p_.content&&(E2=function(t){return p_.innerHTML=t,p_.content.childNodes});function Voe(t){var e,r=t.match($oe);r&&r[1]&&(e=r[1].toLowerCase());var n,i,s;switch(e){case sk:return n=S2(t),ak.test(t)||(i=n.querySelector(ok),i&&i.parentNode.removeChild(i)),lk.test(t)||(i=n.querySelector(C0),i&&i.parentNode.removeChild(i)),n.querySelectorAll(sk);case ok:case C0:return n=zy(t),s=n.querySelectorAll(e),lk.test(t)&&ak.test(t)?s[0].parentNode.childNodes:s;default:return E2?E2(t):(i=zy(t,C0).querySelector(C0),i.childNodes)}}var Goe=Voe,JC={},w6={};w6.CASE_SENSITIVE_TAG_NAMES=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"];var W1=YC,Woe=w6,ck=Woe.CASE_SENSITIVE_TAG_NAMES,Xoe=W1.Comment,qoe=W1.Element,Yoe=W1.ProcessingInstruction,Qoe=W1.Text,_6={},m_;for(var g_=0,Koe=ck.length;g_<Koe;g_++)m_=ck[g_],_6[m_.toLowerCase()]=m_;function Zoe(t){return _6[t]}function S6(t){for(var e={},r,n=0,i=t.length;n<i;n++)r=t[n],e[r.name]=r.value;return e}function Joe(t){t=t.toLowerCase();var e=Zoe(t);return e||t}function E6(t,e,r){e=e||null;for(var n=[],i,s=0,o=t.length;s<o;s++){var a=t[s],l;switch(a.nodeType){case 1:i=Joe(a.nodeName),l=new qoe(i,S6(a.attributes)),l.children=E6(i==="template"?a.content.childNodes:a.childNodes,l);break;case 3:l=new Qoe(a.nodeValue);break;case 8:l=new Xoe(a.nodeValue);break;default:continue}var u=n[s-1]||null;u&&(u.next=l),l.parent=e,l.prev=u,l.next=null,n.push(l)}return r&&(l=new Yoe(r.substring(0,r.indexOf(" ")).toLowerCase(),r),l.next=n[0]||null,l.parent=e,n.unshift(l),n[1]&&(n[1].prev=n[0])),n}JC.formatAttributes=S6;JC.formatDOM=E6;var eae=Goe,tae=JC,rae=tae.formatDOM,nae=/<(![a-zA-Z\s]+)>/;function iae(t){if(typeof t!="string")throw new TypeError("First argument must be a string");if(t==="")return[];var e=t.match(nae),r;return e&&e[1]&&(r=e[1]),rae(eae(t),null,r)}var sae=iae,Ki={},X1={},oae=0;X1.SAME=oae;var aae=1;X1.CAMELCASE=aae;X1.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1};Object.defineProperty(Ki,"__esModule",{value:!0});function lae(t,e){return uae(t)||cae(t,e)||dae(t,e)||hae()}function uae(t){if(Array.isArray(t))return t}function cae(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],i=!0,s=!1,o,a;try{for(r=r.call(t);!(i=(o=r.next()).done)&&(n.push(o.value),!(e&&n.length===e));i=!0);}catch(l){s=!0,a=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(s)throw a}}return n}}function dae(t,e){if(t){if(typeof t=="string")return dk(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return dk(t,e)}}function dk(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function hae(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1389
1389
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var T6=0,Hl=1,q1=2,Y1=3,eA=4,C6=5,A6=6;function fae(t){return Kr.hasOwnProperty(t)?Kr[t]:null}function In(t,e,r,n,i,s,o){this.acceptsBooleans=e===q1||e===Y1||e===eA,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Kr={},pae=["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"];pae.forEach(function(t){Kr[t]=new In(t,T6,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=lae(t,2),r=e[0],n=e[1];Kr[r]=new In(r,Hl,!1,n,null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Kr[t]=new In(t,q1,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Kr[t]=new In(t,q1,!1,t,null,!1,!1)});["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(function(t){Kr[t]=new In(t,Y1,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Kr[t]=new In(t,Y1,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Kr[t]=new In(t,eA,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Kr[t]=new In(t,A6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Kr[t]=new In(t,C6,!1,t.toLowerCase(),null,!1,!1)});var tA=/[\-\:]([a-z])/g,rA=function(e){return e[1].toUpperCase()};["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach(function(t){var e=t.replace(tA,rA);Kr[e]=new In(e,Hl,!1,t,null,!1,!1)});["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(function(t){var e=t.replace(tA,rA);Kr[e]=new In(e,Hl,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(tA,rA);Kr[e]=new In(e,Hl,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Kr[t]=new In(t,Hl,!1,t.toLowerCase(),null,!1,!1)});var mae="xlinkHref";Kr[mae]=new In("xlinkHref",Hl,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Kr[t]=new In(t,Hl,!1,t.toLowerCase(),null,!0,!0)});var nA=X1,gae=nA.CAMELCASE,vae=nA.SAME,hk=nA.possibleStandardNames,yae=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",xae=yae+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",bae=RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+xae+"]*$")),wae=Object.keys(hk).reduce(function(t,e){var r=hk[e];return r===vae?t[e]=e:r===gae?t[e.toLowerCase()]=e:t[e]=r,t},{});Ki.BOOLEAN=Y1;Ki.BOOLEANISH_STRING=q1;Ki.NUMERIC=C6;Ki.OVERLOADED_BOOLEAN=eA;Ki.POSITIVE_NUMERIC=A6;Ki.RESERVED=T6;Ki.STRING=Hl;Ki.getPropertyInfo=fae;Ki.isCustomAttribute=bae;Ki.possibleStandardNames=wae;var R6={},iA={exports:{}},fk=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,_ae=/\n/g,Sae=/^\s*/,Eae=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Tae=/^:\s*/,Cae=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Aae=/^[;\s]*/,Rae=/^\s+|\s+$/g,Pae=`
1390
- `,pk="/",mk="*",_u="",Iae="comment",Mae="declaration",kae=function(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var r=1,n=1;function i(y){var v=y.match(_ae);v&&(r+=v.length);var x=y.lastIndexOf(Pae);n=~x?y.length-x:n+y.length}function s(){var y={line:r,column:n};return function(v){return v.position=new o(y),u(),v}}function o(y){this.start=y,this.end={line:r,column:n},this.source=e.source}o.prototype.content=t;function a(y){var v=new Error(e.source+":"+r+":"+n+": "+y);if(v.reason=y,v.filename=e.source,v.line=r,v.column=n,v.source=t,!e.silent)throw v}function l(y){var v=y.exec(t);if(v){var x=v[0];return i(x),t=t.slice(x.length),v}}function u(){l(Sae)}function c(y){var v;for(y=y||[];v=h();)v!==!1&&y.push(v);return y}function h(){var y=s();if(!(pk!=t.charAt(0)||mk!=t.charAt(1))){for(var v=2;_u!=t.charAt(v)&&(mk!=t.charAt(v)||pk!=t.charAt(v+1));)++v;if(v+=2,_u===t.charAt(v-1))return a("End of comment missing");var x=t.slice(2,v-2);return n+=2,i(x),t=t.slice(v),n+=2,y({type:Iae,comment:x})}}function f(){var y=s(),v=l(Eae);if(v){if(h(),!l(Tae))return a("property missing ':'");var x=l(Cae),b=y({type:Mae,property:gk(v[0].replace(fk,_u)),value:x?gk(x[0].replace(fk,_u)):_u});return l(Aae),b}}function m(){var y=[];c(y);for(var v;v=f();)v!==!1&&(y.push(v),c(y));return y}return u(),m()};function gk(t){return t?t.replace(Rae,_u):_u}var Oae=kae;function P6(t,e){var r=null;if(!t||typeof t!="string")return r;for(var n,i=Oae(t),s=typeof e=="function",o,a,l=0,u=i.length;l<u;l++)n=i[l],o=n.property,a=n.value,s?e(o,a,n):a&&(r||(r={}),r[o]=a);return r}iA.exports=P6;iA.exports.default=P6;var Dae=iA.exports,Q1={};Q1.__esModule=!0;Q1.camelCase=void 0;var Nae=/^--[a-zA-Z0-9-]+$/,Lae=/-([a-z])/g,Fae=/^[^-]+$/,jae=/^-(webkit|moz|ms|o|khtml)-/,Bae=/^-(ms)-/,Uae=function(t){return!t||Fae.test(t)||Nae.test(t)},$ae=function(t,e){return e.toUpperCase()},vk=function(t,e){return"".concat(e,"-")},zae=function(t,e){return e===void 0&&(e={}),Uae(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(Bae,vk):t=t.replace(jae,vk),t.replace(Lae,$ae))};Q1.camelCase=zae;(function(t){var e=rr&&rr.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};t.__esModule=!0;var r=e(Dae),n=Q1;function i(s,o){var a={};return!s||typeof s!="string"||(0,r.default)(s,function(l,u){l&&u&&(a[(0,n.camelCase)(l,o)]=u)}),a}t.default=i})(R6);var Hae=T,Vae=R6.default;function Gae(t,e){if(!t||typeof t!="object")throw new TypeError("First argument must be an object");var r=typeof e=="function",n={},i={};for(var s in t){var o=t[s];if(r&&(n=e(s,o),n&&n.length===2)){i[n[0]]=n[1];continue}typeof o=="string"&&(i[o]=s)}return i}var Wae=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function Xae(t,e){return t.indexOf("-")===-1?e&&typeof e.is=="string":!Wae.has(t)}var qae={reactCompat:!0};function Yae(t,e){if(t!=null)try{e.style=Vae(t,qae)}catch{e.style={}}}var Qae=Hae.version.split(".")[0]>=16,I6=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);function Kae(t){return!I6.has(t.name)}function Zae(t){return t}var M6={PRESERVE_CUSTOM_ATTRIBUTES:Qae,ELEMENTS_WITH_NO_TEXT_CHILDREN:I6,invertObject:Gae,isCustomComponent:Xae,setStyleProp:Yae,canTextBeChildOfNode:Kae,returnFirstArg:Zae},kf=Ki,yk=M6,Jae=["checked","value"],ele=["input","select","textarea"],tle={reset:!0,submit:!0},k6=function(e,r){e=e||{};var n,i,s,o,a,l={},u=e.type&&tle[e.type];for(n in e){if(s=e[n],kf.isCustomAttribute(n)){l[n]=s;continue}if(i=n.toLowerCase(),o=xk(i),o){switch(a=kf.getPropertyInfo(o),Jae.indexOf(o)!==-1&&ele.indexOf(r)!==-1&&!u&&(o=xk("default"+i)),l[o]=s,a&&a.type){case kf.BOOLEAN:l[o]=!0;break;case kf.OVERLOADED_BOOLEAN:s===""&&(l[o]=!0);break}continue}yk.PRESERVE_CUSTOM_ATTRIBUTES&&(l[n]=s)}return yk.setStyleProp(e.style,l),l};function xk(t){return kf.possibleStandardNames[t]}var rle=T,nle=k6,Zp=M6,ile=Zp.setStyleProp,sle=Zp.canTextBeChildOfNode;function O6(t,e){e=e||{};for(var r=e.library||rle,n=r.cloneElement,i=r.createElement,s=r.isValidElement,o=[],a,l,u=typeof e.replace=="function",c=e.transform||Zp.returnFirstArg,h,f,m,y=e.trim,v=0,x=t.length;v<x;v++){if(a=t[v],u&&(h=e.replace(a),s(h))){x>1&&(h=n(h,{key:h.key||v})),o.push(c(h,a,v));continue}if(a.type==="text"){if(l=!a.data.trim().length,l&&a.parent&&!sle(a.parent)||y&&l)continue;o.push(c(a.data,a,v));continue}switch(f=a.attribs,ole(a)?ile(f.style,f):f&&(f=nle(f,a.name)),m=null,a.type){case"script":case"style":a.children[0]&&(f.dangerouslySetInnerHTML={__html:a.children[0].data});break;case"tag":a.name==="textarea"&&a.children[0]?f.defaultValue=a.children[0].data:a.children&&a.children.length&&(m=O6(a.children,e));break;default:continue}x>1&&(f.key=v),o.push(c(i(a.name,f,m),a,v))}return o.length===1?o[0]:o}function ole(t){return Zp.PRESERVE_CUSTOM_ATTRIBUTES&&t.type==="tag"&&Zp.isCustomComponent(t.name,t.attribs)}var ale=O6,K1=YC,cd=sae,lle=k6,D6=ale;cd=typeof cd.default=="function"?cd.default:cd;var ule={lowerCaseAttributeNames:!1};function Eo(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");return t===""?[]:(e=e||{},D6(cd(t,e.htmlparser2||ule),e))}Eo.domToReact=D6;Eo.htmlToDOM=cd;Eo.attributesToProps=lle;Eo.Comment=K1.Comment;Eo.Element=K1.Element;Eo.ProcessingInstruction=K1.ProcessingInstruction;Eo.Text=K1.Text;var cle=Eo;Eo.default=Eo;const Vl=Co(cle);var R0=Vl.domToReact;Vl.htmlToDOM;var v_=Vl.attributesToProps;Vl.Comment;Vl.Element;Vl.ProcessingInstruction;Vl.Text;var dle=Object.defineProperty,hle=(t,e,r)=>e in t?dle(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pf=(t,e,r)=>(hle(t,typeof e!="symbol"?e+"":e,r),r);const fle=async t=>await Ie.conf().getPreference(t),ple=async t=>await Ie.conf().savePreference(t,JSON.stringify({key:!1})),mle=t=>{const[e,r]=T.useState(!0),[n,i]=T.useState(!1);return T.useEffect(()=>{(async()=>{const s=await fle(t);if(s){const{key:o}=s;i(o);return}i(!0)})()},[t]),{isOpen:e,setIsOpen:r,isOnboarding:n,handleSavePreference:async()=>{await ple(t),r(!1)}}},gle=({id:t,items:e,modalOptions:r})=>{const[n]=Pn(),[i,s]=T.useState(),[o,a]=T.useState(0),{isOpen:l,isOnboarding:u,setIsOpen:c,handleSavePreference:h}=mle(t);T.useEffect(()=>{const b=document.createElement("link");return b.href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",b.rel="stylesheet",b.type="text/css",document.head.appendChild(b),()=>{document.head.removeChild(b)}},[]);const{t:f}=we(),{title:m,prevText:y,closeText:v,nextText:x}=r;return u?ur.createPortal(g.jsxs(Ye,{id:"onboarding-modal",size:"md",isOpen:l,focusId:"nextButtonId",onModalClose:()=>c(!1),children:[g.jsx(Ye.Header,{onModalClose:()=>c(!1),children:f(m||"explorer.modal.onboarding.trash.title")}),g.jsx(Ye.Body,{children:g.jsx(i6,{modules:[sse],onSwiper:b=>{s(b)},onSlideChange:b=>{a(b.progress)},pagination:{clickable:!0},children:e.map((b,_)=>g.jsxs(s6,{children:[g.jsx(yo,{width:"270",height:"140",className:"mx-auto my-12",loading:"lazy",src:`${n}/${b.src}`,alt:f(b.alt)}),g.jsx("p",{children:f(b.text)})]},_))})}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{type:"button",color:"tertiary",variant:"ghost",onClick:()=>c(!1),children:f("explorer.modal.onboarding.trash.later")}),o>0&&g.jsx(it,{type:"button",color:"primary",variant:"outline",onClick:()=>i.slidePrev(),children:f(y||"explorer.modal.onboarding.trash.prev")}),o<1&&g.jsx(it,{id:"nextButtonId",type:"button",color:"primary",variant:"filled",onClick:()=>i.slideNext(),children:f(x||"explorer.modal.onboarding.trash.next")}),o===1&&g.jsx(it,{type:"button",color:"primary",variant:"filled",onClick:h,children:f(v||"explorer.modal.onboarding.trash.close")})]})]}),document.getElementById("portal")):null},vle=gle,N6=T.createContext(null),wh=()=>{const t=T.useContext(N6);if(!t)throw new Error("Cannot be rendered outside the Dropdown Component");return t},yle=T.forwardRef(({label:t,disabled:e=!1,checked:r=!1,indeterminate:n=!1,...i},s)=>{const o=T.useRef(null);T.useImperativeHandle(s,()=>({...o.current})),T.useEffect(()=>{o.current.indeterminate=n},[o,n]);const a=T.useId(),l={type:"checkbox",checked:r,disabled:e,ref:o,className:Me(i.className,"form-check-input c-pointer"),id:a},u={...i,...l};return g.jsxs("div",{className:"form-check d-flex align-items-center gap-8",children:[g.jsx("input",{...u}),t&&g.jsx("label",{className:"form-check-label",htmlFor:u.id,children:t})]})}),Cm=yle,xle=({children:t,value:e,model:r,onChange:n})=>{const{itemProps:i,itemRefs:s,isFocused:o}=wh(),{onMenuItemKeyDown:a,onMenuItemMouseEnter:l}=i,u=T.useId(),c=r.includes(e),h={value:e,model:r,checked:c,readOnly:!0},f=Me("dropdown-item c-pointer",{focus:o===u});return g.jsx("div",{id:u,ref:m=>s.current[u]=m,role:"menuitemcheckbox","aria-checked":c,onMouseUp:()=>n(e),onKeyDown:m=>a(m,()=>n(e)),onMouseEnter:l,tabIndex:c?0:-1,className:f,children:g.jsxs("div",{className:"d-flex gap-8 align-items-center justify-content-between position-relative",children:[t,g.jsx(Cm,{...h})]})})},ble=xle,wle=({type:t="action",icon:e,onClick:r,children:n,className:i,...s})=>{const{itemProps:o,itemRefs:a,isFocused:l}=wh(),{onMenuItemKeyDown:u,onMenuItemMouseEnter:c,onMenuItemClick:h}=o,f=v=>{r==null||r(v),t==="action"&&(h(),v.stopPropagation())},m=T.useId(),y=Me("dropdown-item",{focus:l===m},i);return g.jsx("div",{id:m,role:"menuitem",ref:v=>a.current[m]=v,tabIndex:l===m?0:-1,className:y,"aria-current":l===m,onClick:f,onMouseEnter:c,onKeyDown:v=>u(v,r),...s,children:g.jsxs("div",{className:"d-flex gap-8 align-items-center",children:[e,n]})})},_le=wle,Sle=T.forwardRef(({children:t,block:e,unstyled:r,...n},i)=>{const{menuProps:s,visible:o}=wh(),a=Me({"w-100":e,"bg-white shadow rounded-4 p-8":!r},s.className,n.className),l={...s,...n,className:a};return o?g.jsx("div",{ref:i,...l,children:t}):null}),Ele=Sle,Tle=T.forwardRef(({label:t,children:e},r)=>g.jsxs("div",{ref:r,role:"group",children:[g.jsx("span",{className:"small px-4",children:g.jsx("strong",{children:t})}),e]})),Cle=Tle,Ale=T.forwardRef(({model:t,icon:e,label:r=!1,disabled:n=!1,checked:i,...s},o)=>{const a=T.useId(),l={type:"radio",checked:i,disabled:n,ref:o,className:Me(s.className,"form-check-input c-pointer",e&&"d-none"),id:a},u={...s,...l};return g.jsxs("div",{className:Me("form-check d-flex align-items-center gap-8",e&&"ps-0"),children:[g.jsx("input",{...u}),e&&g.jsx("label",{htmlFor:u.id,className:Me("c-pointer",t!==s.value&&"text-muted"),children:e}),!e&&r&&g.jsx("label",{className:"form-check-label",htmlFor:u.id,children:r})]})}),T2=Ale,Rle=({children:t,value:e,model:r,onChange:n})=>{const{itemProps:i,itemRefs:s,isFocused:o}=wh(),{onMenuItemKeyDown:a,onMenuItemMouseEnter:l}=i,u=T.useId(),c={value:e,model:r,checked:e===r,readOnly:!0},h=Me("dropdown-item c-pointer",{focus:o===u});return g.jsx("div",{id:u,ref:f=>s.current[u]=f,role:"menuitemradio","aria-checked":e===r,onMouseUp:()=>n(e),onKeyDown:f=>a(f,()=>n(e)),onMouseEnter:l,tabIndex:e===r?0:-1,className:h,children:g.jsxs("div",{className:"d-flex gap-8 align-items-center justify-content-between position-relative",children:[t,g.jsx(T2,{...c,className:"position-absolute start-0 end-0 top-0 bottom-0 opacity-0"})]})})},Ple=Rle,Ile=()=>g.jsx("div",{role:"separator",className:"px-4",children:g.jsx("hr",{className:"m-0"})}),Mle=Ile,kle=T.forwardRef(({label:t,icon:e,variant:r,disabled:n=!1,size:i,badgeContent:s,hideCarret:o=!1,...a},l)=>{const{triggerProps:u,block:c}=wh(),h=Me("dropdown-toggle ",i,r,{"w-100":c},u.className,a.className),f={...u,...a,className:h};return g.jsxs("button",{ref:l,type:"button",disabled:n,...f,children:[e,t,s?g.jsx("span",{className:"badge text-bg-secondary rounded-pill",children:s}):!o&&g.jsx(gz,{width:16,height:16,className:"dropdown-toggle-caret"})]})}),Ole=kle;function L6(t){var e,r,n;const i=new wX(t),s=i.getOS(),o=i.getDevice(),a=i.getBrowser(),l=((e=o.model)==null?void 0:e.indexOf("iPhone"))!=-1,u=((r=o.model)==null?void 0:r.indexOf("iPod"))!=-1,c=((n=o.model)==null?void 0:n.indexOf("iPad"))!=-1;return{os:s,device:o,browser:a,isIphone:l,isIpod:u,isIpad:c}}const bk=["mousedown","touchstart"];function F6(t,e,r){const n=T.useRef();return T.useEffect(()=>{const i=s=>{const{target:o}=s??{};if(Array.isArray(r)){const a=(o==null?void 0:o.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(o)&&o.tagName!=="HTML";r.every(l=>!!l&&!s.composedPath().includes(l))&&!a&&t()}else n.current&&!n.current.contains(o)&&t()};return bk.forEach(s=>{document.addEventListener(s,i)}),()=>{bk.forEach(s=>{document.removeEventListener(s,i)})}},[n,t,r,e]),n}function sA(t,e){const[r,n]=T.useState(t);return T.useEffect(()=>{const i=setTimeout(()=>{n(t)},e||500);return()=>{clearTimeout(i)}},[t,e]),r}function C2(...t){return e=>{Dle(e,...t)}}function Dle(t,...e){e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}const Nle=(t,e,r=!1)=>{const n=T.useId(),[i,s]=T.useState(!1),[o,a]=T.useState(-1),[l,u]=T.useState(null),{refs:c,floatingStyles:h,context:f}=YH({placement:t,open:i,onOpenChange:s,whileElementsMounted:CH,middleware:[kH(4),DH({apply({rects:j,elements:H}){H.floating.style.minWidth=`${j.reference.width}px`}}),OH({padding:0})]});VH(f,{enabled:r,delay:{open:200},handleClose:KH()});const m=T.useRef(null),y=T.useRef(null),v=T.useRef({});T.useEffect(()=>{i?m.current&&(m.current.focus(),a(0)):(a(-1),v.current={})},[i]),T.useEffect(()=>{if(o!==-1){const j=Object.values(v.current)[o];if(j){const H=j.getAttribute("id");u(H),j.focus()}}},[o]);const x=()=>{const j=Object.values(v.current).length;a(H=>(H+1)%j)},b=()=>{const j=Object.values(v.current).length;a(H=>(H-1+j)%j)},_=()=>{a(0)},w=()=>{const j=Object.values(v.current).length;a(j-1)},E=T.useCallback(()=>{s(!0)},[]),A=T.useCallback(()=>{y.current&&(y.current.focus({preventScroll:!0}),s(!1))},[]),I=(j,H)=>{j&&(H.stopPropagation(),H.preventDefault())},P=T.useCallback(j=>{let H=!1;switch(j.code){case" ":case"Space":case"Enter":case"ArrowDown":case"Down":E(),H=!0;break;case"Esc":case"Escape":A(),H=!0;break;case"Up":case"ArrowUp":E(),H=!0;break}e==null||e(j),I(H,j)},[A,E]),M=j=>{const H=Object.values(v.current).findIndex(F=>F.id===j.currentTarget.getAttribute("id"));a(H)},N=T.useCallback((j,H)=>{let F=!1;if(j.shiftKey)j.key==="Tab"&&(A(),F=!0);else{switch(j.code){case"Escape":A();break;case" ":case"Enter":o!==-1&&(Object.values(v.current)[o].getAttribute("role")==="menuitem"&&y.current&&(y.current.focus(),s(!1)),H==null||H()),F=!0;break;case"ArrowDown":case"Down":x(),F=!0;break;case"ArrowUp":case"Up":b(),F=!0;break;case"Home":_(),F=!0;break;case"End":w(),F=!0;break}I(F,j)}},[o,A]),z=T.useCallback(j=>{s(i!==!0),j.stopPropagation(),j.preventDefault()},[i]);return{isFocused:l,visible:i,itemRefs:v,triggerRef:y,menuRef:m,triggerProps:{ref:C2(y,c.setReference),id:`dropdown-toggle-${n}`,"aria-haspopup":"menu","aria-controls":`dropdown-${n}`,"aria-expanded":!!i,className:`${i?"selected":""}`,onClick:z,onKeyDown:P,"aria-activedescendant":l},menuProps:{ref:C2(m,c.setFloating),className:"dropdown-menu","aria-labelledby":`dropdown-toggle-${n}`,style:{...h}},itemProps:{onMenuItemMouseEnter:M,onMenuItemClick:A,onMenuItemKeyDown:N},setVisible:s}},Lle=Nle,Fle=t=>{const[e,r]=T.useState(!1),[n,i]=T.useState([]),s=T.useRef(null),o=v=>{c([v])},a=v=>{i(x=>x.filter(b=>b.name!==v.name))},l=(v,x)=>{i(b=>{if(0<=v&&v<b.length){const _=b.slice(0,v),w=v===b.length-1?[]:b.slice(v+1);return[..._,x,...w]}return b})},u=v=>{var x;let b=v;if((x=s.current)!=null&&x.accept){const _=s.current.accept.split(",").map(A=>A.trim().toLowerCase()),w=_.filter(A=>A.startsWith(".")),E=_.filter(A=>!A.startsWith(".")).map(A=>A.replace("*",""));b=[],v.forEach(A=>{const I=A.name.toLowerCase();(w.some(P=>I.endsWith(P))||E.some(P=>A.type.includes(P)))&&b.push(A)})}return b},c=v=>{if(t!=null&&t.forceFilters){const x=u(v);x&&x.length&&i(b=>[...b,...x])}else i(x=>[...x,...v])},h=()=>{i([])},f=v=>{const x=v.target.files;x&&c([...x])},m=v=>{v.preventDefault(),v.stopPropagation(),r(!0)},y=v=>{v.preventDefault(),v.stopPropagation(),r(!1)};return{inputRef:s,files:n,dragging:e,handleDragging:m,handleDragLeave:y,handleDrop:v=>{var x;y(v);const b=(x=v.dataTransfer)==null?void 0:x.files;b&&(c([...b]),s!=null&&s.current&&(s.current.files=b))},replaceFileAt:l,deleteFile:a,addFile:o,addFiles:c,cleanFiles:h,handleOnChange:f}},jle=Fle;function j6(){const[t,e]=T.useState(!1),r=T.useRef(null),n=()=>{e(!0)},i=()=>{e(!1)};return T.useEffect(()=>{const s=r.current;if(s)return s.addEventListener("mouseover",n),s.addEventListener("mouseout",i),()=>{s.removeEventListener("mouseover",n),s.removeEventListener("mouseout",i)}},[r]),[r,t]}function Ble(t,e){const r=T.useCallback(({code:n})=>{e.includes(n)&&t()},[t,e]);T.useEffect(()=>(window.addEventListener("keydown",r),()=>{window.removeEventListener("keydown",r)}),[r])}function B6(){const t=document.querySelector("html");return()=>{t&&t.scrollIntoView()}}const Ule=T.forwardRef(({icon:t,className:e,...r},n)=>{const i={...r,className:Me("btn-icon btn-sm",e)};return g.jsx(it,{ref:n,...i,children:t})}),To=Ule,$le=T.forwardRef(({icon:t=g.jsx(RS,{}),onClick:e,className:r,...n},i)=>{const s=Me("btn-search",r);return g.jsx(To,{ref:i,className:s,icon:t,onClick:e,...n})}),oA=$le,zle=T.forwardRef(({type:t="success",className:e="",children:r,button:n,isDismissible:i=!1,isToast:s=!1,isConfirm:o=!1,position:a="none",autoClose:l=!1,autoCloseDelay:u=3e3,onClose:c,onVisibilityChange:h},f)=>{const[m,y]=T.useState(!0),v=T.useRef(null),{t:x}=we(),b=T.useCallback(()=>{y(!1),c==null||c()},[c]);T.useImperativeHandle(f,()=>({show:_,hide:b,...v.current})),T.useLayoutEffect(()=>{h==null||h(m)},[m,h]),T.useEffect(()=>{l&&m&&setTimeout(()=>{b()},u)},[l,u,b,m]);const _=()=>{y(!0)},w={success:{icon:g.jsx(VN,{}),classModifier:"alert-success"},warning:{icon:g.jsx(A$,{}),classModifier:"alert-warning"},info:{icon:g.jsx(FN,{}),classModifier:"alert-info"},danger:{icon:g.jsx(Y$,{}),classModifier:"alert-danger"}},E={"is-dismissible":i,"is-toast ":s},A={"is-confirm":o},I=Me("alert gap-12",w[t].classModifier,E,A,a,e);return g.jsx(g.Fragment,{children:m?g.jsxs("div",{ref:v,className:I,role:"alert",children:[!o&&w[t].icon,g.jsx("div",{className:"alert-content small",children:r}),n&&g.jsxs("div",{className:"ms-12",children:[n," ",o&&g.jsx(it,{onClick:b,children:x("close")})]}),(i||o)&&g.jsx("div",{className:"btn-close-container",children:g.jsx("button",{type:"button",className:"btn-close","data-bs-dismiss":"alert","aria-label":x("close"),onClick:b})}),l&&g.jsx("div",{className:"alert-progress",style:{transform:"scaleX(0)"}})]}):null})}),Jo=zle,P0="top-right";function Jr(){return{success:(t,e)=>ou.custom(g.jsx(Jo,{type:"success",isToast:!0,isDismissible:e==null?void 0:e.isDismissible,className:"mb-12",children:t}),{id:e==null?void 0:e.id,duration:e==null?void 0:e.duration,position:(e==null?void 0:e.position)??P0}),error:(t,e)=>ou.custom(g.jsx(Jo,{type:"danger",isToast:!0,isDismissible:e==null?void 0:e.isDismissible,className:"mb-12",children:t}),{id:e==null?void 0:e.id,duration:e==null?void 0:e.duration,position:(e==null?void 0:e.position)??P0}),info:(t,e)=>ou.custom(g.jsx(Jo,{type:"info",isToast:!0,isDismissible:e==null?void 0:e.isDismissible,className:"mb-12",children:t}),{id:e==null?void 0:e.id,duration:e==null?void 0:e.duration,position:(e==null?void 0:e.position)??P0}),warning:(t,e)=>ou.custom(g.jsx(Jo,{type:"warning",isToast:!0,isDismissible:e==null?void 0:e.isDismissible,className:"mb-12",children:t}),{id:e==null?void 0:e.id,duration:e==null?void 0:e.duration,position:(e==null?void 0:e.position)??P0}),loading:ou.loading,dismiss:t=>ou.dismiss(t),remove:t=>ou.remove(t)}}function Am(t=!1){const[e,r]=T.useState(t),n=T.useCallback(()=>{r(i=>!i)},[]);return[e,n]}function Hle(){const t=T.useRef(null),e='button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';return T.useEffect(()=>{const r=t.current,n=r.querySelectorAll(e)[0],i=r.querySelectorAll(e),s=t&&(i==null?void 0:i[i.length-1]),o=a=>{a.key==="Tab"&&(a.shiftKey?document.activeElement===n&&(s.focus(),a.preventDefault()):document.activeElement===s&&(n.focus(),a.preventDefault()))};if(r)return r.addEventListener("keydown",o),()=>{r.removeEventListener("keydown",o)}},[]),t}const Vle=({children:t,block:e,overflow:r=!0,placement:n="bottom-start",extraTriggerKeyDownHandler:i,onToggle:s,isTriggerHovered:o=!1})=>{const{visible:a,isFocused:l,triggerProps:u,menuProps:c,itemProps:h,itemRefs:f,setVisible:m}=Lle(n,i,o),y=F6(()=>{m(!1)}),v=T.useMemo(()=>({visible:a,isFocused:l,triggerProps:u,menuProps:c,itemProps:h,itemRefs:f,block:e,setVisible:m}),[a,l,u,c,h,f,e,m]),x=Me("dropdown",{"w-100":e,overflow:r});return T.useEffect(()=>{s==null||s(a)},[a]),g.jsx(N6.Provider,{value:v,children:g.jsx("div",{ref:y,className:x,children:typeof t=="function"?t(u,f,m):t})})},Gle=Object.assign(Vle,{Trigger:Ole,Menu:Ele,Item:_le,Separator:Mle,CheckboxItem:ble,RadioItem:Ple,MenuGroup:Cle}),xt=Gle,Wle=()=>{const{t}=we();return[{value:"bpr.activityType.classroomActivity",label:t("bpr.activityType.classroomActivity")},{value:"bpr.activityType.groupActivity",label:t("bpr.activityType.groupActivity")},{value:"bpr.activityType.personalActivity",label:t("bpr.activityType.personalActivity")},{value:"bpr.activityType.homework",label:t("bpr.activityType.homework")},{value:"bpr.activityType.exercize",label:t("bpr.activityType.exercize")},{value:"bpr.activityType.learningPath",label:t("bpr.activityType.learningPath")},{value:"bpr.activityType.courseElement",label:t("bpr.activityType.courseElement")},{value:"bpr.other",label:t("bpr.other")}]},Xle=({control:t,selectedActivities:e,selectActivities:r})=>{const n=Wle(),{t:i}=we();return g.jsx("div",{className:"col d-flex",children:g.jsx(l1,{name:"activityType",control:t,rules:{required:!0},render:({field:{onChange:s}})=>g.jsxs(xt,{block:!0,overflow:!0,children:[g.jsx(xt.Trigger,{size:"md",label:i("bpr.form.publication.type"),badgeContent:e==null?void 0:e.length}),g.jsx(xt.Menu,{children:n.map((o,a)=>g.jsx(xt.CheckboxItem,{value:o.value,model:e,onChange:()=>{r(o.value),s(o.value)},children:o.label},a))})]})})})},qle=t=>g.jsx(xt.Trigger,{...t,"aria-haspopup":"listbox",role:"combobox"}),Yle=qle,Qle=({icon:t,options:e,overflow:r,block:n,variant:i,size:s,disabled:o,placeholderOption:a,onValueChange:l})=>{const[u,c]=T.useState(),{t:h}=we();T.useEffect(()=>{if(u){const y=typeof u=="object"?u.value:u;l==null||l(y)}},[u]);const f=typeof u=="object"?u.label:u,m=typeof u=="object"?u.icon:void 0;return g.jsxs(xt,{overflow:r,block:n,children:[g.jsx(Yle,{icon:m||t,label:h(f||a),variant:i,size:s,disabled:o}),g.jsx(xt.Menu,{role:"listbox",children:e==null?void 0:e.map(y=>{const v=typeof y=="object"?y.value:y,x=typeof y=="object"?y.label:y,b=typeof y=="object"?y.icon:void 0;return g.jsx(xt.Item,{type:"action",onClick:()=>c(y),icon:b,children:x},v)})})]})},aA=Qle,Kle=["3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"],wk=({name:t,control:e,placeholderOption:r,validate:n})=>g.jsx(l1,{name:t,control:e,rules:{required:!0,validate:n},render:({field:{onChange:i}})=>g.jsx(aA,{block:!0,size:"md",onValueChange:i,options:Kle,"aria-required":!0,placeholderOption:r})}),Zle=()=>{const{t}=we();return[{value:"de_DE",label:t("de_DE")},{value:"en_EN",label:t("en_EN")},{value:"ar_DZ",label:t("ar_DZ")},{value:"es_ES",label:t("es_ES")},{value:"fr_FR",label:t("fr_FR")},{value:"it_IT",label:t("it_IT")},{value:"ja_JP",label:t("ja_JP")},{value:"zh_CN",label:t("zh_CN")},{value:"pt_PT",label:t("pt_PT")},{value:"ru_RU",label:t("ru_RU")},{value:"bpr.other",label:t("bpr.other")}]},Jle="bpr.form.publication.language",eue=({control:t})=>{const e=Zle();return g.jsx("div",{className:"col",children:g.jsx(l1,{name:"language",control:t,rules:{required:!0},render:({field:{onChange:r}})=>g.jsx(aA,{block:!0,size:"md",onValueChange:r,options:e,"aria-required":!0,placeholderOption:Jle})})})},tue=()=>{const{t}=we(),[e]=Pn();return g.jsxs(g.Fragment,{children:[g.jsxs("ul",{className:"mb-12",children:[g.jsxs("li",{children:[t("bpr.form.publication.licence.text.1"),g.jsx("img",{className:"ms-8 d-inline-block",src:`${e}/common/image-creative-commons.png`,alt:"licence creative commons"})]}),g.jsx("li",{children:t("bpr.form.publication.licence.text.2")})]}),g.jsx(Jo,{type:"info",className:"mb-12",children:t("bpr.form.publication.licence.text.3")}),g.jsx(Jo,{type:"warning",children:t("bpr.form.publication.licence.text.4")})]})},rue=()=>{const{t}=we();return[{value:"bpr.subjectArea.artActivity",label:t("bpr.subjectArea.artActivity")},{value:"bpr.subjectArea.readLearning",label:t("bpr.subjectArea.readLearning")},{value:"bpr.subjectArea.chemistry",label:t("bpr.subjectArea.chemistry")},{value:"bpr.subjectArea.law",label:t("bpr.subjectArea.law")},{value:"bpr.subjectArea.worldDiscovery",label:t("bpr.subjectArea.worldDiscovery")},{value:"bpr.subjectArea.economy",label:t("bpr.subjectArea.economy")},{value:"bpr.subjectArea.mediaEducation",label:t("bpr.subjectArea.mediaEducation")},{value:"bpr.subjectArea.musicEducation",label:t("bpr.subjectArea.musicEducation")},{value:"bpr.subjectArea.sportEducation",label:t("bpr.subjectArea.sportEducation")},{value:"bpr.subjectArea.citizenshipEducation",label:t("bpr.subjectArea.citizenshipEducation")},{value:"bpr.subjectArea.geography",label:t("bpr.subjectArea.geography")},{value:"bpr.subjectArea.history",label:t("bpr.subjectArea.history")},{value:"bpr.subjectArea.artHistory",label:t("bpr.subjectArea.artHistory")},{value:"bpr.subjectArea.ComputerScience",label:t("bpr.subjectArea.ComputerScience")},{value:"bpr.subjectArea.languages",label:t("bpr.subjectArea.languages")},{value:"bpr.subjectArea.italian",label:t("bpr.subjectArea.italian")},{value:"bpr.subjectArea.spanish",label:t("bpr.subjectArea.spanish")},{value:"bpr.subjectArea.french",label:t("bpr.subjectArea.french")},{value:"bpr.subjectArea.german",label:t("bpr.subjectArea.german")},{value:"bpr.subjectArea.english",label:t("bpr.subjectArea.english")},{value:"bpr.subjectArea.ancientLanguages",label:t("bpr.subjectArea.ancientLanguages")},{value:"bpr.subjectArea.literature",label:t("bpr.subjectArea.literature")},{value:"bpr.subjectArea.mathematics",label:t("bpr.subjectArea.mathematics")},{value:"bpr.subjectArea.vocationalGuidance",label:t("bpr.subjectArea.vocationalGuidance")},{value:"bpr.subjectArea.philosohppy",label:t("bpr.subjectArea.philosohppy")},{value:"bpr.subjectArea.physics",label:t("bpr.subjectArea.physics")},{value:"bpr.subjectArea.politicalSscience",label:t("bpr.subjectArea.politicalSscience")},{value:"bpr.subjectArea.sociology",label:t("bpr.subjectArea.sociology")},{value:"bpr.subjectArea.biology",label:t("bpr.subjectArea.biology")},{value:"bpr.subjectArea.geology",label:t("bpr.subjectArea.geology")},{value:"bpr.subjectArea.technology",label:t("bpr.subjectArea.technology")},{value:"bpr.subjectArea.Arabic",label:t("bpr.subjectArea.Arabic")},{value:"bpr.subjectArea.Chinese",label:t("bpr.subjectArea.Chinese")},{value:"bpr.subjectArea.NaturalSciences",label:t("bpr.subjectArea.NaturalSciences")},{value:"bpr.subjectArea.SocioEmotionalEducation",label:t("bpr.subjectArea.SocioEmotionalEducation")},{value:"bpr.other",label:t("bpr.other")}]},nue=({control:t,selectedSubjectAreas:e,selectSubjects:r})=>{const n=rue(),{t:i}=we();return g.jsx("div",{className:"col d-flex",children:g.jsx(l1,{name:"subjectArea",control:t,rules:{required:!0},render:({field:{onChange:s}})=>g.jsxs(xt,{block:!0,overflow:!0,children:[g.jsx(xt.Trigger,{size:"md",label:i("bpr.form.publication.discipline"),badgeContent:e==null?void 0:e.length}),g.jsx(xt.Menu,{children:n.map((o,a)=>g.jsx(xt.CheckboxItem,{value:o.value,model:e,onChange:()=>{r(o.value),s(o.value)},children:o.label},a))})]})})})},U6=T.createContext(null);function iue({defaultTheme:t,children:e}){var r;const{appCode:n}=yt(),i=SL({appCode:n});T.useEffect(()=>{var o,a,l,u,c,h,f,m,y,v,x;const b=document.getElementById("favicon");b.href=`${(a=(o=i==null?void 0:i.data)==null?void 0:o.theme)==null?void 0:a.basePath}/img/illustrations/favicon.ico`;const _=(c=(u=(l=i==null?void 0:i.data)==null?void 0:l.theme)==null?void 0:u.bootstrapVersion)==null?void 0:c.split("-"),w=_?_[_.length-1]:void 0;[{data:"data-skin",value:(f=(h=i==null?void 0:i.data)==null?void 0:h.theme)==null?void 0:f.skinName},{data:"data-theme",value:((y=(m=i==null?void 0:i.data)==null?void 0:m.theme)==null?void 0:y.npmTheme)??((x=(v=i==null?void 0:i.data)==null?void 0:v.theme)==null?void 0:x.themeName)},{data:"data-product",value:t==="none"?"":t??w}].forEach(E=>{var A;return(A=document.querySelector("html"))==null?void 0:A.setAttribute(E.data,E.value)})},[i==null?void 0:i.data,t]);const s=T.useMemo(()=>{var o;return{theme:(o=i==null?void 0:i.data)==null?void 0:o.theme}},[(r=i==null?void 0:i.data)==null?void 0:r.theme]);return g.jsx(U6.Provider,{value:s,children:e})}function ya(){const t=T.useContext(U6);if(!t)throw new Error("Cannot be used outside of OdeClientProvider");return t}const sue=T.forwardRef(({children:t},e)=>g.jsx("div",{ref:e,className:"actionbar",children:t})),oue=sue,aue=T.forwardRef(({children:t,render:e,isFullscreen:r=!1,...n},i)=>{const s=Me("d-flex flex-wrap p-16 gap-8 border-bottom bg-white",{"justify-content-between":e,"mx-n16":!r,"z-3 top-0 start-0 end-0":r});return g.jsxs("div",{ref:i,className:s,...n,children:[t,e?g.jsx("div",{className:"d-flex align-items-center ms-auto gap-8",children:e()}):null]})}),lue=aue,uue=T.forwardRef(({app:t,size:e="24",iconFit:r="contain",variant:n="square",className:i=""},s)=>{const{isIconUrl:o,getIconCode:a}=cA(),[,l]=Pn(),u=n==="square",c=n==="rounded",h=n==="circle",f=r==="contain",m=r==="ratio",y={"icon-xs":e==="24","icon-sm":e==="40","icon-md":e==="48","icon-lg":e==="80","icon-xl":e==="160"},v={square:u,rounded:c,"rounded-circle":h},x={"icon-contain":f,"icon-ratio":m},b=typeof t=="string"?t:(t==null?void 0:t.icon)!==void 0?t.icon:"placeholder",_=typeof t!="string"&&(t==null?void 0:t.displayName)!==void 0?t.displayName:"",w=t?a(t):"",E=o(b),A=w||"placeholder";if(E){const P=Me("h-full",i);return g.jsx(yo,{src:b,alt:_,objectFit:"contain",width:e,height:e,className:P,style:{minWidth:e+"px"}})}const I=Me("app-icon",{...y,...v,...x,[`bg-light-${A}`]:A&&!f,[`color-app-${A}`]:A},i);return g.jsx("div",{className:I,style:{width:e+"px",height:e+"px"},children:g.jsx("svg",{ref:s,width:e,height:e,role:"img",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:g.jsx("use",{xlinkHref:`${l}/apps.svg#${A}`})})})}),ga=uue,cue=T.createContext(null);function $6(){return T.useContext(cue)}class _k{static isLocalURL(e){return e.length>0&&e.charAt(0)==="/"}static startWithHttp(e){return/^https?:\/\//gi.test(e)}static toCounter(e){return e>999?`${Number(e/1e3).toFixed(1)} k`:""+e}}function due(t){const e=new Date().getTime(),r=t.includes("?")?"&":"?";return`${t}${r}timestamp=${e}`}const mf=(t,e)=>{const r="virtualID";if(!Object.hasOwnProperty.apply(t,[r])){const n=e??`${NB.generateVirtualId()}#${t.size}`;Object.defineProperty(t,r,{value:n,writable:!1})}return t[r]};function z6(t,e){if(e(t))return t;if(Array.isArray(t.children))for(const r of t.children){const n=z6(r,e);if(n)return n}}const Hy=(t,e)=>{const r=e==null?void 0:e.filter(n=>n.id===t&&n.available);return r&&r.length>0},H6={blog:"Blog",mindmap:"MindMap",scrapbook:"ScrapBook",collaborativewall:"CollaborativeWall",timelinegenerator:"TimelineGenerator",wiki:"Wiki",exercizer:"Exercizer"},hl=t=>{if(t>0){let e=Math.floor(t/1e3),r=Math.floor(e/60);return e=e%60,r=r%60,Sk(r)+":"+Sk(e)}return"00:00"},Sk=t=>t.toString().padStart(2,"0");function Qi(t,e){if(Array.isArray(t))for(const r of t){const n=Qi(r,e);if(n)return n}else{if(t.id===e)return t;if(t.children)for(const r of t.children){const n=Qi(r,e);if(n)return n}}}function hue(t,{parentId:e,newFolder:r}){return Rm(t,n=>{var i;if(n.id===e){const s=[...((i=n.folder)==null?void 0:i.ancestors)||[]],o=V6([...s,n.id]);return{...n,children:[...n.children||[],new lA({...r,ancestors:o})]}}else return n})}function V6(t){return t.filter((e,r)=>t.indexOf(e)===r)}function fue(t,{folders:e}){return Rm(t,r=>{if(!e.includes(r.id))return r})}const G6=(t,e)=>{if(t.children)for(const r of t.children){if(r.id===e)return t;const n=G6(r,e);if(n)return n}};function A2(t,e){var r;const n=Qi(t,e);return(r=n==null?void 0:n.folder)!=null&&r.ancestors?[...(n==null?void 0:n.folder.ancestors)||[],e]:e===Tr.BIN?[Tr.BIN]:[Tr.DEFAULT]}function Rm(t,e){return W6(t,e)||t}function W6(t,e,r){var n;const i=e(t,r);if((n=i==null?void 0:i.children)!=null&&n.length){const s=[];for(const o of(i==null?void 0:i.children)||[]){const a=W6(o,e,i);a&&s.push(a)}return{...i,children:s}}return i}function pue(t,{destinationId:e,folders:r}){return Rm(t,(n,i)=>{var s,o;if(e===n.id){const a=[...((s=n.folder)==null?void 0:s.ancestors)||[]],l=V6([...a,n.id]),u=[...n.children||[]],c=((o=n.children)==null?void 0:o.map(h=>h.id))||[];for(const h of r)if(!c.includes(h)){const f=Qi(n,h);f&&u.push({...f,folder:{...f==null?void 0:f.folder,ancestors:l}})}return{...n,children:u}}else return r.includes(n.id)&&e!==(i==null?void 0:i.id)?void 0:n})}const mue=(t,e,r)=>Rm(t,n=>(n.id===r&&(n.children=e==null?void 0:e.map(i=>new lA(i))),n));function gue(t,{folderId:e,newFolder:r}){return Rm(t,n=>n.id===e?new lA(r):n)}function vue(t,e){let r=[];function n(s,o){if(s.id===e)return r=o.concat(s.id),!0;if(s.children){for(const a of s.children)if(n(a,o.concat(s.id)))return!0}return!1}function i(s){if(Array.isArray(s)){for(const o of s)if(n(o,[]))break}else n(s,[])}return i(t),r}class lA{constructor(e){pf(this,"id"),pf(this,"name"),pf(this,"childNumber"),pf(this,"section",!1),pf(this,"children",[]),this.folder=e,this.id=e.id,this.name=e.name,this.childNumber=e.childNumber}}const yue=()=>MediaRecorder.isTypeSupported?["video/webm;codecs=vp9",'video/mp4; codecs="avc1.424028, mp4a.40.2"',"video/webm;codecs=vp8,opus","video/webm"].find(t=>MediaRecorder.isTypeSupported(t)?!0:(console.error(`${t} is not Supported`),!1))||"video/ogg":"video/webm;codecs=vp8,opus",X6=T.createContext({ariaLabelId:"",ariaDescriptionId:"",focusId:""}),q6=()=>{const t=T.useContext(X6);if(!t)throw new Error("Cannot be rendered outside the Modal component");return t},xue=t=>{const{ariaDescriptionId:e}=q6(),{children:r,className:n}=t,i=Me("modal-body",n);return g.jsx("div",{id:e,className:i,children:r})},bue=xue,wue=t=>g.jsx("div",{className:"modal-footer",children:t.children}),_ue=wue,Sue=t=>{const{onModalClose:e,children:r}=t,{ariaLabelId:n,focusId:i}=q6(),s=T.useRef(null),{t:o}=we();return T.useEffect(()=>{var a;i||(a=s.current)==null||a.focus()},[i]),g.jsxs("div",{className:"modal-header",children:[g.jsx("h2",{id:n,className:"modal-title",tabIndex:-1,children:r}),g.jsx(To,{ref:s,"aria-label":o("close"),color:"tertiary",icon:g.jsx(LT,{}),type:"button",variant:"ghost",title:o("close"),onClick:e,className:"btn-close"})]})},Eue=Sue,Tue=t=>g.jsx("p",{className:"modal-subtitle",children:t.children}),Cue=Tue,Aue=T.forwardRef((t,e)=>{const{id:r,isOpen:n,onModalClose:i,size:s="md",viewport:o=!1,scrollable:a=!1,focusId:l,children:u}=t,c=`aria_label_${r}`,h=`aria_desc_${r}`,f=F6(i),m=Hle();Ble(i,["Escape"]),T.useEffect(()=>{if(n&&(document.body.style.overflow="hidden",l)){const _=document.getElementById(l);_==null||_.focus()}return()=>{document.body.style.overflow=""}},[l,n]);const y=Me("modal fade",{"show d-block":n,"modal-scrollable":a,viewport:o,[`modal-${s}`]:s}),v=Me("modal-dialog"),x={ariaLabelId:c,ariaDescriptionId:h,focusId:l},b=jC(n,{from:{x:-50,opacity:0},enter:{x:0,opacity:1},leave:{x:50,opacity:0}});return g.jsx(X6.Provider,{value:x,children:b((_,w)=>g.jsxs(g.Fragment,{children:[w&&g.jsx(kl.div,{id:r,ref:e,role:"dialog","aria-modal":"true","aria-labelledby":c,"aria-describedby":h,className:y,style:_,tabIndex:-1,children:g.jsx("div",{id:`${r}_ref`,ref:E=>{f.current=E,w&&(m.current=E)},className:v,children:g.jsx("div",{className:"modal-content",children:u})})}),w&&g.jsx(kl.div,{className:"modal-backdrop fade show",style:{opacity:.65}})]}))})}),Rue=Object.assign(Aue,{Header:Eue,Subtitle:Cue,Body:bue,Footer:_ue}),Ye=Rue,Pue=({children:t,message:e,icon:r=null,placement:n="auto",...i})=>{const[s,o]=T.useState(null),[a,l]=T.useState(null),[u,c]=T.useState(null),{styles:h,attributes:f}=JW(s,a,{placement:n,modifiers:[{name:"arrow",options:{element:u}}]}),[m,y]=T.useState(!1);return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"d-inline-block position-relative z-2",ref:o,onMouseEnter:()=>{y(!0)},onMouseLeave:()=>{y(!1)},...i,children:t}),m&&e&&g.jsxs("div",{className:Me("tooltip d-block show mb-12","bs-tooltip-auto"),ref:l,style:h.popper,...f.popper,children:[g.jsxs("div",{className:"tooltip-inner shadow-hover d-flex gap-8 align-items-center",children:[r&&r,g.jsx("div",{children:e})]}),g.jsx("div",{className:"tooltip-arrow",ref:c,style:h.arrow})]})]})},co=Pue,Y6=T.createContext(null);function uA(){const t=T.useContext(Y6);if(!t)throw new Error("Tabs compound components cannot be rendered outside the Tabs component");return t}const Iue=({icon:t,label:e,id:r,order:n})=>{const{activeTab:i,setSelectedTab:s,onKeyDown:o,tabsRef:a}=uA(),{t:l}=we(),u=Me("nav-link d-inline-flex gap-8 border-0",i===r?"selected":"");return g.jsx("li",{className:"nav-item flex-shrink-0",role:"presentation",children:g.jsxs("button",{ref:c=>a.current[n]=c,type:"button",id:`tab-${r}`,className:u,onClick:()=>s(r),onKeyDown:c=>o(c),role:"tab","aria-controls":`tabpanel-${r}`,"aria-selected":i===r,tabIndex:i===r?0:-1,children:[t,g.jsx("small",{children:l(e)})]})})},Mue=Iue,kue=t=>{const{items:e,tabUnderlineLeft:r,tabUnderlineWidth:n}=uA(),{className:i,...s}=t,o=Me("position-relative flex-shrink-0 overflow-x-auto",i);return g.jsxs("div",{className:o,...s,children:[g.jsx("ul",{className:"nav nav-tabs flex-nowrap",role:"tablist",children:e.map((a,l)=>g.jsx(gv.Item,{order:l,...a},a.id))}),g.jsx("span",{className:"nav-slide",style:{left:r,width:n}})]})},Oue=kue,Due=({children:t,currentItem:e})=>{const{activeTab:r}=uA();return g.jsx("div",{className:"tab-content d-flex flex-fill w-100",children:g.jsx("div",{className:`tab-pane flex-fill w-100 fade ${r===(e==null?void 0:e.id)?"show active":""}`,id:`tabpanel-${e==null?void 0:e.id}`,role:"tabpanel","aria-labelledby":`tab-${e==null?void 0:e.id}`,tabIndex:0,children:t})})},Nue=Due,lh=({defaultId:t,items:e,onChange:r,children:n})=>{const[i,s]=T.useState(t||""),[o,a]=T.useState(0),[l,u]=T.useState(0),c=T.useRef([]),h=T.useCallback(b=>{s(b)},[]);T.useEffect(()=>{const b=e.find(_=>_.id===i);b&&(r==null||r(b))},[i]),T.useEffect(()=>{function b(){var _;if(((_=document==null?void 0:document.activeElement)==null?void 0:_.tagName)!=="INPUT"){const w=e.findIndex(A=>A.id===i);w===-1&&t&&s(t);const E=c.current[w];E&&(E.focus(),u((E==null?void 0:E.offsetLeft)??0),a((E==null?void 0:E.clientWidth)??0))}}return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[i,e,t]);const f=T.useCallback(b=>{var _,w,E;const A=e.findIndex(I=>I.id===b);b===((_=e[0])==null?void 0:_.id)?s((w=e[e.length-1])==null?void 0:w.id):s((E=e[A-1])==null?void 0:E.id)},[e]),m=T.useCallback(b=>{var _,w,E;const A=e.findIndex(I=>I.id===b);b===((_=e[e.length-1])==null?void 0:_.id)?s((w=e[0])==null?void 0:w.id):s((E=e[A+1])==null?void 0:E.id)},[e]),y=T.useCallback(b=>{var _,w;switch(b.code){case"ArrowLeft":f(i);break;case"ArrowRight":m(i);break;case"Home":s((_=e[0])==null?void 0:_.id);break;case"End":s((w=e[e.length-1])==null?void 0:w.id);break}},[i,e,m,f]),v=T.useMemo(()=>({activeTab:i,items:e,setSelectedTab:h,tabsRef:c,tabUnderlineLeft:l,tabUnderlineWidth:o,onKeyDown:y}),[i,e,y,h,l,o]),x=e.find(b=>b.id===i);return g.jsx(Y6.Provider,{value:v,children:typeof n=="function"?n(x):g.jsxs(g.Fragment,{children:[g.jsx(lh.List,{}),g.jsx(lh.Panel,{currentItem:x,children:x==null?void 0:x.content})]})})};lh.Item=Mue;lh.Panel=Nue;lh.List=Oue;const gv=lh,Lue=T.forwardRef(({children:t,className:e,...r},n)=>{const i=Me("breadcrumb-item",e);return g.jsx("li",{ref:n,className:i,...r,children:t})}),I0=Lue,Fue=T.forwardRef(({children:t,className:e},r)=>{const n=Me("breadcrumb d-flex flex-nowrap align-items-center mb-0",e);return g.jsx("ol",{ref:r,className:n,children:t})}),jue=Fue;function cA(){const t={"last-infos-widget":"ic-widget-actualites",birthday:"ic-star","calendar-widget":"ic-widget-calendar","carnet-de-bord":"ic-widget-carnet-de-bord","record-me":"ic-widget-microphone",mood:"ic-star","my-apps":"ic-widget-apps",notes:"ic-widget-notes","rss-widget":"ic-widget-rss","bookmark-widget":"ic-widget-signets",qwant:"ic-widget-qwant","qwant-junior":"ic-widget-qwant","agenda-widget":"ic-widget-agenda","cursus-widget":"ic-widget-aide-devoirs","maxicours-widget":"ic-widget-maxicours","school-widget":"ic-widget-schoolbook","universalis-widget":"ic-widget-universalis","briefme-widget":"ic-widget-briefme"};function e(a){let l="";switch(typeof a=="string"?l=a:l=(a==null?void 0:a.icon)!==void 0?a==null?void 0:a.icon.trim().toLowerCase():"placeholder",l&&l.length>0?l.endsWith("-large")&&(l=l.replace("-large","")):typeof a=="object"&&(l=(a==null?void 0:a.displayName)!==void 0?a==null?void 0:a.displayName.trim().toLowerCase():""),l){case"admin.title":l="admin";break;case"banques des savoirs":l="banquesavoir";break;case"collaborativewall":l="collaborative-wall";break;case"communautés":l="community";break;case"directory.user":l="userbook";break;case"emploi du temps":l="edt";break;case"formulaire":l="forms";break;case"messagerie":l="conversation";break;case"news":l="actualites";break;case"homeworks":case"cahier de texte":l="cahier-de-texte";break;case"diary":case"cahier de texte 2d":l="cahier-textes";break}return l}function r(a){return a&&(a.startsWith("/")||a.startsWith("http://")||a.startsWith("https://"))}function n(a){const l=e(a);return l?`color-app-${l}`:"color-app-placeholder"}function i(a){const l=e(a);return l?`bg-app-${l}`:"bg-app-placeholder"}function s(a){const l=e(a);return l?`bg-light-${l}`:"bg-light-placeholder"}function o(a){return t[a.platformConf.name]}return{getIconClass:n,getBackgroundIconClass:i,getBackgroundLightIconClass:s,getIconCode:e,getWidgetIconClass:o,isIconUrl:r}}const Bue=T.forwardRef(({children:t,app:e,className:r},n)=>{const{t:i}=we(),{getIconClass:s}=cA(),o=Me("d-flex align-items-center mb-0",s(e),r),a={"--edifice-breadcrumb-divider":"-"};return g.jsx("nav",{ref:n,className:o,"aria-label":i("breadcrumb"),style:a,children:t})}),Uue=Bue,$ue=T.forwardRef(({app:t,name:e},r)=>{const{t:n}=we();return g.jsx(Uue,{app:t,ref:r,className:"mw-100",children:g.jsx(jue,{className:"gap-12 mw-100",children:e?g.jsxs(g.Fragment,{children:[g.jsx(I0,{children:g.jsx("a",{href:t==null?void 0:t.address,className:"d-flex","aria-label":n(t==null?void 0:t.displayName),children:g.jsx(ga,{app:t,size:"40"})})}),g.jsx(I0,{children:g.jsx(UN,{color:"var(--edifice-gray-600)",width:20,height:20})}),g.jsx(I0,{className:"text-truncate",children:g.jsx(Ss,{level:"h1",headingStyle:"h3",className:"text-truncate",children:e})})]}):g.jsxs(I0,{className:"gap-12 d-flex align-items-center",children:[g.jsx("a",{href:t==null?void 0:t.address,className:"d-flex","aria-label":n(t==null?void 0:t.displayName),children:g.jsx(ga,{app:t,size:"40"})}),g.jsx(Ss,{level:"h1",headingStyle:"h3",className:"d-none d-md-flex",children:n(t==null?void 0:t.displayName)})]})})})}),zue=$ue,Hue=({children:t,space:e=null,flexDirection:r="row"})=>{const n=Me("card-body",{[`p-${e}`]:e,[`gap-${e}`]:e,"align-items-start":r==="column","flex-column":r==="column"});return g.jsx("div",{className:n,children:t})},Vue=Hue,Q6=T.createContext(null),K6=()=>{const t=T.useContext(Q6);if(!t)throw new Error("Cannot be rendered outside the Card component");return t},Gue=({children:t})=>g.jsx("div",{className:"card-footer gap-16",children:t}),Wue=Gue,Xue=()=>{const{isSelectable:t,isClickable:e,onClick:r,onSelect:n}=K6(),{t:i}=we();return t||e?g.jsxs("div",{className:"card-header",children:[t?g.jsx(To,{"aria-label":i("card.open.menu"),className:"z-3 bg-white",color:"secondary",icon:g.jsx(az,{}),onClick:n,variant:"ghost"}):null,e?g.jsx("button",{type:"button",onClick:r,className:"position-absolute bottom-0 end-0 top-0 start-0 opacity-0 z-1 w-100","aria-label":i("card.open.resource")}):null]}):null},que=Xue,Yue=({imageSrc:t,className:e,variant:r="medium"})=>{const{app:n}=K6(),i=r==="landscape"?{width:"100%",height:"auto"}:null;return g.jsx("div",{className:Me("card-image",r),children:t?g.jsx(yo,{alt:"",src:t,objectFit:"cover",className:Me("h-full w-100",e)}):g.jsx(ga,{app:n,iconFit:"ratio",size:"80",variant:"rounded",...i})})},Que=Yue,Kue=({children:t,className:e})=>{const r=Me("card-text small text-break text-truncate text-truncate-1",e);return g.jsx("p",{className:r,children:t})},Zue=Kue,Jue=({children:t,className:e})=>{const r=Me("card-title body text-break text-truncate text-truncate-2",e);return g.jsx("h3",{className:r,children:g.jsx("strong",{children:t})})},ece=Jue,tce=({userSrc:t,creatorName:e})=>t?g.jsx(ec,{alt:e||"",size:"xs",src:t,variant:"circle",width:"24",height:"24"}):g.jsx(iC,{}),rce=tce,nce=T.forwardRef(({app:t,isSelectable:e=!0,isClickable:r=!0,isSelected:n=!1,isFocused:i=!1,onClick:s,onSelect:o,children:a,className:l},u)=>{const{getIconCode:c}=cA(),h=t?c(t):"placeholder",f=T.useMemo(()=>({app:t,appCode:h,isSelectable:e,isClickable:r,onClick:s,onSelect:o}),[t,h,e,r,s,o]);return g.jsx(Q6.Provider,{value:f,children:g.jsxs("div",{ref:u,className:Me("card",{"drag-focus":i,"is-selected":n,"c-pointer":r},l),children:[g.jsx(Z6.Header,{}),typeof a=="function"?a(h):a]})})}),Z6=Object.assign(nce,{Title:ece,Text:Zue,Image:Que,Body:Vue,User:rce,Footer:Wue,Header:que}),tr=Z6,J6=T.createContext(null),Z1=()=>{const t=T.useContext(J6);if(!t)throw new Error("Cannot be rendered outside the FormControl component");return t},ice=({children:t})=>{const{status:e}=Z1(),r=Me("form-text",{"is-invalid":e==="invalid",valid:e==="valid"});return g.jsx("p",{className:r,children:g.jsx("em",{children:t})})},sce=ice,oce=T.forwardRef(({noValidationIcon:t,placeholder:e,size:r="md",type:n="text",className:i,...s},o)=>{const{id:a,isRequired:l,isReadOnly:u,status:c}=Z1(),h=Me({"form-control":!u,"form-control-lg":r==="lg","form-control-sm":r==="sm","is-invalid":c==="invalid","is-valid":c==="valid","form-control-plaintext":u,"no-validation-icon":t},i);return g.jsx("input",{ref:o,id:a,className:h,type:n,placeholder:e,required:l,readOnly:u,...s})}),Zn=oce,ace=T.forwardRef(({leftIcon:t,optionalText:e,requiredText:r="*",children:n,className:i},s)=>{const{id:o,isOptional:a,isRequired:l}=Z1(),{t:u}=we(),c=Me("form-label",{"has-icon":t},i),h=a&&!l,f=l&&!a;return T.useEffect(()=>{if(a&&l)throw new Error("Cannot be optional and required at the same time")},[a,l]),g.jsxs("label",{ref:s,htmlFor:o,className:c,children:[t,n,h&&g.jsxs("em",{className:"optional",children:["- ",e??u("explorer.optional")]}),f&&g.jsx("em",{className:"required",children:r})]})}),Vi=ace,lce=T.forwardRef(({children:t,className:e,id:r,isOptional:n,isReadOnly:i,isRequired:s,status:o,...a},l)=>{const u=T.useMemo(()=>({id:r,isOptional:n,isRequired:s,isReadOnly:i,status:o}),[r,n,i,s,o]);return g.jsx(J6.Provider,{value:u,children:g.jsx("div",{ref:l,className:e,...a,children:t})})}),uce=Object.assign(lce,{Label:Vi,Input:Zn,Text:sce}),Ot=uce,cce=({placeholder:t,value:e="",searchMinLength:r=3,handleSearchInputChange:n})=>{const{triggerProps:i,itemProps:s,setVisible:o}=wh(),a={...i,role:"combobox",onClick:()=>{e.length>=r&&o(!0)},onChange:n};return T.useEffect(()=>{o(e.length>=r)},[o,e,r]),g.jsx(Ot,{className:"d-flex align-items-center",id:"search",children:g.jsx(Zn,{...a,className:"max-w-512",noValidationIcon:!0,placeholder:t,size:"md",type:"search",onKeyDown:s.onMenuItemKeyDown})})},dce=cce,dA=({onSearchResultsChange:t,onSearchInputChange:e,options:r,value:n,isLoading:i,noResult:s,searchMinLength:o,placeholder:a})=>{const{t:l}=we(),[u,c]=T.useState([]);T.useEffect(()=>{t(u)},[u]);const h=m=>{c([m])},f=()=>i?g.jsxs("div",{className:"d-flex align-items-center p-4",children:[g.jsx(YT,{isLoading:i}),g.jsx("span",{className:"ps-4",children:l("explorer.search.pending")})]}):s?g.jsx("div",{className:"p-4",children:l("portal.no.result")}):r.map((m,y)=>g.jsxs(T.Fragment,{children:[g.jsx(xt.Item,{type:"select",icon:m.icon,onClick:()=>h(m.value),children:m.label}),y<r.length-1&&g.jsx(xt.Separator,{})]},y));return g.jsxs(xt,{block:!0,children:[g.jsx(dA.Trigger,{placeholder:a,searchMinLength:o,handleSearchInputChange:e,value:n}),g.jsx(xt.Menu,{children:f()})]})};dA.Trigger=dce;const hce=dA,e8=T.createContext(null);function hA(){const t=T.useContext(e8);if(!t)throw new Error("Cannot be rendered outside Dropzone Provider");return t}const fce=()=>{const{t}=we();return g.jsx("div",{className:"drop-wrapper",children:g.jsx("div",{className:"drop-content",children:g.jsx("p",{className:"drop-text",children:t("dropzone.drop")})})})},pce=fce,t8=T.createContext(null);function Io(){const t=T.useContext(t8);if(!t)throw new Error("Innertabs compound components cannot be rendered outside the MediaLibrary component");return t}const mce=({children:t})=>{const{t:e}=we(),{files:r,inputRef:n}=hA(),{multiple:i}=Io(),s=r&&r.length>0,o=Me("drop-file-wrapper",{"d-block":s,"d-none":!s});return g.jsxs("div",{className:o,children:[g.jsx("div",{className:"drop-file-content",children:g.jsx("div",{className:"add-button p-4",children:g.jsx(it,{variant:"ghost",leftIcon:g.jsx(c1,{}),disabled:!i,onClick:()=>{var a;return(a=n==null?void 0:n.current)==null?void 0:a.click()},children:e("dropzone.add.more")})})}),g.jsx("div",{className:"p-8",children:t})]})},gce=mce,vce=()=>{const{t}=we(),{files:e,inputRef:r}=hA(),n=e&&e.length>0,i=Me("import-wrapper",{"d-flex":!n,"d-none":n});return g.jsxs("div",{className:i,children:[g.jsx(G$,{height:48,width:48}),g.jsx("p",{className:"my-16",children:t("dropzone.text")}),g.jsx(it,{onClick:()=>{var s;return(s=r==null?void 0:r.current)==null?void 0:s.click()},children:t("dropzone.import")})]})},yce=vce,Vu=({className:t,accept:e,multiple:r=!0,handle:n=!1,children:i})=>{const{inputRef:s,dragging:o,files:a,addFile:l,deleteFile:u,replaceFileAt:c,handleDragLeave:h,handleDragging:f,handleDrop:m,handleOnChange:y}=jle(e?{forceFilters:!0}:void 0),v=Me("dropzone",{"is-dragging":(r||a.length<1)&&o,"is-drop-files":!(a.length!==0&&!n)},t),x=T.useMemo(()=>({inputRef:s,files:a,addFile:l,deleteFile:u,replaceFileAt:c}),[l,u,c,a,s]);return g.jsx(e8.Provider,{value:x,children:g.jsxs("div",{className:v,onDragEnter:f,onDragOver:f,onDragLeave:h,onDrop:a.length>0&&!r?void 0:m,children:[g.jsxs("div",{className:"align-center",children:[n?null:g.jsxs(g.Fragment,{children:[g.jsx(Vu.File,{children:i}),g.jsx(Vu.Import,{})]}),g.jsx(Vu.Drag,{})]}),g.jsx("input",{ref:s,accept:e==null?void 0:e.join(","),multiple:r,type:"file",name:"attachment-input",id:"attachment-input",onChange:y,hidden:!0})]})})};Vu.File=gce;Vu.Import=yce;Vu.Drag=pce;const xce=Vu;function bce(t,e){const[r,n]=T.useState(null),{ref:i,inView:s}=Qie({triggerOnce:!0,...e==null?void 0:e.intersectionOptions});return T.useEffect(()=>{var o;(o=e==null?void 0:e.ref)!=null&&o.current&&(i==null||i(e.ref.current))},[e==null?void 0:e.ref,i]),T.useEffect(()=>{if((e==null?void 0:e.ref)===void 0||s){const o=new Image;return o.src=t,o.onload=()=>{n(!0)},o.onerror=()=>{n(!1)},()=>{o.onload=null,o.onerror=null,n(null)}}},[s]),r}const wce=({type:t,roleMap:e})=>{const r=typeof(e==null?void 0:e.icon)!="string"&&t!=="unknown",n=Me("position-absolute top-50 start-50 translate-middle",{"p-12 rounded-circle shadow":r},e==null?void 0:e.color);return g.jsx("div",{className:n,children:(e==null?void 0:e.icon)??g.jsx(uz,{})})},_ce=wce,Sce=({doc:t,isClickable:e=!0,isSelectable:r=!1,isSelected:n=!1,onClick:i,className:s})=>{var o;const a=T.useRef(null),l=zk.getRole(t);function u(y){const v={csv:{icon:".CSV",color:"bg-orange-200"},xls:{icon:".XLS",color:"bg-green-200"},doc:{icon:".DOC",color:"bg-blue-200"},txt:{icon:".TXT",color:"bg-blue-200"},pdf:{icon:".PDF",color:"bg-red-200"},audio:{icon:g.jsx(u1,{width:22,height:22}),color:"bg-red-200"},ppt:{icon:".PPT",color:"bg-yellow-200"},img:{icon:g.jsx(nz,{width:22,height:22}),color:"bg-green-200"},video:{icon:g.jsx(Vz,{width:22,height:22}),color:"bg-purple-200"},zip:{icon:".ZIP",color:"bg-gray-300"},md:{icon:".MD",color:"bg-blue-200"},unknown:{icon:g.jsx(Bz,{width:22,height:22}),color:"bg-gray-300"}};return v[y]||v.unknown}const c=Me("file position-relative rounded",((o=u(l??"default"))==null?void 0:o.color)??"bg-yellow-200"),h=l==="img"||l==="video"?Ie.workspace().getThumbnailUrl(t):null,f=bce(h,{ref:a}),m=f&&{backgroundImage:`url(${h})`,backgroundSize:"cover"};return g.jsx(tr,{className:Me("card-file",s),isClickable:e,isSelectable:r,isSelected:n,onClick:i,children:g.jsxs(tr.Body,{space:"8",children:[g.jsx("div",{ref:a,className:c,style:{aspectRatio:"16/10",...m},children:l!=="img"||l==="img"&&!f?g.jsx(_ce,{type:l,roleMap:u(l)}):null}),g.jsxs("div",{className:"mt-4",children:[g.jsx(tr.Text,{children:t.name}),g.jsx(tr.Text,{className:"text-black-50",children:t==null?void 0:t.ownerName})]})]})})},Ece=Sce,io=({children:t,className:e,...r})=>{const n=Me("grid",e);return g.jsx("div",{className:n,...r,children:t})},Tce=({sm:t,md:e,lg:r,xl:n,children:i,className:s,as:o,...a})=>{const l=o||"div",u=Me({[`g-col-${t}`]:t,[e?`g-col-md-${e}`:""]:e,[r?`g-col-lg-${r}`:""]:r,[n?`g-col-xl-${n}`:""]:n},s);return g.jsx(l,{className:u,...a,children:i})};io.Col=Tce;const Cce=T.forwardRef(({position:t=!0,caption:e},r)=>{const[n]=Pn(),i=`${n}/loading/screen-loading.gif`,s=Me("top-0 end-0 start-0 bottom-0 d-grid justify-content-center align-content-center align-items-center z-2000",{"position-fixed":!t,"position-static":t}),o=Me("text-center pt-12",{"text-white":!t});return g.jsxs(g.Fragment,{children:[g.jsxs("div",{ref:r,className:s,children:[g.jsx("div",{className:"bg-white rounded-circle mx-auto w-25",children:g.jsx("img",{src:i,alt:"loading"})}),e&&g.jsx("div",{className:o,children:e})]}),!t&&g.jsx("div",{className:"modal-backdrop fade show"})]})}),pr=Cce,Ace=T.forwardRef(({src:t,is1d:e,translate:r="Retour accueil"},n)=>{const i=Me("navbar-brand d-none d-md-block");return g.jsx("a",{ref:n,className:i,href:"/timeline/timeline","aria-label":r,children:g.jsx("img",{className:"logo",src:t,alt:`logo ${e?"ONE":"NEO"}`,width:"300",height:"52"})})}),Ek=Ace,Rce=({children:t,className:e})=>{const r=Me("popover-body",e);return g.jsx("div",{className:r,children:t})},Pce=({children:t,className:e})=>{const r=Me("popover-footer p-8",e);return g.jsx("div",{className:r,children:t})},r8=T.forwardRef(({children:t,className:e,id:r,isVisible:n,...i},s)=>{const o=Me("popover d-block position-absolute top-100 start-50 translate-middle-x",e);return jC(n,{from:{opacity:0},enter:{opacity:1},leave:{opacity:0},config:{duration:0}})((a,l)=>l&&g.jsx(kl.div,{ref:s,"aria-labelledby":r,className:o,role:"tooltip",style:a,...i,children:t}))}),Ice=({isVariant:t=!1,size:e="md",placeholder:r="search",className:n,disabled:i,onChange:s,onClick:o,...a})=>{const{t:l}=we(),u=Me(n,{"input-group":!t,"position-relative":t}),c=Me({"border-end-0":!t,"ps-48":t}),h=()=>{o==null||o()};return g.jsxs(Ot,{id:"search-bar",className:u,children:[t&&g.jsx("div",{className:"position-absolute z-1 top-50 start-0 translate-middle-y border-0 ps-12 bg-transparent",children:g.jsx(RS,{})}),g.jsx(Ot.Input,{type:"search",placeholder:l(r),size:e,noValidationIcon:!0,className:c,onChange:s,disabled:i,...a}),!t&&g.jsx(oA,{type:"submit","aria-label":l("search"),icon:g.jsx(RS,{}),className:"border-start-0",onClick:h})]})},n8=Ice,Mce=T.forwardRef(({noValidationIcon:t,placeholder:e,size:r="md",height:n="md",className:i,...s},o)=>{const{id:a,isRequired:l,isReadOnly:u,status:c}=Z1(),h=Me({"form-control":!u,"form-control-lg":r==="lg","form-control-sm":r==="sm","textarea-height-lg":n==="lg","textarea-height-md":n==="md","textarea-height-sm":n==="sm","is-invalid":c==="invalid","is-valid":c==="valid","form-control-plaintext":u,"no-validation-icon":t},i);return g.jsx(g.Fragment,{children:g.jsx("textarea",{ref:o,id:a,className:h,placeholder:e,required:l,readOnly:u,...s})})}),fA=Mce,pA=T.forwardRef(({items:t,variant:e="default",align:r="space",isBlock:n=!1,ariaControls:i,className:s},o)=>{const[a,l]=T.useState(0),[u,c]=T.useState([]),[h,f]=T.useState(),[m,y]=T.useState(),v=T.useRef(),x=Me("toolbar z-1000 bg-white",s,{default:e==="default","no-shadow":e==="no-shadow","d-flex":n,"d-inline-flex":!n,"overflow-x-auto":n,"justify-content-start":r==="left","justify-content-between":r==="space","justify-content-center":r==="center","justify-content-end":r==="right"});T.useEffect(()=>{var I;const P=(I=v.current)==null?void 0:I.querySelectorAll("button"),M=[];let N=!1;P==null||P.forEach(z=>{z.disabled||(N||(f(z),N=!0),y(z),M.push(z))}),c(M),l(t.findIndex(z=>(z.type==="button"||z.type==="icon")&&!z.props.disabled))},[t]);const b=I=>{I.target.classList.add("focus")},_=I=>{I.target.classList.remove("focus")},w=I=>{var P,M;const N=u.indexOf(I.currentTarget);switch(I.code){case"ArrowLeft":I.currentTarget===h?m==null||m.focus():(P=u[N-1])==null||P.focus();break;case"ArrowRight":I.currentTarget===m?h==null||h.focus():(M=u[N+1])==null||M.focus();break}},E=I=>{var P;return typeof I.tooltip=="string"?I.tooltip:(P=I.tooltip)==null?void 0:P.message},A=I=>{var P;return typeof I.tooltip!="string"?(P=I.tooltip)==null?void 0:P.position:"top"};return g.jsx("div",{ref:C2(o,v),className:x,role:"toolbar","aria-label":"Text Formatting","aria-controls":i,onFocus:b,onBlur:_,children:t.map((I,P)=>{if(I.visibility==="hide")return null;switch(I.type){case"divider":return g.jsx("div",{className:"toolbar-divider"},I.name??P);case"button":return g.jsx(co,{message:E(I),placement:A(I),children:T.createElement(it,{...I.props,key:I.name??P,color:I.props.color?I.props.color:"tertiary",variant:"ghost",tabIndex:P===a?0:-1,onKeyDown:w})},I.name??P);case"icon":return g.jsx(co,{message:E(I),placement:A(I),children:T.createElement(To,{...I.props,key:I.name??P,color:I.props.color?I.props.color:"tertiary",variant:I.props.variant?I.props.variant:"ghost",tabIndex:P===a?0:-1,onKeyDown:w})},I.name??P);case"dropdown":return T.createElement(xt,{...I.props,key:I.name??P,extraTriggerKeyDownHandler:w,overflow:I.overflow});case"primary":return g.jsx(co,{message:E(I),placement:A(I),children:g.jsx(it,{...I.props,variant:"filled",color:"primary",tabIndex:P===a?0:-1,onKeyDown:w})},I.name??P)}return null})})}),R2=({node:t,showIcon:e,selectedNodeId:r,expandedNodes:n,siblingsNodes:i,draggedNodeId:s,handleItemClick:o,handleToggleNode:a,handleItemAction:l})=>{const u=n.has(t.id),c=i==null?void 0:i.current.has(t.id),h=r===t.id,f=s===t.id,m={action:Me("action-container d-flex align-items-center gap-8 px-2",{"drag-focus":f,"py-4":!t.section}),arrow:Me({"py-4":!t.section,"py-8":t.section,invisible:!Array.isArray(t.children)||t.children.length===0}),button:Me("flex-fill d-flex align-items-center text-truncate gap-8",{"py-8":t.section})},y=t.section?16:12,{t:v}=we(),{setNodeRef:x}=Hj({id:T.useId(),data:{id:t.id,name:t.name,isTreeview:!0,accepts:["folder","resource"]}}),b=M=>o==null?void 0:o(M),_=M=>a==null?void 0:a(M),w=M=>l==null?void 0:l(M),E=M=>{(M.code==="Enter"||M.code==="Space")&&(M.preventDefault(),M.stopPropagation(),o==null||o(t.id))},A=M=>{(M.code==="Enter"||M.code==="Space")&&(M.preventDefault(),M.stopPropagation(),a==null||a(t.id))},I=M=>g.jsx(M?Cp:UN,{title:v("foldUnfold"),width:y,height:y}),P=()=>{var M;const N=!((M=i==null?void 0:i.current)!=null&&M.has(t.id)),z=Array.isArray(t.children)&&t.children.length>0;return c||N&&z};return g.jsx("li",{ref:x,id:`treeitem-${t.id}`,role:"treeitem","aria-selected":h&&h,"aria-expanded":u&&u,children:g.jsxs("div",{children:[g.jsxs("div",{className:m.action,children:[g.jsx("div",{className:m.arrow,tabIndex:0,role:"button",onClick:()=>_(t.id),onKeyDown:A,"aria-label":v("foldUnfold"),children:P()&&I(u)}),g.jsxs("div",{tabIndex:0,role:"button",className:m.button,onClick:()=>b(t.id),onKeyDown:E,children:[t.section&&e&&g.jsx(LN,{title:v("folder"),width:20,height:20}),g.jsx("span",{className:"text-truncate",children:t.name})]}),t.section&&l&&g.jsx("button",{className:"tree-btn mx-8",onClick:()=>w(t.id),children:g.jsx(c1,{height:16,width:16})})]}),Array.isArray(t.children)&&!!t.children.length&&u&&g.jsx("ul",{role:"group",children:t.children.map(M=>g.jsx(R2,{node:M,selectedNodeId:r,expandedNodes:n,siblingsNodes:i,draggedNodeId:s,handleItemClick:o,handleToggleNode:a},M.id))})]})},t.id)},kce=({data:t,ref:e,externalSelectedNodeId:r,draggedNode:n,allExpandedNodes:i,onTreeItemUnfold:s,onTreeItemFold:o,onTreeItemClick:a})=>{const[l,u]=T.useState(void 0),[c,h]=T.useState(new Set),f=T.useRef(new Set),[m,y]=T.useState(void 0),v=l??r;function x(j){var H;Array.isArray(j)?j.forEach(F=>{const L=new Set(f.current);j.filter(({id:O})=>O!==F.id).some(O=>O.children&&O.children.length>0)&&L.add(F.id),F.children&&F.children.length>0&&F.children.forEach(O=>{var U;const V=(U=F.children)==null?void 0:U.filter(({id:k})=>k!==O.id);V!=null&&V.some(k=>k.children&&k.children.length>0)&&L.add(O.id),x(O)})}):(H=j.children)==null||H.forEach(F=>{var L;const O=new Set(f.current),U=(L=j.children)==null?void 0:L.filter(V=>V.id!==F.id);U!=null&&U.some(V=>V.children&&V.children.length>0)&&(O.add(F.id),f.current=O),x(F)})}const b=j=>{const H=new Set("");t&&Array.isArray(t)&&j&&(t.forEach(F=>{H.add(F.id)}),h(H))};T.useEffect(()=>{t&&x(t)},[t]),T.useEffect(()=>{n!=null&&n.isOver&&n.isTreeview?(n.overId&&z(n.overId),y(n.overId)):y(void 0)},[n]);const _=T.useMemo(()=>({unselectAll(){u(void 0)},select(j){M(j)},allExpandedNodes(){b(i)}}),[]);T.useImperativeHandle(e,()=>_,[_]),T.useEffect(()=>{b(i)},[]),T.useEffect(()=>{r&&!i?(w(r),u(r)):u(void 0)},[r]);const w=j=>{if(!Qi(t,v)){u(void 0);return}if(r==="default"){c.forEach(H=>s==null?void 0:s(H));return}E(j)},E=j=>{const H=new Set(c),F=vue(t,j),L=Array.from(H);F.forEach(O=>{const U=L.indexOf(O);U>-1&&L.splice(U,1),L.push(O)}),H.clear(),L.forEach(O=>H.add(O)),H.forEach(O=>s==null?void 0:s(O)),h(H)},A=j=>{const H=new Set(c);H.delete(j),H.forEach(F=>o==null?void 0:o(F)),h(H)},I=j=>{c.has(j)?A(j):E(j)},P=j=>{v!==j&&u(j)},M=j=>{P(j),E(j),a==null||a(j)},N=j=>{I(j)},z=j=>{Qi(t,r)&&E(j)};return{selectedNodeId:v,expandedNodes:c,siblingsNodes:f,draggedNodeId:m,handleItemClick:M,handleFoldUnfold:N}},Oce=T.forwardRef((t,e)=>{const{data:r,onTreeItemClick:n,onTreeItemUnfold:i,onTreeItemFold:s,onTreeItemAction:o,draggedNode:a,showIcon:l=!0,allExpandedNodes:u=!1,selectedNodeId:c}=t,{selectedNodeId:h,expandedNodes:f,siblingsNodes:m,draggedNodeId:y,handleItemClick:v,handleFoldUnfold:x}=kce({data:r,ref:e,externalSelectedNodeId:c,draggedNode:a,allExpandedNodes:u,onTreeItemClick:n,onTreeItemFold:s,onTreeItemUnfold:i});return g.jsx("div",{className:"treeview",children:g.jsx("ul",{role:"tree",className:"m-0 p-0",children:Array.isArray(r)?r.map(b=>g.jsx(R2,{node:b,showIcon:l,selectedNodeId:h,expandedNodes:f,siblingsNodes:m,draggedNodeId:y,handleItemClick:v,handleToggleNode:x,handleItemAction:o},b.id)):g.jsx(R2,{node:r,selectedNodeId:h,expandedNodes:f,siblingsNodes:m,showIcon:l,draggedNodeId:y,handleItemClick:v,handleToggleNode:x})})})}),dd=Oce,Dce=({item:t,status:e="idle",isClickable:r=!1,isSelectable:n=!1,onDelete:i,onEdit:s,onRetry:o})=>{const[a]=Pn(),{t:l}=we(),{src:u,name:c,info:h}=t,f=e==="idle",m=e==="loading",y=e==="success",v=h==null?void 0:h.type.startsWith("image"),x=`${a}/common/image-placeholder.png`,b={text:"",context:null,image:g.jsx("img",{src:x,alt:"",width:"48",height:"48"})},_={error:{text:g.jsx("strong",{children:g.jsx("small",{className:"text-danger caption",children:l("tiptap.upload.error")})}),context:g.jsx(it,{leftIcon:g.jsx(HN,{}),variant:"ghost",color:"tertiary",onClick:o,children:l("tiptap.upload.retry")}),image:g.jsx(yo,{alt:"",src:`${a}/common/image-status-error.svg`,objectFit:"cover"})},idle:b,loading:{text:"",context:g.jsx(co,{message:l("tiptap.tooltip.upload.loading"),placement:"top",children:g.jsx(YT,{isLoading:!0,loadingPosition:"left",className:"text-secondary"})}),image:b.image},warning:b,success:{text:g.jsxs("em",{children:[h==null?void 0:h.type," ",(h==null?void 0:h.weight)&&`- ${h.weight}`]}),context:g.jsx(co,{message:l("tiptap.tooltip.upload.loaded"),placement:"top",children:g.jsx(VN,{className:"text-success"})}),image:g.jsx(yo,{alt:"",src:u??"",width:"48",objectFit:"cover",className:"rounded",style:{aspectRatio:1/1}})},unknown:b},w=()=>v&&g.jsx(co,{message:l("tiptap.tooltip.upload.edit"),placement:"top",children:g.jsx(To,{icon:g.jsx(Wz,{}),variant:"ghost","aria-label":l("tiptap.tooltip.upload.loading"),disabled:m||!y,onClick:s,color:"secondary"})});return g.jsx(tr,{isClickable:r,isSelectable:n,className:"card-upload",children:g.jsxs(tr.Body,{children:[g.jsx("div",{className:"card-image",children:_[e].image}),g.jsxs("div",{className:"text-truncate",children:[g.jsx(tr.Text,{children:c}),g.jsx(tr.Text,{className:"caption",children:_[e].text})]}),!f&&g.jsx("div",{className:"ms-auto",children:g.jsxs("div",{className:"d-flex align-items-center gap-12",children:[_[e].context,!f&&g.jsx("div",{className:"vr"}),w(),g.jsx(co,{message:l("tiptap.tooltip.upload.delete"),placement:"top",children:g.jsx(To,{icon:g.jsx(LT,{}),variant:"ghost","aria-label":l("tiptap.tooltip.upload.delete"),color:"tertiary",onClick:i})})]})})]})})},Nce=Dce,Lce=T.forwardRef(({children:t},e)=>g.jsx("span",{className:"visually-hidden",ref:e,children:t})),fl=Lce;function Fce(){var t;const{sessionQuery:e}=yt(),r=new Set;return(t=e==null?void 0:e.data)==null?void 0:t.bookmarkedApps.filter(n=>{const i=r.has(n.displayName);return r.add(n.displayName),!i})}function Gi(t){const e=$6(),[r,n]=T.useState();return T.useEffect(()=>{(async()=>{let i;if(e!=null&&e.hasWorkflow)if(typeof t=="string")i=await e.hasWorkflow(t);else throw"not.implemented.yet)";else typeof t=="string"?i=await Ie.rights().sessionHasWorkflowRight(t):i=await Ie.rights().sessionHasWorkflowRights(t);n(i)})()},[t,e]),r}const jce=()=>{const t=Gi("fr.openent.zimbra.controllers.ZimbraController|view"),e=Gi("fr.openent.zimbra.controllers.ZimbraController|preauth"),[r,n]=T.useState(0),[i,s]=T.useState(""),o={unread:!0,_:new Date().getTime()},a=async()=>{const u=t?"/zimbra/count/INBOX":"/conversation/count/INBOX";try{const{count:c}=await Ie.http().get(u,{queryParams:o});n(c??0)}catch(c){console.error(c),n(0)}},l=async()=>{const u="/zimbra/zimbra";try{const{preference:c}=await Ie.http().get("/userbook/preference/zimbra"),h=c?JSON.parse(c).modeExpert:!1;s(h&&e?"/zimbra/preauth":window.location.origin+u)}catch(c){console.error(c),s(window.location.origin+u)}};return T.useEffect(()=>{a()},[]),T.useEffect(()=>{l()},[]),{messages:r,msgLink:i,zimbraWorkflow:t}},Bce=jce;function Uce({user:t,avatar:e}){const{appCode:r}=yt(),{t:n}=we(),{theme:i}=ya(),s=n(r),[o,a]=T.useState(!0),[l,u]=j6(),c=T.useId(),h=T.useId(),f=e,m=t==null?void 0:t.username,y=n("welcome",{username:t==null?void 0:t.firstName}),v=Fce(),x=Gi("net.atos.entng.community.controllers.CommunityController|view"),b=Gi("org.entcore.conversation.controllers.ConversationController|view"),_=Gi("fr.openent.searchengine.controllers.SearchEngineController|view"),w=T.useCallback(()=>{a(!o)},[o]),E=async()=>{await Ie.session().logout(),window.location.href=(i==null?void 0:i.logoutCallback)??"/auth/login"};return T.useMemo(()=>({title:s,bookmarkedApps:v,appsRef:l,isAppsHovered:u,popoverAppsId:c,popoverSearchId:h,userAvatar:f,userName:m,welcomeUser:y,communityWorkflow:x,conversationWorflow:b,searchWorkflow:_,isCollapsed:o,toggleCollapsedNav:w,handleLogout:E}),[l,v,x,b,u,o,c,h,_,s,w,f,m,y])}const $ce=t=>{const e=T.useRef(),r=Jr(),{t:n}=we();return T.useEffect(()=>{const i=Ie.notify().events().subscribe(DB.TRANSPORT,s=>{var o,a;e.current=n(((a=(o=s==null?void 0:s.data)==null?void 0:o.payload)==null?void 0:a.error)||s.data.response.statusText),r.error(Pe.createElement("div",{children:[e.current]}),t)});return()=>i.revoke()},[n,r]),e.current},zce=$ce;function i8(){const[t,e]=T.useState(!1);T.useEffect(()=>{r()},[]);const r=T.useCallback(async()=>{const n=await Ie.session().isAdml();e(n)},[]);return{isAdml:t}}const Hce=()=>{var t;const{user:e,appCode:r}=yt(),n=H6[r],i=e==null?void 0:e.apps.find(u=>u.isExternal&&u.address.includes("library"));if(!i)return null;const s=(t=i.address)==null?void 0:t.split("?");if(!s||s.length<2)return null;let o=s[0];o.endsWith("/")||(o=`${o}/`);const a=s==null?void 0:s[1],l=`application%5B0%5D=${n}&page=1&sort_field=views&sort_order=desc`;return`${o}search/?${a}&${l}`},Vce=Hce,Gce=()=>({createOrUpdate:async({alt:t,uri:e,blob:r,legend:n,parentId:i,application:s,visibility:o})=>{const a=/\/workspace\/document\/([0-9a-fA-F-]+)/,l=(e??"").match(a);if(l&&l.length===2){const u=l[1],c=await Ie.workspace().searchDocuments({filter:"all",id:u,limit:1}),h=c.length?c[0].name:void 0;await Ie.workspace().updateFile(u,r,{alt:t,legend:n,name:h});const f=(await Ie.workspace().searchDocuments({filter:"all",id:u,limit:1}))[0];return{file:f,src:`/workspace/${f.public?"pub/":""}document/${u}`}}else{const u=await Ie.workspace().saveFile(r,{application:s,parentId:i,visibility:o});return`/workspace/${u.public?"pub/":""}document/${u._id}`}},create:async(t,e)=>await Ie.workspace().saveFile(t,e),remove:async t=>!t||Array.isArray(t)&&t.length===0?Promise.resolve():await Ie.workspace().deleteFile(Array.isArray(t)?t:[t])}),J1=Gce,Wce=()=>{const t=T.useRef(null),[e,r]=T.useState(),{remove:n}=J1();return{ref:t,libraryMedia:e,setLibraryMedia:r,onCancel:async i=>{var s,o;(s=t.current)!=null&&s.type&&i&&i.length>0&&await n(i),(o=t.current)==null||o.hide()},onSuccess:i=>{var s,o,a,l;let u;switch((s=t.current)==null?void 0:s.type){case"video":{if(typeof i=="object")u=i[0];else{const c=new DOMParser().parseFromString(i,"text/html").body.firstChild,h=c==null?void 0:c.getAttribute("src");(o=t.current)==null||o.hide(),u=h}break}case"embedder":{const c=new DOMParser().parseFromString(i,"text/html").body.firstChild,h=c==null?void 0:c.getAttribute("src");(a=t.current)==null||a.hide(),u=h;break}case"audio":{i.length===void 0?u=i:u=i[0];break}case"hyperlink":{u=i;break}case"image":{u=`/workspace/document/${i[0]._id}`;break}default:u=i[0]}(l=t.current)==null||l.hide(),r(u)},onTabChange:async(i,s)=>{var o;(o=t.current)!=null&&o.type&&s&&s.length>0&&await n(s)}}},s8=Wce,Xce=t=>{const[e,r]=T.useState([]);T.useEffect(()=>{(async()=>(await Sb.initialize(Ie,t),await Sb.registerBehaviours(t),r(Sb.resourceProducingApps)))()},[]);const n=T.useCallback(async i=>{const[s]=i.types;return await Ie.behaviour(t,s).loadResources(i)},[t]);return{resourceApplications:e,loadResources:n}},qce=(t,e="media-library")=>{const[r,n]=T.useState({}),{browser:i,device:s}=L6(navigator.userAgent),{create:o}=J1(),a=T.useCallback(y=>r[mf(y)],[r]),l=(y,v)=>{n(x=>{const b=mf(y);return{...x,[b]:v}})},u=y=>{n(v=>{const x=mf(y),{[x]:b,..._}=v;return _})};async function c(y,v){l(y,"loading");try{let x;return e==="media-library"&&y.type.includes("video")?x=await f(y,{filename:y.name,...v}):x=await o(y,{application:e,visibility:t}),l(y,"success"),x}catch{return l(y,"error"),null}}async function h(y,v){l(y,"loading");try{let x;if(y.type.includes("video"))x=await f(y,v);else throw new Error(Hk.NOT_SUPPORTED);return l(y,"success"),x}catch{return l(y,"error"),null}}const f=async(y,v)=>{const x={data:{device:s.type,browser:{name:i.name,version:i.version},url:window.location.hostname,file:y,filename:(v==null?void 0:v.filename)??"filename",weight:y.size},appCode:e,captation:!(y instanceof File),duration:(v==null?void 0:v.duration)??0},b=await Ie.video().upload(x);if(b.state==="succeed")return{_id:b.videoworkspaceid,file:b.videoid,name:x.data.filename,eType:"file",eParent:"",children:[],created:new Date,_shared:[],_isShared:!1,owner:{userId:"",displayName:""}};throw b.state==="error"?new Error(b.code||"Error while uploading video"):new Error("Video encoding is still running")};function m(y,v,x){return mf(v,mf(y)),c(v,x)}return{getUploadStatus:a,setUploadStatus:l,clearUploadStatus:u,uploadFile:c,uploadAlternateFile:m,uploadBlob:h}},o8=qce;function Yce(){const t=(n,i,s,o)=>(s>o&&(n=Math.round(n*o/s),s=o),n>i&&(s=Math.round(s*i/n),n=i),{height:n,width:s}),e=(n,i)=>{const s=n.split(".");return s.pop(),s.join(".")+"."+i},r=(n,i,s,o,a="jpeg",l=80)=>{const u=l/100,c=document.createElement("canvas"),h=`image/${a}`;let f=n.width,m=n.height;const y=t(m,o,f,s);f=y.width,m=y.height;const v=c.getContext("2d");return v&&(c.width=f,c.height=m,v.imageSmoothingEnabled&&v.imageSmoothingQuality&&(v.imageSmoothingQuality="high"),v.drawImage(n,0,0,f,m)),new Promise((x,b)=>{c.toBlob(_=>{_?x(new File([_],i,{type:h,lastModified:new Date().getTime()})):b()},h,u)})};return{resizeImageFile:async(n,i=1440,s=1440,o=80)=>{if(!n)throw Error("Image resizer: file not found!");if(!n.type||!n.type.startsWith("image/"))throw Error("Image resizer: the file given is not an image.");const a="jpeg";return new Promise(l=>{const u=new Image;u.setAttribute("style","max-width: none;"),u.src=URL.createObjectURL(n),u.onload=async()=>{const c=await r(u,e(n.name,a),i,s,a,o);l(c)},u.onerror=c=>{throw Error("Image Loading Error: "+c)}})}}}const Qce=({handleOnChange:t,visibility:e,application:r})=>{const[n,i]=T.useState([]),[s,o]=T.useState(void 0),{files:a,deleteFile:l,replaceFileAt:u}=hA(),{remove:c,createOrUpdate:h}=J1(),{getUploadStatus:f,setUploadStatus:m,clearUploadStatus:y,uploadFile:v,uploadAlternateFile:x}=o8(e,r),{resizeImageFile:b}=Yce(),_=T.useCallback(P=>{P.forEach(async(M,N)=>{if(M==null)return;let z;if(M.type.startsWith("image"))try{const j=await b(M);z=await x(M,j),u(N,j)}catch(j){console.error(j)}z||(z=await v(M)),z&&i(j=>[...j,z])})},[b,x,v,u]);T.useEffect(()=>{let P=0;const M=a.map(N=>{if(P>=5)return null;const z=f(N);return z==="loading"&&P++,z?null:N});M.forEach(N=>N&&m(N,"idle")),_(M)},[a,n,f,m,_]),T.useEffect(()=>{const P=w(a,n);t(P)},[n]);const w=(P,M)=>{const N=P.reduce((z,j,H)=>(z[j.name]=H,z),{});return M.sort((z,j)=>N[z.name]-N[j.name])};async function E(P){const M=n.find(N=>N.name===P.name);M&&(await c(M),y(P),i(N=>N.filter(z=>z.name!==(M==null?void 0:M.name)))),l(P)}async function A({blob:P,legend:M,altText:N}){if(s)try{const z=await h({blob:P,legend:M,alt:N,uri:I(s)});z&&typeof z=="object"&&i(j=>j.map(H=>H._id===z.file._id?{...z.file}:H))}finally{o(void 0)}}const I=(P,M)=>{const N=`/workspace/${P!=null&&P.public?"pub/":""}document/${P==null?void 0:P._id}`;return P?M?due(N):N:""};return{files:a,getUploadStatus:f,clearUploadStatus:y,uploadedFiles:n,editingImage:s,setEditingImage:o,getUrl:I,updateImage:A,uploadFile:v,removeFile:E}},Kce=Qce;function _h(){const{user:t,userDescription:e}=yt(),{theme:r}=ya();function n(){let i=e==null?void 0:e.picture;return(!i||i==="no-avatar.jpg"||i==="no-avatar.svg")&&(i=`${r==null?void 0:r.basePath}/img/illustrations/no-avatar.svg`),i}return{user:t,avatar:n(),userDescription:e}}function M0(t,e,r,n){const i=$6(),s=Gi("org.entcore.workspace.controllers.WorkspaceController|listDocuments"),o=Gi("org.entcore.workspace.controllers.WorkspaceController|listFolders");function a(h,f){switch(f.type){case"update":{const m=Qi(h,f.folderId);return m&&(m.children=f.subfolders.map(y=>({id:y._id||"",name:y.name})),m.files=f.files),{...h}}default:throw Error("[useWorkspaceSearch] Unknown action type: "+f.type)}}const[l,u]=T.useReducer(a,{id:t,name:e,section:!0}),c=T.useCallback(async h=>{var f;if(s&&o){const m=h===t?"":h,y=i!=null&&i.listWorkspaceDocuments?await((f=i==null?void 0:i.listWorkspaceDocuments)==null?void 0:f.call(i).then(b=>b.map(_=>{const w={..._,_id:""+Math.round(Math.random()*9999)};return w.name=_.eType=="folder"?"folder id="+w._id:"file id="+w._id,w}))):await Ie.workspace().listDocuments(r,m),v=[],x=[];y.filter(b=>{if(!n||b.eType==="folder")return!0;const _=zk.getRole(b);return typeof n=="string"?n===_:Array.isArray(n)?n.findIndex(w=>w===_)>=0:!1}).forEach(b=>{b.eType==="folder"?v.push(b):x.push(b)}),u({folderId:h,subfolders:v,files:x,type:"update"})}},[s,o,t,i,r,n]);return{root:l,loadContent:c}}function Zce(){const[t,e]=T.useState("pending"),{currentApp:r}=yt();T.useEffect(()=>{n()},[]);const n=async()=>{if(!r){e("[Xiti] Error, currentApp is not defined.");return}try{await Ie.analytics().trackPageLoad(window.location.pathname,r),console.info(`[Xiti] Success tracking page ${window.location.pathname}`),e(`[Xiti] Success tracking page ${window.location.pathname}`)}catch(i){console.error("[Xiti] Error Tracking Page Load",i),e(`[Xiti] Error Tracking Page Load: ${i}`)}};return{xitiStatus:t}}function Jce(){const{currentLanguage:t}=yt(),{userDescription:e}=_h(),{isAdml:r}=i8(),{theme:n}=ya(),i=window.innerWidth<=768,s=Gi("net.atos.entng.support.controllers.DisplayController|view"),[o,a]=T.useState(""),[l,u]=T.useState(void 0),c=()=>{const h=o.split("/");let f="",m="";if(l!=null&&l.labels&&Object.keys(l==null?void 0:l.labels).length>0&&h.length>1){for(let y=1;y<h.length;y++)h[y].length>0&&h[y].match(/\d/)==null&&(f.length===0?f=h[y]:f=f+"/"+h[y]);l!=null&&l.labels&&Object.prototype.hasOwnProperty.call(l==null?void 0:l.labels,f)?m=l==null?void 0:l.labels[f]:l!=null&&l.default&&String(l.default).length>0&&(m=l==null?void 0:l.default)}else l!=null&&l.default&&String(l==null?void 0:l.default).length>0&&(m=l==null?void 0:l.default);if(h.includes("collaborativewall")&&h.includes("id")&&i&&window.zE("webWidget","hide"),m.includes("${adml}")&&(r?m=m.replace("${adml}","adml"):m=m.replace("/${adml}","")),m.includes("${profile}")){const y=e==null?void 0:e.profiles;m=m.replace("${profile}",y[0].toLowerCase())}m.includes("${theme")&&(n!=null&&n.is1d?m=m.replace("${theme}","1D"):m=m.replace("${theme}","2D")),window.zE("webWidget","helpCenter:setSuggestions",{labels:[m]})};return T.useEffect(()=>{window.location.pathname!==o&&a(window.location.pathname),!(l===void 0||Object.keys(l).length===0)&&c()},[window.location.pathname,l]),T.useEffect(()=>{document.getElementById("ze-snippet")||s===void 0||(async()=>{const h=await Ie.http().get("/zendeskGuide/config");if(h&&h.key&&h.key!==""){const f=document.createElement("script");f.id="ze-snippet",f.src=`https://static.zdassets.com/ekr/snippet.js?key=${h.key}`,document.body.appendChild(f).onload=()=>{t==="es"?window.zE(function(){window.zE.setLocale("es-419")}):window.zE(function(){window.zE.setLocale("fr")}),Object.keys(h.module).length>0&&u(h.module),window.zE("webWidget","show"),window.zE("webWidget","updateSettings",{webWidget:{color:{theme:h.color||"#ffc400"},zIndex:3,launcher:{mobile:{labelVisible:!0}},contactForm:{suppress:!s},helpCenter:{messageButton:{"*":"Assistance ENT","es-419":"Asistencia ENT"}}}}),window.addEventListener("scroll",()=>{window.zE("webWidget","updateSettings",{webWidget:{launcher:{mobile:{labelVisible:window.scrollY<=5}}}})}),window.zE("webWidget:on","open",function(){s&&window.zE("webWidget","updateSettings",{webWidget:{contactForm:{suppress:!1}}})}),window.zE("webWidget:on","userEvent",function(m){const y=m.category,v=m.action,x=m.properties;v==="Contact Form Shown"&&y==="Zendesk Web Widget"&&x&&x.name==="contact-form"&&s&&(window.zE("webWidget","updateSettings",{webWidget:{contactForm:{suppress:!0}}}),window.zE("webWidget","close"),window.open("/support","_blank"))})}}})()},[s]),null}function ede(){const t=Gi("org.entcore.portal.controllers.PortalController|optionalFeatureCantoo");return T.useEffect(()=>{t&&!document.getElementById("cantoo-edifice-script")&&(async()=>{const e=await Ie.http().get("/optionalFeature/cantoo");if(e&&e.scriptPath){const r=document.createElement("script");r.id="cantoo-edifice-script",r.src=e.scriptPath,r.async=!0,document.body.appendChild(r)}})()},[t]),null}function y_({formData:t,errorMessage:e}){const{t:r}=we(),n=i=>i==null?void 0:i.match(/^\s/);return e==="CONTENT_TOO_LARGE"?g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"pt-24",children:r("bpr.form.publication.response.error.title")}),g.jsx("p",{className:"pt-24 pb-24",children:g.jsx("strong",{children:r("bpr.form.publication.response.error.content_too_large")})})]}):g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"pt-24",children:r("bpr.form.publication.response.error.title")}),g.jsx("p",{className:"pt-24 pb-24",children:g.jsx("strong",{children:r("bpr.form.publication.response.error.content")})}),g.jsxs("ul",{children:[n(t==null?void 0:t.title)&&g.jsx("li",{className:"pt-2 pb-2",children:g.jsx("strong",{children:r("bpr.form.publication.response.empty.title")})}),n(t==null?void 0:t.description)&&g.jsx("li",{className:"pt-2 pb-2",children:g.jsx("strong",{children:r("bpr.form.publication.response.empty.description")})})]})]})}function tde({result:t}){const{t:e}=we();return g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"pt-24",children:e("bpr.form.publication.response.success.title")}),g.jsx("p",{className:"pt-24",children:e("bpr.form.publication.response.success.content.1")}),g.jsx("p",{className:"pt-24",children:e("bpr.form.publication.response.success.content.2")}),t.details.front_url&&g.jsx("p",{className:"pt-24 pb-24",children:g.jsx("a",{className:"button right-magnet",href:t.details.front_url,target:"_blank",rel:"noreferrer",children:e("bpr.form.publication.response.success.button")})})]})}function rde({onSuccess:t,resource:e}){const{user:r,appCode:n}=yt(),i=Jr(),[s,o]=T.useState((e==null?void 0:e.thumbnail)||"");T.useEffect(()=>{o(e==null?void 0:e.thumbnail)},[e]);const{control:a,register:l,watch:u,setValue:c,handleSubmit:h,formState:{errors:f,isSubmitting:m,isDirty:y,isValid:v}}=DT({mode:"onChange"}),[x,b]=T.useState([]),[_,w]=T.useState([]),E=(A,I,P)=>{let M=[...I];const N=M.findIndex(z=>z===A);I.includes(A)?M=I.filter((z,j)=>j!==N):M=[...I,A],P(M)};return{control:a,cover:s,formState:{errors:f,isSubmitting:m,isDirty:y,isValid:v},handleDeleteImage:()=>o(""),handlePublish:async A=>{const I=r?r==null?void 0:r.userId:"";try{let P=new Blob;typeof s=="string"?P=await Ie.http().get(s,{responseType:"blob"}):s?P=await Ie.http().get(URL.createObjectURL(s),{responseType:"blob"}):e!=null&&e.thumbnail&&(P=await Ie.http().get(e==null?void 0:e.thumbnail,{responseType:"blob"}));const M=await Ie.http().get(`/userbook/avatar/${I}?thumbnail=48x48`,{responseType:"blob"}),N=await Ie.http().get(`/directory/user/${I}/attachment-school`,{responseType:"json"}),z=H6[n],j={activityType:x,age:[A.ageMin,A.ageMax],application:z,cover:P,description:A.description,keyWords:A.keyWords,language:A.language,licence:"CC-BY",resourceId:e==null?void 0:e.assetId,resourceEntId:e==null?void 0:e.assetId,subjectArea:_,teacherAvatar:M,title:A.title,userId:I,userStructureName:N.name||(r==null?void 0:r.structureNames[0])},H=await Ie.resource(n).publish(j);H.success?i.success(g.jsx(tde,{result:H}),{duration:1e4}):H.message==="CONTENT_TOO_LARGE"?i.error(g.jsx(y_,{errorMessage:H.message})):i.error(g.jsx(y_,{formData:A})),t==null||t()}catch(P){console.error(P),i.error(g.jsx(y_,{formData:A}))}},handleSubmit:h,handleUploadImage:A=>o(A),register:l,selectActivities:A=>{E(A,x,b)},selectedActivities:x,selectedSubjectAreas:_,selectSubjects:A=>{E(A,_,w)},setValue:c,watch:u}}const nde=(t,e)=>{const[r,n]=T.useState(null);return T.useEffect(()=>{if(e===""){console.warn("resourceId must be an assetId and not an empty string");return}(async()=>{try{const i=await Ie.resource(t).searchResource({application:t,id:e});n(i)}catch(i){console.error(i)}})()},[]),r},mA=nde,ide=({addButtonLabel:t="Add image",deleteButtonLabel:e="Delete image",src:r,className:n,mediaLibraryRef:i,libraryMedia:s,app:o,onUploadImage:a,onDeleteImage:l})=>{const[u,c]=T.useState(r||"");T.useEffect(()=>{s&&(c(s),a(s))},[s]);const h=()=>{var y;(y=i.current)==null||y.show("image")},f=()=>{c(""),l()},m=Me("image-input",n);return g.jsxs("div",{id:"image-input",className:m,children:[g.jsxs("div",{className:"image-input-actions gap-8",children:[g.jsx(To,{"aria-label":t,color:"tertiary",icon:g.jsx(X$,{}),onClick:h,type:"button",variant:"ghost"}),g.jsx(To,{"aria-label":e,color:"danger",disabled:!u,icon:g.jsx(DN,{width:"20",height:"20"}),onClick:f,type:"button",variant:"ghost"})]}),u?g.jsx(ec,{alt:"",src:u,size:"xl"}):g.jsx(ga,{app:o,iconFit:"ratio",size:"160",variant:"rounded"})]})},a8=ide,sde=({recordState:t,playState:e,recordTime:r,audioTime:n,maxDuration:i})=>g.jsxs("div",{className:"audio-recorder-time my-16 mx-auto",children:[e==="IDLE"&&g.jsxs("div",{className:"d-flex align-items-center",children:[t==="PAUSED"?g.jsx(jT,{width:12,height:12,className:"me-8 text-danger"}):g.jsx(Kv,{width:12,height:12,className:"me-8 text-danger"}),hl(t!=="IDLE"?r:0)+" / "+hl(i)]}),e!=="IDLE"&&g.jsxs("div",{className:"d-flex align-items-center mx-auto",children:[g.jsx(u1,{width:12,height:12,className:"me-8"}),hl(n*1e3)," /",hl(r)]})]}),ode=sde;function ade(t,e,r=!1,n="protected",i="media-library"){var s;function o(q,te){return{...q,...te.updatedState}}const[{recordState:a,playState:l,micStream:u,micStreamAudioSourceNode:c,audioWorkletNode:h,audioContext:f,encoderWorker:m,maxDuration:y,recordTime:v,isEncoding:x},b]=T.useReducer(o,{recordState:"IDLE",isEncoding:!1,playState:"IDLE",recordTime:0,maxDuration:180}),_=T.useRef(null),w=T.useRef(null),E=T.useRef(),A=T.useRef(),{t:I}=we(),{create:P}=J1(),M=128,N=48e3;T.useEffect(()=>{const q=new Worker("/infra/public/js/audioEncoder.js");return b({type:"update",updatedState:{encoderWorker:q}}),q.postMessage(["init",(f==null?void 0:f.sampleRate)||N]),()=>{j(),q.terminate()}},[]);const z=q=>{var te,ue;const le=q.data.inputs[0][0];let me=q.data.inputs[0][1];(!me||me.filter(xe=>xe!==void 0).length===0)&&(me=le),(te=E.current)==null||te.push(le),(ue=A.current)==null||ue.push(me)},j=T.useCallback(()=>{u==null||u.getTracks().forEach(q=>q.stop()),c==null||c.disconnect(),h==null||h.port.removeEventListener("message",z),h==null||h.port.close(),h==null||h.disconnect(),f==null||f.close()},[f,h,u,c]),H=async()=>{const q=await navigator.mediaDevices.getUserMedia({audio:!0}),te=new AudioContext({sampleRate:N}),ue=te.createMediaStreamSource(q);try{await te.audioWorklet.addModule("/infra/public/js/audio-recorder-processor.js")}catch(me){console.error(me)}const le=new AudioWorkletNode(te,"audio-recorder-processor");le.port.addEventListener("message",z),b({type:"update",updatedState:{micStream:q,micStreamAudioSourceNode:ue,audioContext:te,recordTime:0,audioWorkletNode:le,recordState:"RECORDING",playState:"IDLE"}}),A.current=[],E.current=[],le.port.start(),ue.connect(le),le.connect(te.destination)},F=T.useCallback(async()=>{w.current&&(w.current.currentTime=0,w.current.pause()),a==="PAUSED"?(b({type:"update",updatedState:{recordState:"RECORDING",playState:"IDLE"}}),f==null||f.resume(),e==null||e(void 0)):H()},[a,f,w]),L=T.useCallback(()=>{b({type:"update",updatedState:{recordState:"PAUSED",playState:"IDLE",isEncoding:!0}}),f==null||f.suspend(),m&&E.current&&A.current&&(m.postMessage(["wav",A.current,E.current,A.current.length*M]),m.onmessage=q=>{const te=window.URL.createObjectURL(q.data);b({type:"update",updatedState:{isEncoding:!1}}),w.current&&(w.current.src=te),e&&e(te)})},[f,m,e]),O=T.useCallback(()=>{var q;b({type:"update",updatedState:{playState:"PLAYING"}}),((q=w==null?void 0:w.current)!=null&&q.currentTime||w.current)&&w.current.play()},[w]),U=T.useCallback(()=>{var q;(q=w==null?void 0:w.current)==null||q.pause(),b({type:"update",updatedState:{playState:"PAUSED"}})},[w]),V=T.useCallback(()=>{j(),b({type:"update",updatedState:{playState:"IDLE",recordState:"IDLE"}}),A.current=[],E.current=[],e&&e(void 0)},[j,e]),k=T.useCallback(async()=>{var q;const te=(q=_.current)==null?void 0:q.value;if(!te){console.error("Audio name is required");return}return w.current&&(w.current.pause(),w.current.currentTime=0),b({type:"update",updatedState:{recordState:"SAVING",playState:"IDLE"}}),new Promise((ue,le)=>{try{m&&E.current&&A.current&&(m.postMessage(["mp3",A.current,E.current,A.current.length*M]),m.onmessage=async me=>{if(me.data instanceof Blob){const xe=new File([me.data],te,{type:"audio/mp3"}),_e=await P(xe,{application:i,visibility:n});_e&&t&&t(_e),b({type:"update",updatedState:{recordState:"SAVED"}}),ue(_e)}})}catch(me){b({type:"update",updatedState:{playState:"IDLE",recordState:"IDLE"}}),console.error("Error while saving",me),le()}})},[a,t,j]),$=T.useCallback(()=>{w!=null&&w.current&&(w.current.pause(),w.current.currentTime=0),b({type:"update",updatedState:{playState:"IDLE"}})},[w]),B=T.useCallback(()=>{b({type:"update",updatedState:{playState:"PAUSED"}}),w.current&&(w.current.currentTime=0)},[w]);T.useEffect(()=>{if(a==="RECORDING"&&f){const q=window.setInterval(()=>{b({type:"update",updatedState:{recordTime:f.currentTime}}),f.currentTime>=y&&(L(),window.clearInterval(q))},100);return()=>window.clearInterval(q)}},[f,L,y,a]);const X=I(a==="IDLE"?"bbm.audio.record.start":"bbm.audio.record.resume"),K=[{type:"icon",name:"record",visibility:a==="RECORDING"?"hide":"show",props:{icon:g.jsx(Kv,{}),color:"danger",disabled:a!=="IDLE"&&a!=="PAUSED"||v>=y,onClick:F,"aria-label":X},tooltip:X},{type:"icon",name:"recordPause",visibility:a==="RECORDING"?"show":"hide",props:{icon:g.jsx(yz,{}),color:"danger",disabled:a!=="RECORDING",onClick:L,"aria-label":I("bbm.audio.record.pause")},tooltip:I("bbm.audio.record.pause")},{type:"divider"},{type:"icon",name:"encoding",visibility:x?"show":"hide",props:{icon:g.jsx(jN,{style:{animation:"loading 1s infinite"}}),disabled:!0}},{type:"icon",name:"play",visibility:x||l==="PLAYING"?"hide":"show",props:{icon:g.jsx(BN,{}),disabled:a!=="RECORDED"&&a!=="PAUSED"&&a!=="SAVED",onClick:O,"aria-label":I("bbm.audio.play.start")},tooltip:I("bbm.audio.play.start")},{type:"icon",name:"playPause",visibility:!x&&l==="PLAYING"?"show":"hide",props:{icon:g.jsx(jT,{}),onClick:U,"aria-label":I("bbm.audio.play.pause")},tooltip:I("bbm.audio.play.pause")},{type:"icon",name:"stop",props:{icon:g.jsx(Cz,{}),disabled:l!=="PLAYING"&&l!=="PAUSED",onClick:$,"aria-label":I("bbm.audio.play.stop")},tooltip:I("bbm.audio.play.stop")},{type:"divider"},{type:"icon",name:"reset",props:{icon:g.jsx(zN,{}),disabled:a!=="RECORDED"&&a!=="PAUSED"&&l!=="PLAYING"&&l!=="PAUSED",onClick:V,"aria-label":I("bbm.audio.record.reset")},tooltip:I("bbm.audio.record.reset")},{type:"icon",name:"save",visibility:r?"hide":"show",props:{icon:g.jsx(BT,{}),disabled:a!=="RECORDED"&&a!=="PAUSED"&&l!=="PLAYING"&&l!=="PAUSED"||a==="SAVED"||!((s=_.current)!=null&&s.value),onClick:k,"aria-label":I("bbm.audio.record.save")},tooltip:I("bbm.audio.record.save")}];return{recordState:a,playState:l,audioContext:f,recordTime:v*1e3,maxDuration:y*1e3,audioRef:w,audioNameRef:_,toolbarItems:K,handlePlayEnded:B,handleSave:k}}const lde=T.forwardRef(({onSaveSuccess:t,onRecordUpdated:e,hideSaveAction:r=!1,visibility:n="protected"},i)=>{const{recordState:s,playState:o,recordTime:a,audioRef:l,audioNameRef:u,toolbarItems:c,maxDuration:h,handlePlayEnded:f,handleSave:m}=ade(t,e,r,n,"media-library"),{t:y}=we();T.useImperativeHandle(i,()=>({save:m}));const[v,x]=T.useState(0),b=Me({"text-danger":s==="RECORDING","text-success":o==="PLAYING"}),_=w=>{x(w.target.currentTime)};return g.jsxs("div",{className:"audio-recorder m-auto d-flex flex-column",children:[g.jsx(Ot,{id:"recordName",className:"mb-32",isRequired:!0,isReadOnly:s==="SAVED"||s==="SAVING",children:g.jsx(Zn,{type:"text",size:"sm",placeholder:y("bbm.audio.recorder.name"),ref:u,defaultValue:y("bbm.audio.recorder.defaultName")+new Date().toLocaleDateString()})}),g.jsx("div",{className:"audio-recorder-icon mx-auto",children:g.jsx(u1,{width:64,height:64,className:b})}),g.jsx(ode,{recordState:s,playState:o,recordTime:a,audioTime:v,maxDuration:h}),g.jsx("audio",{ref:l,onEnded:f,onTimeUpdate:_,children:g.jsx("track",{default:!0,kind:"captions",srcLang:"fr",src:""})}),g.jsx(pA,{items:c})]})}),ude=lde,cde=()=>{const{setResult:t,setPreSuccess:e,visibility:r}=Io(),n=T.useRef(null);return g.jsx(ude,{ref:n,onRecordUpdated:i=>{i?(t(i),e(()=>n.current.save)):t()},onSaveSuccess:i=>{i&&t(i)},hideSaveAction:!0,visibility:r})},dde=({link:t,onChange:e,multiNodeSelected:r=!1})=>{const{t:n}=we(),[i,s]=T.useState((t==null?void 0:t.text)||""),[o,a]=T.useState((t==null?void 0:t.url)||""),[l,u]=Am(t?t.target==="_blank":!0);return T.useEffect(()=>{r&&t!=null&&t.text&&s(t.text.slice(0,20)+"...")},[r,t]),T.useEffect(()=>{if(!o.length){e==null||e();return}const c={url:o,text:r?t==null?void 0:t.text:i||o,target:l?"_blank":void 0};!_k.isLocalURL(o)&&!_k.startWithHttp(o)&&(c.url="http://"+o),e==null||e(c)},[i,o,l]),g.jsx(g.Fragment,{children:g.jsxs("div",{className:"d-flex flex-column flex-fill gap-24",children:[g.jsxs(Ot,{id:"linkText",isOptional:!0,children:[g.jsx(Vi,{children:n("bbm.linker.ext.text")}),g.jsx(Zn,{type:"text",placeholder:n("bbm.linker.ext.text.placeholder"),size:"md",disabled:r,value:i,onChange:c=>s(c.target.value)})]}),g.jsxs(Ot,{id:"linkUrl",isRequired:!0,children:[g.jsx(Vi,{children:n("bbm.linker.ext.url")}),g.jsx(Zn,{type:"text",placeholder:n("bbm.linker.ext.url.placeholder"),size:"md",value:o,onChange:c=>a(c.target.value)})]}),g.jsx(Cm,{label:n("bbm.linker.open.tab"),onChange:()=>u(),checked:l})]})})},hde=dde,fde=({link:t,multiNodeSelected:e=!1})=>{const{setResult:r}=Io();return g.jsx(hde,{link:t,onChange:n=>{r(n)},multiNodeSelected:e})},pde=({onSuccess:t})=>{const{t:e}=we(),[r,n]=T.useState();function i(s){const o=s.target.value;n(o),o!=null&&o.length?t(o):t()}return g.jsxs("div",{className:"d-flex flex-column flex-fill",children:[g.jsx("div",{className:"mb-32",children:e("bbm.embed.description")}),g.jsxs("div",{className:"mb-8 d-flex",children:[g.jsx(AS,{className:"me-8"}),e("bbm.embed.title")]}),g.jsx(Ot,{id:"iframeContent",children:g.jsx(fA,{size:"md",height:"sm",placeholder:e("bbm.embed.placeholder"),onChange:i})}),!!(r!=null&&r.length)&&g.jsx("div",{className:"embed-preview mt-12",dangerouslySetInnerHTML:{__html:r}}),!(r!=null&&r.length)&&g.jsx("div",{className:"embed-preview mt-12 d-flex align-items-center justify-content-center bg-gray-300 text-black-50 rounded-3",children:g.jsx("strong",{children:e("bbm.embed.preview")})})]})},mde=pde,gde=()=>{const{setResult:t}=Io();return g.jsx(mde,{onSuccess:e=>{e=e==null?void 0:e.replace(/<p /g,"<div ").replace(/\/p>/g,"/div>"),t(e)}})},vde=({doc:t,isClickable:e=!0,isSelectable:r=!1,isSelected:n=!1,onClick:i,className:s})=>{const{fromNow:o}=RL(),{fromDate:a}=T.useMemo(()=>({fromDate:o(t.modifiedAt)}),[o,t]);return g.jsx(tr,{className:Me("card-linker shadow-none",s),isClickable:e,isSelectable:r,isSelected:n,onClick:i,children:g.jsxs(tr.Body,{space:"8",children:[g.jsx("div",{className:"card-image ps-8 pe-4",children:t.thumbnail&&t.thumbnail.length>0?g.jsx(yo,{alt:"",height:48,width:48,src:t.thumbnail,objectFit:"cover",className:"rounded h-full",style:{aspectRatio:1/1}}):g.jsx(ga,{app:t.application,iconFit:"ratio",size:"48",variant:"rounded"})}),g.jsxs("div",{className:"w-75",children:[g.jsx(tr.Text,{children:t.name}),g.jsx(tr.Text,{className:"text-black-50",children:t==null?void 0:t.creatorName})]}),g.jsx("div",{className:"d-none d-md-block text-black-50 ps-4 pe-8",children:g.jsx(tr.Text,{children:a})}),t.shared&&g.jsx("div",{className:"ps-4 pe-8",children:g.jsx(UT,{width:"20",height:"20"})})]})})},yde=vde,xde=({appCode:t,defaultAppCode:e,defaultResourceId:r,onChange:n,onSelect:i,multiple:s=!0,resourceList:o,applicationList:a,showApplicationSelector:l=!0})=>{const{t:u}=we(),{theme:c}=ya(),[h]=Pn(),{resourceApplications:f,loadResources:m}=Xce(t),[y,v]=T.useState(),[x,b]=T.useState(),[_,w]=T.useState(),E=sA(_||"",500),[A,I]=T.useState([]),P=T.useCallback((k,$)=>{var B,X,K;if(!$)return!0;const q=($==null?void 0:$.toLowerCase())||"";return((B=k.name)==null?void 0:B.toLowerCase().includes(q))||((X=k.creatorName)==null?void 0:X.toLowerCase().includes(q))||((K=k.description)==null?void 0:K.toLowerCase().includes(q))},[]),M=T.useCallback(k=>k.sort(($,B)=>$.modifiedAt<B.modifiedAt?1:-1),[]),N=T.useCallback(k=>{async function $(){if(o){const B=o.filter(X=>P(X,k));I(M(B));return}else if(x)try{const B=(await m({application:x.application,search:k,types:[x.application],filters:{},pagination:{startIdx:0,pageSize:300}})).filter(X=>P(X,k));I(M(B));return}catch{}I([])}$()},[m,x,P,M,o]),[z,j]=T.useState([]),H=k=>{n==null||n(k),b(k)},F=k=>{const $=k.target.value;w($.toString())},L=T.useCallback(k=>{N(_),k.stopPropagation(),k.preventDefault()},[N,_]),O=T.useCallback(k=>z.findIndex($=>$.assetId===k),[z]),U=T.useCallback(k=>{j(s?$=>[...$,k]:[k])},[j,s]),V=T.useCallback(k=>{const $=O(k.assetId);$<0?U(k):j(z.filter((B,X)=>X!==$))},[O,U,z]);return T.useEffect(()=>{(async()=>{if(a){v(a.sort((B,X)=>B.displayName.localeCompare(X.displayName)));return}const k=f.map(B=>Ie.session().getWebApp(B)),$=await Promise.all(k);v(f.map((B,X)=>{var K;return{application:B,displayName:u(((K=$[X])==null?void 0:K.displayName)??B),icon:g.jsx(ga,{app:$[X],size:"24"})}}).sort((B,X)=>B.displayName.localeCompare(X.displayName)))})()},[f,u,a]),T.useEffect(()=>{N(E)},[N,E]),T.useEffect(()=>{i==null||i(z)},[z]),T.useEffect(()=>{var k;const $=e??((a==null?void 0:a.length)===1&&((k=a==null?void 0:a[0])==null?void 0:k.application));if($){const B=y==null?void 0:y.find(X=>$===X.application);b(B),N("")}},[y,e]),T.useEffect(()=>{if(r&&O(r)<0){const k=A==null?void 0:A.find($=>r===$.assetId);k&&U(k)}},[A]),g.jsxs("div",{className:"d-flex flex-column flex-fill overflow-hidden",children:[g.jsxs("div",{className:"search d-flex bg-light rounded-top border border-bottom-0",children:[l&&g.jsx("div",{className:"flex-shrink-1 px-8 py-12 border-end",children:g.jsxs(xt,{overflow:!0,children:[g.jsx(xt.Trigger,{icon:g.jsx("div",{className:"pe-8",children:(x==null?void 0:x.icon)||g.jsx(ON,{})}),label:u((x==null?void 0:x.displayName)||"bbm.linker.int.choose"),variant:"ghost",size:"md"}),g.jsx(xt.Menu,{children:y==null?void 0:y.map(k=>g.jsx(xt.Item,{icon:k.icon,onClick:()=>H(k),children:k.displayName},k.application))})]})}),g.jsx("div",{className:"flex-grow-1 align-self-center",children:g.jsx("form",{className:"gap-16 d-flex w-100 align-items-center px-16 py-8",onSubmit:L,children:g.jsx(n8,{isVariant:!0,placeholder:u("search"),size:"lg",className:"w-100",disabled:!x,onChange:F})})})]}),g.jsxs("div",{className:"internal-linker flex-grow-1 w-100 rounded-bottom border gap-0 overflow-auto",children:[x&&A&&A.length>0&&g.jsx("div",{children:A.map(k=>{const $=z.findIndex(B=>B.assetId===k.assetId)>=0;return g.jsx(yde,{doc:k,isSelected:$,onClick:()=>V(k)},k.path)})}),x&&A&&A.length<=0&&g.jsx("div",{className:"d-flex justify-content-center mt-16",children:g.jsx(ua,{imageSrc:`${h}/${c==null?void 0:c.bootstrapVersion}/illu-empty-search-${x.application}.svg`,text:u("bbm.linker.int.notfound"),className:"mt-16"})}),!x&&g.jsx("div",{className:"d-flex justify-content-center mt-32",children:g.jsx(ua,{imageSrc:`${h}/${c==null?void 0:c.bootstrapVersion}/illu-empty-search.svg`,text:u("bbm.linker.int.empty"),className:"mt-32"})})]})]})},bde=xde,wde=({target:t,resourceId:e,appPrefix:r})=>{const{t:n}=we(),{setResult:i,setResultCounter:s,appCode:o,multiple:a}=Io(),[l,u]=Am(t==="_blank"),[c,h]=T.useState([]),f=m=>{h(m)};return T.useEffect(()=>{i({target:l?"_blank":void 0,resources:c}),c&&c.length?s(c.length):s(void 0)},[l,c]),g.jsxs("div",{className:"d-flex flex-column flex-fill gap-16 overflow-hidden",children:[g.jsx(bde,{appCode:o,defaultAppCode:r,defaultResourceId:e,onSelect:f,multiple:a}),g.jsx(Cm,{className:"align-items-center",checked:l,label:n("bbm.linker.open.tab"),onChange:u})]})},_de=(t,e)=>{if(t==0)return"0 octets";const r=1e3,n=e,i=["octets","Ko","Mo","Go"],s=Math.floor(Math.log(t)/Math.log(r));return parseFloat((t/Math.pow(r,s)).toFixed(n))+" "+i[s]},Sde=({historyCount:t,handle:e})=>{const{t:r}=we(),[n,i]=T.useState(void 0),s=a=>{i(a),e(a)},o=[{type:"button",name:"undo",props:{color:"tertiary",leftIcon:g.jsx($z,{}),"aria-label":r("cancel"),children:r("cancel"),onClick:()=>s("UNDO"),disabled:t===0},tooltip:r("cancel")},{type:"divider",name:"div-1"},{type:"button",name:"reset",props:{color:"tertiary",leftIcon:g.jsx(HN,{}),"aria-label":r("rotate"),children:r("rotate"),onClick:()=>s("ROTATE")},tooltip:r("rotate")},{type:"button",name:"crop",props:{color:"tertiary",leftIcon:g.jsx(z$,{}),"aria-label":r("crop"),children:r("crop"),className:n==="CROP"?"is-selected":"",onClick:()=>s("CROP")},tooltip:r("crop")},{type:"button",name:"blur",props:{color:"tertiary",leftIcon:g.jsx(O$,{}),"aria-label":r("blur"),children:r("blur"),className:n==="BLUR"?"is-selected":"",onClick:()=>s("BLUR")},tooltip:r("blur")}];return g.jsx(pA,{variant:"no-shadow",align:"left",isBlock:!0,items:o})},Ede=Sde,Tde=100,Tk=100,Cde=450,Ade=64,Rde=.5,Pde="image";function P2(t,{spriteName:e,imgDatasource:r,settings:n}){const i=URL.createObjectURL(r),s=new Image;return s.src=i,new Promise(o=>{s.onload=async()=>{await I2(t,{spriteName:e,imgDatasource:s,settings:n});const a=t==null?void 0:t.stage.getChildByName(e,!0);o(a)}})}async function I2(t,{spriteName:e,imgDatasource:r,settings:n}){if(t===void 0||t.stage===null)return;const i=t.stage.getChildByName(e,!0);i==null||i.removeFromParent();const s=r instanceof HTMLImageElement?Ee.from(r):r instanceof Rr?r:await Ee.fromURL(r),o=s instanceof Rr?s:Rr.from(s,{});if(o.interactive=!0,o.name=e,n){const{sprite:{anchor:a,position:l,scale:u,size:c,rotation:h},stage:{size:f}}=n,m=h%Math.PI!==0;o.anchor.x=a.x,o.anchor.y=a.y,o.position.x=l.x,o.position.y=l.y,o.scale.x=u.x,o.scale.y=u.y,o.width=m?c.height:c.width,o.height=m?c.width:c.height,t.stage.height=f.height,t.stage.width=f.width,t.renderer.resize(f.width,f.height),t.stage.addChild(o)}else t.stage.addChild(o),t.renderer.resize(o.width,o.height);Ide(t,o)}function Ide(t,e){var r;const n=t.view.parentNode,i=window.innerWidth-Ade,s=Math.max((n==null?void 0:n.offsetWidth)??0,Tk),o=Mde({width:e.width,height:e.height},{width:{max:Math.min(s,i),min:Tk},height:{min:Tde,max:window.innerHeight-Cde}}),{height:a,width:l}=o;(r=t.view)!=null&&r.style&&(t.view.style.width=`${l}px`,t.view.style.height=`${a}px`)}function Mde(t,e){const{height:r,width:n}=t,i=n/r,{height:s,width:o}=e;let a=o.max,l=o.max/i;return n>o.max&&(a=o.max,l=a/i),l>s.max&&(l=s.max,a=l*i),a<o.min&&(a=o.min,l=a/i),l<s.min&&(l=s.min,a=l*i),{width:a,height:l}}function kde(t){return new Promise((e,r)=>{var n;(n=t==null?void 0:t.view)!=null&&n.toBlob?t.view.toBlob(i=>{i?e(i):r("EXTRACT_FAILED")},"image/jpeg",Rde):r("EXTRACT_FAILED")})}function Ode(t){var e,r;return(r=(e=t.view).toDataURL)==null?void 0:r.call(e)}function gA(t){return t.view.getBoundingClientRect?t.view.getBoundingClientRect().width/t.view.width:1}function M2(t){return new Promise((e,r)=>{var n,i;(i=(n=t.view).toBlob)==null||i.call(n,s=>{s?e(s):r("EXTRACT_FAIL")},"image/png",1)})}function Dde({application:t,sprite:e}){return{sprite:{rotation:e.rotation,size:{width:e.width,height:e.height},position:{x:e.position.x,y:e.position.y},scale:{x:e.scale.x,y:e.scale.y},anchor:{x:e.anchor.x,y:e.anchor.y}},stage:{size:{width:t.stage.width,height:t.stage.height},scale:{x:t.stage.scale.x,y:t.stage.scale.y}}}}function Nde({application:t,sprite:e,newHeight:r,newWidth:n}){e.anchor.x=.5,e.anchor.y=.5,e.position=new et(n/2,r/2),t.stage.height=r,t.stage.width=n,t.renderer.resize(n,r)}const Lde=20,Fde=({maxSize:t=Lde,application:e,spriteName:r,onRestore:n})=>{const[i,s]=T.useState([]);T.useEffect(()=>{s([])},[e]);const o=async()=>{const u=i.pop();u&&(n(await u.backup,u),s(i.filter(c=>c!==u)))},a=u=>(u.length>t&&u.splice(0,u.length-t),u),l=async u=>{{if(!e)return;const c=e.stage.getChildByName(r,!0);if(c==null)return;const h=M2(e),f={backup:h,sprite:{rotation:c.rotation,size:{width:c.width,height:c.height},position:{x:c.position.x,y:c.position.y},scale:{x:c.scale.x,y:c.scale.y},anchor:{x:c.anchor.x,y:c.anchor.y}},stage:{size:{width:e.stage.width,height:e.stage.height},scale:{x:e.stage.scale.x,y:e.stage.scale.y}}};return s([...a(i),f]),await h,u.call(u)}};return{historyCount:i.length,restore:o,historize:l}},jde=Fde;function Bde(t,e,r){let n;const i=[];return function(s){i.push(e(s)),!n&&(n=setTimeout(()=>{const o=[...i];i.splice(0,i.length),r(o),n=void 0},t))}}const l8=20,Ude=50,vA="BRUSH_CURSOR";function $de(t,e){const r=new Hi;for(const n of t)n&&(r.beginFill(16777215,1),r.drawCircle(n.x,n.y,l8/e),r.lineStyle(0),r.endFill());return r}function zde(t,{spriteName:e}){return Bde(Ude,r=>t.stage.toLocal(r.global),r=>{const n=t.stage.getChildByName(e),i=gA(t);if(n==null)return;const s=new Rr(n.texture);s.filters=[new FF(8,4,Math.min(i,1))],s.width=n.width,s.height=n.height,s.scale=new et(1,1),s.anchor=n.anchor,s.mask=$de(r,i),n.addChild(s)})}function Hde(t){u8(t);const e=gA(t),r=new Hi;return r.lineStyle(Math.max(1,1/e),16711680),r.drawCircle(0,0,l8/e),r.endFill(),r.name=vA,t.stage.addChild(r),r}function u8(t){const e=t.stage.getChildByName(vA);e&&e.removeFromParent()}function Vde(t){return e=>{if(!t)return;const r=t.stage.toLocal(e.global),n=t.stage.getChildByName(vA,!0);n&&(n.position.x=r.x,n.position.y=r.y)}}function Gde(t,{spriteName:e}){t.stage.interactive=!0;const r=Hde(t),n=Vde(t);t.stage.on("pointermove",n);const i=zde(t,{spriteName:e});t.stage.on("pointerdown",()=>{t.stage.on("pointermove",i)});const s=()=>{var o;(o=t==null?void 0:t.stage)==null||o.off("pointermove",i)};globalThis.addEventListener("pointerup",s),r.once("destroyed",()=>{globalThis.removeEventListener("pointerup",s)})}function Wde(t){u8(t),t.stage.off("pointerdown"),t.stage.off("pointermove")}const Xde=["TOP_LEFT","TOP_RIGHT","BOTTOM_LEFT","BOTTOM_RIGHT"],k0=0,qde=20,yA="CROP_BACKGROUND_NAME",Pm="CROP_MASK_NAME";function k2(t){return"CROP_CORNER_"+t}function Yde(t,{spriteName:e}){c8(t);const r=t.stage.getChildByName(e);if(r==null)return;const n=r.getBounds(),i=t.renderer.generateTexture(t.stage).clone(),s=new Rr(i);s.height=n.height,s.width=n.width,s.position=new et(0,0);const o=new Hi;o.beginFill(16777215,.5),o.drawRect(0,0,n.width,n.height),o.endFill(),o.name=yA,o.position=new et(n.x,n.y);const a=new Hi;a.beginFill(0,1),a.drawRect(0,0,n.width-2*k0,n.height-2*k0),a.endFill(),a.position=new et(k0,k0),a.name=Pm,s.mask=a,t.stage.addChild(o),o.addChild(a),o.addChild(s)}function c8(t){const e=t.stage.getChildByName(yA,!0);e==null||e.removeFromParent()}function d8(t,e){switch(t){case"TOP_LEFT":return{x:e.x,y:e.y,start:0,end:Math.PI/2};case"TOP_RIGHT":return{x:e.x+e.width,y:e.y,start:Math.PI/2,end:Math.PI};case"BOTTOM_LEFT":return{x:e.x,y:e.y+e.height,start:3*Math.PI/2,end:2*Math.PI};case"BOTTOM_RIGHT":return{x:e.x+e.width,y:e.y+e.height,start:Math.PI,end:3*Math.PI/2}}}function Qde(t){const e=t.stage.getChildByName(Pm,!0);e!=null&&Xde.forEach(r=>{const n=t.stage.getChildByName(k2(r),!0);if(n==null)return;const i=d8(r,{height:e.height,width:e.width,x:e.x,y:e.y});n.position=new et(i.x,i.y)})}function O0(t,e,{spriteName:r}){const n=t.stage.getChildByName(k2(e),!0),i=gA(t);n==null||n.removeFromParent();const s=t.stage.getChildByName(yA,!0),o=t.stage.getChildByName(Pm,!0);if(t.stage.getChildByName(r)==null||s===null||s===void 0||o===void 0||o===null)return;const l=d8(e,{height:o.height,width:o.width,x:o.x,y:o.y}),u=new Hi;u.beginFill(4960213,1),u.arc(0,0,qde/i,l.start,l.end),u.lineTo(0,0),u.endFill(),u.position=new et(l.x,l.y),u.name=k2(e),u.interactive=!0;let c=!1;t.stage.on("pointermove",m=>{if(c===!1)return;const y=s.toLocal(m.global);u.position.x=y.x,u.position.y=y.y,Kde(t,e,y)});const h=()=>{c=!0};u.on("pointerdown",h);const f=()=>{c=!1};globalThis.addEventListener("pointerup",f),u.once("destroyed",()=>{u.off("pointerdown"),globalThis.removeEventListener("pointerup",f)}),s.addChild(u)}function Kde(t,e,r){const n=t.stage.getChildByName(Pm,!0);if(n==null)return;const i=n.position.x+n.width,s=n.position.y+n.height;switch(e){case"TOP_LEFT":{n.position.x=r.x,n.position.y=r.y,n.width=i-r.x,n.height=s-r.y;break}case"TOP_RIGHT":{n.position.y=r.y,n.width=r.x-n.position.x,n.height=s-r.y;break}case"BOTTOM_LEFT":{n.position.x=r.x,n.width=i-r.x,n.height=r.y-n.position.y;break}case"BOTTOM_RIGHT":{n.width=r.x-n.position.x,n.height=r.y-n.position.y;break}}Qde(t)}function Zde(t,{spriteName:e}){xA(t),t.stage.interactive=!0,t.stage.interactiveChildren=!0,Yde(t,{spriteName:e}),O0(t,"BOTTOM_LEFT",{spriteName:e}),O0(t,"BOTTOM_RIGHT",{spriteName:e}),O0(t,"TOP_LEFT",{spriteName:e}),O0(t,"TOP_RIGHT",{spriteName:e})}function xA(t){c8(t),t.stage.off("pointermove"),t.render()}function Jde(t){const e=t.stage.getChildByName(Pm,!0);if(e==null)return;xA(t);const r=t.renderer.generateTexture(t.stage).clone(),n=new Rr(r),i=e.getBounds(),s=new st(Math.floor(i.x),Math.floor(i.y),Math.floor(i.width),Math.floor(i.height)),o=new Ee(n.texture.baseTexture,s);return new Rr(o)}const ehe=20,ex="CONTROL_NAME";function h8(t){return"RESIZE_CORNER_"+t}function the(t,e){const r=e.x,n=e.y;switch(t){case"TOP_LEFT":return{x:r,y:n,start:0,end:Math.PI/2};case"TOP_RIGHT":return{x:r+e.width,y:n,start:Math.PI/2,end:Math.PI};case"BOTTOM_LEFT":return{x:r,y:n+e.height,start:3*Math.PI/2,end:2*Math.PI};case"BOTTOM_RIGHT":return{x:r+e.width,y:n+e.height,start:Math.PI,end:3*Math.PI/2}}}function rhe(t,{container:e,cornerType:r,position:n,spriteName:i}){const s=t.stage.getChildByName(i,!0);if(s==null)return;const o=s.rotation%Math.PI!==0,a=o?s.height:s.width,l=o?s.width:s.height;switch(r){case"TOP_LEFT":{e.position=new et(n.x,n.y),e.width=a-2*n.x,e.height=l-2*n.y;break}case"TOP_RIGHT":{const u=a-n.x;e.position=new et(u,n.y),e.width=a-2*u,e.height=l-2*n.y;break}case"BOTTOM_LEFT":{const u=l-n.y;e.position=new et(n.x,u),e.width=a-2*n.x,e.height=l-2*u;break}case"BOTTOM_RIGHT":{const u=l-n.y,c=a-n.x;e.position=new et(c,u),e.width=a-2*c,e.height=l-2*u;break}}}function Of(t,e){const r=t.stage.getChildByName(h8(e),!0);r==null||r.removeFromParent()}function D0(t,e,{spriteName:r}){Of(t,e);const n=t.stage.getChildByName(r,!0),i=t.stage.getChildByName(ex,!0);if(n==null||i===null||i===void 0)return;const s=the(e,i),o=new Hi;o.beginFill(4960213,1),o.arc(0,0,ehe,s.start,s.end),o.lineTo(0,0),o.endFill(),o.position=new et(s.x,s.y),o.name=h8(e),o.interactive=!0;let a=!1;t.stage.on("pointermove",c=>{if(a===!1)return;const h=t.stage.toLocal(c.global);rhe(t,{cornerType:e,position:h,container:i,spriteName:r})});const l=()=>{a=!1};globalThis.addEventListener("pointerup",l),o.once("destroyed",()=>{o.off("pointerdown"),globalThis.removeEventListener("pointerup",l)});const u=()=>{a=!0};o.on("pointerdown",u),i.addChild(o)}function nhe(t,e){f8(t);const r=t.stage.getChildByName(e,!0);if(r==null)return;const n=t.renderer.generateTexture(t.stage),i=new Rr(n);t.stage.children.forEach(o=>{o.alpha=0});const s=new Hi;s.drawRect(0,0,r.width,r.height),s.name=ex,s.interactive=!0,s.interactiveChildren=!0,t.stage.interactive=!0,t.stage.interactiveChildren=!0,t.stage.addChild(s),s.addChild(i)}function f8(t){const e=t.stage.getChildByName(ex,!0);e==null||e.removeFromParent(),t.stage.children.forEach(r=>{r.alpha=1})}function ihe(t,e){nhe(t,e),D0(t,"BOTTOM_LEFT",{spriteName:e}),D0(t,"BOTTOM_RIGHT",{spriteName:e}),D0(t,"TOP_LEFT",{spriteName:e}),D0(t,"TOP_RIGHT",{spriteName:e})}function p8(t){f8(t),Of(t,"BOTTOM_LEFT"),Of(t,"BOTTOM_RIGHT"),Of(t,"TOP_LEFT"),Of(t,"TOP_RIGHT"),t.stage.off("pointermove")}function she(t,e){ihe(t,e)}function ohe(t){p8(t),t.stage.off("pointermove"),t.render()}function ahe(t){var e;const r=(e=t==null?void 0:t.stage)==null?void 0:e.getChildByName(ex,!0),n=r?{height:r.height,width:r.width}:void 0;if(p8(t),n){const i=t.renderer.generateTexture(t.stage).clone(),s=new Rr(i);return s.width=n.width,s.height=n.height,s}else return}async function lhe(t,e){const r=t==null?void 0:t.stage.getChildByName(e,!0);if(t&&r){if(!t)return;const n=await M2(t),i=await P2(t,{imgDatasource:n,spriteName:e,settings:Dde({application:t,sprite:r})});if(!i)return;let s,o;const a=t.view;a.style&&(s=a.style.maxHeight??"",o=a.style.visibility??"",a.style.maxHeight=`${a.clientHeight}px`,a.style.visibility="hidden"),i.rotation+=Math.PI/2,Nde({application:t,sprite:i,newHeight:i.width,newWidth:i.height}),t.render();const l=await M2(t);s!==void 0&&(a.style.maxHeight=s),o!==void 0&&(a.style.visibility=o),await P2(t,{imgDatasource:l,spriteName:e})}}function uhe({application:t,spriteName:e,onSave:r}){return{rotate:async()=>{t&&await lhe(t,e)},startCrop:()=>{t&&Zde(t,{spriteName:e})},stopCrop:n=>{if(t){if(n){const i=Jde(t);i&&r(i)}xA(t)}},startBlur:()=>{t&&Gde(t,{spriteName:e})},stopBlur:()=>{t&&Wde(t)},startResize:()=>{t&&she(t,e)},stopResize:n=>{if(t){if(n){const i=ahe(t);i&&r(i)}ohe(t)}}}}function che({imageSrc:t,spriteName:e=Pde}){const[r,n]=T.useState(void 0),[i,s]=T.useState(!0),{rotate:o,startBlur:a,startCrop:l,startResize:u,stopBlur:c,stopCrop:h,stopResize:f}=uhe({spriteName:e,application:r,onSave(_){r&&I2(r,{imgDatasource:_,spriteName:e})}}),m=()=>r?kde(r):Promise.resolve(void 0),y=()=>{if(r)return Ode(r)},{restore:v,historize:x,historyCount:b}=jde({application:r,spriteName:e,onRestore(_,w){r&&P2(r,{imgDatasource:_,spriteName:e,settings:w})}});return T.useEffect(()=>{r&&(s(!0),I2(r,{spriteName:e,imgDatasource:t}).finally(()=>s(!1)))},[r,t,e]),{historyCount:b,setApplication:n,restore:v,stopCrop:h,stopBlur:c,stopResize:f,startResize:async()=>{s(!0),await x(u),s(!1)},startCrop:async()=>{s(!0),await x(l),s(!1)},startBlur:async()=>{s(!0),await x(a),s(!1)},rotate:async()=>{s(!0),await x(o),s(!1)},toBlob:m,toDataURL:y,loading:i}}const dhe=({altText:t,legend:e,image:r,isOpen:n,onCancel:i,onError:s,onSave:o})=>{const{t:a}=we(),[l,u]=T.useState(void 0),[c,h]=T.useState(!1),[f,m]=T.useState(t??""),[y,v]=T.useState(e??""),[x,b]=T.useState(!1),{toBlob:_,setApplication:w,startBlur:E,stopBlur:A,restore:I,rotate:P,startCrop:M,stopCrop:N,startResize:z,stopResize:j,historyCount:H,loading:F}=che({imageSrc:r}),L=()=>{A(),N(l==="CROP"),j(l==="RESIZE")},O=async()=>{try{h(!0),L();const k=await _();k&&await o({blob:k,altText:f,legend:y})}catch(k){s==null||s(`${k}`)}finally{h(!1)}},U=()=>{i()},V=async k=>{switch(L(),u(k),b(!0),k){case"ROTATE":{await P();break}case"UNDO":{await I();break}case"CROP":{M();break}case"RESIZE":{await z();break}case"BLUR":{await E();break}}};return g.jsxs(Ye,{id:"image-editor",isOpen:n,onModalClose:U,size:"lg",children:[g.jsx(Ye.Header,{onModalClose:U,children:g.jsx("span",{className:"h2",children:a("imageeditor.title")})}),g.jsx(Ye.Body,{className:"d-flex flex-column align-items-center",children:g.jsxs("div",{className:"d-flex flex-column gap-12 w-100 flex-grow-1",children:[g.jsx(Ede,{handle:V,historyCount:H}),g.jsxs("div",{className:"position-relative d-flex flex-column align-items-center justify-content-center flex-grow-1 w-100 image-editor",children:[g.jsx(Bee.Stage,{onMount:k=>w(k),options:{preserveDrawingBuffer:!0,backgroundAlpha:0,resolution:1}}),!!F&&g.jsx("div",{className:"position-absolute top-0 start-0 bottom-0 end-0 m-10 d-flex align-items-center justify-content-center bg-black opacity-25",children:g.jsx(pr,{})})]}),g.jsxs("div",{className:"d-flex flex-column flex-md-row m-10 gap-12 w-100",children:[g.jsxs(Ot,{id:"alt",className:"flex-grow-1",children:[g.jsx(Vi,{children:a("alttext")}),g.jsx(Zn,{value:f,onChange:k=>{b(!0),m(k.target.value)},placeholder:a("alttext.help"),size:"md",type:"text"})]}),g.jsxs(Ot,{id:"legend",className:"flex-grow-1",children:[g.jsx(Vi,{children:a("legend")}),g.jsx(Zn,{value:y,onChange:k=>{b(!0),v(k.target.value)},placeholder:a("legend.help"),size:"md",type:"text"})]})]})]})}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{color:"tertiary",onClick:U,type:"button",variant:"ghost",children:a("imageeditor.cancel")}),g.jsx(it,{color:"primary",onClick:O,type:"button",variant:"filled",isLoading:c,disabled:c||!x,children:a("imageeditor.save")})]})]})},hhe=dhe,fhe=({onFilesChange:t,visibility:e="protected"})=>{const{files:r,uploadedFiles:n,getUploadStatus:i,uploadFile:s,removeFile:o,updateImage:a,editingImage:l,setEditingImage:u,getUrl:c}=Kce({handleOnChange:t,application:"media-library",visibility:e}),h=T.useRef(new Map);T.useEffect(()=>{const y=h.current;return()=>{y.forEach(v=>URL.revokeObjectURL(v)),y.clear()}},[]);const f=y=>{const v=y.type.startsWith("image")?h.current.get(y.name):"";return h.current.has(y.name)||h.current.set(y.name,URL.createObjectURL(y)),{name:y.name,info:{type:y.type,weight:_de(y.size||0,1)},src:v}},m=y=>{const v=h.current.get(y.name);v&&(URL.revokeObjectURL(v),h.current.delete(y.name)),o(y)};return g.jsxs(g.Fragment,{children:[r.map(y=>{const v=n.find(x=>x.name===y.name);return g.jsx(Nce,{status:i(y),item:f(y),onEdit:()=>u(v),onRetry:()=>s(y),onDelete:()=>m(y)},y.name)}),l&&g.jsx(hhe,{altText:l.alt,legend:l.title,image:c(l,!0),isOpen:!!l,onCancel:()=>u(void 0),onSave:a,onError:console.error})]})},phe=fhe,mhe=t=>{const e=[];switch(t){case"audio":e.push("audio/*");break;case"video":e.push("video/*");break;case"image":e.push("image/png"),e.push("image/jpeg"),e.push("image/webp"),e.push("image/gif"),e.push("image/avif");break}return e},ghe=()=>{const{type:t,visibility:e,multiple:r,setResult:n,setResultCounter:i,setCancellable:s}=Io(),o=a=>{a.length?(s(a),i(a.length),n(a)):(s([]),i(void 0),n(void 0))};return g.jsx("div",{className:"py-8 flex-grow-1",children:g.jsx(xce,{multiple:r,accept:mhe(t??"embedder"),children:g.jsx(phe,{onFilesChange:o,visibility:e})})})},x_=9,b_=16,vhe=T.forwardRef(({appCode:t,caption:e,onSuccess:r,onError:n,onRecordUpdated:i,hideSaveAction:s=!1},o)=>{const[a,l]=T.useState(18e4),[u,c]=T.useState([]),[h,f]=T.useState(!1),[m,y]=T.useState(!1),[v,x]=T.useState(!1),[b,_]=T.useState(!1),[w,E]=T.useState(!1),[A,I]=T.useState({audio:!0,video:{facingMode:"environment",aspectRatio:b_/x_}}),[P,M]=T.useState(),[N,z]=T.useState(""),[j,H]=T.useState([]),[F,L]=T.useState(),[O,U]=T.useState(0),[V,k]=T.useState(0),$=T.useRef(null),B=T.useRef(null),{uploadBlob:X}=o8(void 0,t),{device:K}=L6(navigator.userAgent);T.useImperativeHandle(o,()=>({save:de}));const{t:q}=we();T.useEffect(()=>{te(),ue()},[]),T.useEffect(()=>(P||le(A),()=>{P&&P.getTracks().forEach(Re=>Re.stop())}),[P]),T.useEffect(()=>{if(j.length&&!h&&$.current){const Re=new Blob(j,{type:N});if(L(Re),i){const tt=window.URL.createObjectURL(Re);i(tt)}$.current.autoplay=!1,$.current.srcObject=null,$.current.src=window.URL.createObjectURL(Re)}},[h,j]),T.useEffect(()=>{if(h){const Re=Date.now(),tt=window.setInterval(()=>U(Date.now()-Re),500);return()=>{window.clearInterval(tt)}}},[h]),T.useEffect(()=>{if(v){const Re=window.setInterval(()=>k(tt=>tt+500),500);return()=>{window.clearInterval(Re)}}},[v]);const te=async()=>{const Re=await Ie.video().getVideoConf();l((Re.maxDuration??3)*60*1e3)},ue=async()=>{const Re=(await navigator.mediaDevices.enumerateDevices()).filter(tt=>tt.kind==="videoinput");switch(K.type){case"mobile":case"tablet":{const tt={deviceId:"environment",label:q("video.back.camera"),groupId:"",kind:"videoinput"},Rt={deviceId:"user",label:q("video.front.camera"),groupId:"",kind:"videoinput"};(Re==null?void 0:Re.length)>1?c([tt,Rt]):c([tt]);break}default:c(Re);break}},le=async Re=>{try{const tt=await navigator.mediaDevices.getUserMedia(Re);M(tt),$.current&&($.current.src&&(window.URL.revokeObjectURL($.current.src),$.current.src=""),$.current.srcObject=tt,$.current.autoplay=!0,$.current.volume=1,$.current.muted=!0)}catch(tt){console.error(tt)}},me=T.useCallback(()=>{f(!0),$&&$.current&&($.current.muted=!0);const Re=yue();z(Re),P&&(B.current=new MediaRecorder(P,{mimeType:Re}),B.current.ondataavailable=({data:tt})=>{tt.size>0&&H(Rt=>[...Rt,tt])},B.current.onerror=tt=>console.error(tt),B.current.start(1e3))},[P]),xe=T.useCallback(()=>{var Re;f(!1),y(!0),((Re=B.current)==null?void 0:Re.state)==="recording"&&(B.current.requestData(),B.current.stop())},[B]),_e=T.useCallback(()=>{var Re,tt;$&&$.current&&($.current.muted=!1),v?((tt=$==null?void 0:$.current)==null||tt.pause(),x(!1)):((Re=$==null?void 0:$.current)==null||Re.play(),x(!0))},[v]),Te=()=>{y(!1),f(!1),x(!1),E(!1),U(0),H([]),L(void 0),le(A),i&&i()},de=async()=>{if(_(!0),!F){console.error("Error while saving video: recorded video is undefined.");return}const Re=await X(F,{duration:O});if(Re!=null)return r==null||r([Re]),_(!1),E(!0),[Re];n("Error while uploading video"),_(!1),E(!0)},Be=()=>{x(!1),k(0),$.current&&($.current.currentTime=0)},je=Re=>{var tt;const Rt=u.find(J=>J.label===Re);let W={};Rt!=null&&Rt.deviceId?((Rt==null?void 0:Rt.deviceId)==="environment"||(Rt==null?void 0:Rt.deviceId)==="user"?W={audio:!0,video:{aspectRatio:b_/x_,facingMode:Rt==null?void 0:Rt.deviceId}}:W={audio:!0,video:{aspectRatio:b_/x_,deviceId:Rt.deviceId}},I(W),P&&(((tt=B.current)==null?void 0:tt.state)==="recording"&&(B.current.requestData(),B.current.stop()),P.getTracks().forEach(J=>J.stop()),M(void 0)),le(W)):console.error("Selected input device id is null")};T.useEffect(()=>{O>=a&&xe()},[O,xe]);const ut=[{type:"icon",name:"record",props:{icon:g.jsx(Kv,{color:h||m?"":"red"}),color:"danger",disabled:h||m||b,onClick:me,"aria-label":q("bbm.video.record.start")},tooltip:q("bbm.video.record.start")},{type:"icon",name:"stop",props:{icon:g.jsx(bz,{}),disabled:!h||m||b,onClick:xe,"aria-label":q("bbm.video.record.stop")},tooltip:q("bbm.video.record.stop")},{type:"icon",name:"play",visibility:v?"hide":"show",props:{icon:g.jsx(BN,{}),disabled:!m||b,onClick:_e,"aria-label":q("bbm.video.play.start")},tooltip:q("bbm.video.play.start")},{type:"icon",name:"pause",visibility:v?"show":"hide",props:{icon:g.jsx(jT,{}),disabled:!m||b,onClick:_e,"aria-label":q("bbm.video.play.pause")},tooltip:q("bbm.video.play.pause")},{type:"divider"},{type:"icon",name:"reset",props:{icon:g.jsx(zN,{}),disabled:!m||b,onClick:Te,"aria-label":q("bbm.video.record.reset")},tooltip:q("bbm.video.record.reset")},{type:"icon",name:"save",visibility:s?"hide":"show",props:{icon:g.jsx(BT,{}),disabled:!m||b||w,onClick:de,"aria-label":q("bbm.video.record.save")},tooltip:q("bbm.video.record.save")}];return g.jsxs("div",{className:"video-recorder d-flex flex-fill flex-column align-items-center pb-8",children:[g.jsx("div",{className:"video-recorder-caption d-none d-md-block",children:e}),u.length>1&&g.jsx("div",{className:"video-recorder-devices mb-12",children:g.jsxs(Ot,{id:"selectInputDevice",children:[g.jsx(Vi,{className:"d-none d-md-block",children:q("bbm.video.record.select.devices.label")}),g.jsx(aA,{placeholderOption:q("bbm.video.record.select.devices.placeholder"),options:u.map(Re=>Re.label),onValueChange:je})]})}),g.jsxs("div",{className:"video-recorder-video-container position-relative align-self-stretch",children:[g.jsx("video",{ref:$,playsInline:!0,autoPlay:!0,controls:!1,muted:!0,onEnded:Be,className:"rounded",children:g.jsx("track",{default:!0,kind:"captions",srcLang:"fr",src:""})}),(h||m)&&g.jsxs("div",{className:"video-recorder-time d-flex align-items-center font-monospace fs-6 text-bg-dark rounded",children:[h&&g.jsxs(g.Fragment,{children:[g.jsx(Kv,{width:12,height:12,color:"red",className:"me-4"}),g.jsxs("span",{children:[hl(O),"/",hl(a)]})]}),m&&g.jsxs(g.Fragment,{children:[g.jsx($N,{width:14,height:14,className:"me-4"}),g.jsxs("span",{children:[hl(V),"/",hl(O)]})]})]}),P&&g.jsx(pA,{items:ut,className:"position-absolute bottom-0 start-50 bg-white"})]}),b&&g.jsx(pr,{position:!1,caption:q("bbm.video.save.loader.caption")})]})}),yhe=vhe,xhe=()=>{const{appCode:t,setResult:e,setPreSuccess:r}=Io(),{t:n}=we(),i=T.useRef(null),s=a=>{a?(e(a),r(()=>i.current.save)):e()},o=a=>{console.error(a)};return g.jsx(yhe,{ref:i,appCode:t,caption:n("bbm.video.caption"),onRecordUpdated:s,onError:o,hideSaveAction:!0})},bhe=({onSuccess:t})=>{const{t:e}=we(),{switchType:r}=Io(),[n,i]=T.useState(),[s,o]=T.useState(),[a,l]=T.useState(void 0),[u,c]=T.useState(),h=sA(n||"",300),f=T.useId(),[m]=Pn();T.useEffect(()=>{y()},[]),T.useEffect(()=>{if(u&&h){const _=Ie.embedder().getProviderFromUrl(u,h);if(_){l(_);const w=Ie.embedder().getEmbedCodeForProvider(_,h);o(w),t(w)}else l(void 0),t()}},[h,u]);const y=async()=>{const _=await Promise.all([Ie.embedder().getDefault(),Ie.embedder().getCustom()]).then(w=>w.flat());c(_)};function v(_){const w=_.currentTarget.value;i(w),t(w!=null&&w.length?w:void 0)}function x(){r("embedder")}const b=()=>h?a?g.jsxs("div",{className:"mx-auto mt-16",children:[g.jsxs("div",{className:"video-embed-provider d-flex align-items-center",children:[g.jsx(yo,{src:a.logo,alt:"Logo "+a.displayName,className:"video-embed-provider-logo"}),a.displayName]}),s&&g.jsx("div",{className:"video-embed-preview mt-12",dangerouslySetInnerHTML:{__html:s}})]}):g.jsxs("div",{className:"d-flex flex-column align-items-center m-16",children:[g.jsx(ua,{imageSrc:`${m}/emptyscreen/illu-error.svg`,title:e("bbm.video.previewError.title"),text:e("bbm.video.previewError.text")}),g.jsxs(it,{variant:"ghost",color:"primary",onClick:x,className:"align-items-start mt-16",children:[e("bbm.video.useEmbedCode")," ",g.jsx(CS,{})]})]}):g.jsx("div",{className:"d-flex my-16 align-items-start",children:g.jsxs(it,{variant:"ghost",color:"primary",onClick:x,className:"align-items-start",children:[e("bbm.video.useEmbedCode")," ",g.jsx(CS,{})]})});return g.jsxs("div",{className:"d-flex flex-column flex-fill video-embed",children:[g.jsxs("div",{className:"mb-8 d-flex",children:[g.jsx(FT,{className:"me-8"}),e("bbm.video.url.title")]}),g.jsx(Ot,{id:f,children:g.jsx(Zn,{size:"md",type:"text",placeholder:e("bbm.video.url.placeholder"),onChange:v})}),g.jsx(g.Fragment,{children:b()})]})},whe=bhe,_he=()=>{const{setResult:t}=Io();return g.jsx(whe,{onSuccess:e=>{t(e)}})},She=({roles:t,onSelect:e,multiple:r=!0,className:n,defaultFolder:i,showPublicFolder:s})=>{const{t:o}=we(),{root:a,loadContent:l}=M0("root",o("workspace.tree.owner"),"owner",t),{root:u,loadContent:c}=M0("root",o("workspace.tree.shared"),"shared",t),{root:h,loadContent:f}=M0("root",o("workspace.tree.protected"),"protected",t),{root:m,loadContent:y}=M0("root",o("workspace.tree.public"),"public",t),v=T.useRef(null),x=T.useRef(null),b=T.useRef(null),_=T.useRef(null),[w,E]=T.useState(()=>i==="public"?s?i:"protected":i==="protected"||i==="shared"?i:"owner"),[A,I]=T.useState(()=>i==="public"?s?m:h:i==="protected"?h:i==="shared"?u:a),[P,M]=T.useState(),[N,z]=T.useState(null),[j,H]=T.useState(["modified","desc"]),[F,L]=T.useState([]),O=T.useCallback(q=>{switch(q){case"owner":return{root:a,othersRef:[x,b,_]};case"shared":return{root:u,othersRef:[v,b,_]};case"protected":return{root:h,othersRef:[v,x,_]};case"public":return{root:m,othersRef:[v,x,b]};default:throw"no.root.node"}},[a,u,h,m]),U=T.useCallback(()=>{switch(w){case"owner":l(A.id);break;case"shared":c(A.id);break;case"protected":f(A.id);break;case"public":y(A.id);break;default:throw"no.way"}},[w,A.id,l,f,y,c]);function V(q,te){E(q);const{root:ue,othersRef:le}=O(q),me=z6(ue,xe=>xe.id===te);me&&(I(me),le.forEach(xe=>{var _e;return(_e=xe.current)==null?void 0:_e.unselectAll()}))}T.useEffect(()=>{var q;let te;switch(w){case"owner":te=v;break;case"shared":te=x;break;case"protected":te=b;break;case"public":te=_;break;default:return}(q=te==null?void 0:te.current)==null||q.select("root")},[w]),T.useEffect(U,[U]),T.useEffect(()=>{if(A.files){let q=[].concat(A.files);N&&(q=q.filter(ue=>ue.name.indexOf(N)>=0));const te=j[0]==="name"?j[1]==="asc"?(ue,le)=>$(ue.name,le.name):(ue,le)=>$(le.name,ue.name):(ue,le)=>$(le.modified,ue.modified);M(()=>q.sort(te))}else M(void 0)},[A,a,h,u,m,N,j]);const k=T.useCallback(q=>{z(q.target.value)},[z]);function $(q,te){return q?te?q.localeCompare(te):1:-1}function B(){return j[0]==="name"?j[1]==="asc"?o("sort.order.alpha.asc"):o("sort.order.alpha.desc"):o("sort.order.modify.desc")}function X(q){let te=[...F];r?te.includes(q)?te=te.filter(ue=>ue._id!==q._id):te=[...te,q]:te=[q],L(te),e(te)}const K=Me("workspace flex-grow-1 gap-0",n);return g.jsxs(io,{className:K,children:[g.jsx(io.Col,{sm:"12",md:"3",xl:"4",className:"workspace-folders p-12 pt-0 gap-12",children:g.jsxs("div",{style:{position:"sticky",top:0,paddingTop:"1.2rem"},children:[g.jsx(dd,{ref:v,data:a,onTreeItemClick:q=>V("owner",q),onTreeItemUnfold:q=>V("owner",q)}),g.jsx(dd,{ref:x,data:u,onTreeItemClick:q=>V("shared",q),onTreeItemUnfold:q=>V("shared",q)}),g.jsx(dd,{ref:b,data:h,onTreeItemClick:q=>V("protected",q),onTreeItemUnfold:q=>V("protected",q)}),s&&g.jsx(dd,{ref:_,data:m,onTreeItemClick:q=>V("public",q),onTreeItemUnfold:q=>V("public",q)})]})}),g.jsx(io.Col,{sm:"12",md:"5",xl:"8",children:g.jsxs(io,{className:"flex-grow-1 gap-0",children:[g.jsxs(io.Col,{sm:"4",md:"8",xl:"12",children:[g.jsx("div",{className:"workspace-search px-16 py-8 ",children:g.jsx(n8,{isVariant:!0,className:"gap-16",onChange:k})}),g.jsxs("div",{className:"d-flex align-items-center justify-content-end px-8 py-4",children:[g.jsx("small",{className:"text-muted",children:o("workspace.search.order")}),g.jsxs(xt,{children:[g.jsx(xt.Trigger,{size:"sm",label:B(),variant:"ghost"}),g.jsxs(xt.Menu,{children:[g.jsx(xt.Item,{icon:g.jsx(Lz,{}),onClick:()=>H(["modified","desc"]),children:o("sort.order.modify.desc")}),g.jsx(xt.Item,{icon:g.jsx(kz,{}),onClick:()=>H(["name","asc"]),children:o("sort.order.alpha.asc")}),g.jsx(xt.Item,{icon:g.jsx(Dz,{}),onClick:()=>H(["name","desc"]),children:o("sort.order.alpha.desc")})]})]})]})]}),g.jsx(io.Col,{sm:"4",md:"8",xl:"12",className:"p-8 gap-8",children:P?P.length!==0?g.jsx("div",{className:"grid grid-workspace",children:P.map(q=>{const te=F.includes(q);return g.jsx(Ece,{doc:q,isSelected:te,onClick:()=>X(q)},q._id)})}):g.jsx(ua,{imageSrc:"/assets/themes/edifice-bootstrap/images/emptyscreen/illu-trash.svg",text:o("workspace.empty.docSpace"),title:o("explorer.emptyScreen.trash.title")}):g.jsx(pr,{})})]})})]})},Ehe=She,The=()=>{const{type:t,setResultCounter:e,setResult:r,multiple:n,visibility:i}=Io();function s(){switch(t){case"image":return"img";case"audio":return"audio";case"video":return"video";default:return null}}function o(a){e(a.length),a.length?r(a):r()}return g.jsx(Ehe,{roles:s(),onSelect:o,multiple:n,className:"border rounded overflow-y-auto",defaultFolder:i,showPublicFolder:i==="public"})},Na={Audio:cde,Video:xhe,Upload:ghe,ExternalLink:fde,Workspace:The,InternalLink:wde,Iframe:gde,VideoEmbedder:_he},Che=["audio-capture","video-capture","internal-link","external-link","iframe","upload","workspace","video-embedder"],w_={none:null,audio:{title:"bbm.audio.modal.title",defaultTab:"audio-capture"},video:{title:"bbm.video.modal.title",defaultTab:"video-capture"},image:{title:"bbm.image.modal.title",defaultTab:"workspace"},attachment:{title:"bbm.attachment.modal.title",defaultTab:"workspace"},hyperlink:{title:"bbm.link.modal.title",defaultTab:"linker"},embedder:{title:"bbm.embed.modal.title",defaultTab:"iframe"}},Ahe=T.forwardRef(({appCode:t,visibility:e,multiple:r,onSuccess:n,onCancel:i,onTabChange:s},o)=>{var a;const l=T.useRef(),u=T.useRef(null);T.useImperativeHandle(o,()=>({show:L,hide:O,showLink:U,type:m,...u.current})),zce({isDismissible:!0,duration:1/0});const{t:c}=we(),h=Gi("org.entcore.workspace.controllers.WorkspaceController|addDocument"),f=Gi("com.opendigitaleducation.video.controllers.VideoController|capture"),[m,y]=T.useState(null),v={workspace:{id:"workspace",icon:g.jsx(LN,{}),label:c("bbm.workspace"),content:g.jsx(Na.Workspace,{}),availableFor:["audio","video","image","attachment"],isEnable:null},upload:{id:"upload",icon:g.jsx(Iz,{}),label:c("bbm.device"),content:g.jsx(Na.Upload,{}),availableFor:["audio","video","image","attachment"],isEnable:()=>!!h},"video-capture":{id:"video-capture",icon:g.jsx($N,{}),label:c("bbm.video"),content:g.jsx(Na.Video,{}),availableFor:["video"],isEnable:()=>!!f},"audio-capture":{id:"audio-capture",icon:g.jsx(u1,{}),label:c("bbm.audio"),content:g.jsx(Na.Audio,{}),availableFor:["audio"],isEnable:()=>!!h},"external-link":{id:"external-link",icon:g.jsx(FT,{}),label:c("bbm.linker.ext"),content:g.jsx(Na.ExternalLink,{...l.current}),availableFor:["hyperlink"],isEnable:null},"internal-link":{id:"internal-link",icon:g.jsx(ON,{}),label:c("bbm.linker.int"),content:g.jsx(Na.InternalLink,{...l.current}),availableFor:["hyperlink"],isEnable:null},iframe:{id:"iframe",icon:g.jsx(AS,{}),label:c("bbm.embed"),content:g.jsx(Na.Iframe,{}),availableFor:["embedder"],isEnable:null},"video-embedder":{id:"iframe",icon:g.jsx(AS,{}),label:c("bbm.embed"),content:g.jsx(Na.VideoEmbedder,{}),availableFor:["video"],isEnable:null}},x=T.useMemo(()=>Che.map(K=>v[K]).filter(K=>{var q;return((q=K.isEnable)==null?void 0:q.call(K))!==!1&&(K.availableFor.length===0||K.availableFor.includes(m))}),[m]),[b,_]=T.useState(),w=T.useMemo(()=>{const K=x.findIndex(q=>q.id===b);return 0>K||K>=x.length?0:K},[x,b]),[E,A]=T.useState(),[I,P]=T.useState(),[M,N]=T.useState([]),[z,j]=T.useState();function H(K){throw x.findIndex(q=>q.id===K)<0?"tab.not.visible":"not.implemented.yet"}function F(K){l.current=void 0,_(void 0),y(K)}const L=K=>{y(K)},O=()=>{y(null)},U=K=>{l.current=K,!("resourceId"in K||"appPrefix"in K)&&_("external-link"),y("hyperlink")};T.useEffect(()=>{var K,q;const te=m||"none";!b&&typeof((K=w_[te])==null?void 0:K.defaultTab)=="string"&&_((q=w_[te])==null?void 0:q.defaultTab)},[b,m]);const V=c(((a=w_[m??"none"])==null?void 0:a.title)??"bbm"),k=()=>{l.current=void 0,P(void 0),A(void 0),_(void 0),j(void 0),N([])},$=K=>{s==null||s(K,M),k()},B=T.useCallback(()=>{const K=async q=>{q instanceof Array&&["protected","public"].findIndex(te=>te===e)>=0&&(q=await Ie.workspace().transferDocuments(q,t??"media-library",e)),n(q)};z?z().then(q=>{K(q)}):I&&K(I),k()},[z,I,n,e]),X=()=>{i(M),k()};return m&&g.jsx(t8.Provider,{value:{appCode:t,visibility:e,multiple:r,type:m,setResultCounter:A,setResult:P,setCancellable:K=>N([...K]),setVisibleTab:H,switchType:F,setPreSuccess:j},children:g.jsxs(Ye,{id:"media-library",isOpen:m!==null,onModalClose:X,size:"lg",viewport:!0,scrollable:!0,children:[g.jsx(Ye.Header,{onModalClose:X,children:V}),g.jsx(gv,{items:x,defaultId:x[w].id,onChange:$,children:K=>g.jsxs(g.Fragment,{children:[x.length>1&&g.jsx(gv.List,{className:"mt-16"}),g.jsx(Ye.Body,{className:"d-flex",children:g.jsx(gv.Panel,{currentItem:K,children:K==null?void 0:K.content})})]})}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{type:"button",color:"tertiary",variant:"ghost",onClick:X,children:c("cancel")}),g.jsx(it,{type:"button",color:"primary",variant:"filled",disabled:typeof I>"u",onClick:B,children:E&&E>1?c("addMultiple",{number:E}):c("add")})]})]})})}),m8=Ahe;function Rhe({isOpen:t,resourceId:e,onSuccess:r,onCancel:n}){const{appCode:i,currentApp:s}=yt(),{ref:o,libraryMedia:a,...l}=s8(),{t:u}=we(),c=mA(i,e),{control:h,cover:f,formState:{isDirty:m,isValid:y,isSubmitting:v},handleDeleteImage:x,handleSubmit:b,handleUploadImage:_,handlePublish:w,register:E,selectActivities:A,selectedActivities:I,selectedSubjectAreas:P,selectSubjects:M}=rde({resource:c,onSuccess:r});return c?ur.createPortal(g.jsxs(Ye,{isOpen:t,onModalClose:n,id:"libraryModal",size:"lg",children:[g.jsx(Ye.Header,{onModalClose:n,children:u("bpr.publish")}),g.jsx(Ye.Subtitle,{children:u("bpr.form.tip")}),g.jsxs(Ye.Body,{children:[g.jsx(Ss,{headingStyle:"h4",level:"h3",className:"mb-16",children:u("bpr.form.publication.heading.general")}),g.jsxs("form",{id:"libraryModalForm",onSubmit:b(w),children:[g.jsxs("div",{className:"d-block d-md-flex mb-24 gap-24",children:[g.jsxs("div",{style:{maxWidth:"160px"},children:[g.jsx("div",{className:"form-label",children:u("bpr.form.publication.cover.title")}),g.jsx(a8,{app:s,src:c==null?void 0:c.thumbnail,addButtonLabel:u("bpr.form.publication.cover.upload.add"),deleteButtonLabel:u("bpr.form.publication.cover.upload.remove"),onUploadImage:_,onDeleteImage:x,className:"align-self-center",libraryMedia:a,mediaLibraryRef:o}),!f&&g.jsx("p",{className:"form-text is-invalid",children:g.jsx("em",{children:u("bpr.form.publication.cover.upload.required.image")})})]}),g.jsxs("div",{className:"flex-fill",children:[g.jsxs(Ot,{id:"title",className:"mb-16",isRequired:!0,children:[g.jsx(Vi,{children:u("bpr.form.publication.title")}),g.jsx(Zn,{type:"text",defaultValue:c==null?void 0:c.name,...E("title",{required:!0}),placeholder:u("bpr.form.publication.title.placeholder"),size:"md","aria-required":!0})]}),g.jsxs(Ot,{id:"description",isRequired:!0,children:[g.jsx(Vi,{children:u("bpr.form.publication.description")}),g.jsx(fA,{...E("description",{required:!0}),placeholder:u("bpr.form.publication.description.placeholder"),size:"md"})]})]})]}),g.jsx("hr",{}),g.jsx(Ss,{headingStyle:"h4",level:"h3",className:"mb-16",children:u("bpr.form.publication.heading.infos")}),g.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 row mb-24",children:[g.jsx(Xle,{control:h,selectedActivities:I,selectActivities:A}),g.jsx(nue,{control:h,selectedSubjectAreas:P,selectSubjects:M}),g.jsx(eue,{control:h})]}),g.jsxs("div",{className:"mb-24",children:[g.jsx("label",{htmlFor:"",className:"form-label",children:u("bpr.form.publication.age")}),g.jsxs("div",{className:"d-flex gap-8",children:[g.jsx("div",{className:"col col-md-2 d-flex",children:g.jsx(wk,{control:h,name:"ageMin",placeholderOption:"bpr.form.publication.age.min",validate:(j,H)=>parseInt(j)<=parseInt(H.ageMax)})}),g.jsx("div",{className:"col col-md-2 d-flex",children:g.jsx(wk,{control:h,name:"ageMax",placeholderOption:"bpr.form.publication.age.max",validate:(j,H)=>parseInt(j)>=parseInt(H.ageMin)})})]})]}),g.jsx("div",{className:"mb-24",children:g.jsxs(Ot,{id:"keywords",isOptional:!0,children:[g.jsx(Vi,{children:u("bpr.form.publication.keywords")}),g.jsx(Zn,{type:"text",...E("keyWords"),size:"md",placeholder:u("bpr.form.publication.keywords.placeholder")})]})}),g.jsx("hr",{}),g.jsx(Ss,{headingStyle:"h4",level:"h3",className:"mb-16",children:u("bpr.form.publication.licence.text")}),g.jsx(tue,{})]})]}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{color:"tertiary",onClick:n,type:"button",variant:"ghost",children:u("cancel")}),g.jsx(it,{form:"libraryModalForm",type:"submit",color:"primary",variant:"filled",isLoading:v,disabled:!f||v||!m||!y,children:u("bpr.form.submit")})]}),g.jsx(m8,{appCode:i,ref:o,multiple:!1,visibility:"protected",...l})]}),document.getElementById("portal")):g.jsx(pr,{})}const Phe=({content:t,maxLength:e})=>g.jsx("p",{className:"small text-gray-700 p-2 text-end",children:t?`${t.length} / ${e}`:""}),Ihe=({isUpdating:t,selectedResource:e})=>{const[r,n]=T.useState(t&&(e==null?void 0:e.thumbnail)||"");return T.useEffect(()=>{n((e==null?void 0:e.thumbnail)||"")},[e]),{thumbnail:r,handleDeleteImage:()=>n(""),handleUploadImage:i=>n(i)}},Mhe=60,khe=400,Ohe=({isOpen:t,onCancel:e,onSuccess:r,children:n,inputMaxLength:i=Mhe,textareaMaxLength:s=khe,...o})=>{const{appCode:a,currentApp:l}=yt(),{t:u}=we(),{mode:c}=o,h=Jr(),f=T.useId(),m=c==="create",y=c==="update",v=mA(a,y?o.resourceId:""),{watch:x,register:b,handleSubmit:_,setValue:w,formState:{isSubmitting:E,isValid:A}}=DT({mode:"onChange",defaultValues:{description:y?v==null?void 0:v.description:"",enablePublic:y?v==null?void 0:v.public:!1,title:y?v==null?void 0:v.name:"",formSlug:y?v==null?void 0:v.slug:""}}),{ref:I,libraryMedia:P,...M}=s8(),{appCode:N}=yt(),{thumbnail:z,handleDeleteImage:j,handleUploadImage:H}=Ihe({isUpdating:y,selectedResource:y?v:void 0}),F=x("description"),L=async function(O){var U,V;try{const k={description:O.description||"",name:O.title,public:O.enablePublic,slug:O.enablePublic&&O.formSlug||"",thumbnail:z};if(m){const $={...k,folder:o.currentFolder===void 0||((U=o.currentFolder)==null?void 0:U.id)==="default"?void 0:parseInt(((V=o.currentFolder)==null?void 0:V.id)||""),application:a};o.createResource?await o.createResource.mutateAsync($):await Ie.resource(a).create($)}else{const $={...k,entId:v.assetId,trashed:v.trashed};o.updateResource?await o.updateResource.mutateAsync($):await Ie.resource(a).update($)}h.success(g.jsxs(g.Fragment,{children:[g.jsx("strong",{children:u(m?"explorer.resource.created":"explorer.resource.updated")}),g.jsxs("p",{children:[u("title")," : ",O.title]}),g.jsxs("p",{children:[u("description")," : ",O.description]}),a==="blog"&&g.jsxs("p",{children:["Public:",O.enablePublic?u("explorer.enable.public.yes"):u("explorer.enable.public.no")]})]})),r()}catch(k){console.error(k)}};return y&&!v?g.jsx(pr,{}):ur.createPortal(g.jsxs(Ye,{id:`${c}-resource`,size:"lg",isOpen:t,onModalClose:e,children:[g.jsx(Ye.Header,{onModalClose:e,children:u(`explorer.resource.editModal.header.${m?"create":"edit"}`)}),g.jsxs(Ye.Body,{children:[g.jsx(Ss,{headingStyle:"h4",level:"h3",className:"mb-16",children:u("explorer.resource.editModal.heading.general")}),g.jsxs("form",{id:f,onSubmit:_(L),children:[g.jsxs("div",{className:"d-block d-md-flex gap-16 mb-24",children:[g.jsx("div",{children:g.jsx(a8,{app:l,src:y&&(v==null?void 0:v.thumbnail)||"",addButtonLabel:u("explorer.imagepicker.button.add"),deleteButtonLabel:u("explorer.imagepicker.button.delete"),onUploadImage:H,onDeleteImage:j,className:"align-self-center mt-8",libraryMedia:P,mediaLibraryRef:I})}),g.jsxs("div",{className:"col",children:[g.jsxs(Ot,{id:"title",className:"mb-16",isRequired:!0,children:[g.jsx(Vi,{children:u("title")}),g.jsx(Zn,{type:"text",defaultValue:y?v==null?void 0:v.name:"",...b("title",{required:!0,maxLength:i,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:u("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0,maxLength:i})]}),g.jsxs(Ot,{id:"description",isOptional:!0,children:[g.jsx(Vi,{children:u("description")}),g.jsx(fA,{defaultValue:(v==null?void 0:v.description)||"",...b("description",{required:!1,maxLength:s}),placeholder:u("explorer.resource.editModal.description.placeholder"),size:"md",maxLength:s}),F&&g.jsx(Phe,{content:F,maxLength:s})]})]})]}),typeof n=="function"?n(v,y,x,w,b):n]})]}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{color:"tertiary",onClick:e,type:"button",variant:"ghost",children:u("explorer.cancel")}),g.jsx(it,{form:f,type:"submit",color:"primary",isLoading:E,variant:"filled",disabled:!A||E,children:u(m?"explorer.create":"save")})]}),g.jsx(m8,{appCode:N,ref:I,multiple:!1,visibility:"protected",...M})]}),document.getElementById("portal"))},Dhe=Ohe,Nhe=({application:t,options:e})=>Ro({mutationFn:async r=>await Ie.resource(t).update(r),...e}),Lhe=Nhe,Fhe=({watch:t,setValue:e,selectedResource:r})=>{const[n,i]=T.useState(""),[s,o]=T.useState((r==null?void 0:r.public)||!1),a=T.useId(),l=t("title"),{t:u}=we(),c=Jr();T.useEffect(()=>{if(s){let m="";r?m=r.slug?r.slug:`${rk({foo:`${l}${a}`})}-${ik(l)}`:m=`${rk({foo:`${l}${a}`})}-${ik(l)}`,e("formSlug",m),i(m)}},[s,l]);function h(m){o(m)}function f(m){navigator.clipboard.writeText(`${window.location.origin}${m||window.location.pathname}/pub/${n}`),c.success(u("explorer.copy.clipboard"))}return{slug:n,uniqueId:a,isPublic:s,resourceName:l,onPublicChange:h,onCopyToClipBoard:f}},jhe=({appCode:t,isUpdating:e,resource:r,watch:n,register:i,setValue:s})=>{const{t:o}=we(),{slug:a,isPublic:l,resourceName:u,onPublicChange:c,onCopyToClipBoard:h}=Fhe({watch:n,setValue:s,selectedResource:e?r:void 0});return g.jsxs(g.Fragment,{children:[g.jsxs(Ss,{headingStyle:"h4",level:"h3",className:"mb-16",children:[o("explorer.resource.editModal.heading.access"),t]}),g.jsx(Jo,{type:"info",children:o("explorer.resource.editModal.access.alert")}),g.jsxs(Ot,{id:"flexSwitchCheckDefault",className:"form-switch d-flex gap-8 mt-16 mb-8",children:[g.jsx(Ot.Input,{type:"checkbox",role:"switch",defaultChecked:e?r.public:!1,...i("enablePublic",{disabled:!u,onChange:f=>{const m=f.target.checked;c(m)}}),className:"form-check-input mt-0",size:"md"}),g.jsx(Ot.Label,{className:"form-check-label mb-0",children:o("explorer.resource.editModal.access.flexSwitchCheckDefault.label")})]}),l&&g.jsxs(g.Fragment,{children:[g.jsx(Ot,{id:"formSlug",children:g.jsx(Zn,{type:"text",hidden:!0,defaultValue:e?a:"",...i("formSlug"),size:"sm"})},a),g.jsxs("div",{className:"d-flex flex-wrap align-items-center gap-4",children:[g.jsxs("p",{className:"text-break",children:[window.location.origin,"/blog/pub/",a]}),g.jsx(it,{color:"primary",disabled:!l,onClick:()=>h("/blog"),type:"button",leftIcon:g.jsx(U$,{}),variant:"ghost",className:"text-nowrap",children:o("explorer.resource.editModal.access.url.button")})]})]})]})},g8=jhe,Bhe=({bookmark:t,refBookmark:e,onBookmarkChange:r,onSave:n})=>{const{t:i}=we();return g.jsx("div",{className:"mt-16",children:g.jsxs(Ot,{id:"bookmarkName",className:"d-flex flex-wrap align-items-center gap-16",children:[g.jsx("div",{className:"flex-fill",children:g.jsx(Ot.Input,{ref:e,onChange:r,placeholder:i("explorer.modal.share.sharebookmark.placeholder"),size:"sm",type:"text"},t.id)}),g.jsx(it,{type:"button",color:"primary",variant:"ghost",disabled:t.name.length===0,leftIcon:g.jsx(BT,{}),onClick:n,className:"text-nowrap",children:i("explorer.modal.share.sharebookmark.save")})]})})},Uhe=(t,e)=>t.actions.filter(r=>e.id===r.id).length>0,$he=(t,e)=>t.isBookmarkMember&&e||!t.isBookmarkMember,zhe=({shareRights:t,showBookmark:e,toggleBookmark:r,shareRightActions:n,toggleRight:i,onDeleteRow:s})=>{const{t:o}=we();return t==null?void 0:t.rights.map(a=>{const l={user:g.jsx(ec,{alt:o("explorer.modal.share.avatar.shared.alt"),size:"xs",src:a.avatarUrl,variant:"circle"}),group:g.jsx("div",{className:"avatar-xs bg-primary-200 justify-content-center d-flex rounded-circle",children:g.jsx(UT,{width:16})}),sharebookmark:g.jsx(NT,{})}[a.type]||null,u=a.type==="sharebookmark",c=a.type==="user";return $he(a,e)&&g.jsxs("tr",{className:a.isBookmarkMember?"bg-light":"",children:[g.jsx("td",{children:l}),g.jsx("td",{children:g.jsxs("div",{className:"d-flex",children:[u&&g.jsx(it,{color:"tertiary",rightIcon:g.jsx(Cp,{title:o("show"),className:"w-16 min-w-0",style:{transition:"rotate 0.2s ease-out",rotate:e?"-180deg":"0deg"}}),type:"button",variant:"ghost",className:"fw-normal ps-0",onClick:r,children:a.displayName}),!u&&a.displayName,c&&` (${o(a.profile||"")})`]})}),n.map(h=>g.jsx("td",{style:{width:"80px"},className:"text-center text-white",children:g.jsx(Cm,{checked:Uhe(a,h),onChange:()=>i(a,h.id)})},h.displayName)),g.jsx("td",{children:!a.isBookmarkMember&&g.jsx(To,{"aria-label":o("close"),color:"tertiary",icon:g.jsx(LT,{}),type:"button",variant:"ghost",title:o("close"),onClick:()=>s(a)})})]},a.id)})},Hhe={searchInputValue:"",searchResults:[],searchAPIResults:[],isSearching:!1};function Vhe(t,e){switch(e.type){case"onChange":return{...t,searchInputValue:e.payload};case"isSearching":return{...t,isSearching:e.payload};case"addResult":return{...t,searchResults:e.payload};case"addApiResult":return{...t,searchAPIResults:e.payload};case"updateSearchResult":return{...t,searchResults:e.payload};case"emptyResult":return{...t,searchResults:e.payload};default:throw new Error("Unhandled action type")}}const __=[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}],Ghe=({resourceId:t,resourceCreatorId:e,shareRights:r,shareDispatch:n})=>{const[i,s]=T.useReducer(Vhe,Hhe),o=sA(i.searchInputValue,500),{isAdml:a}=i8(),{appCode:l}=yt(),{t:u}=we();T.useEffect(()=>{h(o)},[o]);const c=f=>{const m=f.target.value;s({type:"onChange",payload:m})},h=async f=>{if(t){if(s({type:"isSearching",payload:!0}),!a&&f.length>=1||a&&f.length>=3){const m=await Ie.share().searchShareSubjects(l,t,f);s({type:"addApiResult",payload:m});const y=m.filter(v=>!r.rights.find(x=>x.id===v.id)).filter(v=>!(v.type==="user"&&v.id===e)).map(v=>{let x=v.displayName;return v.type==="user"&&v.profile?x=`${x} (${u(v.profile)})`:v.type==="group"&&v.structureName&&(x=`${x} (${v.structureName})`),{value:v.id,label:x,icon:v.type==="sharebookmark"?g.jsx(NT,{}):null}});s({type:"addResult",payload:y})}else s({type:"emptyResult",payload:[]}),Promise.resolve();s({type:"isSearching",payload:!1})}};return{state:i,showSearchAdmlHint:()=>a&&i.searchInputValue.length<3,showSearchLoading:()=>i.isSearching,showSearchNoResults:()=>!i.isSearching&&!a&&o.length>0&&i.searchResults.length===0||!i.isSearching&&a&&o.length>3&&i.searchResults.length===0,getSearchMinLength:()=>a?3:1,handleSearchInputChange:c,handleSearchResultsChange:async f=>{const m=i.searchAPIResults.find(y=>y.id===f[0]);if(m){let y=[];if(m.type==="sharebookmark"){const v=await Ie.directory().getBookMarkById(m.id);y.push({...v,type:"sharebookmark",avatarUrl:"",directoryUrl:"",actions:__}),v==null||v.users.filter(x=>!r.rights.find(b=>b.id===x.id)).forEach(x=>{y.push({...x,type:"user",avatarUrl:"",directoryUrl:"",actions:__,isBookmarkMember:!0})}),v.groups.filter(x=>!r.rights.find(b=>b.id===x.id)).forEach(x=>{y.push({...x,type:"group",avatarUrl:"",directoryUrl:"",actions:__,isBookmarkMember:!0})})}else y=[{...m,actions:[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}]}];n({type:"updateShareRights",payload:{...r,rights:[...r.rights,...y]}}),s({type:"updateSearchResult",payload:i.searchResults.filter(v=>v.value!==f[0])})}}}},Whe={isSharing:!1,shareRights:{rights:[],visibleBookmarks:[],visibleGroups:[],visibleUsers:[]},shareRightActions:[]};function Xhe(t,e){switch(e.type){case"init":return{...t,...e.payload};case"deleteRow":return{...t,shareRights:e.payload};case"updateShareRights":return{...t,shareRights:e.payload};case"toggleRight":return{...t,shareRights:e.payload};case"isSharing":return{...t,isSharing:e.payload};default:throw new Error("Unhandled action type")}}function qhe({resourceId:t,resourceRights:e,resourceCreatorId:r,shareResource:n,setIsLoading:i,onSuccess:s}){const{appCode:o}=yt(),{user:a,avatar:l}=_h(),u=Jr(),{t:c}=we(),[h,f]=T.useReducer(Xhe,Whe);T.useEffect(()=>{t&&(async()=>{try{const[v,x]=await Promise.all([Ie.share().getActionsForApp(o),Ie.share().getRightsForResource(o,t)]);f({type:"init",payload:{shareRightActions:v,shareRights:x}})}catch(v){console.error(v)}i(!1)})()},[t]);const m=(v,x)=>{var b,_;const{rights:w,...E}=h.shareRights,A=[...w],I=A.findIndex(M=>M.id===v.id),P=h.shareRightActions.filter(M=>M.id===x)[0];if(A[I].actions.findIndex(M=>M.id===x)>-1){let M=A[I].actions.filter(z=>z.id!==x);const N=h.shareRightActions.filter(z=>{var j;return(j=z.requires)==null?void 0:j.includes(x)});M=M.filter(z=>!N.find(j=>j.id===z.id)),A[I]={...A[I],actions:M}}else{const M=h.shareRightActions.filter(N=>{var z;return((z=P.requires)==null?void 0:z.includes(N.id))&&!A[I].actions.find(j=>j.id===N.id)});A[I]={...A[I],actions:[...A[I].actions,P,...M]}}v.type==="sharebookmark"&&((b=A[I].users)==null||b.forEach(M=>{const N=A.findIndex(z=>z.id===M.id);A[N]={...A[N],actions:A[I].actions}}),(_=A[I].groups)==null||_.forEach(M=>{const N=A.findIndex(z=>z.id===M.id);A[N]={...A[N],actions:A[I].actions}})),f({type:"toggleRight",payload:{rights:A,...E}})},y=v=>{Object.keys(v)[0]==="error"?(u.error(c("explorer.shared.status.error")),console.error("Failed to save share",v)):u.success(c("explorer.shared.status.saved"))};return{state:h,dispatch:f,currentIsAuthor:()=>r===(a==null?void 0:a.userId),myAvatar:l,handleDeleteRow:v=>{f({type:"deleteRow",payload:{...h.shareRights,rights:h.shareRights.rights.filter(x=>{var b,_;return x.id!==v.id&&!((b=v.users)!=null&&b.find(w=>w.id===x.id))&&!((_=v.groups)!=null&&_.find(w=>w.id===x.id))})}})},handleShare:async()=>{f({type:"isSharing",payload:!0});try{const v=e.filter(b=>a&&b.includes(`user:${a.userId}`)).map(b=>b.split(":")[2]).filter(b=>!!b),x=[...h.shareRights.rights];if(v.length>0){const b=v.map(_=>({displayName:_,id:_}));x.push({actions:b,avatarUrl:"",directoryUrl:"",displayName:a.username,id:a.userId,type:"user"})}if(n){const b=await n.mutateAsync({resourceId:t,rights:x});y(b)}else{const b=await Ie.share().saveRights(o,t,x);y(b)}s()}catch(v){typeof v=="string"&&u.error(c("explorer.shared.status.error")),console.error("Failed to save share",v)}finally{f({type:"isSharing",payload:!1})}},toggleRight:m}}const Yhe=({shareRights:t,shareDispatch:e})=>{const r=Jr(),{t:n}=we(),i=T.useRef(null),[s,o]=T.useState({name:"",id:T.useId()}),[a,l]=Am(!1),[u,c]=T.useState(!1),h=()=>{l()},f=()=>{o(y=>{var v;return{...y,name:((v=i.current)==null?void 0:v.value)||""}})},m=async y=>{try{const v=await Ie.directory().saveBookmarks(y,{users:t.rights.filter(x=>x.type==="user").map(x=>x.id),groups:t.rights.filter(x=>x.type==="group").map(x=>x.id),bookmarks:t.rights.filter(x=>x.type==="sharebookmark").map(x=>x.id)});r.success(n("explorer.bookmarked.status.saved")),e({type:"updateShareRights",payload:{...t,visibleBookmarks:[...t.visibleBookmarks,{displayName:y,id:v.id}]}}),o(x=>({...x,bookmarkId:x.id+new Date().getTime().toString()})),c(!1)}catch(v){console.error("Failed to save bookmark",v),r.error(n("explorer.bookmarked.status.error"))}};return{refBookmark:i,showBookmark:a,showBookmarkInput:u,bookmark:s,handleBookmarkChange:f,setBookmark:o,handleOnSave:()=>{var y;const v=((y=i.current)==null?void 0:y.value)||"";m(v)},toggleBookmark:h,toggleBookmarkInput:c}};function Qhe({isOpen:t,shareOptions:e,shareResource:r,children:n,onSuccess:i,onCancel:s}){const{resourceId:o,resourceCreatorId:a,resourceRights:l}=e,[u,c]=T.useState(!0),{state:{isSharing:h,shareRights:f,shareRightActions:m},dispatch:y,myAvatar:v,currentIsAuthor:x,handleShare:b,toggleRight:_,handleDeleteRow:w}=qhe({resourceId:o,resourceCreatorId:a,resourceRights:l,shareResource:r,setIsLoading:c,onSuccess:i}),{state:{searchResults:E,searchInputValue:A},showSearchAdmlHint:I,showSearchLoading:P,showSearchNoResults:M,getSearchMinLength:N,handleSearchInputChange:z,handleSearchResultsChange:j}=Ghe({resourceId:o,resourceCreatorId:a,shareRights:f,shareDispatch:y}),{refBookmark:H,showBookmark:F,handleBookmarkChange:L,toggleBookmark:O,bookmark:U,handleOnSave:V,showBookmarkInput:k,toggleBookmarkInput:$}=Yhe({shareRights:f,shareDispatch:y}),{t:B}=we(),X=I()?B("explorer.search.adml.hint"):B("explorer.modal.share.search.placeholder");return ur.createPortal(g.jsxs(Ye,{id:"share_modal",size:"lg",isOpen:t,onModalClose:s,children:[g.jsx(Ye.Header,{onModalClose:s,children:B("share.title")}),g.jsxs(Ye.Body,{children:[g.jsx(Ss,{headingStyle:"h4",level:"h3",className:"mb-16",children:B("explorer.modal.share.usersWithAccess")}),g.jsx("div",{className:"table-responsive",children:u?g.jsx(pr,{}):g.jsxs("table",{className:"table border align-middle mb-0",children:[g.jsx("thead",{className:"bg-secondary",children:g.jsxs("tr",{children:[g.jsx("th",{scope:"col",className:"w-32",children:g.jsx(fl,{children:B("explorer.modal.share.avatar.shared.alt")})}),g.jsx("th",{scope:"col",children:g.jsx(fl,{children:B("explorer.modal.share.search.placeholder")})}),m.map(K=>g.jsx("th",{scope:"col",className:"text-center text-white",children:B(K.displayName)},K.displayName)),g.jsx("th",{scope:"col",children:g.jsx(fl,{children:B("close")})})]})}),g.jsxs("tbody",{children:[x()&&g.jsxs("tr",{children:[g.jsx("th",{scope:"row",children:g.jsx(ec,{alt:B("explorer.modal.share.avatar.me.alt"),size:"xs",src:v,variant:"circle"})}),g.jsx("td",{children:B("share.me")}),m.map(K=>g.jsx("td",{style:{width:"80px"},className:"text-center text-white",children:g.jsx(Cm,{checked:!0,disabled:!0})},K.displayName)),g.jsx("td",{})]}),g.jsx(zhe,{showBookmark:F,shareRightActions:m,shareRights:f,onDeleteRow:w,toggleRight:_,toggleBookmark:O})]})]})}),g.jsxs("div",{className:"mt-16",children:[g.jsx(it,{color:"tertiary",leftIcon:g.jsx(NT,{}),rightIcon:g.jsx(Cp,{title:B("show"),className:"w-16 min-w-0",style:{transition:"rotate 0.2s ease-out",rotate:k?"-180deg":"0deg"}}),type:"button",variant:"ghost",className:"fw-normal",onClick:()=>$(!k),children:B("share.save.sharebookmark")}),k&&g.jsx(Bhe,{refBookmark:H,bookmark:U,onBookmarkChange:L,onSave:V})]}),g.jsx("hr",{}),g.jsxs(Ss,{headingStyle:"h4",level:"h3",className:"mb-16 d-flex align-items-center",children:[g.jsx("div",{className:"me-8",children:B("explorer.modal.share.search")}),g.jsx(co,{message:"Vos favoris de partage s’affichent en priorité dans votre liste lorsque vous recherchez un groupe ou une personne, vous pouvez les retrouver dans l’annuaire.",placement:"top",children:g.jsx(FN,{className:"c-pointer",height:"18"})})]}),g.jsx("div",{className:"row",children:g.jsx("div",{className:"col-10",children:g.jsx(hce,{value:A,placeholder:X,isLoading:P(),noResult:M(),options:E,searchMinLength:N(),onSearchInputChange:z,onSearchResultsChange:j})})}),n]}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{type:"button",color:"tertiary",variant:"ghost",onClick:s,children:B("explorer.cancel")}),g.jsx(it,{type:"button",color:"primary",variant:"filled",isLoading:h,onClick:b,disabled:h,children:B("share")})]})]}),document.getElementById("portal"))}function Khe({resourceId:t,updateResource:e}){const{appCode:r}=yt(),{t:n}=we(r),i=mA("blog",t),s=i&&i["publish-type"],[o,a]=T.useState(s??"RESTRAINT");T.useEffect(()=>{s&&a(s)},[s]);const l=async u=>{const c=u.target.value,h={description:i.description||"",entId:i.assetId,name:i.name,public:!!i.public,slug:i.slug||"",thumbnail:i.thumbnail,trashed:i.trashed,"publish-type":c};e?await e.mutateAsync(h):await Ie.resource("blog").update(h),a(c)};return g.jsxs(g.Fragment,{children:[g.jsx("hr",{}),g.jsx(Ss,{headingStyle:"h4",level:"h3",className:"mb-16",children:n("explorer.publication.steps")}),g.jsx(T2,{label:n("explorer.immediat.publication"),id:"publication-now",name:"publication",value:"IMMEDIATE",model:o,checked:o==="IMMEDIATE",onChange:l}),g.jsx(T2,{label:n("explorer.validate.publication"),id:"publication-validate",name:"publication",value:"RESTRAINT",checked:o==="RESTRAINT",model:o,onChange:l})]})}const Zhe=({application:t,options:e})=>Ro({mutationFn:async({resourceId:r,rights:n})=>await Ie.share().saveRights(t,r,n),...e}),Jhe=Zhe;function efe(t){return{getPreference:async()=>await Ie.conf().getPreference(t),savePreference:async e=>await Ie.conf().savePreference(t,JSON.stringify(e))}}function tfe(){const[t,e]=T.useState(!1),{getPreference:r,savePreference:n}=efe("rgpdCookies");return T.useEffect(()=>{(async()=>{const i=await r();e(i===null?!0:i.showInfoTip)})()},[]),{showCookiesConsent:t,handleConsultCookies:()=>{document.location.href="/userbook/mon-compte",n({showInfoTip:!1}),e(!1)},handleCloseCookiesConsent:()=>{n({showInfoTip:!1}),e(!1)}}}function S_({children:t}){return g.jsx("span",{className:"position-absolute badge rounded-pill bg-warning",children:t})}function E_({children:t,className:e,...r}){const n=Me("navbar",e);return g.jsx("nav",{className:n,...r,children:t})}function Ck({children:t,className:e,...r}){const n=Me("navbar-nav",e);return g.jsx("ul",{className:n,...r,children:t})}const yr=T.forwardRef(({children:t,className:e,...r},n)=>{const i=Me("nav-item",e);return g.jsx("li",{ref:n,className:i,...r,children:t})});function gf({link:t,className:e,children:r,translate:n,...i}){const s=Me("nav-link",e);return g.jsxs("a",{href:t,className:s,...i,children:[r,n&&g.jsx(fl,{children:g.jsx("span",{className:"nav-text",children:n})})]})}const rfe=()=>{const{t}=we();return g.jsx("div",{className:"widget-footer",children:g.jsx("div",{className:"widget-footer-action",children:g.jsx("a",{href:"/welcome",className:"link",children:t("plus")})})})},nfe=({bookmarkedApps:t})=>{const{t:e}=we();return g.jsxs("div",{className:"widget-body d-flex flex-wrap",children:[!t.length&&g.jsx("div",{className:"text-dark",children:e("navbar.myapps.more")}),t.slice(0,6).map((r,n)=>g.jsx("a",{href:r.address,className:"bookmarked-app",children:g.jsx(ga,{app:r,size:"32"})},n))]})};function Ak({isHelpOpen:t,setIsHelpOpen:e,parsedHeadline:r,parsedContent:n,error:i}){const{t:s}=we(),o=()=>{e(!1)};return t?ur.createPortal(g.jsxs(Ye,{id:"help-modal",isOpen:t,onModalClose:o,scrollable:!0,size:"lg",children:[g.jsx(Ye.Header,{onModalClose:o,children:s("navbar.help")}),g.jsx(Ye.Subtitle,{children:i?s("help.notfound.title"):r}),g.jsx(Ye.Body,{className:i?"d-flex":null,children:i?s("help.notfound.text"):n})]}),document.getElementById("portal")):null}function ife(){var t,e,r,n,i;const{appCode:s}=yt(),{theme:o}=ya(),[a,l]=T.useState(""),[u,c]=T.useState(!0),[h,f]=T.useState(!1),[m,y]=T.useState(!1),v=o!=null&&o.is1d?"/help-1d":"/help-2d";T.useEffect(()=>{(async()=>{let w="";w=v+"/application/"+s+"/",!s&&window.location.pathname!=="/adapter"?w=v+"/application/portal/":window.location.pathname==="/adapter"?w=v+"/application/"+window.location.search.split("eliot=")[1].split("&")[0]+"/":window.location.pathname.includes("/directory/class-admin")?w=v+"/application/parametrage-de-la-classe/":(window.location.pathname.includes("/userbook/mon-compte")||window.location.pathname.includes("/timeline/preferencesView")||window.location.pathname.includes("/timeline/historyView"))&&(w=v+"/application/userbook/");try{const E=await fetch(w),A=await E.text();if(E.status===404){y(!0);return}l(A),y(!1)}catch(E){y(!0),console.error(E)}})()},[s,v]);const x=Vl(a,{replace:w=>{const E=w;if(E.attribs&&E.attribs.id==="TOC")return g.jsxs("nav",{id:"TOC",children:[g.jsx(it,{onClick:()=>{c(!u)},children:g.jsx(L$,{})}),R0(E.children,{replace:A=>{const I=A;if(I.attribs&&I.name==="ul")return g.jsx("ul",{id:"TOC-list",style:{display:u?"block":"none"},children:R0(I.children,{replace:P=>{const M=P;if(M.attribs&&M.name==="a")return g.jsx("a",{...v_(M.attribs),children:g.jsx("span",{onClick:()=>{c(!1)},children:R0(M.children)})})}})})}})]});if(E.attribs&&E.attribs.class==="section level2"){const A=v_(w.attribs);return g.jsx("div",{...A,className:"section level2",style:{display:E.attribs.id!=="présentation"?"none":"block"},children:R0(E.children,{replace:I=>{const P=I;if(P.attribs&&P.name==="img"){const M=I.attribs.src;return g.jsx("img",{...v_(P.attribs),src:`${v}/${M}`,alt:""})}}})})}}}),b=(r=(e=(t=x==null?void 0:x.props)==null?void 0:t.children.find(w=>w.type==="body"))==null?void 0:e.props)==null?void 0:r.children,_=(i=(n=b==null?void 0:b.find(w=>w.type==="p"))==null?void 0:n.props)==null?void 0:i.children;return{html:a,visibility:u,isModalOpen:h,setIsModalOpen:f,parsedContent:b,parsedHeadline:_,error:m}}const sfe=()=>{const[t,e]=j6(),r=T.useRef(null),n=T.useId(),{t:i}=we();function s(){if(r.current){const o=r.current.value;window.location.href=`/searchengine#/${o}`}}return g.jsxs(yr,{id:n,ref:t,className:"position-relative","aria-haspopup":"true","aria-expanded":e,children:[g.jsxs("a",{href:"/searchengine",className:"nav-link dropdown-item",children:[g.jsx(vX,{className:"icon search"}),g.jsx("span",{className:"nav-text",children:i("navbar.search")})]}),g.jsx(r8,{id:n,isVisible:e,className:"d-none d-md-flex",children:g.jsxs(Ot,{id:"my-search-input",className:"search-text input-group py-8 px-12",children:[g.jsx(Ot.Input,{ref:r,size:"sm",type:"text",name:"my-search-input",placeholder:"Rechercher"}),g.jsx(oA,{type:"submit",size:"sm",onClick:s,"aria-label":i("navbar.search")})]})})]})},ofe=sfe,afe=({is1d:t=!1,src:e=""})=>{const{t:r}=we(),{messages:n,msgLink:i,zimbraWorkflow:s}=Bce(),{user:o,avatar:a}=_h(),{currentLanguage:l,currentApp:u}=yt(),c=Gi("org.entcore.portal.controllers.PortalController|oldHelpEnable")||!1,{isModalOpen:h,setIsModalOpen:f,parsedContent:m,parsedHeadline:y,error:v}=ife(),x=Me("header",{"no-2d":t,"no-1d":!t}),{title:b,bookmarkedApps:_,appsRef:w,isAppsHovered:E,popoverAppsId:A,userAvatar:I,userName:P,welcomeUser:M,communityWorkflow:N,conversationWorflow:z,searchWorkflow:j,isCollapsed:H,toggleCollapsedNav:F,handleLogout:L}=Uce({user:o,avatar:a}),O=n>0,{theme:U}=ya();return g.jsx("header",{className:x,children:t?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"container-fluid",children:g.jsxs(E_,{children:[g.jsx("a",{className:"navbar-title d-md-none text-truncate h4",href:u?u.address:"/timeline/timeline",children:b}),g.jsxs("div",{className:"d-none d-md-inline-flex gap-12 align-items-center",children:[g.jsx(ec,{alt:P,size:"sm",src:I,variant:"circle",width:"32",height:"32"}),g.jsx("span",{className:"navbar-text",children:M})]}),g.jsxs(Ck,{className:"gap-8","aria-hidden":"false","aria-label":r("navbar.main.navigation"),children:[z&&g.jsx(yr,{children:g.jsxs("a",{href:"/conversation/conversation",className:"nav-link",children:[g.jsx(pX,{className:"icon notification"}),O&&g.jsx(S_,{children:n}),g.jsx(fl,{children:r("navbar.messages")})]})}),g.jsx(yr,{children:g.jsx(gf,{link:"/userbook/mon-compte",className:"dropdown-item",translate:r("navbar.myaccount"),children:g.jsx(iC,{className:"icon user"})})}),l==="fr"&&c?g.jsxs(yr,{children:[g.jsxs("button",{className:"nav-link",onClick:()=>{f(!0)},children:[g.jsx(hX,{className:"icon help"}),g.jsx(fl,{children:r("navbar.help")})]}),g.jsx(Ak,{isHelpOpen:h,setIsHelpOpen:f,parsedContent:m,parsedHeadline:y,error:v})]}):null,g.jsx(yr,{children:g.jsxs("button",{className:"nav-link",onClick:L,children:[g.jsx(m3,{className:"icon logout"}),g.jsx(fl,{children:r("navbar.disconnect")})]})}),g.jsx(yr,{className:"d-md-none",children:g.jsx("button",{className:"nav-link btn btn-naked",type:"button","aria-controls":"navbarCollapsed","aria-expanded":!H,"aria-label":r("navbar.secondary.navigation"),onClick:F,children:g.jsx(Cp,{className:"icon rafter-down",width:"20",height:"20"})})})]})]})}),g.jsx(E_,{className:"no-2d navbar-secondary navbar-expand-md","aria-label":r("navbar.secondary.navigation"),children:g.jsx("div",{className:"container-fluid",children:g.jsxs("div",{className:`collapse navbar-collapse ${H?"":"show"}`,id:"navbarCollapsed",children:[g.jsx(Ek,{is1d:!0,src:`${e}/img/illustrations/logo.png`,translate:r("navbar.home")}),g.jsxs(Ck,{className:"gap-8",children:[g.jsx(yr,{children:g.jsxs("a",{href:"/timeline/timeline",className:"button",children:[g.jsx(cX,{color:"#fff",className:"d-md-none"}),g.jsx("span",{className:"d-inline-block",children:r("portal.header.navigation.whatsnew")})]})}),g.jsx(yr,{children:g.jsxs("a",{href:"/userbook/annuaire",className:"button",children:[g.jsx(xX,{color:"#fff",className:"d-md-none"}),g.jsx("span",{className:"d-inline-block",children:r("portal.header.navigation.classMembers")})]})}),g.jsx(yr,{children:g.jsxs("a",{href:"/welcome",className:"button",children:[g.jsx(g3,{color:"#fff",className:"d-md-none"}),g.jsx("span",{className:"d-inline-block",children:r("portal.header.navigation.myapps")})]})})]})]})})})]}):g.jsx(E_,{className:"navbar-expand-md",children:g.jsxs("div",{className:"container-fluid",children:[g.jsx(Ek,{src:`${e}/img/illustrations/logo.png`}),g.jsx("a",{href:u?u.address:"/timeline/timeline",className:"navbar-title text-truncate d-md-none",children:b}),g.jsxs("ul",{className:"navbar-nav",children:[g.jsx(yr,{children:g.jsx(gf,{link:"/timeline/timeline",translate:r("navbar.home"),children:g.jsx(iX,{color:"#fff"})})}),g.jsxs(yr,{className:"position-relative",ref:w,id:A,"aria-haspopup":"true","aria-expanded":E,children:[g.jsx(gf,{link:"/welcome",translate:r("navbar.applications"),children:g.jsx(g3,{color:"#fff"})}),g.jsxs(r8,{className:"top-100 widget",id:A,isVisible:E,children:[g.jsx(Rce,{children:g.jsx(nfe,{bookmarkedApps:_})}),g.jsx(Pce,{className:"widget-footer border-top border-ghost",children:g.jsx(rfe,{})})]})]}),z&&g.jsx(yr,{children:g.jsxs(gf,{className:"position-relative",link:"/conversation/conversation",translate:r("conversation"),children:[g.jsx(v3,{color:"#fff"}),O&&g.jsx(S_,{children:n})]})}),s&&g.jsx(yr,{children:g.jsxs(gf,{className:"position-relative",link:i,translate:r("conversation"),children:[g.jsx(v3,{color:"#fff"}),O&&g.jsx(S_,{children:n})]})}),l==="fr"&&c?g.jsxs(yr,{children:[g.jsxs("button",{className:"nav-link btn btn-naked",onClick:()=>{f(!0)},children:[g.jsx(aX,{color:"#fff"}),g.jsx(fl,{children:r("support")})]}),g.jsx(Ak,{isHelpOpen:h,setIsHelpOpen:f,parsedContent:m,parsedHeadline:y,error:v})]}):null,g.jsx(yr,{children:g.jsxs("div",{className:"dropdown",children:[g.jsx("button",{className:"nav-link btn btn-naked d-md-none",type:"button","aria-controls":"dropdown-navbar","aria-expanded":!H,"aria-label":r("navbar.open.menu"),onClick:F,children:g.jsx(Cp,{className:"icon rafter-down",width:"20",height:"20",color:"#fff"})}),g.jsxs("ul",{className:`dropdown-menu dropdown-menu-end ${H?"":"show"}`,id:"dropdown-navbar",children:[N&&g.jsx(yr,{children:g.jsxs("a",{href:"/community",className:"nav-link dropdown-item",children:[g.jsx(tX,{className:"icon community"}),g.jsx("span",{className:"nav-text",children:r("navbar.community")})]})}),j?g.jsx(ofe,{}):null,g.jsx(yr,{children:g.jsxs("a",{href:"/userbook/mon-compte",className:"nav-link dropdown-item",children:[g.jsx(ec,{alt:P,size:"sm",src:I,variant:"circle",className:"bg-white",width:"32",height:"32"}),g.jsx("span",{className:"nav-text",children:r("navbar.myaccount")})]})}),g.jsx(yr,{children:g.jsx("hr",{className:"dropdown-divider"})}),g.jsx(yr,{children:g.jsxs("a",{href:"/auth/logout?callback="+((U==null?void 0:U.logoutCallback)??"/"),className:"nav-link dropdown-item",children:[g.jsx(m3,{className:"icon logout"}),g.jsx("span",{id:"logout-label",className:"nav-text",children:r("navbar.disconnect")})]})})]})]})})]})]})})})},lfe=afe,ufe=({children:t,headless:e=!1,...r})=>{const{theme:n}=ya(),{t:i}=we(),{showCookiesConsent:s,handleConsultCookies:o,handleCloseCookiesConsent:a}=tfe();Jce(),ede();const l=Me("d-flex flex-column bg-white",{"container-fluid":!e,"rounded-4 border":(n==null?void 0:n.is1d)&&!e,"mt-24":(n==null?void 0:n.is1d)&&!e}),u=e?null:g.jsx(lfe,{is1d:n==null?void 0:n.is1d,src:n==null?void 0:n.basePath}),c=s&&g.jsx(Jo,{type:"info",className:"m-12 rgpd",isConfirm:!0,position:"bottom-right",button:g.jsx(it,{color:"tertiary",variant:"ghost",onClick:o,children:i("rgpd.cookies.banner.button.consult")}),onClose:a,children:i("rgpd.cookies.banner.text1")}),h=g.jsx(BG,{containerClassName:"toaster-container",toastOptions:{position:"top-right"}});return g.jsxs(g.Fragment,{children:[u,g.jsx("main",{className:l,...r,children:t}),h,c]})},cfe=ufe,dfe="modulepreload",hfe=function(t){return"/"+t},Rk={},dr=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),o=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));i=Promise.all(r.map(a=>{if(a=hfe(a),a in Rk)return;Rk[a]=!0;const l=a.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${u}`))return;const c=document.createElement("link");if(c.rel=l?"stylesheet":dfe,l||(c.as="script",c.crossOrigin=""),c.href=a,o&&c.setAttribute("nonce",o),document.head.appendChild(c),l)return new Promise((h,f)=>{c.addEventListener("load",h),c.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${a}`)))})}))}return i.then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})},ffe=t=>{let{activatorEvent:e,draggingNodeRect:r,transform:n}=t;if(r&&e){const i=Ly(e);if(!i)return n;const s=i.x-r.left,o=i.y-r.top;return{...n,x:n.x+s-r.width/2,y:n.y+o-r.height/2}}return n},pfe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},mfe=t=>{let e;const r=new Set,n=(c,h)=>{const f=typeof c=="function"?c(e):c;if(!Object.is(f,e)){const m=e;e=h??(typeof f!="object"||f===null)?f:Object.assign({},e,f),r.forEach(y=>y(e,m))}},i=()=>e,l={setState:n,getState:i,getInitialState:()=>u,subscribe:c=>(r.add(c),()=>r.delete(c)),destroy:()=>{(pfe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},u=e=t(n,i,l);return l},gfe=t=>mfe;var v8={exports:{}},y8={},x8={exports:{}},b8={};/**
1390
+ `,pk="/",mk="*",_u="",Iae="comment",Mae="declaration",kae=function(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var r=1,n=1;function i(y){var v=y.match(_ae);v&&(r+=v.length);var x=y.lastIndexOf(Pae);n=~x?y.length-x:n+y.length}function s(){var y={line:r,column:n};return function(v){return v.position=new o(y),u(),v}}function o(y){this.start=y,this.end={line:r,column:n},this.source=e.source}o.prototype.content=t;function a(y){var v=new Error(e.source+":"+r+":"+n+": "+y);if(v.reason=y,v.filename=e.source,v.line=r,v.column=n,v.source=t,!e.silent)throw v}function l(y){var v=y.exec(t);if(v){var x=v[0];return i(x),t=t.slice(x.length),v}}function u(){l(Sae)}function c(y){var v;for(y=y||[];v=h();)v!==!1&&y.push(v);return y}function h(){var y=s();if(!(pk!=t.charAt(0)||mk!=t.charAt(1))){for(var v=2;_u!=t.charAt(v)&&(mk!=t.charAt(v)||pk!=t.charAt(v+1));)++v;if(v+=2,_u===t.charAt(v-1))return a("End of comment missing");var x=t.slice(2,v-2);return n+=2,i(x),t=t.slice(v),n+=2,y({type:Iae,comment:x})}}function f(){var y=s(),v=l(Eae);if(v){if(h(),!l(Tae))return a("property missing ':'");var x=l(Cae),b=y({type:Mae,property:gk(v[0].replace(fk,_u)),value:x?gk(x[0].replace(fk,_u)):_u});return l(Aae),b}}function m(){var y=[];c(y);for(var v;v=f();)v!==!1&&(y.push(v),c(y));return y}return u(),m()};function gk(t){return t?t.replace(Rae,_u):_u}var Oae=kae;function P6(t,e){var r=null;if(!t||typeof t!="string")return r;for(var n,i=Oae(t),s=typeof e=="function",o,a,l=0,u=i.length;l<u;l++)n=i[l],o=n.property,a=n.value,s?e(o,a,n):a&&(r||(r={}),r[o]=a);return r}iA.exports=P6;iA.exports.default=P6;var Dae=iA.exports,Q1={};Q1.__esModule=!0;Q1.camelCase=void 0;var Nae=/^--[a-zA-Z0-9-]+$/,Lae=/-([a-z])/g,Fae=/^[^-]+$/,jae=/^-(webkit|moz|ms|o|khtml)-/,Bae=/^-(ms)-/,Uae=function(t){return!t||Fae.test(t)||Nae.test(t)},$ae=function(t,e){return e.toUpperCase()},vk=function(t,e){return"".concat(e,"-")},zae=function(t,e){return e===void 0&&(e={}),Uae(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(Bae,vk):t=t.replace(jae,vk),t.replace(Lae,$ae))};Q1.camelCase=zae;(function(t){var e=rr&&rr.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};t.__esModule=!0;var r=e(Dae),n=Q1;function i(s,o){var a={};return!s||typeof s!="string"||(0,r.default)(s,function(l,u){l&&u&&(a[(0,n.camelCase)(l,o)]=u)}),a}t.default=i})(R6);var Hae=T,Vae=R6.default;function Gae(t,e){if(!t||typeof t!="object")throw new TypeError("First argument must be an object");var r=typeof e=="function",n={},i={};for(var s in t){var o=t[s];if(r&&(n=e(s,o),n&&n.length===2)){i[n[0]]=n[1];continue}typeof o=="string"&&(i[o]=s)}return i}var Wae=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function Xae(t,e){return t.indexOf("-")===-1?e&&typeof e.is=="string":!Wae.has(t)}var qae={reactCompat:!0};function Yae(t,e){if(t!=null)try{e.style=Vae(t,qae)}catch{e.style={}}}var Qae=Hae.version.split(".")[0]>=16,I6=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);function Kae(t){return!I6.has(t.name)}function Zae(t){return t}var M6={PRESERVE_CUSTOM_ATTRIBUTES:Qae,ELEMENTS_WITH_NO_TEXT_CHILDREN:I6,invertObject:Gae,isCustomComponent:Xae,setStyleProp:Yae,canTextBeChildOfNode:Kae,returnFirstArg:Zae},kf=Ki,yk=M6,Jae=["checked","value"],ele=["input","select","textarea"],tle={reset:!0,submit:!0},k6=function(e,r){e=e||{};var n,i,s,o,a,l={},u=e.type&&tle[e.type];for(n in e){if(s=e[n],kf.isCustomAttribute(n)){l[n]=s;continue}if(i=n.toLowerCase(),o=xk(i),o){switch(a=kf.getPropertyInfo(o),Jae.indexOf(o)!==-1&&ele.indexOf(r)!==-1&&!u&&(o=xk("default"+i)),l[o]=s,a&&a.type){case kf.BOOLEAN:l[o]=!0;break;case kf.OVERLOADED_BOOLEAN:s===""&&(l[o]=!0);break}continue}yk.PRESERVE_CUSTOM_ATTRIBUTES&&(l[n]=s)}return yk.setStyleProp(e.style,l),l};function xk(t){return kf.possibleStandardNames[t]}var rle=T,nle=k6,Zp=M6,ile=Zp.setStyleProp,sle=Zp.canTextBeChildOfNode;function O6(t,e){e=e||{};for(var r=e.library||rle,n=r.cloneElement,i=r.createElement,s=r.isValidElement,o=[],a,l,u=typeof e.replace=="function",c=e.transform||Zp.returnFirstArg,h,f,m,y=e.trim,v=0,x=t.length;v<x;v++){if(a=t[v],u&&(h=e.replace(a),s(h))){x>1&&(h=n(h,{key:h.key||v})),o.push(c(h,a,v));continue}if(a.type==="text"){if(l=!a.data.trim().length,l&&a.parent&&!sle(a.parent)||y&&l)continue;o.push(c(a.data,a,v));continue}switch(f=a.attribs,ole(a)?ile(f.style,f):f&&(f=nle(f,a.name)),m=null,a.type){case"script":case"style":a.children[0]&&(f.dangerouslySetInnerHTML={__html:a.children[0].data});break;case"tag":a.name==="textarea"&&a.children[0]?f.defaultValue=a.children[0].data:a.children&&a.children.length&&(m=O6(a.children,e));break;default:continue}x>1&&(f.key=v),o.push(c(i(a.name,f,m),a,v))}return o.length===1?o[0]:o}function ole(t){return Zp.PRESERVE_CUSTOM_ATTRIBUTES&&t.type==="tag"&&Zp.isCustomComponent(t.name,t.attribs)}var ale=O6,K1=YC,cd=sae,lle=k6,D6=ale;cd=typeof cd.default=="function"?cd.default:cd;var ule={lowerCaseAttributeNames:!1};function Eo(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");return t===""?[]:(e=e||{},D6(cd(t,e.htmlparser2||ule),e))}Eo.domToReact=D6;Eo.htmlToDOM=cd;Eo.attributesToProps=lle;Eo.Comment=K1.Comment;Eo.Element=K1.Element;Eo.ProcessingInstruction=K1.ProcessingInstruction;Eo.Text=K1.Text;var cle=Eo;Eo.default=Eo;const Vl=Co(cle);var R0=Vl.domToReact;Vl.htmlToDOM;var v_=Vl.attributesToProps;Vl.Comment;Vl.Element;Vl.ProcessingInstruction;Vl.Text;var dle=Object.defineProperty,hle=(t,e,r)=>e in t?dle(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pf=(t,e,r)=>(hle(t,typeof e!="symbol"?e+"":e,r),r);const fle=async t=>await Ie.conf().getPreference(t),ple=async t=>await Ie.conf().savePreference(t,JSON.stringify({key:!1})),mle=t=>{const[e,r]=T.useState(!0),[n,i]=T.useState(!1);return T.useEffect(()=>{(async()=>{const s=await fle(t);if(s){const{key:o}=s;i(o);return}i(!0)})()},[t]),{isOpen:e,setIsOpen:r,isOnboarding:n,handleSavePreference:async()=>{await ple(t),r(!1)}}},gle=({id:t,items:e,modalOptions:r})=>{const[n]=Pn(),[i,s]=T.useState(),[o,a]=T.useState(0),{isOpen:l,isOnboarding:u,setIsOpen:c,handleSavePreference:h}=mle(t);T.useEffect(()=>{const b=document.createElement("link");return b.href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",b.rel="stylesheet",b.type="text/css",document.head.appendChild(b),()=>{document.head.removeChild(b)}},[]);const{t:f}=we(),{title:m,prevText:y,closeText:v,nextText:x}=r;return u?ur.createPortal(g.jsxs(Ye,{id:"onboarding-modal",size:"md",isOpen:l,focusId:"nextButtonId",onModalClose:()=>c(!1),children:[g.jsx(Ye.Header,{onModalClose:()=>c(!1),children:f(m||"explorer.modal.onboarding.trash.title")}),g.jsx(Ye.Body,{children:g.jsx(i6,{modules:[sse],onSwiper:b=>{s(b)},onSlideChange:b=>{a(b.progress)},pagination:{clickable:!0},children:e.map((b,_)=>g.jsxs(s6,{children:[g.jsx(yo,{width:"270",height:"140",className:"mx-auto my-12",loading:"lazy",src:`${n}/${b.src}`,alt:f(b.alt)}),g.jsx("p",{children:f(b.text)})]},_))})}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{type:"button",color:"tertiary",variant:"ghost",onClick:()=>c(!1),children:f("explorer.modal.onboarding.trash.later")}),o>0&&g.jsx(it,{type:"button",color:"primary",variant:"outline",onClick:()=>i.slidePrev(),children:f(y||"explorer.modal.onboarding.trash.prev")}),o<1&&g.jsx(it,{id:"nextButtonId",type:"button",color:"primary",variant:"filled",onClick:()=>i.slideNext(),children:f(x||"explorer.modal.onboarding.trash.next")}),o===1&&g.jsx(it,{type:"button",color:"primary",variant:"filled",onClick:h,children:f(v||"explorer.modal.onboarding.trash.close")})]})]}),document.getElementById("portal")):null},vle=gle,N6=T.createContext(null),wh=()=>{const t=T.useContext(N6);if(!t)throw new Error("Cannot be rendered outside the Dropdown Component");return t},yle=T.forwardRef(({label:t,disabled:e=!1,checked:r=!1,indeterminate:n=!1,...i},s)=>{const o=T.useRef(null);T.useImperativeHandle(s,()=>({...o.current})),T.useEffect(()=>{o.current.indeterminate=n},[o,n]);const a=T.useId(),l={type:"checkbox",checked:r,disabled:e,ref:o,className:Me(i.className,"form-check-input c-pointer"),id:a},u={...i,...l};return g.jsxs("div",{className:"form-check d-flex align-items-center gap-8",children:[g.jsx("input",{...u}),t&&g.jsx("label",{className:"form-check-label",htmlFor:u.id,children:t})]})}),Cm=yle,xle=({children:t,value:e,model:r,onChange:n})=>{const{itemProps:i,itemRefs:s,isFocused:o}=wh(),{onMenuItemKeyDown:a,onMenuItemMouseEnter:l}=i,u=T.useId(),c=r.includes(e),h={value:e,model:r,checked:c,readOnly:!0},f=Me("dropdown-item c-pointer",{focus:o===u});return g.jsx("div",{id:u,ref:m=>s.current[u]=m,role:"menuitemcheckbox","aria-checked":c,onMouseUp:()=>n(e),onKeyDown:m=>a(m,()=>n(e)),onMouseEnter:l,tabIndex:c?0:-1,className:f,children:g.jsxs("div",{className:"d-flex gap-8 align-items-center justify-content-between position-relative",children:[t,g.jsx(Cm,{...h})]})})},ble=xle,wle=({type:t="action",icon:e,onClick:r,children:n,className:i,...s})=>{const{itemProps:o,itemRefs:a,isFocused:l}=wh(),{onMenuItemKeyDown:u,onMenuItemMouseEnter:c,onMenuItemClick:h}=o,f=v=>{r==null||r(v),t==="action"&&(h(),v.stopPropagation())},m=T.useId(),y=Me("dropdown-item",{focus:l===m},i);return g.jsx("div",{id:m,role:"menuitem",ref:v=>a.current[m]=v,tabIndex:l===m?0:-1,className:y,"aria-current":l===m,onClick:f,onMouseEnter:c,onKeyDown:v=>u(v,r),...s,children:g.jsxs("div",{className:"d-flex gap-8 align-items-center",children:[e,n]})})},_le=wle,Sle=T.forwardRef(({children:t,block:e,unstyled:r,...n},i)=>{const{menuProps:s,visible:o}=wh(),a=Me({"w-100":e,"bg-white shadow rounded-4 p-8":!r},s.className,n.className),l={...s,...n,className:a};return o?g.jsx("div",{ref:i,...l,children:t}):null}),Ele=Sle,Tle=T.forwardRef(({label:t,children:e},r)=>g.jsxs("div",{ref:r,role:"group",children:[g.jsx("span",{className:"small px-4",children:g.jsx("strong",{children:t})}),e]})),Cle=Tle,Ale=T.forwardRef(({model:t,icon:e,label:r=!1,disabled:n=!1,checked:i,...s},o)=>{const a=T.useId(),l={type:"radio",checked:i,disabled:n,ref:o,className:Me(s.className,"form-check-input c-pointer",e&&"d-none"),id:a},u={...s,...l};return g.jsxs("div",{className:Me("form-check d-flex align-items-center gap-8",e&&"ps-0"),children:[g.jsx("input",{...u}),e&&g.jsx("label",{htmlFor:u.id,className:Me("c-pointer",t!==s.value&&"text-muted"),children:e}),!e&&r&&g.jsx("label",{className:"form-check-label",htmlFor:u.id,children:r})]})}),T2=Ale,Rle=({children:t,value:e,model:r,onChange:n})=>{const{itemProps:i,itemRefs:s,isFocused:o}=wh(),{onMenuItemKeyDown:a,onMenuItemMouseEnter:l}=i,u=T.useId(),c={value:e,model:r,checked:e===r,readOnly:!0},h=Me("dropdown-item c-pointer",{focus:o===u});return g.jsx("div",{id:u,ref:f=>s.current[u]=f,role:"menuitemradio","aria-checked":e===r,onMouseUp:()=>n(e),onKeyDown:f=>a(f,()=>n(e)),onMouseEnter:l,tabIndex:e===r?0:-1,className:h,children:g.jsxs("div",{className:"d-flex gap-8 align-items-center justify-content-between position-relative",children:[t,g.jsx(T2,{...c,className:"position-absolute start-0 end-0 top-0 bottom-0 opacity-0"})]})})},Ple=Rle,Ile=()=>g.jsx("div",{role:"separator",className:"px-4",children:g.jsx("hr",{className:"m-0"})}),Mle=Ile,kle=T.forwardRef(({label:t,icon:e,variant:r,disabled:n=!1,size:i,badgeContent:s,hideCarret:o=!1,...a},l)=>{const{triggerProps:u,block:c}=wh(),h=Me("dropdown-toggle ",i,r,{"w-100":c},u.className,a.className),f={...u,...a,className:h};return g.jsxs("button",{ref:l,type:"button",disabled:n,...f,children:[e,t,s?g.jsx("span",{className:"badge text-bg-secondary rounded-pill",children:s}):!o&&g.jsx(gz,{width:16,height:16,className:"dropdown-toggle-caret"})]})}),Ole=kle;function L6(t){var e,r,n;const i=new wX(t),s=i.getOS(),o=i.getDevice(),a=i.getBrowser(),l=((e=o.model)==null?void 0:e.indexOf("iPhone"))!=-1,u=((r=o.model)==null?void 0:r.indexOf("iPod"))!=-1,c=((n=o.model)==null?void 0:n.indexOf("iPad"))!=-1;return{os:s,device:o,browser:a,isIphone:l,isIpod:u,isIpad:c}}const bk=["mousedown","touchstart"];function F6(t,e,r){const n=T.useRef();return T.useEffect(()=>{const i=s=>{const{target:o}=s??{};if(Array.isArray(r)){const a=(o==null?void 0:o.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(o)&&o.tagName!=="HTML";r.every(l=>!!l&&!s.composedPath().includes(l))&&!a&&t()}else n.current&&!n.current.contains(o)&&t()};return bk.forEach(s=>{document.addEventListener(s,i)}),()=>{bk.forEach(s=>{document.removeEventListener(s,i)})}},[n,t,r,e]),n}function sA(t,e){const[r,n]=T.useState(t);return T.useEffect(()=>{const i=setTimeout(()=>{n(t)},e||500);return()=>{clearTimeout(i)}},[t,e]),r}function C2(...t){return e=>{Dle(e,...t)}}function Dle(t,...e){e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}const Nle=(t,e,r=!1)=>{const n=T.useId(),[i,s]=T.useState(!1),[o,a]=T.useState(-1),[l,u]=T.useState(null),{refs:c,floatingStyles:h,context:f}=YH({placement:t,open:i,onOpenChange:s,whileElementsMounted:CH,middleware:[kH(4),DH({apply({rects:j,elements:H}){H.floating.style.minWidth=`${j.reference.width}px`}}),OH({padding:0})]});VH(f,{enabled:r,delay:{open:200},handleClose:KH()});const m=T.useRef(null),y=T.useRef(null),v=T.useRef({});T.useEffect(()=>{i?m.current&&(m.current.focus(),a(0)):(a(-1),v.current={})},[i]),T.useEffect(()=>{if(o!==-1){const j=Object.values(v.current)[o];if(j){const H=j.getAttribute("id");u(H),j.focus()}}},[o]);const x=()=>{const j=Object.values(v.current).length;a(H=>(H+1)%j)},b=()=>{const j=Object.values(v.current).length;a(H=>(H-1+j)%j)},_=()=>{a(0)},w=()=>{const j=Object.values(v.current).length;a(j-1)},E=T.useCallback(()=>{s(!0)},[]),A=T.useCallback(()=>{y.current&&(y.current.focus({preventScroll:!0}),s(!1))},[]),I=(j,H)=>{j&&(H.stopPropagation(),H.preventDefault())},P=T.useCallback(j=>{let H=!1;switch(j.code){case" ":case"Space":case"Enter":case"ArrowDown":case"Down":E(),H=!0;break;case"Esc":case"Escape":A(),H=!0;break;case"Up":case"ArrowUp":E(),H=!0;break}e==null||e(j),I(H,j)},[A,E]),M=j=>{const H=Object.values(v.current).findIndex(F=>F.id===j.currentTarget.getAttribute("id"));a(H)},N=T.useCallback((j,H)=>{let F=!1;if(j.shiftKey)j.key==="Tab"&&(A(),F=!0);else{switch(j.code){case"Escape":A();break;case" ":case"Enter":o!==-1&&(Object.values(v.current)[o].getAttribute("role")==="menuitem"&&y.current&&(y.current.focus(),s(!1)),H==null||H()),F=!0;break;case"ArrowDown":case"Down":x(),F=!0;break;case"ArrowUp":case"Up":b(),F=!0;break;case"Home":_(),F=!0;break;case"End":w(),F=!0;break}I(F,j)}},[o,A]),z=T.useCallback(j=>{s(i!==!0),j.stopPropagation(),j.preventDefault()},[i]);return{isFocused:l,visible:i,itemRefs:v,triggerRef:y,menuRef:m,triggerProps:{ref:C2(y,c.setReference),id:`dropdown-toggle-${n}`,"aria-haspopup":"menu","aria-controls":`dropdown-${n}`,"aria-expanded":!!i,className:`${i?"selected":""}`,onClick:z,onKeyDown:P,"aria-activedescendant":l},menuProps:{ref:C2(m,c.setFloating),className:"dropdown-menu","aria-labelledby":`dropdown-toggle-${n}`,style:{...h}},itemProps:{onMenuItemMouseEnter:M,onMenuItemClick:A,onMenuItemKeyDown:N},setVisible:s}},Lle=Nle,Fle=t=>{const[e,r]=T.useState(!1),[n,i]=T.useState([]),s=T.useRef(null),o=v=>{c([v])},a=v=>{i(x=>x.filter(b=>b.name!==v.name))},l=(v,x)=>{i(b=>{if(0<=v&&v<b.length){const _=b.slice(0,v),w=v===b.length-1?[]:b.slice(v+1);return[..._,x,...w]}return b})},u=v=>{var x;let b=v;if((x=s.current)!=null&&x.accept){const _=s.current.accept.split(",").map(A=>A.trim().toLowerCase()),w=_.filter(A=>A.startsWith(".")),E=_.filter(A=>!A.startsWith(".")).map(A=>A.replace("*",""));b=[],v.forEach(A=>{const I=A.name.toLowerCase();(w.some(P=>I.endsWith(P))||E.some(P=>A.type.includes(P)))&&b.push(A)})}return b},c=v=>{if(t!=null&&t.forceFilters){const x=u(v);x&&x.length&&i(b=>[...b,...x])}else i(x=>[...x,...v])},h=()=>{i([])},f=v=>{const x=v.target.files;x&&c([...x])},m=v=>{v.preventDefault(),v.stopPropagation(),r(!0)},y=v=>{v.preventDefault(),v.stopPropagation(),r(!1)};return{inputRef:s,files:n,dragging:e,handleDragging:m,handleDragLeave:y,handleDrop:v=>{var x;y(v);const b=(x=v.dataTransfer)==null?void 0:x.files;b&&(c([...b]),s!=null&&s.current&&(s.current.files=b))},replaceFileAt:l,deleteFile:a,addFile:o,addFiles:c,cleanFiles:h,handleOnChange:f}},jle=Fle;function j6(){const[t,e]=T.useState(!1),r=T.useRef(null),n=()=>{e(!0)},i=()=>{e(!1)};return T.useEffect(()=>{const s=r.current;if(s)return s.addEventListener("mouseover",n),s.addEventListener("mouseout",i),()=>{s.removeEventListener("mouseover",n),s.removeEventListener("mouseout",i)}},[r]),[r,t]}function Ble(t,e){const r=T.useCallback(({code:n})=>{e.includes(n)&&t()},[t,e]);T.useEffect(()=>(window.addEventListener("keydown",r),()=>{window.removeEventListener("keydown",r)}),[r])}function B6(){const t=document.querySelector("html");return()=>{t&&t.scrollIntoView()}}const Ule=T.forwardRef(({icon:t,className:e,...r},n)=>{const i={...r,className:Me("btn-icon btn-sm",e)};return g.jsx(it,{ref:n,...i,children:t})}),To=Ule,$le=T.forwardRef(({icon:t=g.jsx(RS,{}),onClick:e,className:r,...n},i)=>{const s=Me("btn-search",r);return g.jsx(To,{ref:i,className:s,icon:t,onClick:e,...n})}),oA=$le,zle=T.forwardRef(({type:t="success",className:e="",children:r,button:n,isDismissible:i=!1,isToast:s=!1,isConfirm:o=!1,position:a="none",autoClose:l=!1,autoCloseDelay:u=3e3,onClose:c,onVisibilityChange:h},f)=>{const[m,y]=T.useState(!0),v=T.useRef(null),{t:x}=we(),b=T.useCallback(()=>{y(!1),c==null||c()},[c]);T.useImperativeHandle(f,()=>({show:_,hide:b,...v.current})),T.useLayoutEffect(()=>{h==null||h(m)},[m,h]),T.useEffect(()=>{l&&m&&setTimeout(()=>{b()},u)},[l,u,b,m]);const _=()=>{y(!0)},w={success:{icon:g.jsx(VN,{}),classModifier:"alert-success"},warning:{icon:g.jsx(A$,{}),classModifier:"alert-warning"},info:{icon:g.jsx(FN,{}),classModifier:"alert-info"},danger:{icon:g.jsx(Y$,{}),classModifier:"alert-danger"}},E={"is-dismissible":i,"is-toast ":s},A={"is-confirm":o},I=Me("alert gap-12",w[t].classModifier,E,A,a,e);return g.jsx(g.Fragment,{children:m?g.jsxs("div",{ref:v,className:I,role:"alert",children:[!o&&w[t].icon,g.jsx("div",{className:"alert-content small",children:r}),n&&g.jsxs("div",{className:"ms-12",children:[n," ",o&&g.jsx(it,{onClick:b,children:x("close")})]}),(i||o)&&g.jsx("div",{className:"btn-close-container",children:g.jsx("button",{type:"button",className:"btn-close","data-bs-dismiss":"alert","aria-label":x("close"),onClick:b})}),l&&g.jsx("div",{className:"alert-progress",style:{transform:"scaleX(0)"}})]}):null})}),Jo=zle,P0="top-right";function Jr(){return{success:(t,e)=>ou.custom(g.jsx(Jo,{type:"success",isToast:!0,isDismissible:e==null?void 0:e.isDismissible,className:"mb-12",children:t}),{id:e==null?void 0:e.id,duration:e==null?void 0:e.duration,position:(e==null?void 0:e.position)??P0}),error:(t,e)=>ou.custom(g.jsx(Jo,{type:"danger",isToast:!0,isDismissible:e==null?void 0:e.isDismissible,className:"mb-12",children:t}),{id:e==null?void 0:e.id,duration:e==null?void 0:e.duration,position:(e==null?void 0:e.position)??P0}),info:(t,e)=>ou.custom(g.jsx(Jo,{type:"info",isToast:!0,isDismissible:e==null?void 0:e.isDismissible,className:"mb-12",children:t}),{id:e==null?void 0:e.id,duration:e==null?void 0:e.duration,position:(e==null?void 0:e.position)??P0}),warning:(t,e)=>ou.custom(g.jsx(Jo,{type:"warning",isToast:!0,isDismissible:e==null?void 0:e.isDismissible,className:"mb-12",children:t}),{id:e==null?void 0:e.id,duration:e==null?void 0:e.duration,position:(e==null?void 0:e.position)??P0}),loading:ou.loading,dismiss:t=>ou.dismiss(t),remove:t=>ou.remove(t)}}function Am(t=!1){const[e,r]=T.useState(t),n=T.useCallback(()=>{r(i=>!i)},[]);return[e,n]}function Hle(){const t=T.useRef(null),e='button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';return T.useEffect(()=>{const r=t.current,n=r.querySelectorAll(e)[0],i=r.querySelectorAll(e),s=t&&(i==null?void 0:i[i.length-1]),o=a=>{a.key==="Tab"&&(a.shiftKey?document.activeElement===n&&(s.focus(),a.preventDefault()):document.activeElement===s&&(n.focus(),a.preventDefault()))};if(r)return r.addEventListener("keydown",o),()=>{r.removeEventListener("keydown",o)}},[]),t}const Vle=({children:t,block:e,overflow:r=!0,placement:n="bottom-start",extraTriggerKeyDownHandler:i,onToggle:s,isTriggerHovered:o=!1})=>{const{visible:a,isFocused:l,triggerProps:u,menuProps:c,itemProps:h,itemRefs:f,setVisible:m}=Lle(n,i,o),y=F6(()=>{m(!1)}),v=T.useMemo(()=>({visible:a,isFocused:l,triggerProps:u,menuProps:c,itemProps:h,itemRefs:f,block:e,setVisible:m}),[a,l,u,c,h,f,e,m]),x=Me("dropdown",{"w-100":e,overflow:r});return T.useEffect(()=>{s==null||s(a)},[a]),g.jsx(N6.Provider,{value:v,children:g.jsx("div",{ref:y,className:x,children:typeof t=="function"?t(u,f,m):t})})},Gle=Object.assign(Vle,{Trigger:Ole,Menu:Ele,Item:_le,Separator:Mle,CheckboxItem:ble,RadioItem:Ple,MenuGroup:Cle}),xt=Gle,Wle=()=>{const{t}=we();return[{value:"bpr.activityType.classroomActivity",label:t("bpr.activityType.classroomActivity")},{value:"bpr.activityType.groupActivity",label:t("bpr.activityType.groupActivity")},{value:"bpr.activityType.personalActivity",label:t("bpr.activityType.personalActivity")},{value:"bpr.activityType.homework",label:t("bpr.activityType.homework")},{value:"bpr.activityType.exercize",label:t("bpr.activityType.exercize")},{value:"bpr.activityType.learningPath",label:t("bpr.activityType.learningPath")},{value:"bpr.activityType.courseElement",label:t("bpr.activityType.courseElement")},{value:"bpr.other",label:t("bpr.other")}]},Xle=({control:t,selectedActivities:e,selectActivities:r})=>{const n=Wle(),{t:i}=we();return g.jsx("div",{className:"col d-flex",children:g.jsx(l1,{name:"activityType",control:t,rules:{required:!0},render:({field:{onChange:s}})=>g.jsxs(xt,{block:!0,overflow:!0,children:[g.jsx(xt.Trigger,{size:"md",label:i("bpr.form.publication.type"),badgeContent:e==null?void 0:e.length}),g.jsx(xt.Menu,{children:n.map((o,a)=>g.jsx(xt.CheckboxItem,{value:o.value,model:e,onChange:()=>{r(o.value),s(o.value)},children:o.label},a))})]})})})},qle=t=>g.jsx(xt.Trigger,{...t,"aria-haspopup":"listbox",role:"combobox"}),Yle=qle,Qle=({icon:t,options:e,overflow:r,block:n,variant:i,size:s,disabled:o,placeholderOption:a,onValueChange:l})=>{const[u,c]=T.useState(),{t:h}=we();T.useEffect(()=>{if(u){const y=typeof u=="object"?u.value:u;l==null||l(y)}},[u]);const f=typeof u=="object"?u.label:u,m=typeof u=="object"?u.icon:void 0;return g.jsxs(xt,{overflow:r,block:n,children:[g.jsx(Yle,{icon:m||t,label:h(f||a),variant:i,size:s,disabled:o}),g.jsx(xt.Menu,{role:"listbox",children:e==null?void 0:e.map(y=>{const v=typeof y=="object"?y.value:y,x=typeof y=="object"?y.label:y,b=typeof y=="object"?y.icon:void 0;return g.jsx(xt.Item,{type:"action",onClick:()=>c(y),icon:b,children:x},v)})})]})},aA=Qle,Kle=["3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"],wk=({name:t,control:e,placeholderOption:r,validate:n})=>g.jsx(l1,{name:t,control:e,rules:{required:!0,validate:n},render:({field:{onChange:i}})=>g.jsx(aA,{block:!0,size:"md",onValueChange:i,options:Kle,"aria-required":!0,placeholderOption:r})}),Zle=()=>{const{t}=we();return[{value:"de_DE",label:t("de_DE")},{value:"en_EN",label:t("en_EN")},{value:"ar_DZ",label:t("ar_DZ")},{value:"es_ES",label:t("es_ES")},{value:"fr_FR",label:t("fr_FR")},{value:"it_IT",label:t("it_IT")},{value:"ja_JP",label:t("ja_JP")},{value:"zh_CN",label:t("zh_CN")},{value:"pt_PT",label:t("pt_PT")},{value:"ru_RU",label:t("ru_RU")},{value:"bpr.other",label:t("bpr.other")}]},Jle="bpr.form.publication.language",eue=({control:t})=>{const e=Zle();return g.jsx("div",{className:"col",children:g.jsx(l1,{name:"language",control:t,rules:{required:!0},render:({field:{onChange:r}})=>g.jsx(aA,{block:!0,size:"md",onValueChange:r,options:e,"aria-required":!0,placeholderOption:Jle})})})},tue=()=>{const{t}=we(),[e]=Pn();return g.jsxs(g.Fragment,{children:[g.jsxs("ul",{className:"mb-12",children:[g.jsxs("li",{children:[t("bpr.form.publication.licence.text.1"),g.jsx("img",{className:"ms-8 d-inline-block",src:`${e}/common/image-creative-commons.png`,alt:"licence creative commons"})]}),g.jsx("li",{children:t("bpr.form.publication.licence.text.2")})]}),g.jsx(Jo,{type:"info",className:"mb-12",children:t("bpr.form.publication.licence.text.3")}),g.jsx(Jo,{type:"warning",children:t("bpr.form.publication.licence.text.4")})]})},rue=()=>{const{t}=we();return[{value:"bpr.subjectArea.artActivity",label:t("bpr.subjectArea.artActivity")},{value:"bpr.subjectArea.readLearning",label:t("bpr.subjectArea.readLearning")},{value:"bpr.subjectArea.chemistry",label:t("bpr.subjectArea.chemistry")},{value:"bpr.subjectArea.law",label:t("bpr.subjectArea.law")},{value:"bpr.subjectArea.worldDiscovery",label:t("bpr.subjectArea.worldDiscovery")},{value:"bpr.subjectArea.economy",label:t("bpr.subjectArea.economy")},{value:"bpr.subjectArea.mediaEducation",label:t("bpr.subjectArea.mediaEducation")},{value:"bpr.subjectArea.musicEducation",label:t("bpr.subjectArea.musicEducation")},{value:"bpr.subjectArea.sportEducation",label:t("bpr.subjectArea.sportEducation")},{value:"bpr.subjectArea.citizenshipEducation",label:t("bpr.subjectArea.citizenshipEducation")},{value:"bpr.subjectArea.geography",label:t("bpr.subjectArea.geography")},{value:"bpr.subjectArea.history",label:t("bpr.subjectArea.history")},{value:"bpr.subjectArea.artHistory",label:t("bpr.subjectArea.artHistory")},{value:"bpr.subjectArea.ComputerScience",label:t("bpr.subjectArea.ComputerScience")},{value:"bpr.subjectArea.languages",label:t("bpr.subjectArea.languages")},{value:"bpr.subjectArea.italian",label:t("bpr.subjectArea.italian")},{value:"bpr.subjectArea.spanish",label:t("bpr.subjectArea.spanish")},{value:"bpr.subjectArea.french",label:t("bpr.subjectArea.french")},{value:"bpr.subjectArea.german",label:t("bpr.subjectArea.german")},{value:"bpr.subjectArea.english",label:t("bpr.subjectArea.english")},{value:"bpr.subjectArea.ancientLanguages",label:t("bpr.subjectArea.ancientLanguages")},{value:"bpr.subjectArea.literature",label:t("bpr.subjectArea.literature")},{value:"bpr.subjectArea.mathematics",label:t("bpr.subjectArea.mathematics")},{value:"bpr.subjectArea.vocationalGuidance",label:t("bpr.subjectArea.vocationalGuidance")},{value:"bpr.subjectArea.philosohppy",label:t("bpr.subjectArea.philosohppy")},{value:"bpr.subjectArea.physics",label:t("bpr.subjectArea.physics")},{value:"bpr.subjectArea.politicalSscience",label:t("bpr.subjectArea.politicalSscience")},{value:"bpr.subjectArea.sociology",label:t("bpr.subjectArea.sociology")},{value:"bpr.subjectArea.biology",label:t("bpr.subjectArea.biology")},{value:"bpr.subjectArea.geology",label:t("bpr.subjectArea.geology")},{value:"bpr.subjectArea.technology",label:t("bpr.subjectArea.technology")},{value:"bpr.subjectArea.Arabic",label:t("bpr.subjectArea.Arabic")},{value:"bpr.subjectArea.Chinese",label:t("bpr.subjectArea.Chinese")},{value:"bpr.subjectArea.NaturalSciences",label:t("bpr.subjectArea.NaturalSciences")},{value:"bpr.subjectArea.SocioEmotionalEducation",label:t("bpr.subjectArea.SocioEmotionalEducation")},{value:"bpr.other",label:t("bpr.other")}]},nue=({control:t,selectedSubjectAreas:e,selectSubjects:r})=>{const n=rue(),{t:i}=we();return g.jsx("div",{className:"col d-flex",children:g.jsx(l1,{name:"subjectArea",control:t,rules:{required:!0},render:({field:{onChange:s}})=>g.jsxs(xt,{block:!0,overflow:!0,children:[g.jsx(xt.Trigger,{size:"md",label:i("bpr.form.publication.discipline"),badgeContent:e==null?void 0:e.length}),g.jsx(xt.Menu,{children:n.map((o,a)=>g.jsx(xt.CheckboxItem,{value:o.value,model:e,onChange:()=>{r(o.value),s(o.value)},children:o.label},a))})]})})})},U6=T.createContext(null);function iue({defaultTheme:t,children:e}){var r;const{appCode:n}=yt(),i=SL({appCode:n});T.useEffect(()=>{var o,a,l,u,c,h,f,m,y,v,x;const b=document.getElementById("favicon");b.href=`${(a=(o=i==null?void 0:i.data)==null?void 0:o.theme)==null?void 0:a.basePath}/img/illustrations/favicon.ico`;const _=(c=(u=(l=i==null?void 0:i.data)==null?void 0:l.theme)==null?void 0:u.bootstrapVersion)==null?void 0:c.split("-"),w=_?_[_.length-1]:void 0;[{data:"data-skin",value:(f=(h=i==null?void 0:i.data)==null?void 0:h.theme)==null?void 0:f.skinName},{data:"data-theme",value:((y=(m=i==null?void 0:i.data)==null?void 0:m.theme)==null?void 0:y.npmTheme)??((x=(v=i==null?void 0:i.data)==null?void 0:v.theme)==null?void 0:x.themeName)},{data:"data-product",value:t==="none"?"":t??w}].forEach(E=>{var A;return(A=document.querySelector("html"))==null?void 0:A.setAttribute(E.data,E.value)})},[i==null?void 0:i.data,t]);const s=T.useMemo(()=>{var o;return{theme:(o=i==null?void 0:i.data)==null?void 0:o.theme}},[(r=i==null?void 0:i.data)==null?void 0:r.theme]);return g.jsx(U6.Provider,{value:s,children:e})}function ya(){const t=T.useContext(U6);if(!t)throw new Error("Cannot be used outside of OdeClientProvider");return t}const sue=T.forwardRef(({children:t},e)=>g.jsx("div",{ref:e,className:"actionbar",children:t})),oue=sue,aue=T.forwardRef(({children:t,render:e,isFullscreen:r=!1,...n},i)=>{const s=Me("d-flex flex-wrap p-16 gap-8 border-bottom bg-white",{"justify-content-between":e,"mx-n16":!r,"z-3 top-0 start-0 end-0":r});return g.jsxs("div",{ref:i,className:s,...n,children:[t,e?g.jsx("div",{className:"d-flex align-items-center ms-auto gap-8",children:e()}):null]})}),lue=aue,uue=T.forwardRef(({app:t,size:e="24",iconFit:r="contain",variant:n="square",className:i=""},s)=>{const{isIconUrl:o,getIconCode:a}=cA(),[,l]=Pn(),u=n==="square",c=n==="rounded",h=n==="circle",f=r==="contain",m=r==="ratio",y={"icon-xs":e==="24","icon-sm":e==="40","icon-md":e==="48","icon-lg":e==="80","icon-xl":e==="160"},v={square:u,rounded:c,"rounded-circle":h},x={"icon-contain":f,"icon-ratio":m},b=typeof t=="string"?t:(t==null?void 0:t.icon)!==void 0?t.icon:"placeholder",_=typeof t!="string"&&(t==null?void 0:t.displayName)!==void 0?t.displayName:"",w=t?a(t):"",E=o(b),A=w||"placeholder";if(E){const P=Me("h-full",i);return g.jsx(yo,{src:b,alt:_,objectFit:"contain",width:e,height:e,className:P,style:{minWidth:e+"px"}})}const I=Me("app-icon",{...y,...v,...x,[`bg-light-${A}`]:A&&!f,[`color-app-${A}`]:A},i);return g.jsx("div",{className:I,style:{width:e+"px",height:e+"px"},children:g.jsx("svg",{ref:s,width:e,height:e,role:"img",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:g.jsx("use",{xlinkHref:`${l}/apps.svg#${A}`})})})}),ga=uue;function Qi(t,e){if(Array.isArray(t))for(const r of t){const n=Qi(r,e);if(n)return n}else{if(t.id===e)return t;if(t.children)for(const r of t.children){const n=Qi(r,e);if(n)return n}}}function cue(t,{parentId:e,newFolder:r}){return Rm(t,n=>{var i;if(n.id===e){const s=[...((i=n.folder)==null?void 0:i.ancestors)||[]],o=$6([...s,n.id]);return{...n,children:[...n.children||[],new lA({...r,ancestors:o})]}}else return n})}function $6(t){return t.filter((e,r)=>t.indexOf(e)===r)}function due(t,{folders:e}){return Rm(t,r=>{if(!e.includes(r.id))return r})}const z6=(t,e)=>{if(t.children)for(const r of t.children){if(r.id===e)return t;const n=z6(r,e);if(n)return n}};function A2(t,e){var r;const n=Qi(t,e);return(r=n==null?void 0:n.folder)!=null&&r.ancestors?[...(n==null?void 0:n.folder.ancestors)||[],e]:e===Tr.BIN?[Tr.BIN]:[Tr.DEFAULT]}function Rm(t,e){return H6(t,e)||t}function H6(t,e,r){var n;const i=e(t,r);if((n=i==null?void 0:i.children)!=null&&n.length){const s=[];for(const o of(i==null?void 0:i.children)||[]){const a=H6(o,e,i);a&&s.push(a)}return{...i,children:s}}return i}function hue(t,{destinationId:e,folders:r}){return Rm(t,(n,i)=>{var s,o;if(e===n.id){const a=[...((s=n.folder)==null?void 0:s.ancestors)||[]],l=$6([...a,n.id]),u=[...n.children||[]],c=((o=n.children)==null?void 0:o.map(h=>h.id))||[];for(const h of r)if(!c.includes(h)){const f=Qi(n,h);f&&u.push({...f,folder:{...f==null?void 0:f.folder,ancestors:l}})}return{...n,children:u}}else return r.includes(n.id)&&e!==(i==null?void 0:i.id)?void 0:n})}const fue=(t,e,r)=>Rm(t,n=>(n.id===r&&(n.children=e==null?void 0:e.map(i=>new lA(i))),n));function pue(t,{folderId:e,newFolder:r}){return Rm(t,n=>n.id===e?new lA(r):n)}function mue(t,e){let r=[];function n(s,o){if(s.id===e)return r=o.concat(s.id),!0;if(s.children){for(const a of s.children)if(n(a,o.concat(s.id)))return!0}return!1}function i(s){if(Array.isArray(s)){for(const o of s)if(n(o,[]))break}else n(s,[])}return i(t),r}class lA{constructor(e){pf(this,"id"),pf(this,"name"),pf(this,"childNumber"),pf(this,"section",!1),pf(this,"children",[]),this.folder=e,this.id=e.id,this.name=e.name,this.childNumber=e.childNumber}}const gue=T.createContext(null);function V6(){return T.useContext(gue)}class _k{static isLocalURL(e){return e.length>0&&e.charAt(0)==="/"}static startWithHttp(e){return/^https?:\/\//gi.test(e)}static toCounter(e){return e>999?`${Number(e/1e3).toFixed(1)} k`:""+e}}function vue(t){const e=new Date().getTime(),r=t.includes("?")?"&":"?";return`${t}${r}timestamp=${e}`}const mf=(t,e)=>{const r="virtualID";if(!Object.hasOwnProperty.apply(t,[r])){const n=e??`${NB.generateVirtualId()}#${t.size}`;Object.defineProperty(t,r,{value:n,writable:!1})}return t[r]};function G6(t,e){if(e(t))return t;if(Array.isArray(t.children))for(const r of t.children){const n=G6(r,e);if(n)return n}}const Hy=(t,e)=>{const r=e==null?void 0:e.filter(n=>n.id===t&&n.available);return r&&r.length>0},W6={blog:"Blog",mindmap:"MindMap",scrapbook:"ScrapBook",collaborativewall:"CollaborativeWall",timelinegenerator:"TimelineGenerator",wiki:"Wiki",exercizer:"Exercizer"},hl=t=>{if(t>0){let e=Math.floor(t/1e3),r=Math.floor(e/60);return e=e%60,r=r%60,Sk(r)+":"+Sk(e)}return"00:00"},Sk=t=>t.toString().padStart(2,"0"),yue=()=>MediaRecorder.isTypeSupported?["video/webm;codecs=vp9",'video/mp4; codecs="avc1.424028, mp4a.40.2"',"video/webm;codecs=vp8,opus","video/webm"].find(t=>MediaRecorder.isTypeSupported(t)?!0:(console.error(`${t} is not Supported`),!1))||"video/ogg":"video/webm;codecs=vp8,opus",X6=T.createContext({ariaLabelId:"",ariaDescriptionId:"",focusId:""}),q6=()=>{const t=T.useContext(X6);if(!t)throw new Error("Cannot be rendered outside the Modal component");return t},xue=t=>{const{ariaDescriptionId:e}=q6(),{children:r,className:n}=t,i=Me("modal-body",n);return g.jsx("div",{id:e,className:i,children:r})},bue=xue,wue=t=>g.jsx("div",{className:"modal-footer",children:t.children}),_ue=wue,Sue=t=>{const{onModalClose:e,children:r}=t,{ariaLabelId:n,focusId:i}=q6(),s=T.useRef(null),{t:o}=we();return T.useEffect(()=>{var a;i||(a=s.current)==null||a.focus()},[i]),g.jsxs("div",{className:"modal-header",children:[g.jsx("h2",{id:n,className:"modal-title",tabIndex:-1,children:r}),g.jsx(To,{ref:s,"aria-label":o("close"),color:"tertiary",icon:g.jsx(LT,{}),type:"button",variant:"ghost",title:o("close"),onClick:e,className:"btn-close"})]})},Eue=Sue,Tue=t=>g.jsx("p",{className:"modal-subtitle",children:t.children}),Cue=Tue,Aue=T.forwardRef((t,e)=>{const{id:r,isOpen:n,onModalClose:i,size:s="md",viewport:o=!1,scrollable:a=!1,focusId:l,children:u}=t,c=`aria_label_${r}`,h=`aria_desc_${r}`,f=F6(i),m=Hle();Ble(i,["Escape"]),T.useEffect(()=>{if(n&&(document.body.style.overflow="hidden",l)){const _=document.getElementById(l);_==null||_.focus()}return()=>{document.body.style.overflow=""}},[l,n]);const y=Me("modal fade",{"show d-block":n,"modal-scrollable":a,viewport:o,[`modal-${s}`]:s}),v=Me("modal-dialog"),x={ariaLabelId:c,ariaDescriptionId:h,focusId:l},b=jC(n,{from:{x:-50,opacity:0},enter:{x:0,opacity:1},leave:{x:50,opacity:0}});return g.jsx(X6.Provider,{value:x,children:b((_,w)=>g.jsxs(g.Fragment,{children:[w&&g.jsx(kl.div,{id:r,ref:e,role:"dialog","aria-modal":"true","aria-labelledby":c,"aria-describedby":h,className:y,style:_,tabIndex:-1,children:g.jsx("div",{id:`${r}_ref`,ref:E=>{f.current=E,w&&(m.current=E)},className:v,children:g.jsx("div",{className:"modal-content",children:u})})}),w&&g.jsx(kl.div,{className:"modal-backdrop fade show",style:{opacity:.65}})]}))})}),Rue=Object.assign(Aue,{Header:Eue,Subtitle:Cue,Body:bue,Footer:_ue}),Ye=Rue,Pue=({children:t,message:e,icon:r=null,placement:n="auto",...i})=>{const[s,o]=T.useState(null),[a,l]=T.useState(null),[u,c]=T.useState(null),{styles:h,attributes:f}=JW(s,a,{placement:n,modifiers:[{name:"arrow",options:{element:u}}]}),[m,y]=T.useState(!1);return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"d-inline-block position-relative z-2",ref:o,onMouseEnter:()=>{y(!0)},onMouseLeave:()=>{y(!1)},...i,children:t}),m&&e&&g.jsxs("div",{className:Me("tooltip d-block show mb-12","bs-tooltip-auto"),ref:l,style:h.popper,...f.popper,children:[g.jsxs("div",{className:"tooltip-inner shadow-hover d-flex gap-8 align-items-center",children:[r&&r,g.jsx("div",{children:e})]}),g.jsx("div",{className:"tooltip-arrow",ref:c,style:h.arrow})]})]})},co=Pue,Y6=T.createContext(null);function uA(){const t=T.useContext(Y6);if(!t)throw new Error("Tabs compound components cannot be rendered outside the Tabs component");return t}const Iue=({icon:t,label:e,id:r,order:n})=>{const{activeTab:i,setSelectedTab:s,onKeyDown:o,tabsRef:a}=uA(),{t:l}=we(),u=Me("nav-link d-inline-flex gap-8 border-0",i===r?"selected":"");return g.jsx("li",{className:"nav-item flex-shrink-0",role:"presentation",children:g.jsxs("button",{ref:c=>a.current[n]=c,type:"button",id:`tab-${r}`,className:u,onClick:()=>s(r),onKeyDown:c=>o(c),role:"tab","aria-controls":`tabpanel-${r}`,"aria-selected":i===r,tabIndex:i===r?0:-1,children:[t,g.jsx("small",{children:l(e)})]})})},Mue=Iue,kue=t=>{const{items:e,tabUnderlineLeft:r,tabUnderlineWidth:n}=uA(),{className:i,...s}=t,o=Me("position-relative flex-shrink-0 overflow-x-auto",i);return g.jsxs("div",{className:o,...s,children:[g.jsx("ul",{className:"nav nav-tabs flex-nowrap",role:"tablist",children:e.map((a,l)=>g.jsx(gv.Item,{order:l,...a},a.id))}),g.jsx("span",{className:"nav-slide",style:{left:r,width:n}})]})},Oue=kue,Due=({children:t,currentItem:e})=>{const{activeTab:r}=uA();return g.jsx("div",{className:"tab-content d-flex flex-fill w-100",children:g.jsx("div",{className:`tab-pane flex-fill w-100 fade ${r===(e==null?void 0:e.id)?"show active":""}`,id:`tabpanel-${e==null?void 0:e.id}`,role:"tabpanel","aria-labelledby":`tab-${e==null?void 0:e.id}`,tabIndex:0,children:t})})},Nue=Due,lh=({defaultId:t,items:e,onChange:r,children:n})=>{const[i,s]=T.useState(t||""),[o,a]=T.useState(0),[l,u]=T.useState(0),c=T.useRef([]),h=T.useCallback(b=>{s(b)},[]);T.useEffect(()=>{const b=e.find(_=>_.id===i);b&&(r==null||r(b))},[i]),T.useEffect(()=>{function b(){var _;if(((_=document==null?void 0:document.activeElement)==null?void 0:_.tagName)!=="INPUT"){const w=e.findIndex(A=>A.id===i);w===-1&&t&&s(t);const E=c.current[w];E&&(E.focus(),u((E==null?void 0:E.offsetLeft)??0),a((E==null?void 0:E.clientWidth)??0))}}return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[i,e,t]);const f=T.useCallback(b=>{var _,w,E;const A=e.findIndex(I=>I.id===b);b===((_=e[0])==null?void 0:_.id)?s((w=e[e.length-1])==null?void 0:w.id):s((E=e[A-1])==null?void 0:E.id)},[e]),m=T.useCallback(b=>{var _,w,E;const A=e.findIndex(I=>I.id===b);b===((_=e[e.length-1])==null?void 0:_.id)?s((w=e[0])==null?void 0:w.id):s((E=e[A+1])==null?void 0:E.id)},[e]),y=T.useCallback(b=>{var _,w;switch(b.code){case"ArrowLeft":f(i);break;case"ArrowRight":m(i);break;case"Home":s((_=e[0])==null?void 0:_.id);break;case"End":s((w=e[e.length-1])==null?void 0:w.id);break}},[i,e,m,f]),v=T.useMemo(()=>({activeTab:i,items:e,setSelectedTab:h,tabsRef:c,tabUnderlineLeft:l,tabUnderlineWidth:o,onKeyDown:y}),[i,e,y,h,l,o]),x=e.find(b=>b.id===i);return g.jsx(Y6.Provider,{value:v,children:typeof n=="function"?n(x):g.jsxs(g.Fragment,{children:[g.jsx(lh.List,{}),g.jsx(lh.Panel,{currentItem:x,children:x==null?void 0:x.content})]})})};lh.Item=Mue;lh.Panel=Nue;lh.List=Oue;const gv=lh,Lue=T.forwardRef(({children:t,className:e,...r},n)=>{const i=Me("breadcrumb-item",e);return g.jsx("li",{ref:n,className:i,...r,children:t})}),I0=Lue,Fue=T.forwardRef(({children:t,className:e},r)=>{const n=Me("breadcrumb d-flex flex-nowrap align-items-center mb-0",e);return g.jsx("ol",{ref:r,className:n,children:t})}),jue=Fue;function cA(){const t={"last-infos-widget":"ic-widget-actualites",birthday:"ic-star","calendar-widget":"ic-widget-calendar","carnet-de-bord":"ic-widget-carnet-de-bord","record-me":"ic-widget-microphone",mood:"ic-star","my-apps":"ic-widget-apps",notes:"ic-widget-notes","rss-widget":"ic-widget-rss","bookmark-widget":"ic-widget-signets",qwant:"ic-widget-qwant","qwant-junior":"ic-widget-qwant","agenda-widget":"ic-widget-agenda","cursus-widget":"ic-widget-aide-devoirs","maxicours-widget":"ic-widget-maxicours","school-widget":"ic-widget-schoolbook","universalis-widget":"ic-widget-universalis","briefme-widget":"ic-widget-briefme"};function e(a){let l="";switch(typeof a=="string"?l=a:l=(a==null?void 0:a.icon)!==void 0?a==null?void 0:a.icon.trim().toLowerCase():"placeholder",l&&l.length>0?l.endsWith("-large")&&(l=l.replace("-large","")):typeof a=="object"&&(l=(a==null?void 0:a.displayName)!==void 0?a==null?void 0:a.displayName.trim().toLowerCase():""),l){case"admin.title":l="admin";break;case"banques des savoirs":l="banquesavoir";break;case"collaborativewall":l="collaborative-wall";break;case"communautés":l="community";break;case"directory.user":l="userbook";break;case"emploi du temps":l="edt";break;case"formulaire":l="forms";break;case"messagerie":l="conversation";break;case"news":l="actualites";break;case"homeworks":case"cahier de texte":l="cahier-de-texte";break;case"diary":case"cahier de texte 2d":l="cahier-textes";break}return l}function r(a){return a&&(a.startsWith("/")||a.startsWith("http://")||a.startsWith("https://"))}function n(a){const l=e(a);return l?`color-app-${l}`:"color-app-placeholder"}function i(a){const l=e(a);return l?`bg-app-${l}`:"bg-app-placeholder"}function s(a){const l=e(a);return l?`bg-light-${l}`:"bg-light-placeholder"}function o(a){return t[a.platformConf.name]}return{getIconClass:n,getBackgroundIconClass:i,getBackgroundLightIconClass:s,getIconCode:e,getWidgetIconClass:o,isIconUrl:r}}const Bue=T.forwardRef(({children:t,app:e,className:r},n)=>{const{t:i}=we(),{getIconClass:s}=cA(),o=Me("d-flex align-items-center mb-0",s(e),r),a={"--edifice-breadcrumb-divider":"-"};return g.jsx("nav",{ref:n,className:o,"aria-label":i("breadcrumb"),style:a,children:t})}),Uue=Bue,$ue=T.forwardRef(({app:t,name:e},r)=>{const{t:n}=we();return g.jsx(Uue,{app:t,ref:r,className:"mw-100",children:g.jsx(jue,{className:"gap-12 mw-100",children:e?g.jsxs(g.Fragment,{children:[g.jsx(I0,{children:g.jsx("a",{href:t==null?void 0:t.address,className:"d-flex","aria-label":n(t==null?void 0:t.displayName),children:g.jsx(ga,{app:t,size:"40"})})}),g.jsx(I0,{children:g.jsx(UN,{color:"var(--edifice-gray-600)",width:20,height:20})}),g.jsx(I0,{className:"text-truncate",children:g.jsx(Ss,{level:"h1",headingStyle:"h3",className:"text-truncate",children:e})})]}):g.jsxs(I0,{className:"gap-12 d-flex align-items-center",children:[g.jsx("a",{href:t==null?void 0:t.address,className:"d-flex","aria-label":n(t==null?void 0:t.displayName),children:g.jsx(ga,{app:t,size:"40"})}),g.jsx(Ss,{level:"h1",headingStyle:"h3",className:"d-none d-md-flex",children:n(t==null?void 0:t.displayName)})]})})})}),zue=$ue,Hue=({children:t,space:e=null,flexDirection:r="row"})=>{const n=Me("card-body",{[`p-${e}`]:e,[`gap-${e}`]:e,"align-items-start":r==="column","flex-column":r==="column"});return g.jsx("div",{className:n,children:t})},Vue=Hue,Q6=T.createContext(null),K6=()=>{const t=T.useContext(Q6);if(!t)throw new Error("Cannot be rendered outside the Card component");return t},Gue=({children:t})=>g.jsx("div",{className:"card-footer gap-16",children:t}),Wue=Gue,Xue=()=>{const{isSelectable:t,isClickable:e,onClick:r,onSelect:n}=K6(),{t:i}=we();return t||e?g.jsxs("div",{className:"card-header",children:[t?g.jsx(To,{"aria-label":i("card.open.menu"),className:"z-3 bg-white",color:"secondary",icon:g.jsx(az,{}),onClick:n,variant:"ghost"}):null,e?g.jsx("button",{type:"button",onClick:r,className:"position-absolute bottom-0 end-0 top-0 start-0 opacity-0 z-1 w-100","aria-label":i("card.open.resource")}):null]}):null},que=Xue,Yue=({imageSrc:t,className:e,variant:r="medium"})=>{const{app:n}=K6(),i=r==="landscape"?{width:"100%",height:"auto"}:null;return g.jsx("div",{className:Me("card-image",r),children:t?g.jsx(yo,{alt:"",src:t,objectFit:"cover",className:Me("h-full w-100",e)}):g.jsx(ga,{app:n,iconFit:"ratio",size:"80",variant:"rounded",...i})})},Que=Yue,Kue=({children:t,className:e})=>{const r=Me("card-text small text-break text-truncate text-truncate-1",e);return g.jsx("p",{className:r,children:t})},Zue=Kue,Jue=({children:t,className:e})=>{const r=Me("card-title body text-break text-truncate text-truncate-2",e);return g.jsx("h3",{className:r,children:g.jsx("strong",{children:t})})},ece=Jue,tce=({userSrc:t,creatorName:e})=>t?g.jsx(ec,{alt:e||"",size:"xs",src:t,variant:"circle",width:"24",height:"24"}):g.jsx(iC,{}),rce=tce,nce=T.forwardRef(({app:t,isSelectable:e=!0,isClickable:r=!0,isSelected:n=!1,isFocused:i=!1,onClick:s,onSelect:o,children:a,className:l},u)=>{const{getIconCode:c}=cA(),h=t?c(t):"placeholder",f=T.useMemo(()=>({app:t,appCode:h,isSelectable:e,isClickable:r,onClick:s,onSelect:o}),[t,h,e,r,s,o]);return g.jsx(Q6.Provider,{value:f,children:g.jsxs("div",{ref:u,className:Me("card",{"drag-focus":i,"is-selected":n,"c-pointer":r},l),children:[g.jsx(Z6.Header,{}),typeof a=="function"?a(h):a]})})}),Z6=Object.assign(nce,{Title:ece,Text:Zue,Image:Que,Body:Vue,User:rce,Footer:Wue,Header:que}),tr=Z6,J6=T.createContext(null),Z1=()=>{const t=T.useContext(J6);if(!t)throw new Error("Cannot be rendered outside the FormControl component");return t},ice=({children:t})=>{const{status:e}=Z1(),r=Me("form-text",{"is-invalid":e==="invalid",valid:e==="valid"});return g.jsx("p",{className:r,children:g.jsx("em",{children:t})})},sce=ice,oce=T.forwardRef(({noValidationIcon:t,placeholder:e,size:r="md",type:n="text",className:i,...s},o)=>{const{id:a,isRequired:l,isReadOnly:u,status:c}=Z1(),h=Me({"form-control":!u,"form-control-lg":r==="lg","form-control-sm":r==="sm","is-invalid":c==="invalid","is-valid":c==="valid","form-control-plaintext":u,"no-validation-icon":t},i);return g.jsx("input",{ref:o,id:a,className:h,type:n,placeholder:e,required:l,readOnly:u,...s})}),Zn=oce,ace=T.forwardRef(({leftIcon:t,optionalText:e,requiredText:r="*",children:n,className:i},s)=>{const{id:o,isOptional:a,isRequired:l}=Z1(),{t:u}=we(),c=Me("form-label",{"has-icon":t},i),h=a&&!l,f=l&&!a;return T.useEffect(()=>{if(a&&l)throw new Error("Cannot be optional and required at the same time")},[a,l]),g.jsxs("label",{ref:s,htmlFor:o,className:c,children:[t,n,h&&g.jsxs("em",{className:"optional",children:["- ",e??u("explorer.optional")]}),f&&g.jsx("em",{className:"required",children:r})]})}),Vi=ace,lce=T.forwardRef(({children:t,className:e,id:r,isOptional:n,isReadOnly:i,isRequired:s,status:o,...a},l)=>{const u=T.useMemo(()=>({id:r,isOptional:n,isRequired:s,isReadOnly:i,status:o}),[r,n,i,s,o]);return g.jsx(J6.Provider,{value:u,children:g.jsx("div",{ref:l,className:e,...a,children:t})})}),uce=Object.assign(lce,{Label:Vi,Input:Zn,Text:sce}),Ot=uce,cce=({placeholder:t,value:e="",searchMinLength:r=3,handleSearchInputChange:n})=>{const{triggerProps:i,itemProps:s,setVisible:o}=wh(),a={...i,role:"combobox",onClick:()=>{e.length>=r&&o(!0)},onChange:n};return T.useEffect(()=>{o(e.length>=r)},[o,e,r]),g.jsx(Ot,{className:"d-flex align-items-center",id:"search",children:g.jsx(Zn,{...a,className:"max-w-512",noValidationIcon:!0,placeholder:t,size:"md",type:"search",onKeyDown:s.onMenuItemKeyDown})})},dce=cce,dA=({onSearchResultsChange:t,onSearchInputChange:e,options:r,value:n,isLoading:i,noResult:s,searchMinLength:o,placeholder:a})=>{const{t:l}=we(),[u,c]=T.useState([]);T.useEffect(()=>{t(u)},[u]);const h=m=>{c([m])},f=()=>i?g.jsxs("div",{className:"d-flex align-items-center p-4",children:[g.jsx(YT,{isLoading:i}),g.jsx("span",{className:"ps-4",children:l("explorer.search.pending")})]}):s?g.jsx("div",{className:"p-4",children:l("portal.no.result")}):r.map((m,y)=>g.jsxs(T.Fragment,{children:[g.jsx(xt.Item,{type:"select",icon:m.icon,onClick:()=>h(m.value),children:m.label}),y<r.length-1&&g.jsx(xt.Separator,{})]},y));return g.jsxs(xt,{block:!0,children:[g.jsx(dA.Trigger,{placeholder:a,searchMinLength:o,handleSearchInputChange:e,value:n}),g.jsx(xt.Menu,{children:f()})]})};dA.Trigger=dce;const hce=dA,e8=T.createContext(null);function hA(){const t=T.useContext(e8);if(!t)throw new Error("Cannot be rendered outside Dropzone Provider");return t}const fce=()=>{const{t}=we();return g.jsx("div",{className:"drop-wrapper",children:g.jsx("div",{className:"drop-content",children:g.jsx("p",{className:"drop-text",children:t("dropzone.drop")})})})},pce=fce,t8=T.createContext(null);function Io(){const t=T.useContext(t8);if(!t)throw new Error("Innertabs compound components cannot be rendered outside the MediaLibrary component");return t}const mce=({children:t})=>{const{t:e}=we(),{files:r,inputRef:n}=hA(),{multiple:i}=Io(),s=r&&r.length>0,o=Me("drop-file-wrapper",{"d-block":s,"d-none":!s});return g.jsxs("div",{className:o,children:[g.jsx("div",{className:"drop-file-content",children:g.jsx("div",{className:"add-button p-4",children:g.jsx(it,{variant:"ghost",leftIcon:g.jsx(c1,{}),disabled:!i,onClick:()=>{var a;return(a=n==null?void 0:n.current)==null?void 0:a.click()},children:e("dropzone.add.more")})})}),g.jsx("div",{className:"p-8",children:t})]})},gce=mce,vce=()=>{const{t}=we(),{files:e,inputRef:r}=hA(),n=e&&e.length>0,i=Me("import-wrapper",{"d-flex":!n,"d-none":n});return g.jsxs("div",{className:i,children:[g.jsx(G$,{height:48,width:48}),g.jsx("p",{className:"my-16",children:t("dropzone.text")}),g.jsx(it,{onClick:()=>{var s;return(s=r==null?void 0:r.current)==null?void 0:s.click()},children:t("dropzone.import")})]})},yce=vce,Vu=({className:t,accept:e,multiple:r=!0,handle:n=!1,children:i})=>{const{inputRef:s,dragging:o,files:a,addFile:l,deleteFile:u,replaceFileAt:c,handleDragLeave:h,handleDragging:f,handleDrop:m,handleOnChange:y}=jle(e?{forceFilters:!0}:void 0),v=Me("dropzone",{"is-dragging":(r||a.length<1)&&o,"is-drop-files":!(a.length!==0&&!n)},t),x=T.useMemo(()=>({inputRef:s,files:a,addFile:l,deleteFile:u,replaceFileAt:c}),[l,u,c,a,s]);return g.jsx(e8.Provider,{value:x,children:g.jsxs("div",{className:v,onDragEnter:f,onDragOver:f,onDragLeave:h,onDrop:a.length>0&&!r?void 0:m,children:[g.jsxs("div",{className:"align-center",children:[n?null:g.jsxs(g.Fragment,{children:[g.jsx(Vu.File,{children:i}),g.jsx(Vu.Import,{})]}),g.jsx(Vu.Drag,{})]}),g.jsx("input",{ref:s,accept:e==null?void 0:e.join(","),multiple:r,type:"file",name:"attachment-input",id:"attachment-input",onChange:y,hidden:!0})]})})};Vu.File=gce;Vu.Import=yce;Vu.Drag=pce;const xce=Vu;function bce(t,e){const[r,n]=T.useState(null),{ref:i,inView:s}=Qie({triggerOnce:!0,...e==null?void 0:e.intersectionOptions});return T.useEffect(()=>{var o;(o=e==null?void 0:e.ref)!=null&&o.current&&(i==null||i(e.ref.current))},[e==null?void 0:e.ref,i]),T.useEffect(()=>{if((e==null?void 0:e.ref)===void 0||s){const o=new Image;return o.src=t,o.onload=()=>{n(!0)},o.onerror=()=>{n(!1)},()=>{o.onload=null,o.onerror=null,n(null)}}},[s]),r}const wce=({type:t,roleMap:e})=>{const r=typeof(e==null?void 0:e.icon)!="string"&&t!=="unknown",n=Me("position-absolute top-50 start-50 translate-middle",{"p-12 rounded-circle shadow":r},e==null?void 0:e.color);return g.jsx("div",{className:n,children:(e==null?void 0:e.icon)??g.jsx(uz,{})})},_ce=wce,Sce=({doc:t,isClickable:e=!0,isSelectable:r=!1,isSelected:n=!1,onClick:i,className:s})=>{var o;const a=T.useRef(null),l=zk.getRole(t);function u(y){const v={csv:{icon:".CSV",color:"bg-orange-200"},xls:{icon:".XLS",color:"bg-green-200"},doc:{icon:".DOC",color:"bg-blue-200"},txt:{icon:".TXT",color:"bg-blue-200"},pdf:{icon:".PDF",color:"bg-red-200"},audio:{icon:g.jsx(u1,{width:22,height:22}),color:"bg-red-200"},ppt:{icon:".PPT",color:"bg-yellow-200"},img:{icon:g.jsx(nz,{width:22,height:22}),color:"bg-green-200"},video:{icon:g.jsx(Vz,{width:22,height:22}),color:"bg-purple-200"},zip:{icon:".ZIP",color:"bg-gray-300"},md:{icon:".MD",color:"bg-blue-200"},unknown:{icon:g.jsx(Bz,{width:22,height:22}),color:"bg-gray-300"}};return v[y]||v.unknown}const c=Me("file position-relative rounded",((o=u(l??"default"))==null?void 0:o.color)??"bg-yellow-200"),h=l==="img"||l==="video"?Ie.workspace().getThumbnailUrl(t):null,f=bce(h,{ref:a}),m=f&&{backgroundImage:`url(${h})`,backgroundSize:"cover"};return g.jsx(tr,{className:Me("card-file",s),isClickable:e,isSelectable:r,isSelected:n,onClick:i,children:g.jsxs(tr.Body,{space:"8",children:[g.jsx("div",{ref:a,className:c,style:{aspectRatio:"16/10",...m},children:l!=="img"||l==="img"&&!f?g.jsx(_ce,{type:l,roleMap:u(l)}):null}),g.jsxs("div",{className:"mt-4",children:[g.jsx(tr.Text,{children:t.name}),g.jsx(tr.Text,{className:"text-black-50",children:t==null?void 0:t.ownerName})]})]})})},Ece=Sce,io=({children:t,className:e,...r})=>{const n=Me("grid",e);return g.jsx("div",{className:n,...r,children:t})},Tce=({sm:t,md:e,lg:r,xl:n,children:i,className:s,as:o,...a})=>{const l=o||"div",u=Me({[`g-col-${t}`]:t,[e?`g-col-md-${e}`:""]:e,[r?`g-col-lg-${r}`:""]:r,[n?`g-col-xl-${n}`:""]:n},s);return g.jsx(l,{className:u,...a,children:i})};io.Col=Tce;const Cce=T.forwardRef(({position:t=!0,caption:e},r)=>{const[n]=Pn(),i=`${n}/loading/screen-loading.gif`,s=Me("top-0 end-0 start-0 bottom-0 d-grid justify-content-center align-content-center align-items-center z-2000",{"position-fixed":!t,"position-static":t}),o=Me("text-center pt-12",{"text-white":!t});return g.jsxs(g.Fragment,{children:[g.jsxs("div",{ref:r,className:s,children:[g.jsx("div",{className:"bg-white rounded-circle mx-auto w-25",children:g.jsx("img",{src:i,alt:"loading"})}),e&&g.jsx("div",{className:o,children:e})]}),!t&&g.jsx("div",{className:"modal-backdrop fade show"})]})}),pr=Cce,Ace=T.forwardRef(({src:t,is1d:e,translate:r="Retour accueil"},n)=>{const i=Me("navbar-brand d-none d-md-block");return g.jsx("a",{ref:n,className:i,href:"/timeline/timeline","aria-label":r,children:g.jsx("img",{className:"logo",src:t,alt:`logo ${e?"ONE":"NEO"}`,width:"300",height:"52"})})}),Ek=Ace,Rce=({children:t,className:e})=>{const r=Me("popover-body",e);return g.jsx("div",{className:r,children:t})},Pce=({children:t,className:e})=>{const r=Me("popover-footer p-8",e);return g.jsx("div",{className:r,children:t})},r8=T.forwardRef(({children:t,className:e,id:r,isVisible:n,...i},s)=>{const o=Me("popover d-block position-absolute top-100 start-50 translate-middle-x",e);return jC(n,{from:{opacity:0},enter:{opacity:1},leave:{opacity:0},config:{duration:0}})((a,l)=>l&&g.jsx(kl.div,{ref:s,"aria-labelledby":r,className:o,role:"tooltip",style:a,...i,children:t}))}),Ice=({isVariant:t=!1,size:e="md",placeholder:r="search",className:n,disabled:i,onChange:s,onClick:o,...a})=>{const{t:l}=we(),u=Me(n,{"input-group":!t,"position-relative":t}),c=Me({"border-end-0":!t,"ps-48":t}),h=()=>{o==null||o()};return g.jsxs(Ot,{id:"search-bar",className:u,children:[t&&g.jsx("div",{className:"position-absolute z-1 top-50 start-0 translate-middle-y border-0 ps-12 bg-transparent",children:g.jsx(RS,{})}),g.jsx(Ot.Input,{type:"search",placeholder:l(r),size:e,noValidationIcon:!0,className:c,onChange:s,disabled:i,...a}),!t&&g.jsx(oA,{type:"submit","aria-label":l("search"),icon:g.jsx(RS,{}),className:"border-start-0",onClick:h})]})},n8=Ice,Mce=T.forwardRef(({noValidationIcon:t,placeholder:e,size:r="md",height:n="md",className:i,...s},o)=>{const{id:a,isRequired:l,isReadOnly:u,status:c}=Z1(),h=Me({"form-control":!u,"form-control-lg":r==="lg","form-control-sm":r==="sm","textarea-height-lg":n==="lg","textarea-height-md":n==="md","textarea-height-sm":n==="sm","is-invalid":c==="invalid","is-valid":c==="valid","form-control-plaintext":u,"no-validation-icon":t},i);return g.jsx(g.Fragment,{children:g.jsx("textarea",{ref:o,id:a,className:h,placeholder:e,required:l,readOnly:u,...s})})}),fA=Mce,pA=T.forwardRef(({items:t,variant:e="default",align:r="space",isBlock:n=!1,ariaControls:i,className:s},o)=>{const[a,l]=T.useState(0),[u,c]=T.useState([]),[h,f]=T.useState(),[m,y]=T.useState(),v=T.useRef(),x=Me("toolbar z-1000 bg-white",s,{default:e==="default","no-shadow":e==="no-shadow","d-flex":n,"d-inline-flex":!n,"overflow-x-auto":n,"justify-content-start":r==="left","justify-content-between":r==="space","justify-content-center":r==="center","justify-content-end":r==="right"});T.useEffect(()=>{var I;const P=(I=v.current)==null?void 0:I.querySelectorAll("button"),M=[];let N=!1;P==null||P.forEach(z=>{z.disabled||(N||(f(z),N=!0),y(z),M.push(z))}),c(M),l(t.findIndex(z=>(z.type==="button"||z.type==="icon")&&!z.props.disabled))},[t]);const b=I=>{I.target.classList.add("focus")},_=I=>{I.target.classList.remove("focus")},w=I=>{var P,M;const N=u.indexOf(I.currentTarget);switch(I.code){case"ArrowLeft":I.currentTarget===h?m==null||m.focus():(P=u[N-1])==null||P.focus();break;case"ArrowRight":I.currentTarget===m?h==null||h.focus():(M=u[N+1])==null||M.focus();break}},E=I=>{var P;return typeof I.tooltip=="string"?I.tooltip:(P=I.tooltip)==null?void 0:P.message},A=I=>{var P;return typeof I.tooltip!="string"?(P=I.tooltip)==null?void 0:P.position:"top"};return g.jsx("div",{ref:C2(o,v),className:x,role:"toolbar","aria-label":"Text Formatting","aria-controls":i,onFocus:b,onBlur:_,children:t.map((I,P)=>{if(I.visibility==="hide")return null;switch(I.type){case"divider":return g.jsx("div",{className:"toolbar-divider"},I.name??P);case"button":return g.jsx(co,{message:E(I),placement:A(I),children:T.createElement(it,{...I.props,key:I.name??P,color:I.props.color?I.props.color:"tertiary",variant:"ghost",tabIndex:P===a?0:-1,onKeyDown:w})},I.name??P);case"icon":return g.jsx(co,{message:E(I),placement:A(I),children:T.createElement(To,{...I.props,key:I.name??P,color:I.props.color?I.props.color:"tertiary",variant:I.props.variant?I.props.variant:"ghost",tabIndex:P===a?0:-1,onKeyDown:w})},I.name??P);case"dropdown":return T.createElement(xt,{...I.props,key:I.name??P,extraTriggerKeyDownHandler:w,overflow:I.overflow});case"primary":return g.jsx(co,{message:E(I),placement:A(I),children:g.jsx(it,{...I.props,variant:"filled",color:"primary",tabIndex:P===a?0:-1,onKeyDown:w})},I.name??P)}return null})})}),R2=({node:t,showIcon:e,selectedNodeId:r,expandedNodes:n,siblingsNodes:i,draggedNodeId:s,handleItemClick:o,handleToggleNode:a,handleItemAction:l})=>{const u=n.has(t.id),c=i==null?void 0:i.current.has(t.id),h=r===t.id,f=s===t.id,m={action:Me("action-container d-flex align-items-center gap-8 px-2",{"drag-focus":f,"py-4":!t.section}),arrow:Me({"py-4":!t.section,"py-8":t.section,invisible:!Array.isArray(t.children)||t.children.length===0}),button:Me("flex-fill d-flex align-items-center text-truncate gap-8",{"py-8":t.section})},y=t.section?16:12,{t:v}=we(),{setNodeRef:x}=Hj({id:T.useId(),data:{id:t.id,name:t.name,isTreeview:!0,accepts:["folder","resource"]}}),b=M=>o==null?void 0:o(M),_=M=>a==null?void 0:a(M),w=M=>l==null?void 0:l(M),E=M=>{(M.code==="Enter"||M.code==="Space")&&(M.preventDefault(),M.stopPropagation(),o==null||o(t.id))},A=M=>{(M.code==="Enter"||M.code==="Space")&&(M.preventDefault(),M.stopPropagation(),a==null||a(t.id))},I=M=>g.jsx(M?Cp:UN,{title:v("foldUnfold"),width:y,height:y}),P=()=>{var M;const N=!((M=i==null?void 0:i.current)!=null&&M.has(t.id)),z=Array.isArray(t.children)&&t.children.length>0;return c||N&&z};return g.jsx("li",{ref:x,id:`treeitem-${t.id}`,role:"treeitem","aria-selected":h&&h,"aria-expanded":u&&u,children:g.jsxs("div",{children:[g.jsxs("div",{className:m.action,children:[g.jsx("div",{className:m.arrow,tabIndex:0,role:"button",onClick:()=>_(t.id),onKeyDown:A,"aria-label":v("foldUnfold"),children:P()&&I(u)}),g.jsxs("div",{tabIndex:0,role:"button",className:m.button,onClick:()=>b(t.id),onKeyDown:E,children:[t.section&&e&&g.jsx(LN,{title:v("folder"),width:20,height:20}),g.jsx("span",{className:"text-truncate",children:t.name})]}),t.section&&l&&g.jsx("button",{className:"tree-btn mx-8",onClick:()=>w(t.id),children:g.jsx(c1,{height:16,width:16})})]}),Array.isArray(t.children)&&!!t.children.length&&u&&g.jsx("ul",{role:"group",children:t.children.map(M=>g.jsx(R2,{node:M,selectedNodeId:r,expandedNodes:n,siblingsNodes:i,draggedNodeId:s,handleItemClick:o,handleToggleNode:a},M.id))})]})},t.id)},kce=({data:t,ref:e,externalSelectedNodeId:r,draggedNode:n,allExpandedNodes:i,onTreeItemUnfold:s,onTreeItemFold:o,onTreeItemClick:a})=>{const[l,u]=T.useState(void 0),[c,h]=T.useState(new Set),f=T.useRef(new Set),[m,y]=T.useState(void 0),v=l??r;function x(j){var H;Array.isArray(j)?j.forEach(F=>{const L=new Set(f.current);j.filter(({id:O})=>O!==F.id).some(O=>O.children&&O.children.length>0)&&L.add(F.id),F.children&&F.children.length>0&&F.children.forEach(O=>{var U;const V=(U=F.children)==null?void 0:U.filter(({id:k})=>k!==O.id);V!=null&&V.some(k=>k.children&&k.children.length>0)&&L.add(O.id),x(O)})}):(H=j.children)==null||H.forEach(F=>{var L;const O=new Set(f.current),U=(L=j.children)==null?void 0:L.filter(V=>V.id!==F.id);U!=null&&U.some(V=>V.children&&V.children.length>0)&&(O.add(F.id),f.current=O),x(F)})}const b=j=>{const H=new Set("");t&&Array.isArray(t)&&j&&(t.forEach(F=>{H.add(F.id)}),h(H))};T.useEffect(()=>{t&&x(t)},[t]),T.useEffect(()=>{n!=null&&n.isOver&&n.isTreeview?(n.overId&&z(n.overId),y(n.overId)):y(void 0)},[n]);const _=T.useMemo(()=>({unselectAll(){u(void 0)},select(j){M(j)},allExpandedNodes(){b(i)}}),[]);T.useImperativeHandle(e,()=>_,[_]),T.useEffect(()=>{b(i)},[]),T.useEffect(()=>{r&&!i?(w(r),u(r)):u(void 0)},[r]);const w=j=>{if(!Qi(t,v)){u(void 0);return}if(r==="default"){c.forEach(H=>s==null?void 0:s(H));return}E(j)},E=j=>{const H=new Set(c),F=mue(t,j),L=Array.from(H);F.forEach(O=>{const U=L.indexOf(O);U>-1&&L.splice(U,1),L.push(O)}),H.clear(),L.forEach(O=>H.add(O)),H.forEach(O=>s==null?void 0:s(O)),h(H)},A=j=>{const H=new Set(c);H.delete(j),H.forEach(F=>o==null?void 0:o(F)),h(H)},I=j=>{c.has(j)?A(j):E(j)},P=j=>{v!==j&&u(j)},M=j=>{P(j),E(j),a==null||a(j)},N=j=>{I(j)},z=j=>{Qi(t,r)&&E(j)};return{selectedNodeId:v,expandedNodes:c,siblingsNodes:f,draggedNodeId:m,handleItemClick:M,handleFoldUnfold:N}},Oce=T.forwardRef((t,e)=>{const{data:r,onTreeItemClick:n,onTreeItemUnfold:i,onTreeItemFold:s,onTreeItemAction:o,draggedNode:a,showIcon:l=!0,allExpandedNodes:u=!1,selectedNodeId:c}=t,{selectedNodeId:h,expandedNodes:f,siblingsNodes:m,draggedNodeId:y,handleItemClick:v,handleFoldUnfold:x}=kce({data:r,ref:e,externalSelectedNodeId:c,draggedNode:a,allExpandedNodes:u,onTreeItemClick:n,onTreeItemFold:s,onTreeItemUnfold:i});return g.jsx("div",{className:"treeview",children:g.jsx("ul",{role:"tree",className:"m-0 p-0",children:Array.isArray(r)?r.map(b=>g.jsx(R2,{node:b,showIcon:l,selectedNodeId:h,expandedNodes:f,siblingsNodes:m,draggedNodeId:y,handleItemClick:v,handleToggleNode:x,handleItemAction:o},b.id)):g.jsx(R2,{node:r,selectedNodeId:h,expandedNodes:f,siblingsNodes:m,showIcon:l,draggedNodeId:y,handleItemClick:v,handleToggleNode:x})})})}),dd=Oce,Dce=({item:t,status:e="idle",isClickable:r=!1,isSelectable:n=!1,onDelete:i,onEdit:s,onRetry:o})=>{const[a]=Pn(),{t:l}=we(),{src:u,name:c,info:h}=t,f=e==="idle",m=e==="loading",y=e==="success",v=h==null?void 0:h.type.startsWith("image"),x=`${a}/common/image-placeholder.png`,b={text:"",context:null,image:g.jsx("img",{src:x,alt:"",width:"48",height:"48"})},_={error:{text:g.jsx("strong",{children:g.jsx("small",{className:"text-danger caption",children:l("tiptap.upload.error")})}),context:g.jsx(it,{leftIcon:g.jsx(HN,{}),variant:"ghost",color:"tertiary",onClick:o,children:l("tiptap.upload.retry")}),image:g.jsx(yo,{alt:"",src:`${a}/common/image-status-error.svg`,objectFit:"cover"})},idle:b,loading:{text:"",context:g.jsx(co,{message:l("tiptap.tooltip.upload.loading"),placement:"top",children:g.jsx(YT,{isLoading:!0,loadingPosition:"left",className:"text-secondary"})}),image:b.image},warning:b,success:{text:g.jsxs("em",{children:[h==null?void 0:h.type," ",(h==null?void 0:h.weight)&&`- ${h.weight}`]}),context:g.jsx(co,{message:l("tiptap.tooltip.upload.loaded"),placement:"top",children:g.jsx(VN,{className:"text-success"})}),image:g.jsx(yo,{alt:"",src:u??"",width:"48",objectFit:"cover",className:"rounded",style:{aspectRatio:1/1}})},unknown:b},w=()=>v&&g.jsx(co,{message:l("tiptap.tooltip.upload.edit"),placement:"top",children:g.jsx(To,{icon:g.jsx(Wz,{}),variant:"ghost","aria-label":l("tiptap.tooltip.upload.loading"),disabled:m||!y,onClick:s,color:"secondary"})});return g.jsx(tr,{isClickable:r,isSelectable:n,className:"card-upload",children:g.jsxs(tr.Body,{children:[g.jsx("div",{className:"card-image",children:_[e].image}),g.jsxs("div",{className:"text-truncate",children:[g.jsx(tr.Text,{children:c}),g.jsx(tr.Text,{className:"caption",children:_[e].text})]}),!f&&g.jsx("div",{className:"ms-auto",children:g.jsxs("div",{className:"d-flex align-items-center gap-12",children:[_[e].context,!f&&g.jsx("div",{className:"vr"}),w(),g.jsx(co,{message:l("tiptap.tooltip.upload.delete"),placement:"top",children:g.jsx(To,{icon:g.jsx(LT,{}),variant:"ghost","aria-label":l("tiptap.tooltip.upload.delete"),color:"tertiary",onClick:i})})]})})]})})},Nce=Dce,Lce=T.forwardRef(({children:t},e)=>g.jsx("span",{className:"visually-hidden",ref:e,children:t})),fl=Lce;function Fce(){var t;const{sessionQuery:e}=yt(),r=new Set;return(t=e==null?void 0:e.data)==null?void 0:t.bookmarkedApps.filter(n=>{const i=r.has(n.displayName);return r.add(n.displayName),!i})}function Gi(t){const e=V6(),[r,n]=T.useState();return T.useEffect(()=>{(async()=>{let i;if(e!=null&&e.hasWorkflow)if(typeof t=="string")i=await e.hasWorkflow(t);else throw"not.implemented.yet)";else typeof t=="string"?i=await Ie.rights().sessionHasWorkflowRight(t):i=await Ie.rights().sessionHasWorkflowRights(t);n(i)})()},[t,e]),r}const jce=()=>{const t=Gi("fr.openent.zimbra.controllers.ZimbraController|view"),e=Gi("fr.openent.zimbra.controllers.ZimbraController|preauth"),[r,n]=T.useState(0),[i,s]=T.useState(""),o={unread:!0,_:new Date().getTime()},a=async()=>{const u=t?"/zimbra/count/INBOX":"/conversation/count/INBOX";try{const{count:c}=await Ie.http().get(u,{queryParams:o});n(c??0)}catch(c){console.error(c),n(0)}},l=async()=>{const u="/zimbra/zimbra";try{const{preference:c}=await Ie.http().get("/userbook/preference/zimbra"),h=c?JSON.parse(c).modeExpert:!1;s(h&&e?"/zimbra/preauth":window.location.origin+u)}catch(c){console.error(c),s(window.location.origin+u)}};return T.useEffect(()=>{a()},[]),T.useEffect(()=>{l()},[]),{messages:r,msgLink:i,zimbraWorkflow:t}},Bce=jce;function Uce({user:t,avatar:e}){const{appCode:r}=yt(),{t:n}=we(),{theme:i}=ya(),s=n(r),[o,a]=T.useState(!0),[l,u]=j6(),c=T.useId(),h=T.useId(),f=e,m=t==null?void 0:t.username,y=n("welcome",{username:t==null?void 0:t.firstName}),v=Fce(),x=Gi("net.atos.entng.community.controllers.CommunityController|view"),b=Gi("org.entcore.conversation.controllers.ConversationController|view"),_=Gi("fr.openent.searchengine.controllers.SearchEngineController|view"),w=T.useCallback(()=>{a(!o)},[o]),E=async()=>{await Ie.session().logout(),window.location.href=(i==null?void 0:i.logoutCallback)??"/auth/login"};return T.useMemo(()=>({title:s,bookmarkedApps:v,appsRef:l,isAppsHovered:u,popoverAppsId:c,popoverSearchId:h,userAvatar:f,userName:m,welcomeUser:y,communityWorkflow:x,conversationWorflow:b,searchWorkflow:_,isCollapsed:o,toggleCollapsedNav:w,handleLogout:E}),[l,v,x,b,u,o,c,h,_,s,w,f,m,y])}const $ce=t=>{const e=T.useRef(),r=Jr(),{t:n}=we();return T.useEffect(()=>{const i=Ie.notify().events().subscribe(DB.TRANSPORT,s=>{var o,a;e.current=n(((a=(o=s==null?void 0:s.data)==null?void 0:o.payload)==null?void 0:a.error)||s.data.response.statusText),r.error(Pe.createElement("div",{children:[e.current]}),t)});return()=>i.revoke()},[n,r]),e.current},zce=$ce;function i8(){const[t,e]=T.useState(!1);T.useEffect(()=>{r()},[]);const r=T.useCallback(async()=>{const n=await Ie.session().isAdml();e(n)},[]);return{isAdml:t}}const Hce=()=>{var t;const{user:e,appCode:r}=yt(),n=W6[r],i=e==null?void 0:e.apps.find(u=>u.isExternal&&u.address.includes("library"));if(!i)return null;const s=(t=i.address)==null?void 0:t.split("?");if(!s||s.length<2)return null;let o=s[0];o.endsWith("/")||(o=`${o}/`);const a=s==null?void 0:s[1],l=`application%5B0%5D=${n}&page=1&sort_field=views&sort_order=desc`;return`${o}search/?${a}&${l}`},Vce=Hce,Gce=()=>({createOrUpdate:async({alt:t,uri:e,blob:r,legend:n,parentId:i,application:s,visibility:o})=>{const a=/\/workspace\/document\/([0-9a-fA-F-]+)/,l=(e??"").match(a);if(l&&l.length===2){const u=l[1],c=await Ie.workspace().searchDocuments({filter:"all",id:u,limit:1}),h=c.length?c[0].name:void 0;await Ie.workspace().updateFile(u,r,{alt:t,legend:n,name:h});const f=(await Ie.workspace().searchDocuments({filter:"all",id:u,limit:1}))[0];return{file:f,src:`/workspace/${f.public?"pub/":""}document/${u}`}}else{const u=await Ie.workspace().saveFile(r,{application:s,parentId:i,visibility:o});return`/workspace/${u.public?"pub/":""}document/${u._id}`}},create:async(t,e)=>await Ie.workspace().saveFile(t,e),remove:async t=>!t||Array.isArray(t)&&t.length===0?Promise.resolve():await Ie.workspace().deleteFile(Array.isArray(t)?t:[t])}),J1=Gce,Wce=()=>{const t=T.useRef(null),[e,r]=T.useState(),{remove:n}=J1();return{ref:t,libraryMedia:e,setLibraryMedia:r,onCancel:async i=>{var s,o;(s=t.current)!=null&&s.type&&i&&i.length>0&&await n(i),(o=t.current)==null||o.hide()},onSuccess:i=>{var s,o,a,l;let u;switch((s=t.current)==null?void 0:s.type){case"video":{if(typeof i=="object")u=i[0];else{const c=new DOMParser().parseFromString(i,"text/html").body.firstChild,h=c==null?void 0:c.getAttribute("src");(o=t.current)==null||o.hide(),u=h}break}case"embedder":{const c=new DOMParser().parseFromString(i,"text/html").body.firstChild,h=c==null?void 0:c.getAttribute("src");(a=t.current)==null||a.hide(),u=h;break}case"audio":{i.length===void 0?u=i:u=i[0];break}case"hyperlink":{u=i;break}case"image":{u=`/workspace/document/${i[0]._id}`;break}default:u=i[0]}(l=t.current)==null||l.hide(),r(u)},onTabChange:async(i,s)=>{var o;(o=t.current)!=null&&o.type&&s&&s.length>0&&await n(s)}}},s8=Wce,Xce=t=>{const[e,r]=T.useState([]);T.useEffect(()=>{(async()=>(await Sb.initialize(Ie,t),await Sb.registerBehaviours(t),r(Sb.resourceProducingApps)))()},[]);const n=T.useCallback(async i=>{const[s]=i.types;return await Ie.behaviour(t,s).loadResources(i)},[t]);return{resourceApplications:e,loadResources:n}},qce=(t,e="media-library")=>{const[r,n]=T.useState({}),{browser:i,device:s}=L6(navigator.userAgent),{create:o}=J1(),a=T.useCallback(y=>r[mf(y)],[r]),l=(y,v)=>{n(x=>{const b=mf(y);return{...x,[b]:v}})},u=y=>{n(v=>{const x=mf(y),{[x]:b,..._}=v;return _})};async function c(y,v){l(y,"loading");try{let x;return e==="media-library"&&y.type.includes("video")?x=await f(y,{filename:y.name,...v}):x=await o(y,{application:e,visibility:t}),l(y,"success"),x}catch{return l(y,"error"),null}}async function h(y,v){l(y,"loading");try{let x;if(y.type.includes("video"))x=await f(y,v);else throw new Error(Hk.NOT_SUPPORTED);return l(y,"success"),x}catch{return l(y,"error"),null}}const f=async(y,v)=>{const x={data:{device:s.type,browser:{name:i.name,version:i.version},url:window.location.hostname,file:y,filename:(v==null?void 0:v.filename)??"filename",weight:y.size},appCode:e,captation:!(y instanceof File),duration:(v==null?void 0:v.duration)??0},b=await Ie.video().upload(x);if(b.state==="succeed")return{_id:b.videoworkspaceid,file:b.videoid,name:x.data.filename,eType:"file",eParent:"",children:[],created:new Date,_shared:[],_isShared:!1,owner:{userId:"",displayName:""}};throw b.state==="error"?new Error(b.code||"Error while uploading video"):new Error("Video encoding is still running")};function m(y,v,x){return mf(v,mf(y)),c(v,x)}return{getUploadStatus:a,setUploadStatus:l,clearUploadStatus:u,uploadFile:c,uploadAlternateFile:m,uploadBlob:h}},o8=qce;function Yce(){const t=(n,i,s,o)=>(s>o&&(n=Math.round(n*o/s),s=o),n>i&&(s=Math.round(s*i/n),n=i),{height:n,width:s}),e=(n,i)=>{const s=n.split(".");return s.pop(),s.join(".")+"."+i},r=(n,i,s,o,a="jpeg",l=80)=>{const u=l/100,c=document.createElement("canvas"),h=`image/${a}`;let f=n.width,m=n.height;const y=t(m,o,f,s);f=y.width,m=y.height;const v=c.getContext("2d");return v&&(c.width=f,c.height=m,v.imageSmoothingEnabled&&v.imageSmoothingQuality&&(v.imageSmoothingQuality="high"),v.drawImage(n,0,0,f,m)),new Promise((x,b)=>{c.toBlob(_=>{_?x(new File([_],i,{type:h,lastModified:new Date().getTime()})):b()},h,u)})};return{resizeImageFile:async(n,i=1440,s=1440,o=80)=>{if(!n)throw Error("Image resizer: file not found!");if(!n.type||!n.type.startsWith("image/"))throw Error("Image resizer: the file given is not an image.");const a="jpeg";return new Promise(l=>{const u=new Image;u.setAttribute("style","max-width: none;"),u.src=URL.createObjectURL(n),u.onload=async()=>{const c=await r(u,e(n.name,a),i,s,a,o);l(c)},u.onerror=c=>{throw Error("Image Loading Error: "+c)}})}}}const Qce=({handleOnChange:t,visibility:e,application:r})=>{const[n,i]=T.useState([]),[s,o]=T.useState(void 0),{files:a,deleteFile:l,replaceFileAt:u}=hA(),{remove:c,createOrUpdate:h}=J1(),{getUploadStatus:f,setUploadStatus:m,clearUploadStatus:y,uploadFile:v,uploadAlternateFile:x}=o8(e,r),{resizeImageFile:b}=Yce(),_=T.useCallback(P=>{P.forEach(async(M,N)=>{if(M==null)return;let z;if(M.type.startsWith("image"))try{const j=await b(M);z=await x(M,j),u(N,j)}catch(j){console.error(j)}z||(z=await v(M)),z&&i(j=>[...j,z])})},[b,x,v,u]);T.useEffect(()=>{let P=0;const M=a.map(N=>{if(P>=5)return null;const z=f(N);return z==="loading"&&P++,z?null:N});M.forEach(N=>N&&m(N,"idle")),_(M)},[a,n,f,m,_]),T.useEffect(()=>{const P=w(a,n);t(P)},[n]);const w=(P,M)=>{const N=P.reduce((z,j,H)=>(z[j.name]=H,z),{});return M.sort((z,j)=>N[z.name]-N[j.name])};async function E(P){const M=n.find(N=>N.name===P.name);M&&(await c(M),y(P),i(N=>N.filter(z=>z.name!==(M==null?void 0:M.name)))),l(P)}async function A({blob:P,legend:M,altText:N}){if(s)try{const z=await h({blob:P,legend:M,alt:N,uri:I(s)});z&&typeof z=="object"&&i(j=>j.map(H=>H._id===z.file._id?{...z.file}:H))}finally{o(void 0)}}const I=(P,M)=>{const N=`/workspace/${P!=null&&P.public?"pub/":""}document/${P==null?void 0:P._id}`;return P?M?vue(N):N:""};return{files:a,getUploadStatus:f,clearUploadStatus:y,uploadedFiles:n,editingImage:s,setEditingImage:o,getUrl:I,updateImage:A,uploadFile:v,removeFile:E}},Kce=Qce;function _h(){const{user:t,userDescription:e}=yt(),{theme:r}=ya();function n(){let i=e==null?void 0:e.picture;return(!i||i==="no-avatar.jpg"||i==="no-avatar.svg")&&(i=`${r==null?void 0:r.basePath}/img/illustrations/no-avatar.svg`),i}return{user:t,avatar:n(),userDescription:e}}function M0(t,e,r,n){const i=V6(),s=Gi("org.entcore.workspace.controllers.WorkspaceController|listDocuments"),o=Gi("org.entcore.workspace.controllers.WorkspaceController|listFolders");function a(h,f){switch(f.type){case"update":{const m=Qi(h,f.folderId);return m&&(m.children=f.subfolders.map(y=>({id:y._id||"",name:y.name})),m.files=f.files),{...h}}default:throw Error("[useWorkspaceSearch] Unknown action type: "+f.type)}}const[l,u]=T.useReducer(a,{id:t,name:e,section:!0}),c=T.useCallback(async h=>{var f;if(s&&o){const m=h===t?"":h,y=i!=null&&i.listWorkspaceDocuments?await((f=i==null?void 0:i.listWorkspaceDocuments)==null?void 0:f.call(i).then(b=>b.map(_=>{const w={..._,_id:""+Math.round(Math.random()*9999)};return w.name=_.eType=="folder"?"folder id="+w._id:"file id="+w._id,w}))):await Ie.workspace().listDocuments(r,m),v=[],x=[];y.filter(b=>{if(!n||b.eType==="folder")return!0;const _=zk.getRole(b);return typeof n=="string"?n===_:Array.isArray(n)?n.findIndex(w=>w===_)>=0:!1}).forEach(b=>{b.eType==="folder"?v.push(b):x.push(b)}),u({folderId:h,subfolders:v,files:x,type:"update"})}},[s,o,t,i,r,n]);return{root:l,loadContent:c}}function Zce(){const[t,e]=T.useState("pending"),{currentApp:r}=yt();T.useEffect(()=>{n()},[]);const n=async()=>{if(!r){e("[Xiti] Error, currentApp is not defined.");return}try{await Ie.analytics().trackPageLoad(window.location.pathname,r),console.info(`[Xiti] Success tracking page ${window.location.pathname}`),e(`[Xiti] Success tracking page ${window.location.pathname}`)}catch(i){console.error("[Xiti] Error Tracking Page Load",i),e(`[Xiti] Error Tracking Page Load: ${i}`)}};return{xitiStatus:t}}function Jce(){const{currentLanguage:t}=yt(),{userDescription:e}=_h(),{isAdml:r}=i8(),{theme:n}=ya(),i=window.innerWidth<=768,s=Gi("net.atos.entng.support.controllers.DisplayController|view"),[o,a]=T.useState(""),[l,u]=T.useState(void 0),c=()=>{const h=o.split("/");let f="",m="";if(l!=null&&l.labels&&Object.keys(l==null?void 0:l.labels).length>0&&h.length>1){for(let y=1;y<h.length;y++)h[y].length>0&&h[y].match(/\d/)==null&&(f.length===0?f=h[y]:f=f+"/"+h[y]);l!=null&&l.labels&&Object.prototype.hasOwnProperty.call(l==null?void 0:l.labels,f)?m=l==null?void 0:l.labels[f]:l!=null&&l.default&&String(l.default).length>0&&(m=l==null?void 0:l.default)}else l!=null&&l.default&&String(l==null?void 0:l.default).length>0&&(m=l==null?void 0:l.default);if(h.includes("collaborativewall")&&h.includes("id")&&i&&window.zE("webWidget","hide"),m.includes("${adml}")&&(r?m=m.replace("${adml}","adml"):m=m.replace("/${adml}","")),m.includes("${profile}")){const y=e==null?void 0:e.profiles;m=m.replace("${profile}",y[0].toLowerCase())}m.includes("${theme")&&(n!=null&&n.is1d?m=m.replace("${theme}","1D"):m=m.replace("${theme}","2D")),window.zE("webWidget","helpCenter:setSuggestions",{labels:[m]})};return T.useEffect(()=>{window.location.pathname!==o&&a(window.location.pathname),!(l===void 0||Object.keys(l).length===0)&&c()},[window.location.pathname,l]),T.useEffect(()=>{document.getElementById("ze-snippet")||s===void 0||(async()=>{const h=await Ie.http().get("/zendeskGuide/config");if(h&&h.key&&h.key!==""){const f=document.createElement("script");f.id="ze-snippet",f.src=`https://static.zdassets.com/ekr/snippet.js?key=${h.key}`,document.body.appendChild(f).onload=()=>{t==="es"?window.zE(function(){window.zE.setLocale("es-419")}):window.zE(function(){window.zE.setLocale("fr")}),Object.keys(h.module).length>0&&u(h.module),window.zE("webWidget","show"),window.zE("webWidget","updateSettings",{webWidget:{color:{theme:h.color||"#ffc400"},zIndex:3,launcher:{mobile:{labelVisible:!0}},contactForm:{suppress:!s},helpCenter:{messageButton:{"*":"Assistance ENT","es-419":"Asistencia ENT"}}}}),window.addEventListener("scroll",()=>{window.zE("webWidget","updateSettings",{webWidget:{launcher:{mobile:{labelVisible:window.scrollY<=5}}}})}),window.zE("webWidget:on","open",function(){s&&window.zE("webWidget","updateSettings",{webWidget:{contactForm:{suppress:!1}}})}),window.zE("webWidget:on","userEvent",function(m){const y=m.category,v=m.action,x=m.properties;v==="Contact Form Shown"&&y==="Zendesk Web Widget"&&x&&x.name==="contact-form"&&s&&(window.zE("webWidget","updateSettings",{webWidget:{contactForm:{suppress:!0}}}),window.zE("webWidget","close"),window.open("/support","_blank"))})}}})()},[s]),null}function ede(){const t=Gi("org.entcore.portal.controllers.PortalController|optionalFeatureCantoo");return T.useEffect(()=>{t&&!document.getElementById("cantoo-edifice-script")&&(async()=>{const e=await Ie.http().get("/optionalFeature/cantoo");if(e&&e.scriptPath){const r=document.createElement("script");r.id="cantoo-edifice-script",r.src=e.scriptPath,r.async=!0,document.body.appendChild(r)}})()},[t]),null}function y_({formData:t,errorMessage:e}){const{t:r}=we(),n=i=>i==null?void 0:i.match(/^\s/);return e==="CONTENT_TOO_LARGE"?g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"pt-24",children:r("bpr.form.publication.response.error.title")}),g.jsx("p",{className:"pt-24 pb-24",children:g.jsx("strong",{children:r("bpr.form.publication.response.error.content_too_large")})})]}):g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"pt-24",children:r("bpr.form.publication.response.error.title")}),g.jsx("p",{className:"pt-24 pb-24",children:g.jsx("strong",{children:r("bpr.form.publication.response.error.content")})}),g.jsxs("ul",{children:[n(t==null?void 0:t.title)&&g.jsx("li",{className:"pt-2 pb-2",children:g.jsx("strong",{children:r("bpr.form.publication.response.empty.title")})}),n(t==null?void 0:t.description)&&g.jsx("li",{className:"pt-2 pb-2",children:g.jsx("strong",{children:r("bpr.form.publication.response.empty.description")})})]})]})}function tde({result:t}){const{t:e}=we();return g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"pt-24",children:e("bpr.form.publication.response.success.title")}),g.jsx("p",{className:"pt-24",children:e("bpr.form.publication.response.success.content.1")}),g.jsx("p",{className:"pt-24",children:e("bpr.form.publication.response.success.content.2")}),t.details.front_url&&g.jsx("p",{className:"pt-24 pb-24",children:g.jsx("a",{className:"button right-magnet",href:t.details.front_url,target:"_blank",rel:"noreferrer",children:e("bpr.form.publication.response.success.button")})})]})}function rde({onSuccess:t,resource:e}){const{user:r,appCode:n}=yt(),i=Jr(),[s,o]=T.useState((e==null?void 0:e.thumbnail)||"");T.useEffect(()=>{o(e==null?void 0:e.thumbnail)},[e]);const{control:a,register:l,watch:u,setValue:c,handleSubmit:h,formState:{errors:f,isSubmitting:m,isDirty:y,isValid:v}}=DT({mode:"onChange"}),[x,b]=T.useState([]),[_,w]=T.useState([]),E=(A,I,P)=>{let M=[...I];const N=M.findIndex(z=>z===A);I.includes(A)?M=I.filter((z,j)=>j!==N):M=[...I,A],P(M)};return{control:a,cover:s,formState:{errors:f,isSubmitting:m,isDirty:y,isValid:v},handleDeleteImage:()=>o(""),handlePublish:async A=>{const I=r?r==null?void 0:r.userId:"";try{let P=new Blob;typeof s=="string"?P=await Ie.http().get(s,{responseType:"blob"}):s?P=await Ie.http().get(URL.createObjectURL(s),{responseType:"blob"}):e!=null&&e.thumbnail&&(P=await Ie.http().get(e==null?void 0:e.thumbnail,{responseType:"blob"}));const M=await Ie.http().get(`/userbook/avatar/${I}?thumbnail=48x48`,{responseType:"blob"}),N=await Ie.http().get(`/directory/user/${I}/attachment-school`,{responseType:"json"}),z=W6[n],j={activityType:x,age:[A.ageMin,A.ageMax],application:z,cover:P,description:A.description,keyWords:A.keyWords,language:A.language,licence:"CC-BY",resourceId:e==null?void 0:e.assetId,resourceEntId:e==null?void 0:e.assetId,subjectArea:_,teacherAvatar:M,title:A.title,userId:I,userStructureName:N.name||(r==null?void 0:r.structureNames[0])},H=await Ie.resource(n).publish(j);H.success?i.success(g.jsx(tde,{result:H}),{duration:1e4}):H.message==="CONTENT_TOO_LARGE"?i.error(g.jsx(y_,{errorMessage:H.message})):i.error(g.jsx(y_,{formData:A})),t==null||t()}catch(P){console.error(P),i.error(g.jsx(y_,{formData:A}))}},handleSubmit:h,handleUploadImage:A=>o(A),register:l,selectActivities:A=>{E(A,x,b)},selectedActivities:x,selectedSubjectAreas:_,selectSubjects:A=>{E(A,_,w)},setValue:c,watch:u}}const nde=(t,e)=>{const[r,n]=T.useState(null);return T.useEffect(()=>{if(e===""){console.warn("resourceId must be an assetId and not an empty string");return}(async()=>{try{const i=await Ie.resource(t).searchResource({application:t,id:e});n(i)}catch(i){console.error(i)}})()},[]),r},mA=nde,ide=({addButtonLabel:t="Add image",deleteButtonLabel:e="Delete image",src:r,className:n,mediaLibraryRef:i,libraryMedia:s,app:o,onUploadImage:a,onDeleteImage:l})=>{const[u,c]=T.useState(r||"");T.useEffect(()=>{s&&(c(s),a(s))},[s]);const h=()=>{var y;(y=i.current)==null||y.show("image")},f=()=>{c(""),l()},m=Me("image-input",n);return g.jsxs("div",{id:"image-input",className:m,children:[g.jsxs("div",{className:"image-input-actions gap-8",children:[g.jsx(To,{"aria-label":t,color:"tertiary",icon:g.jsx(X$,{}),onClick:h,type:"button",variant:"ghost"}),g.jsx(To,{"aria-label":e,color:"danger",disabled:!u,icon:g.jsx(DN,{width:"20",height:"20"}),onClick:f,type:"button",variant:"ghost"})]}),u?g.jsx(ec,{alt:"",src:u,size:"xl"}):g.jsx(ga,{app:o,iconFit:"ratio",size:"160",variant:"rounded"})]})},a8=ide,sde=({recordState:t,playState:e,recordTime:r,audioTime:n,maxDuration:i})=>g.jsxs("div",{className:"audio-recorder-time my-16 mx-auto",children:[e==="IDLE"&&g.jsxs("div",{className:"d-flex align-items-center",children:[t==="PAUSED"?g.jsx(jT,{width:12,height:12,className:"me-8 text-danger"}):g.jsx(Kv,{width:12,height:12,className:"me-8 text-danger"}),hl(t!=="IDLE"?r:0)+" / "+hl(i)]}),e!=="IDLE"&&g.jsxs("div",{className:"d-flex align-items-center mx-auto",children:[g.jsx(u1,{width:12,height:12,className:"me-8"}),hl(n*1e3)," /",hl(r)]})]}),ode=sde;function ade(t,e,r=!1,n="protected",i="media-library"){var s;function o(q,te){return{...q,...te.updatedState}}const[{recordState:a,playState:l,micStream:u,micStreamAudioSourceNode:c,audioWorkletNode:h,audioContext:f,encoderWorker:m,maxDuration:y,recordTime:v,isEncoding:x},b]=T.useReducer(o,{recordState:"IDLE",isEncoding:!1,playState:"IDLE",recordTime:0,maxDuration:180}),_=T.useRef(null),w=T.useRef(null),E=T.useRef(),A=T.useRef(),{t:I}=we(),{create:P}=J1(),M=128,N=48e3;T.useEffect(()=>{const q=new Worker("/infra/public/js/audioEncoder.js");return b({type:"update",updatedState:{encoderWorker:q}}),q.postMessage(["init",(f==null?void 0:f.sampleRate)||N]),()=>{j(),q.terminate()}},[]);const z=q=>{var te,ue;const le=q.data.inputs[0][0];let me=q.data.inputs[0][1];(!me||me.filter(xe=>xe!==void 0).length===0)&&(me=le),(te=E.current)==null||te.push(le),(ue=A.current)==null||ue.push(me)},j=T.useCallback(()=>{u==null||u.getTracks().forEach(q=>q.stop()),c==null||c.disconnect(),h==null||h.port.removeEventListener("message",z),h==null||h.port.close(),h==null||h.disconnect(),f==null||f.close()},[f,h,u,c]),H=async()=>{const q=await navigator.mediaDevices.getUserMedia({audio:!0}),te=new AudioContext({sampleRate:N}),ue=te.createMediaStreamSource(q);try{await te.audioWorklet.addModule("/infra/public/js/audio-recorder-processor.js")}catch(me){console.error(me)}const le=new AudioWorkletNode(te,"audio-recorder-processor");le.port.addEventListener("message",z),b({type:"update",updatedState:{micStream:q,micStreamAudioSourceNode:ue,audioContext:te,recordTime:0,audioWorkletNode:le,recordState:"RECORDING",playState:"IDLE"}}),A.current=[],E.current=[],le.port.start(),ue.connect(le),le.connect(te.destination)},F=T.useCallback(async()=>{w.current&&(w.current.currentTime=0,w.current.pause()),a==="PAUSED"?(b({type:"update",updatedState:{recordState:"RECORDING",playState:"IDLE"}}),f==null||f.resume(),e==null||e(void 0)):H()},[a,f,w]),L=T.useCallback(()=>{b({type:"update",updatedState:{recordState:"PAUSED",playState:"IDLE",isEncoding:!0}}),f==null||f.suspend(),m&&E.current&&A.current&&(m.postMessage(["wav",A.current,E.current,A.current.length*M]),m.onmessage=q=>{const te=window.URL.createObjectURL(q.data);b({type:"update",updatedState:{isEncoding:!1}}),w.current&&(w.current.src=te),e&&e(te)})},[f,m,e]),O=T.useCallback(()=>{var q;b({type:"update",updatedState:{playState:"PLAYING"}}),((q=w==null?void 0:w.current)!=null&&q.currentTime||w.current)&&w.current.play()},[w]),U=T.useCallback(()=>{var q;(q=w==null?void 0:w.current)==null||q.pause(),b({type:"update",updatedState:{playState:"PAUSED"}})},[w]),V=T.useCallback(()=>{j(),b({type:"update",updatedState:{playState:"IDLE",recordState:"IDLE"}}),A.current=[],E.current=[],e&&e(void 0)},[j,e]),k=T.useCallback(async()=>{var q;const te=(q=_.current)==null?void 0:q.value;if(!te){console.error("Audio name is required");return}return w.current&&(w.current.pause(),w.current.currentTime=0),b({type:"update",updatedState:{recordState:"SAVING",playState:"IDLE"}}),new Promise((ue,le)=>{try{m&&E.current&&A.current&&(m.postMessage(["mp3",A.current,E.current,A.current.length*M]),m.onmessage=async me=>{if(me.data instanceof Blob){const xe=new File([me.data],te,{type:"audio/mp3"}),_e=await P(xe,{application:i,visibility:n});_e&&t&&t(_e),b({type:"update",updatedState:{recordState:"SAVED"}}),ue(_e)}})}catch(me){b({type:"update",updatedState:{playState:"IDLE",recordState:"IDLE"}}),console.error("Error while saving",me),le()}})},[a,t,j]),$=T.useCallback(()=>{w!=null&&w.current&&(w.current.pause(),w.current.currentTime=0),b({type:"update",updatedState:{playState:"IDLE"}})},[w]),B=T.useCallback(()=>{b({type:"update",updatedState:{playState:"PAUSED"}}),w.current&&(w.current.currentTime=0)},[w]);T.useEffect(()=>{if(a==="RECORDING"&&f){const q=window.setInterval(()=>{b({type:"update",updatedState:{recordTime:f.currentTime}}),f.currentTime>=y&&(L(),window.clearInterval(q))},100);return()=>window.clearInterval(q)}},[f,L,y,a]);const X=I(a==="IDLE"?"bbm.audio.record.start":"bbm.audio.record.resume"),K=[{type:"icon",name:"record",visibility:a==="RECORDING"?"hide":"show",props:{icon:g.jsx(Kv,{}),color:"danger",disabled:a!=="IDLE"&&a!=="PAUSED"||v>=y,onClick:F,"aria-label":X},tooltip:X},{type:"icon",name:"recordPause",visibility:a==="RECORDING"?"show":"hide",props:{icon:g.jsx(yz,{}),color:"danger",disabled:a!=="RECORDING",onClick:L,"aria-label":I("bbm.audio.record.pause")},tooltip:I("bbm.audio.record.pause")},{type:"divider"},{type:"icon",name:"encoding",visibility:x?"show":"hide",props:{icon:g.jsx(jN,{style:{animation:"loading 1s infinite"}}),disabled:!0}},{type:"icon",name:"play",visibility:x||l==="PLAYING"?"hide":"show",props:{icon:g.jsx(BN,{}),disabled:a!=="RECORDED"&&a!=="PAUSED"&&a!=="SAVED",onClick:O,"aria-label":I("bbm.audio.play.start")},tooltip:I("bbm.audio.play.start")},{type:"icon",name:"playPause",visibility:!x&&l==="PLAYING"?"show":"hide",props:{icon:g.jsx(jT,{}),onClick:U,"aria-label":I("bbm.audio.play.pause")},tooltip:I("bbm.audio.play.pause")},{type:"icon",name:"stop",props:{icon:g.jsx(Cz,{}),disabled:l!=="PLAYING"&&l!=="PAUSED",onClick:$,"aria-label":I("bbm.audio.play.stop")},tooltip:I("bbm.audio.play.stop")},{type:"divider"},{type:"icon",name:"reset",props:{icon:g.jsx(zN,{}),disabled:a!=="RECORDED"&&a!=="PAUSED"&&l!=="PLAYING"&&l!=="PAUSED",onClick:V,"aria-label":I("bbm.audio.record.reset")},tooltip:I("bbm.audio.record.reset")},{type:"icon",name:"save",visibility:r?"hide":"show",props:{icon:g.jsx(BT,{}),disabled:a!=="RECORDED"&&a!=="PAUSED"&&l!=="PLAYING"&&l!=="PAUSED"||a==="SAVED"||!((s=_.current)!=null&&s.value),onClick:k,"aria-label":I("bbm.audio.record.save")},tooltip:I("bbm.audio.record.save")}];return{recordState:a,playState:l,audioContext:f,recordTime:v*1e3,maxDuration:y*1e3,audioRef:w,audioNameRef:_,toolbarItems:K,handlePlayEnded:B,handleSave:k}}const lde=T.forwardRef(({onSaveSuccess:t,onRecordUpdated:e,hideSaveAction:r=!1,visibility:n="protected"},i)=>{const{recordState:s,playState:o,recordTime:a,audioRef:l,audioNameRef:u,toolbarItems:c,maxDuration:h,handlePlayEnded:f,handleSave:m}=ade(t,e,r,n,"media-library"),{t:y}=we();T.useImperativeHandle(i,()=>({save:m}));const[v,x]=T.useState(0),b=Me({"text-danger":s==="RECORDING","text-success":o==="PLAYING"}),_=w=>{x(w.target.currentTime)};return g.jsxs("div",{className:"audio-recorder m-auto d-flex flex-column",children:[g.jsx(Ot,{id:"recordName",className:"mb-32",isRequired:!0,isReadOnly:s==="SAVED"||s==="SAVING",children:g.jsx(Zn,{type:"text",size:"sm",placeholder:y("bbm.audio.recorder.name"),ref:u,defaultValue:y("bbm.audio.recorder.defaultName")+new Date().toLocaleDateString()})}),g.jsx("div",{className:"audio-recorder-icon mx-auto",children:g.jsx(u1,{width:64,height:64,className:b})}),g.jsx(ode,{recordState:s,playState:o,recordTime:a,audioTime:v,maxDuration:h}),g.jsx("audio",{ref:l,onEnded:f,onTimeUpdate:_,children:g.jsx("track",{default:!0,kind:"captions",srcLang:"fr",src:""})}),g.jsx(pA,{items:c})]})}),ude=lde,cde=()=>{const{setResult:t,setPreSuccess:e,visibility:r}=Io(),n=T.useRef(null);return g.jsx(ude,{ref:n,onRecordUpdated:i=>{i?(t(i),e(()=>n.current.save)):t()},onSaveSuccess:i=>{i&&t(i)},hideSaveAction:!0,visibility:r})},dde=({link:t,onChange:e,multiNodeSelected:r=!1})=>{const{t:n}=we(),[i,s]=T.useState((t==null?void 0:t.text)||""),[o,a]=T.useState((t==null?void 0:t.url)||""),[l,u]=Am(t?t.target==="_blank":!0);return T.useEffect(()=>{r&&t!=null&&t.text&&s(t.text.slice(0,20)+"...")},[r,t]),T.useEffect(()=>{if(!o.length){e==null||e();return}const c={url:o,text:r?t==null?void 0:t.text:i||o,target:l?"_blank":void 0};!_k.isLocalURL(o)&&!_k.startWithHttp(o)&&(c.url="http://"+o),e==null||e(c)},[i,o,l]),g.jsx(g.Fragment,{children:g.jsxs("div",{className:"d-flex flex-column flex-fill gap-24",children:[g.jsxs(Ot,{id:"linkText",isOptional:!0,children:[g.jsx(Vi,{children:n("bbm.linker.ext.text")}),g.jsx(Zn,{type:"text",placeholder:n("bbm.linker.ext.text.placeholder"),size:"md",disabled:r,value:i,onChange:c=>s(c.target.value)})]}),g.jsxs(Ot,{id:"linkUrl",isRequired:!0,children:[g.jsx(Vi,{children:n("bbm.linker.ext.url")}),g.jsx(Zn,{type:"text",placeholder:n("bbm.linker.ext.url.placeholder"),size:"md",value:o,onChange:c=>a(c.target.value)})]}),g.jsx(Cm,{label:n("bbm.linker.open.tab"),onChange:()=>u(),checked:l})]})})},hde=dde,fde=({link:t,multiNodeSelected:e=!1})=>{const{setResult:r}=Io();return g.jsx(hde,{link:t,onChange:n=>{r(n)},multiNodeSelected:e})},pde=({onSuccess:t})=>{const{t:e}=we(),[r,n]=T.useState();function i(s){const o=s.target.value;n(o),o!=null&&o.length?t(o):t()}return g.jsxs("div",{className:"d-flex flex-column flex-fill",children:[g.jsx("div",{className:"mb-32",children:e("bbm.embed.description")}),g.jsxs("div",{className:"mb-8 d-flex",children:[g.jsx(AS,{className:"me-8"}),e("bbm.embed.title")]}),g.jsx(Ot,{id:"iframeContent",children:g.jsx(fA,{size:"md",height:"sm",placeholder:e("bbm.embed.placeholder"),onChange:i})}),!!(r!=null&&r.length)&&g.jsx("div",{className:"embed-preview mt-12",dangerouslySetInnerHTML:{__html:r}}),!(r!=null&&r.length)&&g.jsx("div",{className:"embed-preview mt-12 d-flex align-items-center justify-content-center bg-gray-300 text-black-50 rounded-3",children:g.jsx("strong",{children:e("bbm.embed.preview")})})]})},mde=pde,gde=()=>{const{setResult:t}=Io();return g.jsx(mde,{onSuccess:e=>{e=e==null?void 0:e.replace(/<p /g,"<div ").replace(/\/p>/g,"/div>"),t(e)}})},vde=({doc:t,isClickable:e=!0,isSelectable:r=!1,isSelected:n=!1,onClick:i,className:s})=>{const{fromNow:o}=RL(),{fromDate:a}=T.useMemo(()=>({fromDate:o(t.modifiedAt)}),[o,t]);return g.jsx(tr,{className:Me("card-linker shadow-none",s),isClickable:e,isSelectable:r,isSelected:n,onClick:i,children:g.jsxs(tr.Body,{space:"8",children:[g.jsx("div",{className:"card-image ps-8 pe-4",children:t.thumbnail&&t.thumbnail.length>0?g.jsx(yo,{alt:"",height:48,width:48,src:t.thumbnail,objectFit:"cover",className:"rounded h-full",style:{aspectRatio:1/1}}):g.jsx(ga,{app:t.application,iconFit:"ratio",size:"48",variant:"rounded"})}),g.jsxs("div",{className:"w-75",children:[g.jsx(tr.Text,{children:t.name}),g.jsx(tr.Text,{className:"text-black-50",children:t==null?void 0:t.creatorName})]}),g.jsx("div",{className:"d-none d-md-block text-black-50 ps-4 pe-8",children:g.jsx(tr.Text,{children:a})}),t.shared&&g.jsx("div",{className:"ps-4 pe-8",children:g.jsx(UT,{width:"20",height:"20"})})]})})},yde=vde,xde=({appCode:t,defaultAppCode:e,defaultResourceId:r,onChange:n,onSelect:i,multiple:s=!0,resourceList:o,applicationList:a,showApplicationSelector:l=!0})=>{const{t:u}=we(),{theme:c}=ya(),[h]=Pn(),{resourceApplications:f,loadResources:m}=Xce(t),[y,v]=T.useState(),[x,b]=T.useState(),[_,w]=T.useState(),E=sA(_||"",500),[A,I]=T.useState([]),P=T.useCallback((k,$)=>{var B,X,K;if(!$)return!0;const q=($==null?void 0:$.toLowerCase())||"";return((B=k.name)==null?void 0:B.toLowerCase().includes(q))||((X=k.creatorName)==null?void 0:X.toLowerCase().includes(q))||((K=k.description)==null?void 0:K.toLowerCase().includes(q))},[]),M=T.useCallback(k=>k.sort(($,B)=>$.modifiedAt<B.modifiedAt?1:-1),[]),N=T.useCallback(k=>{async function $(){if(o){const B=o.filter(X=>P(X,k));I(M(B));return}else if(x)try{const B=(await m({application:x.application,search:k,types:[x.application],filters:{},pagination:{startIdx:0,pageSize:300}})).filter(X=>P(X,k));I(M(B));return}catch{}I([])}$()},[m,x,P,M,o]),[z,j]=T.useState([]),H=k=>{n==null||n(k),b(k)},F=k=>{const $=k.target.value;w($.toString())},L=T.useCallback(k=>{N(_),k.stopPropagation(),k.preventDefault()},[N,_]),O=T.useCallback(k=>z.findIndex($=>$.assetId===k),[z]),U=T.useCallback(k=>{j(s?$=>[...$,k]:[k])},[j,s]),V=T.useCallback(k=>{const $=O(k.assetId);$<0?U(k):j(z.filter((B,X)=>X!==$))},[O,U,z]);return T.useEffect(()=>{(async()=>{if(a){v(a.sort((B,X)=>B.displayName.localeCompare(X.displayName)));return}const k=f.map(B=>Ie.session().getWebApp(B)),$=await Promise.all(k);v(f.map((B,X)=>{var K;return{application:B,displayName:u(((K=$[X])==null?void 0:K.displayName)??B),icon:g.jsx(ga,{app:$[X],size:"24"})}}).sort((B,X)=>B.displayName.localeCompare(X.displayName)))})()},[f,u,a]),T.useEffect(()=>{N(E)},[N,E]),T.useEffect(()=>{i==null||i(z)},[z]),T.useEffect(()=>{var k;const $=e??((a==null?void 0:a.length)===1&&((k=a==null?void 0:a[0])==null?void 0:k.application));if($){const B=y==null?void 0:y.find(X=>$===X.application);b(B),N("")}},[y,e]),T.useEffect(()=>{if(r&&O(r)<0){const k=A==null?void 0:A.find($=>r===$.assetId);k&&U(k)}},[A]),g.jsxs("div",{className:"d-flex flex-column flex-fill overflow-hidden",children:[g.jsxs("div",{className:"search d-flex bg-light rounded-top border border-bottom-0",children:[l&&g.jsx("div",{className:"flex-shrink-1 px-8 py-12 border-end",children:g.jsxs(xt,{overflow:!0,children:[g.jsx(xt.Trigger,{icon:g.jsx("div",{className:"pe-8",children:(x==null?void 0:x.icon)||g.jsx(ON,{})}),label:u((x==null?void 0:x.displayName)||"bbm.linker.int.choose"),variant:"ghost",size:"md"}),g.jsx(xt.Menu,{children:y==null?void 0:y.map(k=>g.jsx(xt.Item,{icon:k.icon,onClick:()=>H(k),children:k.displayName},k.application))})]})}),g.jsx("div",{className:"flex-grow-1 align-self-center",children:g.jsx("form",{className:"gap-16 d-flex w-100 align-items-center px-16 py-8",onSubmit:L,children:g.jsx(n8,{isVariant:!0,placeholder:u("search"),size:"lg",className:"w-100",disabled:!x,onChange:F})})})]}),g.jsxs("div",{className:"internal-linker flex-grow-1 w-100 rounded-bottom border gap-0 overflow-auto",children:[x&&A&&A.length>0&&g.jsx("div",{children:A.map(k=>{const $=z.findIndex(B=>B.assetId===k.assetId)>=0;return g.jsx(yde,{doc:k,isSelected:$,onClick:()=>V(k)},k.path)})}),x&&A&&A.length<=0&&g.jsx("div",{className:"d-flex justify-content-center mt-16",children:g.jsx(ua,{imageSrc:`${h}/${c==null?void 0:c.bootstrapVersion}/illu-empty-search-${x.application}.svg`,text:u("bbm.linker.int.notfound"),className:"mt-16"})}),!x&&g.jsx("div",{className:"d-flex justify-content-center mt-32",children:g.jsx(ua,{imageSrc:`${h}/${c==null?void 0:c.bootstrapVersion}/illu-empty-search.svg`,text:u("bbm.linker.int.empty"),className:"mt-32"})})]})]})},bde=xde,wde=({target:t,resourceId:e,appPrefix:r})=>{const{t:n}=we(),{setResult:i,setResultCounter:s,appCode:o,multiple:a}=Io(),[l,u]=Am(t==="_blank"),[c,h]=T.useState([]),f=m=>{h(m)};return T.useEffect(()=>{i({target:l?"_blank":void 0,resources:c}),c&&c.length?s(c.length):s(void 0)},[l,c]),g.jsxs("div",{className:"d-flex flex-column flex-fill gap-16 overflow-hidden",children:[g.jsx(bde,{appCode:o,defaultAppCode:r,defaultResourceId:e,onSelect:f,multiple:a}),g.jsx(Cm,{className:"align-items-center",checked:l,label:n("bbm.linker.open.tab"),onChange:u})]})},_de=(t,e)=>{if(t==0)return"0 octets";const r=1e3,n=e,i=["octets","Ko","Mo","Go"],s=Math.floor(Math.log(t)/Math.log(r));return parseFloat((t/Math.pow(r,s)).toFixed(n))+" "+i[s]},Sde=({historyCount:t,handle:e})=>{const{t:r}=we(),[n,i]=T.useState(void 0),s=a=>{i(a),e(a)},o=[{type:"button",name:"undo",props:{color:"tertiary",leftIcon:g.jsx($z,{}),"aria-label":r("cancel"),children:r("cancel"),onClick:()=>s("UNDO"),disabled:t===0},tooltip:r("cancel")},{type:"divider",name:"div-1"},{type:"button",name:"reset",props:{color:"tertiary",leftIcon:g.jsx(HN,{}),"aria-label":r("rotate"),children:r("rotate"),onClick:()=>s("ROTATE")},tooltip:r("rotate")},{type:"button",name:"crop",props:{color:"tertiary",leftIcon:g.jsx(z$,{}),"aria-label":r("crop"),children:r("crop"),className:n==="CROP"?"is-selected":"",onClick:()=>s("CROP")},tooltip:r("crop")},{type:"button",name:"blur",props:{color:"tertiary",leftIcon:g.jsx(O$,{}),"aria-label":r("blur"),children:r("blur"),className:n==="BLUR"?"is-selected":"",onClick:()=>s("BLUR")},tooltip:r("blur")}];return g.jsx(pA,{variant:"no-shadow",align:"left",isBlock:!0,items:o})},Ede=Sde,Tde=100,Tk=100,Cde=450,Ade=64,Rde=.5,Pde="image";function P2(t,{spriteName:e,imgDatasource:r,settings:n}){const i=URL.createObjectURL(r),s=new Image;return s.src=i,new Promise(o=>{s.onload=async()=>{await I2(t,{spriteName:e,imgDatasource:s,settings:n});const a=t==null?void 0:t.stage.getChildByName(e,!0);o(a)}})}async function I2(t,{spriteName:e,imgDatasource:r,settings:n}){if(t===void 0||t.stage===null)return;const i=t.stage.getChildByName(e,!0);i==null||i.removeFromParent();const s=r instanceof HTMLImageElement?Ee.from(r):r instanceof Rr?r:await Ee.fromURL(r),o=s instanceof Rr?s:Rr.from(s,{});if(o.interactive=!0,o.name=e,n){const{sprite:{anchor:a,position:l,scale:u,size:c,rotation:h},stage:{size:f}}=n,m=h%Math.PI!==0;o.anchor.x=a.x,o.anchor.y=a.y,o.position.x=l.x,o.position.y=l.y,o.scale.x=u.x,o.scale.y=u.y,o.width=m?c.height:c.width,o.height=m?c.width:c.height,t.stage.height=f.height,t.stage.width=f.width,t.renderer.resize(f.width,f.height),t.stage.addChild(o)}else t.stage.addChild(o),t.renderer.resize(o.width,o.height);Ide(t,o)}function Ide(t,e){var r;const n=t.view.parentNode,i=window.innerWidth-Ade,s=Math.max((n==null?void 0:n.offsetWidth)??0,Tk),o=Mde({width:e.width,height:e.height},{width:{max:Math.min(s,i),min:Tk},height:{min:Tde,max:window.innerHeight-Cde}}),{height:a,width:l}=o;(r=t.view)!=null&&r.style&&(t.view.style.width=`${l}px`,t.view.style.height=`${a}px`)}function Mde(t,e){const{height:r,width:n}=t,i=n/r,{height:s,width:o}=e;let a=o.max,l=o.max/i;return n>o.max&&(a=o.max,l=a/i),l>s.max&&(l=s.max,a=l*i),a<o.min&&(a=o.min,l=a/i),l<s.min&&(l=s.min,a=l*i),{width:a,height:l}}function kde(t){return new Promise((e,r)=>{var n;(n=t==null?void 0:t.view)!=null&&n.toBlob?t.view.toBlob(i=>{i?e(i):r("EXTRACT_FAILED")},"image/jpeg",Rde):r("EXTRACT_FAILED")})}function Ode(t){var e,r;return(r=(e=t.view).toDataURL)==null?void 0:r.call(e)}function gA(t){return t.view.getBoundingClientRect?t.view.getBoundingClientRect().width/t.view.width:1}function M2(t){return new Promise((e,r)=>{var n,i;(i=(n=t.view).toBlob)==null||i.call(n,s=>{s?e(s):r("EXTRACT_FAIL")},"image/png",1)})}function Dde({application:t,sprite:e}){return{sprite:{rotation:e.rotation,size:{width:e.width,height:e.height},position:{x:e.position.x,y:e.position.y},scale:{x:e.scale.x,y:e.scale.y},anchor:{x:e.anchor.x,y:e.anchor.y}},stage:{size:{width:t.stage.width,height:t.stage.height},scale:{x:t.stage.scale.x,y:t.stage.scale.y}}}}function Nde({application:t,sprite:e,newHeight:r,newWidth:n}){e.anchor.x=.5,e.anchor.y=.5,e.position=new et(n/2,r/2),t.stage.height=r,t.stage.width=n,t.renderer.resize(n,r)}const Lde=20,Fde=({maxSize:t=Lde,application:e,spriteName:r,onRestore:n})=>{const[i,s]=T.useState([]);T.useEffect(()=>{s([])},[e]);const o=async()=>{const u=i.pop();u&&(n(await u.backup,u),s(i.filter(c=>c!==u)))},a=u=>(u.length>t&&u.splice(0,u.length-t),u),l=async u=>{{if(!e)return;const c=e.stage.getChildByName(r,!0);if(c==null)return;const h=M2(e),f={backup:h,sprite:{rotation:c.rotation,size:{width:c.width,height:c.height},position:{x:c.position.x,y:c.position.y},scale:{x:c.scale.x,y:c.scale.y},anchor:{x:c.anchor.x,y:c.anchor.y}},stage:{size:{width:e.stage.width,height:e.stage.height},scale:{x:e.stage.scale.x,y:e.stage.scale.y}}};return s([...a(i),f]),await h,u.call(u)}};return{historyCount:i.length,restore:o,historize:l}},jde=Fde;function Bde(t,e,r){let n;const i=[];return function(s){i.push(e(s)),!n&&(n=setTimeout(()=>{const o=[...i];i.splice(0,i.length),r(o),n=void 0},t))}}const l8=20,Ude=50,vA="BRUSH_CURSOR";function $de(t,e){const r=new Hi;for(const n of t)n&&(r.beginFill(16777215,1),r.drawCircle(n.x,n.y,l8/e),r.lineStyle(0),r.endFill());return r}function zde(t,{spriteName:e}){return Bde(Ude,r=>t.stage.toLocal(r.global),r=>{const n=t.stage.getChildByName(e),i=gA(t);if(n==null)return;const s=new Rr(n.texture);s.filters=[new FF(8,4,Math.min(i,1))],s.width=n.width,s.height=n.height,s.scale=new et(1,1),s.anchor=n.anchor,s.mask=$de(r,i),n.addChild(s)})}function Hde(t){u8(t);const e=gA(t),r=new Hi;return r.lineStyle(Math.max(1,1/e),16711680),r.drawCircle(0,0,l8/e),r.endFill(),r.name=vA,t.stage.addChild(r),r}function u8(t){const e=t.stage.getChildByName(vA);e&&e.removeFromParent()}function Vde(t){return e=>{if(!t)return;const r=t.stage.toLocal(e.global),n=t.stage.getChildByName(vA,!0);n&&(n.position.x=r.x,n.position.y=r.y)}}function Gde(t,{spriteName:e}){t.stage.interactive=!0;const r=Hde(t),n=Vde(t);t.stage.on("pointermove",n);const i=zde(t,{spriteName:e});t.stage.on("pointerdown",()=>{t.stage.on("pointermove",i)});const s=()=>{var o;(o=t==null?void 0:t.stage)==null||o.off("pointermove",i)};globalThis.addEventListener("pointerup",s),r.once("destroyed",()=>{globalThis.removeEventListener("pointerup",s)})}function Wde(t){u8(t),t.stage.off("pointerdown"),t.stage.off("pointermove")}const Xde=["TOP_LEFT","TOP_RIGHT","BOTTOM_LEFT","BOTTOM_RIGHT"],k0=0,qde=20,yA="CROP_BACKGROUND_NAME",Pm="CROP_MASK_NAME";function k2(t){return"CROP_CORNER_"+t}function Yde(t,{spriteName:e}){c8(t);const r=t.stage.getChildByName(e);if(r==null)return;const n=r.getBounds(),i=t.renderer.generateTexture(t.stage).clone(),s=new Rr(i);s.height=n.height,s.width=n.width,s.position=new et(0,0);const o=new Hi;o.beginFill(16777215,.5),o.drawRect(0,0,n.width,n.height),o.endFill(),o.name=yA,o.position=new et(n.x,n.y);const a=new Hi;a.beginFill(0,1),a.drawRect(0,0,n.width-2*k0,n.height-2*k0),a.endFill(),a.position=new et(k0,k0),a.name=Pm,s.mask=a,t.stage.addChild(o),o.addChild(a),o.addChild(s)}function c8(t){const e=t.stage.getChildByName(yA,!0);e==null||e.removeFromParent()}function d8(t,e){switch(t){case"TOP_LEFT":return{x:e.x,y:e.y,start:0,end:Math.PI/2};case"TOP_RIGHT":return{x:e.x+e.width,y:e.y,start:Math.PI/2,end:Math.PI};case"BOTTOM_LEFT":return{x:e.x,y:e.y+e.height,start:3*Math.PI/2,end:2*Math.PI};case"BOTTOM_RIGHT":return{x:e.x+e.width,y:e.y+e.height,start:Math.PI,end:3*Math.PI/2}}}function Qde(t){const e=t.stage.getChildByName(Pm,!0);e!=null&&Xde.forEach(r=>{const n=t.stage.getChildByName(k2(r),!0);if(n==null)return;const i=d8(r,{height:e.height,width:e.width,x:e.x,y:e.y});n.position=new et(i.x,i.y)})}function O0(t,e,{spriteName:r}){const n=t.stage.getChildByName(k2(e),!0),i=gA(t);n==null||n.removeFromParent();const s=t.stage.getChildByName(yA,!0),o=t.stage.getChildByName(Pm,!0);if(t.stage.getChildByName(r)==null||s===null||s===void 0||o===void 0||o===null)return;const l=d8(e,{height:o.height,width:o.width,x:o.x,y:o.y}),u=new Hi;u.beginFill(4960213,1),u.arc(0,0,qde/i,l.start,l.end),u.lineTo(0,0),u.endFill(),u.position=new et(l.x,l.y),u.name=k2(e),u.interactive=!0;let c=!1;t.stage.on("pointermove",m=>{if(c===!1)return;const y=s.toLocal(m.global);u.position.x=y.x,u.position.y=y.y,Kde(t,e,y)});const h=()=>{c=!0};u.on("pointerdown",h);const f=()=>{c=!1};globalThis.addEventListener("pointerup",f),u.once("destroyed",()=>{u.off("pointerdown"),globalThis.removeEventListener("pointerup",f)}),s.addChild(u)}function Kde(t,e,r){const n=t.stage.getChildByName(Pm,!0);if(n==null)return;const i=n.position.x+n.width,s=n.position.y+n.height;switch(e){case"TOP_LEFT":{n.position.x=r.x,n.position.y=r.y,n.width=i-r.x,n.height=s-r.y;break}case"TOP_RIGHT":{n.position.y=r.y,n.width=r.x-n.position.x,n.height=s-r.y;break}case"BOTTOM_LEFT":{n.position.x=r.x,n.width=i-r.x,n.height=r.y-n.position.y;break}case"BOTTOM_RIGHT":{n.width=r.x-n.position.x,n.height=r.y-n.position.y;break}}Qde(t)}function Zde(t,{spriteName:e}){xA(t),t.stage.interactive=!0,t.stage.interactiveChildren=!0,Yde(t,{spriteName:e}),O0(t,"BOTTOM_LEFT",{spriteName:e}),O0(t,"BOTTOM_RIGHT",{spriteName:e}),O0(t,"TOP_LEFT",{spriteName:e}),O0(t,"TOP_RIGHT",{spriteName:e})}function xA(t){c8(t),t.stage.off("pointermove"),t.render()}function Jde(t){const e=t.stage.getChildByName(Pm,!0);if(e==null)return;xA(t);const r=t.renderer.generateTexture(t.stage).clone(),n=new Rr(r),i=e.getBounds(),s=new st(Math.floor(i.x),Math.floor(i.y),Math.floor(i.width),Math.floor(i.height)),o=new Ee(n.texture.baseTexture,s);return new Rr(o)}const ehe=20,ex="CONTROL_NAME";function h8(t){return"RESIZE_CORNER_"+t}function the(t,e){const r=e.x,n=e.y;switch(t){case"TOP_LEFT":return{x:r,y:n,start:0,end:Math.PI/2};case"TOP_RIGHT":return{x:r+e.width,y:n,start:Math.PI/2,end:Math.PI};case"BOTTOM_LEFT":return{x:r,y:n+e.height,start:3*Math.PI/2,end:2*Math.PI};case"BOTTOM_RIGHT":return{x:r+e.width,y:n+e.height,start:Math.PI,end:3*Math.PI/2}}}function rhe(t,{container:e,cornerType:r,position:n,spriteName:i}){const s=t.stage.getChildByName(i,!0);if(s==null)return;const o=s.rotation%Math.PI!==0,a=o?s.height:s.width,l=o?s.width:s.height;switch(r){case"TOP_LEFT":{e.position=new et(n.x,n.y),e.width=a-2*n.x,e.height=l-2*n.y;break}case"TOP_RIGHT":{const u=a-n.x;e.position=new et(u,n.y),e.width=a-2*u,e.height=l-2*n.y;break}case"BOTTOM_LEFT":{const u=l-n.y;e.position=new et(n.x,u),e.width=a-2*n.x,e.height=l-2*u;break}case"BOTTOM_RIGHT":{const u=l-n.y,c=a-n.x;e.position=new et(c,u),e.width=a-2*c,e.height=l-2*u;break}}}function Of(t,e){const r=t.stage.getChildByName(h8(e),!0);r==null||r.removeFromParent()}function D0(t,e,{spriteName:r}){Of(t,e);const n=t.stage.getChildByName(r,!0),i=t.stage.getChildByName(ex,!0);if(n==null||i===null||i===void 0)return;const s=the(e,i),o=new Hi;o.beginFill(4960213,1),o.arc(0,0,ehe,s.start,s.end),o.lineTo(0,0),o.endFill(),o.position=new et(s.x,s.y),o.name=h8(e),o.interactive=!0;let a=!1;t.stage.on("pointermove",c=>{if(a===!1)return;const h=t.stage.toLocal(c.global);rhe(t,{cornerType:e,position:h,container:i,spriteName:r})});const l=()=>{a=!1};globalThis.addEventListener("pointerup",l),o.once("destroyed",()=>{o.off("pointerdown"),globalThis.removeEventListener("pointerup",l)});const u=()=>{a=!0};o.on("pointerdown",u),i.addChild(o)}function nhe(t,e){f8(t);const r=t.stage.getChildByName(e,!0);if(r==null)return;const n=t.renderer.generateTexture(t.stage),i=new Rr(n);t.stage.children.forEach(o=>{o.alpha=0});const s=new Hi;s.drawRect(0,0,r.width,r.height),s.name=ex,s.interactive=!0,s.interactiveChildren=!0,t.stage.interactive=!0,t.stage.interactiveChildren=!0,t.stage.addChild(s),s.addChild(i)}function f8(t){const e=t.stage.getChildByName(ex,!0);e==null||e.removeFromParent(),t.stage.children.forEach(r=>{r.alpha=1})}function ihe(t,e){nhe(t,e),D0(t,"BOTTOM_LEFT",{spriteName:e}),D0(t,"BOTTOM_RIGHT",{spriteName:e}),D0(t,"TOP_LEFT",{spriteName:e}),D0(t,"TOP_RIGHT",{spriteName:e})}function p8(t){f8(t),Of(t,"BOTTOM_LEFT"),Of(t,"BOTTOM_RIGHT"),Of(t,"TOP_LEFT"),Of(t,"TOP_RIGHT"),t.stage.off("pointermove")}function she(t,e){ihe(t,e)}function ohe(t){p8(t),t.stage.off("pointermove"),t.render()}function ahe(t){var e;const r=(e=t==null?void 0:t.stage)==null?void 0:e.getChildByName(ex,!0),n=r?{height:r.height,width:r.width}:void 0;if(p8(t),n){const i=t.renderer.generateTexture(t.stage).clone(),s=new Rr(i);return s.width=n.width,s.height=n.height,s}else return}async function lhe(t,e){const r=t==null?void 0:t.stage.getChildByName(e,!0);if(t&&r){if(!t)return;const n=await M2(t),i=await P2(t,{imgDatasource:n,spriteName:e,settings:Dde({application:t,sprite:r})});if(!i)return;let s,o;const a=t.view;a.style&&(s=a.style.maxHeight??"",o=a.style.visibility??"",a.style.maxHeight=`${a.clientHeight}px`,a.style.visibility="hidden"),i.rotation+=Math.PI/2,Nde({application:t,sprite:i,newHeight:i.width,newWidth:i.height}),t.render();const l=await M2(t);s!==void 0&&(a.style.maxHeight=s),o!==void 0&&(a.style.visibility=o),await P2(t,{imgDatasource:l,spriteName:e})}}function uhe({application:t,spriteName:e,onSave:r}){return{rotate:async()=>{t&&await lhe(t,e)},startCrop:()=>{t&&Zde(t,{spriteName:e})},stopCrop:n=>{if(t){if(n){const i=Jde(t);i&&r(i)}xA(t)}},startBlur:()=>{t&&Gde(t,{spriteName:e})},stopBlur:()=>{t&&Wde(t)},startResize:()=>{t&&she(t,e)},stopResize:n=>{if(t){if(n){const i=ahe(t);i&&r(i)}ohe(t)}}}}function che({imageSrc:t,spriteName:e=Pde}){const[r,n]=T.useState(void 0),[i,s]=T.useState(!0),{rotate:o,startBlur:a,startCrop:l,startResize:u,stopBlur:c,stopCrop:h,stopResize:f}=uhe({spriteName:e,application:r,onSave(_){r&&I2(r,{imgDatasource:_,spriteName:e})}}),m=()=>r?kde(r):Promise.resolve(void 0),y=()=>{if(r)return Ode(r)},{restore:v,historize:x,historyCount:b}=jde({application:r,spriteName:e,onRestore(_,w){r&&P2(r,{imgDatasource:_,spriteName:e,settings:w})}});return T.useEffect(()=>{r&&(s(!0),I2(r,{spriteName:e,imgDatasource:t}).finally(()=>s(!1)))},[r,t,e]),{historyCount:b,setApplication:n,restore:v,stopCrop:h,stopBlur:c,stopResize:f,startResize:async()=>{s(!0),await x(u),s(!1)},startCrop:async()=>{s(!0),await x(l),s(!1)},startBlur:async()=>{s(!0),await x(a),s(!1)},rotate:async()=>{s(!0),await x(o),s(!1)},toBlob:m,toDataURL:y,loading:i}}const dhe=({altText:t,legend:e,image:r,isOpen:n,onCancel:i,onError:s,onSave:o})=>{const{t:a}=we(),[l,u]=T.useState(void 0),[c,h]=T.useState(!1),[f,m]=T.useState(t??""),[y,v]=T.useState(e??""),[x,b]=T.useState(!1),{toBlob:_,setApplication:w,startBlur:E,stopBlur:A,restore:I,rotate:P,startCrop:M,stopCrop:N,startResize:z,stopResize:j,historyCount:H,loading:F}=che({imageSrc:r}),L=()=>{A(),N(l==="CROP"),j(l==="RESIZE")},O=async()=>{try{h(!0),L();const k=await _();k&&await o({blob:k,altText:f,legend:y})}catch(k){s==null||s(`${k}`)}finally{h(!1)}},U=()=>{i()},V=async k=>{switch(L(),u(k),b(!0),k){case"ROTATE":{await P();break}case"UNDO":{await I();break}case"CROP":{M();break}case"RESIZE":{await z();break}case"BLUR":{await E();break}}};return g.jsxs(Ye,{id:"image-editor",isOpen:n,onModalClose:U,size:"lg",children:[g.jsx(Ye.Header,{onModalClose:U,children:g.jsx("span",{className:"h2",children:a("imageeditor.title")})}),g.jsx(Ye.Body,{className:"d-flex flex-column align-items-center",children:g.jsxs("div",{className:"d-flex flex-column gap-12 w-100 flex-grow-1",children:[g.jsx(Ede,{handle:V,historyCount:H}),g.jsxs("div",{className:"position-relative d-flex flex-column align-items-center justify-content-center flex-grow-1 w-100 image-editor",children:[g.jsx(Bee.Stage,{onMount:k=>w(k),options:{preserveDrawingBuffer:!0,backgroundAlpha:0,resolution:1}}),!!F&&g.jsx("div",{className:"position-absolute top-0 start-0 bottom-0 end-0 m-10 d-flex align-items-center justify-content-center bg-black opacity-25",children:g.jsx(pr,{})})]}),g.jsxs("div",{className:"d-flex flex-column flex-md-row m-10 gap-12 w-100",children:[g.jsxs(Ot,{id:"alt",className:"flex-grow-1",children:[g.jsx(Vi,{children:a("alttext")}),g.jsx(Zn,{value:f,onChange:k=>{b(!0),m(k.target.value)},placeholder:a("alttext.help"),size:"md",type:"text"})]}),g.jsxs(Ot,{id:"legend",className:"flex-grow-1",children:[g.jsx(Vi,{children:a("legend")}),g.jsx(Zn,{value:y,onChange:k=>{b(!0),v(k.target.value)},placeholder:a("legend.help"),size:"md",type:"text"})]})]})]})}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{color:"tertiary",onClick:U,type:"button",variant:"ghost",children:a("imageeditor.cancel")}),g.jsx(it,{color:"primary",onClick:O,type:"button",variant:"filled",isLoading:c,disabled:c||!x,children:a("imageeditor.save")})]})]})},hhe=dhe,fhe=({onFilesChange:t,visibility:e="protected"})=>{const{files:r,uploadedFiles:n,getUploadStatus:i,uploadFile:s,removeFile:o,updateImage:a,editingImage:l,setEditingImage:u,getUrl:c}=Kce({handleOnChange:t,application:"media-library",visibility:e}),h=T.useRef(new Map);T.useEffect(()=>{const y=h.current;return()=>{y.forEach(v=>URL.revokeObjectURL(v)),y.clear()}},[]);const f=y=>{const v=y.type.startsWith("image")?h.current.get(y.name):"";return h.current.has(y.name)||h.current.set(y.name,URL.createObjectURL(y)),{name:y.name,info:{type:y.type,weight:_de(y.size||0,1)},src:v}},m=y=>{const v=h.current.get(y.name);v&&(URL.revokeObjectURL(v),h.current.delete(y.name)),o(y)};return g.jsxs(g.Fragment,{children:[r.map(y=>{const v=n.find(x=>x.name===y.name);return g.jsx(Nce,{status:i(y),item:f(y),onEdit:()=>u(v),onRetry:()=>s(y),onDelete:()=>m(y)},y.name)}),l&&g.jsx(hhe,{altText:l.alt,legend:l.title,image:c(l,!0),isOpen:!!l,onCancel:()=>u(void 0),onSave:a,onError:console.error})]})},phe=fhe,mhe=t=>{const e=[];switch(t){case"audio":e.push("audio/*");break;case"video":e.push("video/*");break;case"image":e.push("image/png"),e.push("image/jpeg"),e.push("image/webp"),e.push("image/gif"),e.push("image/avif");break}return e},ghe=()=>{const{type:t,visibility:e,multiple:r,setResult:n,setResultCounter:i,setCancellable:s}=Io(),o=a=>{a.length?(s(a),i(a.length),n(a)):(s([]),i(void 0),n(void 0))};return g.jsx("div",{className:"py-8 flex-grow-1",children:g.jsx(xce,{multiple:r,accept:mhe(t??"embedder"),children:g.jsx(phe,{onFilesChange:o,visibility:e})})})},x_=9,b_=16,vhe=T.forwardRef(({appCode:t,caption:e,onSuccess:r,onError:n,onRecordUpdated:i,hideSaveAction:s=!1},o)=>{const[a,l]=T.useState(18e4),[u,c]=T.useState([]),[h,f]=T.useState(!1),[m,y]=T.useState(!1),[v,x]=T.useState(!1),[b,_]=T.useState(!1),[w,E]=T.useState(!1),[A,I]=T.useState({audio:!0,video:{facingMode:"environment",aspectRatio:b_/x_}}),[P,M]=T.useState(),[N,z]=T.useState(""),[j,H]=T.useState([]),[F,L]=T.useState(),[O,U]=T.useState(0),[V,k]=T.useState(0),$=T.useRef(null),B=T.useRef(null),{uploadBlob:X}=o8(void 0,t),{device:K}=L6(navigator.userAgent);T.useImperativeHandle(o,()=>({save:de}));const{t:q}=we();T.useEffect(()=>{te(),ue()},[]),T.useEffect(()=>(P||le(A),()=>{P&&P.getTracks().forEach(Re=>Re.stop())}),[P]),T.useEffect(()=>{if(j.length&&!h&&$.current){const Re=new Blob(j,{type:N});if(L(Re),i){const tt=window.URL.createObjectURL(Re);i(tt)}$.current.autoplay=!1,$.current.srcObject=null,$.current.src=window.URL.createObjectURL(Re)}},[h,j]),T.useEffect(()=>{if(h){const Re=Date.now(),tt=window.setInterval(()=>U(Date.now()-Re),500);return()=>{window.clearInterval(tt)}}},[h]),T.useEffect(()=>{if(v){const Re=window.setInterval(()=>k(tt=>tt+500),500);return()=>{window.clearInterval(Re)}}},[v]);const te=async()=>{const Re=await Ie.video().getVideoConf();l((Re.maxDuration??3)*60*1e3)},ue=async()=>{const Re=(await navigator.mediaDevices.enumerateDevices()).filter(tt=>tt.kind==="videoinput");switch(K.type){case"mobile":case"tablet":{const tt={deviceId:"environment",label:q("video.back.camera"),groupId:"",kind:"videoinput"},Rt={deviceId:"user",label:q("video.front.camera"),groupId:"",kind:"videoinput"};(Re==null?void 0:Re.length)>1?c([tt,Rt]):c([tt]);break}default:c(Re);break}},le=async Re=>{try{const tt=await navigator.mediaDevices.getUserMedia(Re);M(tt),$.current&&($.current.src&&(window.URL.revokeObjectURL($.current.src),$.current.src=""),$.current.srcObject=tt,$.current.autoplay=!0,$.current.volume=1,$.current.muted=!0)}catch(tt){console.error(tt)}},me=T.useCallback(()=>{f(!0),$&&$.current&&($.current.muted=!0);const Re=yue();z(Re),P&&(B.current=new MediaRecorder(P,{mimeType:Re}),B.current.ondataavailable=({data:tt})=>{tt.size>0&&H(Rt=>[...Rt,tt])},B.current.onerror=tt=>console.error(tt),B.current.start(1e3))},[P]),xe=T.useCallback(()=>{var Re;f(!1),y(!0),((Re=B.current)==null?void 0:Re.state)==="recording"&&(B.current.requestData(),B.current.stop())},[B]),_e=T.useCallback(()=>{var Re,tt;$&&$.current&&($.current.muted=!1),v?((tt=$==null?void 0:$.current)==null||tt.pause(),x(!1)):((Re=$==null?void 0:$.current)==null||Re.play(),x(!0))},[v]),Te=()=>{y(!1),f(!1),x(!1),E(!1),U(0),H([]),L(void 0),le(A),i&&i()},de=async()=>{if(_(!0),!F){console.error("Error while saving video: recorded video is undefined.");return}const Re=await X(F,{duration:O});if(Re!=null)return r==null||r([Re]),_(!1),E(!0),[Re];n("Error while uploading video"),_(!1),E(!0)},Be=()=>{x(!1),k(0),$.current&&($.current.currentTime=0)},je=Re=>{var tt;const Rt=u.find(J=>J.label===Re);let W={};Rt!=null&&Rt.deviceId?((Rt==null?void 0:Rt.deviceId)==="environment"||(Rt==null?void 0:Rt.deviceId)==="user"?W={audio:!0,video:{aspectRatio:b_/x_,facingMode:Rt==null?void 0:Rt.deviceId}}:W={audio:!0,video:{aspectRatio:b_/x_,deviceId:Rt.deviceId}},I(W),P&&(((tt=B.current)==null?void 0:tt.state)==="recording"&&(B.current.requestData(),B.current.stop()),P.getTracks().forEach(J=>J.stop()),M(void 0)),le(W)):console.error("Selected input device id is null")};T.useEffect(()=>{O>=a&&xe()},[O,xe]);const ut=[{type:"icon",name:"record",props:{icon:g.jsx(Kv,{color:h||m?"":"red"}),color:"danger",disabled:h||m||b,onClick:me,"aria-label":q("bbm.video.record.start")},tooltip:q("bbm.video.record.start")},{type:"icon",name:"stop",props:{icon:g.jsx(bz,{}),disabled:!h||m||b,onClick:xe,"aria-label":q("bbm.video.record.stop")},tooltip:q("bbm.video.record.stop")},{type:"icon",name:"play",visibility:v?"hide":"show",props:{icon:g.jsx(BN,{}),disabled:!m||b,onClick:_e,"aria-label":q("bbm.video.play.start")},tooltip:q("bbm.video.play.start")},{type:"icon",name:"pause",visibility:v?"show":"hide",props:{icon:g.jsx(jT,{}),disabled:!m||b,onClick:_e,"aria-label":q("bbm.video.play.pause")},tooltip:q("bbm.video.play.pause")},{type:"divider"},{type:"icon",name:"reset",props:{icon:g.jsx(zN,{}),disabled:!m||b,onClick:Te,"aria-label":q("bbm.video.record.reset")},tooltip:q("bbm.video.record.reset")},{type:"icon",name:"save",visibility:s?"hide":"show",props:{icon:g.jsx(BT,{}),disabled:!m||b||w,onClick:de,"aria-label":q("bbm.video.record.save")},tooltip:q("bbm.video.record.save")}];return g.jsxs("div",{className:"video-recorder d-flex flex-fill flex-column align-items-center pb-8",children:[g.jsx("div",{className:"video-recorder-caption d-none d-md-block",children:e}),u.length>1&&g.jsx("div",{className:"video-recorder-devices mb-12",children:g.jsxs(Ot,{id:"selectInputDevice",children:[g.jsx(Vi,{className:"d-none d-md-block",children:q("bbm.video.record.select.devices.label")}),g.jsx(aA,{placeholderOption:q("bbm.video.record.select.devices.placeholder"),options:u.map(Re=>Re.label),onValueChange:je})]})}),g.jsxs("div",{className:"video-recorder-video-container position-relative align-self-stretch",children:[g.jsx("video",{ref:$,playsInline:!0,autoPlay:!0,controls:!1,muted:!0,onEnded:Be,className:"rounded",children:g.jsx("track",{default:!0,kind:"captions",srcLang:"fr",src:""})}),(h||m)&&g.jsxs("div",{className:"video-recorder-time d-flex align-items-center font-monospace fs-6 text-bg-dark rounded",children:[h&&g.jsxs(g.Fragment,{children:[g.jsx(Kv,{width:12,height:12,color:"red",className:"me-4"}),g.jsxs("span",{children:[hl(O),"/",hl(a)]})]}),m&&g.jsxs(g.Fragment,{children:[g.jsx($N,{width:14,height:14,className:"me-4"}),g.jsxs("span",{children:[hl(V),"/",hl(O)]})]})]}),P&&g.jsx(pA,{items:ut,className:"position-absolute bottom-0 start-50 bg-white"})]}),b&&g.jsx(pr,{position:!1,caption:q("bbm.video.save.loader.caption")})]})}),yhe=vhe,xhe=()=>{const{appCode:t,setResult:e,setPreSuccess:r}=Io(),{t:n}=we(),i=T.useRef(null),s=a=>{a?(e(a),r(()=>i.current.save)):e()},o=a=>{console.error(a)};return g.jsx(yhe,{ref:i,appCode:t,caption:n("bbm.video.caption"),onRecordUpdated:s,onError:o,hideSaveAction:!0})},bhe=({onSuccess:t})=>{const{t:e}=we(),{switchType:r}=Io(),[n,i]=T.useState(),[s,o]=T.useState(),[a,l]=T.useState(void 0),[u,c]=T.useState(),h=sA(n||"",300),f=T.useId(),[m]=Pn();T.useEffect(()=>{y()},[]),T.useEffect(()=>{if(u&&h){const _=Ie.embedder().getProviderFromUrl(u,h);if(_){l(_);const w=Ie.embedder().getEmbedCodeForProvider(_,h);o(w),t(w)}else l(void 0),t()}},[h,u]);const y=async()=>{const _=await Promise.all([Ie.embedder().getDefault(),Ie.embedder().getCustom()]).then(w=>w.flat());c(_)};function v(_){const w=_.currentTarget.value;i(w),t(w!=null&&w.length?w:void 0)}function x(){r("embedder")}const b=()=>h?a?g.jsxs("div",{className:"mx-auto mt-16",children:[g.jsxs("div",{className:"video-embed-provider d-flex align-items-center",children:[g.jsx(yo,{src:a.logo,alt:"Logo "+a.displayName,className:"video-embed-provider-logo"}),a.displayName]}),s&&g.jsx("div",{className:"video-embed-preview mt-12",dangerouslySetInnerHTML:{__html:s}})]}):g.jsxs("div",{className:"d-flex flex-column align-items-center m-16",children:[g.jsx(ua,{imageSrc:`${m}/emptyscreen/illu-error.svg`,title:e("bbm.video.previewError.title"),text:e("bbm.video.previewError.text")}),g.jsxs(it,{variant:"ghost",color:"primary",onClick:x,className:"align-items-start mt-16",children:[e("bbm.video.useEmbedCode")," ",g.jsx(CS,{})]})]}):g.jsx("div",{className:"d-flex my-16 align-items-start",children:g.jsxs(it,{variant:"ghost",color:"primary",onClick:x,className:"align-items-start",children:[e("bbm.video.useEmbedCode")," ",g.jsx(CS,{})]})});return g.jsxs("div",{className:"d-flex flex-column flex-fill video-embed",children:[g.jsxs("div",{className:"mb-8 d-flex",children:[g.jsx(FT,{className:"me-8"}),e("bbm.video.url.title")]}),g.jsx(Ot,{id:f,children:g.jsx(Zn,{size:"md",type:"text",placeholder:e("bbm.video.url.placeholder"),onChange:v})}),g.jsx(g.Fragment,{children:b()})]})},whe=bhe,_he=()=>{const{setResult:t}=Io();return g.jsx(whe,{onSuccess:e=>{t(e)}})},She=({roles:t,onSelect:e,multiple:r=!0,className:n,defaultFolder:i,showPublicFolder:s})=>{const{t:o}=we(),{root:a,loadContent:l}=M0("root",o("workspace.tree.owner"),"owner",t),{root:u,loadContent:c}=M0("root",o("workspace.tree.shared"),"shared",t),{root:h,loadContent:f}=M0("root",o("workspace.tree.protected"),"protected",t),{root:m,loadContent:y}=M0("root",o("workspace.tree.public"),"public",t),v=T.useRef(null),x=T.useRef(null),b=T.useRef(null),_=T.useRef(null),[w,E]=T.useState(()=>i==="public"?s?i:"protected":i==="protected"||i==="shared"?i:"owner"),[A,I]=T.useState(()=>i==="public"?s?m:h:i==="protected"?h:i==="shared"?u:a),[P,M]=T.useState(),[N,z]=T.useState(null),[j,H]=T.useState(["modified","desc"]),[F,L]=T.useState([]),O=T.useCallback(q=>{switch(q){case"owner":return{root:a,othersRef:[x,b,_]};case"shared":return{root:u,othersRef:[v,b,_]};case"protected":return{root:h,othersRef:[v,x,_]};case"public":return{root:m,othersRef:[v,x,b]};default:throw"no.root.node"}},[a,u,h,m]),U=T.useCallback(()=>{switch(w){case"owner":l(A.id);break;case"shared":c(A.id);break;case"protected":f(A.id);break;case"public":y(A.id);break;default:throw"no.way"}},[w,A.id,l,f,y,c]);function V(q,te){E(q);const{root:ue,othersRef:le}=O(q),me=G6(ue,xe=>xe.id===te);me&&(I(me),le.forEach(xe=>{var _e;return(_e=xe.current)==null?void 0:_e.unselectAll()}))}T.useEffect(()=>{var q;let te;switch(w){case"owner":te=v;break;case"shared":te=x;break;case"protected":te=b;break;case"public":te=_;break;default:return}(q=te==null?void 0:te.current)==null||q.select("root")},[w]),T.useEffect(U,[U]),T.useEffect(()=>{if(A.files){let q=[].concat(A.files);N&&(q=q.filter(ue=>ue.name.indexOf(N)>=0));const te=j[0]==="name"?j[1]==="asc"?(ue,le)=>$(ue.name,le.name):(ue,le)=>$(le.name,ue.name):(ue,le)=>$(le.modified,ue.modified);M(()=>q.sort(te))}else M(void 0)},[A,a,h,u,m,N,j]);const k=T.useCallback(q=>{z(q.target.value)},[z]);function $(q,te){return q?te?q.localeCompare(te):1:-1}function B(){return j[0]==="name"?j[1]==="asc"?o("sort.order.alpha.asc"):o("sort.order.alpha.desc"):o("sort.order.modify.desc")}function X(q){let te=[...F];r?te.includes(q)?te=te.filter(ue=>ue._id!==q._id):te=[...te,q]:te=[q],L(te),e(te)}const K=Me("workspace flex-grow-1 gap-0",n);return g.jsxs(io,{className:K,children:[g.jsx(io.Col,{sm:"12",md:"3",xl:"4",className:"workspace-folders p-12 pt-0 gap-12",children:g.jsxs("div",{style:{position:"sticky",top:0,paddingTop:"1.2rem"},children:[g.jsx(dd,{ref:v,data:a,onTreeItemClick:q=>V("owner",q),onTreeItemUnfold:q=>V("owner",q)}),g.jsx(dd,{ref:x,data:u,onTreeItemClick:q=>V("shared",q),onTreeItemUnfold:q=>V("shared",q)}),g.jsx(dd,{ref:b,data:h,onTreeItemClick:q=>V("protected",q),onTreeItemUnfold:q=>V("protected",q)}),s&&g.jsx(dd,{ref:_,data:m,onTreeItemClick:q=>V("public",q),onTreeItemUnfold:q=>V("public",q)})]})}),g.jsx(io.Col,{sm:"12",md:"5",xl:"8",children:g.jsxs(io,{className:"flex-grow-1 gap-0",children:[g.jsxs(io.Col,{sm:"4",md:"8",xl:"12",children:[g.jsx("div",{className:"workspace-search px-16 py-8 ",children:g.jsx(n8,{isVariant:!0,className:"gap-16",onChange:k})}),g.jsxs("div",{className:"d-flex align-items-center justify-content-end px-8 py-4",children:[g.jsx("small",{className:"text-muted",children:o("workspace.search.order")}),g.jsxs(xt,{children:[g.jsx(xt.Trigger,{size:"sm",label:B(),variant:"ghost"}),g.jsxs(xt.Menu,{children:[g.jsx(xt.Item,{icon:g.jsx(Lz,{}),onClick:()=>H(["modified","desc"]),children:o("sort.order.modify.desc")}),g.jsx(xt.Item,{icon:g.jsx(kz,{}),onClick:()=>H(["name","asc"]),children:o("sort.order.alpha.asc")}),g.jsx(xt.Item,{icon:g.jsx(Dz,{}),onClick:()=>H(["name","desc"]),children:o("sort.order.alpha.desc")})]})]})]})]}),g.jsx(io.Col,{sm:"4",md:"8",xl:"12",className:"p-8 gap-8",children:P?P.length!==0?g.jsx("div",{className:"grid grid-workspace",children:P.map(q=>{const te=F.includes(q);return g.jsx(Ece,{doc:q,isSelected:te,onClick:()=>X(q)},q._id)})}):g.jsx(ua,{imageSrc:"/assets/themes/edifice-bootstrap/images/emptyscreen/illu-trash.svg",text:o("workspace.empty.docSpace"),title:o("explorer.emptyScreen.trash.title")}):g.jsx(pr,{})})]})})]})},Ehe=She,The=()=>{const{type:t,setResultCounter:e,setResult:r,multiple:n,visibility:i}=Io();function s(){switch(t){case"image":return"img";case"audio":return"audio";case"video":return"video";default:return null}}function o(a){e(a.length),a.length?r(a):r()}return g.jsx(Ehe,{roles:s(),onSelect:o,multiple:n,className:"border rounded overflow-y-auto",defaultFolder:i,showPublicFolder:i==="public"})},Na={Audio:cde,Video:xhe,Upload:ghe,ExternalLink:fde,Workspace:The,InternalLink:wde,Iframe:gde,VideoEmbedder:_he},Che=["audio-capture","video-capture","internal-link","external-link","iframe","upload","workspace","video-embedder"],w_={none:null,audio:{title:"bbm.audio.modal.title",defaultTab:"audio-capture"},video:{title:"bbm.video.modal.title",defaultTab:"video-capture"},image:{title:"bbm.image.modal.title",defaultTab:"workspace"},attachment:{title:"bbm.attachment.modal.title",defaultTab:"workspace"},hyperlink:{title:"bbm.link.modal.title",defaultTab:"linker"},embedder:{title:"bbm.embed.modal.title",defaultTab:"iframe"}},Ahe=T.forwardRef(({appCode:t,visibility:e,multiple:r,onSuccess:n,onCancel:i,onTabChange:s},o)=>{var a;const l=T.useRef(),u=T.useRef(null);T.useImperativeHandle(o,()=>({show:L,hide:O,showLink:U,type:m,...u.current})),zce({isDismissible:!0,duration:1/0});const{t:c}=we(),h=Gi("org.entcore.workspace.controllers.WorkspaceController|addDocument"),f=Gi("com.opendigitaleducation.video.controllers.VideoController|capture"),[m,y]=T.useState(null),v={workspace:{id:"workspace",icon:g.jsx(LN,{}),label:c("bbm.workspace"),content:g.jsx(Na.Workspace,{}),availableFor:["audio","video","image","attachment"],isEnable:null},upload:{id:"upload",icon:g.jsx(Iz,{}),label:c("bbm.device"),content:g.jsx(Na.Upload,{}),availableFor:["audio","video","image","attachment"],isEnable:()=>!!h},"video-capture":{id:"video-capture",icon:g.jsx($N,{}),label:c("bbm.video"),content:g.jsx(Na.Video,{}),availableFor:["video"],isEnable:()=>!!f},"audio-capture":{id:"audio-capture",icon:g.jsx(u1,{}),label:c("bbm.audio"),content:g.jsx(Na.Audio,{}),availableFor:["audio"],isEnable:()=>!!h},"external-link":{id:"external-link",icon:g.jsx(FT,{}),label:c("bbm.linker.ext"),content:g.jsx(Na.ExternalLink,{...l.current}),availableFor:["hyperlink"],isEnable:null},"internal-link":{id:"internal-link",icon:g.jsx(ON,{}),label:c("bbm.linker.int"),content:g.jsx(Na.InternalLink,{...l.current}),availableFor:["hyperlink"],isEnable:null},iframe:{id:"iframe",icon:g.jsx(AS,{}),label:c("bbm.embed"),content:g.jsx(Na.Iframe,{}),availableFor:["embedder"],isEnable:null},"video-embedder":{id:"iframe",icon:g.jsx(AS,{}),label:c("bbm.embed"),content:g.jsx(Na.VideoEmbedder,{}),availableFor:["video"],isEnable:null}},x=T.useMemo(()=>Che.map(K=>v[K]).filter(K=>{var q;return((q=K.isEnable)==null?void 0:q.call(K))!==!1&&(K.availableFor.length===0||K.availableFor.includes(m))}),[m]),[b,_]=T.useState(),w=T.useMemo(()=>{const K=x.findIndex(q=>q.id===b);return 0>K||K>=x.length?0:K},[x,b]),[E,A]=T.useState(),[I,P]=T.useState(),[M,N]=T.useState([]),[z,j]=T.useState();function H(K){throw x.findIndex(q=>q.id===K)<0?"tab.not.visible":"not.implemented.yet"}function F(K){l.current=void 0,_(void 0),y(K)}const L=K=>{y(K)},O=()=>{y(null)},U=K=>{l.current=K,!("resourceId"in K||"appPrefix"in K)&&_("external-link"),y("hyperlink")};T.useEffect(()=>{var K,q;const te=m||"none";!b&&typeof((K=w_[te])==null?void 0:K.defaultTab)=="string"&&_((q=w_[te])==null?void 0:q.defaultTab)},[b,m]);const V=c(((a=w_[m??"none"])==null?void 0:a.title)??"bbm"),k=()=>{l.current=void 0,P(void 0),A(void 0),_(void 0),j(void 0),N([])},$=K=>{s==null||s(K,M),k()},B=T.useCallback(()=>{const K=async q=>{q instanceof Array&&["protected","public"].findIndex(te=>te===e)>=0&&(q=await Ie.workspace().transferDocuments(q,t??"media-library",e)),n(q)};z?z().then(q=>{K(q)}):I&&K(I),k()},[z,I,n,e]),X=()=>{i(M),k()};return m&&g.jsx(t8.Provider,{value:{appCode:t,visibility:e,multiple:r,type:m,setResultCounter:A,setResult:P,setCancellable:K=>N([...K]),setVisibleTab:H,switchType:F,setPreSuccess:j},children:g.jsxs(Ye,{id:"media-library",isOpen:m!==null,onModalClose:X,size:"lg",viewport:!0,scrollable:!0,children:[g.jsx(Ye.Header,{onModalClose:X,children:V}),g.jsx(gv,{items:x,defaultId:x[w].id,onChange:$,children:K=>g.jsxs(g.Fragment,{children:[x.length>1&&g.jsx(gv.List,{className:"mt-16"}),g.jsx(Ye.Body,{className:"d-flex",children:g.jsx(gv.Panel,{currentItem:K,children:K==null?void 0:K.content})})]})}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{type:"button",color:"tertiary",variant:"ghost",onClick:X,children:c("cancel")}),g.jsx(it,{type:"button",color:"primary",variant:"filled",disabled:typeof I>"u",onClick:B,children:E&&E>1?c("addMultiple",{number:E}):c("add")})]})]})})}),m8=Ahe;function Rhe({isOpen:t,resourceId:e,onSuccess:r,onCancel:n}){const{appCode:i,currentApp:s}=yt(),{ref:o,libraryMedia:a,...l}=s8(),{t:u}=we(),c=mA(i,e),{control:h,cover:f,formState:{isDirty:m,isValid:y,isSubmitting:v},handleDeleteImage:x,handleSubmit:b,handleUploadImage:_,handlePublish:w,register:E,selectActivities:A,selectedActivities:I,selectedSubjectAreas:P,selectSubjects:M}=rde({resource:c,onSuccess:r});return c?ur.createPortal(g.jsxs(Ye,{isOpen:t,onModalClose:n,id:"libraryModal",size:"lg",children:[g.jsx(Ye.Header,{onModalClose:n,children:u("bpr.publish")}),g.jsx(Ye.Subtitle,{children:u("bpr.form.tip")}),g.jsxs(Ye.Body,{children:[g.jsx(Ss,{headingStyle:"h4",level:"h3",className:"mb-16",children:u("bpr.form.publication.heading.general")}),g.jsxs("form",{id:"libraryModalForm",onSubmit:b(w),children:[g.jsxs("div",{className:"d-block d-md-flex mb-24 gap-24",children:[g.jsxs("div",{style:{maxWidth:"160px"},children:[g.jsx("div",{className:"form-label",children:u("bpr.form.publication.cover.title")}),g.jsx(a8,{app:s,src:c==null?void 0:c.thumbnail,addButtonLabel:u("bpr.form.publication.cover.upload.add"),deleteButtonLabel:u("bpr.form.publication.cover.upload.remove"),onUploadImage:_,onDeleteImage:x,className:"align-self-center",libraryMedia:a,mediaLibraryRef:o}),!f&&g.jsx("p",{className:"form-text is-invalid",children:g.jsx("em",{children:u("bpr.form.publication.cover.upload.required.image")})})]}),g.jsxs("div",{className:"flex-fill",children:[g.jsxs(Ot,{id:"title",className:"mb-16",isRequired:!0,children:[g.jsx(Vi,{children:u("bpr.form.publication.title")}),g.jsx(Zn,{type:"text",defaultValue:c==null?void 0:c.name,...E("title",{required:!0}),placeholder:u("bpr.form.publication.title.placeholder"),size:"md","aria-required":!0})]}),g.jsxs(Ot,{id:"description",isRequired:!0,children:[g.jsx(Vi,{children:u("bpr.form.publication.description")}),g.jsx(fA,{...E("description",{required:!0}),placeholder:u("bpr.form.publication.description.placeholder"),size:"md"})]})]})]}),g.jsx("hr",{}),g.jsx(Ss,{headingStyle:"h4",level:"h3",className:"mb-16",children:u("bpr.form.publication.heading.infos")}),g.jsxs("div",{className:"d-flex flex-column flex-md-row gap-16 row mb-24",children:[g.jsx(Xle,{control:h,selectedActivities:I,selectActivities:A}),g.jsx(nue,{control:h,selectedSubjectAreas:P,selectSubjects:M}),g.jsx(eue,{control:h})]}),g.jsxs("div",{className:"mb-24",children:[g.jsx("label",{htmlFor:"",className:"form-label",children:u("bpr.form.publication.age")}),g.jsxs("div",{className:"d-flex gap-8",children:[g.jsx("div",{className:"col col-md-2 d-flex",children:g.jsx(wk,{control:h,name:"ageMin",placeholderOption:"bpr.form.publication.age.min",validate:(j,H)=>parseInt(j)<=parseInt(H.ageMax)})}),g.jsx("div",{className:"col col-md-2 d-flex",children:g.jsx(wk,{control:h,name:"ageMax",placeholderOption:"bpr.form.publication.age.max",validate:(j,H)=>parseInt(j)>=parseInt(H.ageMin)})})]})]}),g.jsx("div",{className:"mb-24",children:g.jsxs(Ot,{id:"keywords",isOptional:!0,children:[g.jsx(Vi,{children:u("bpr.form.publication.keywords")}),g.jsx(Zn,{type:"text",...E("keyWords"),size:"md",placeholder:u("bpr.form.publication.keywords.placeholder")})]})}),g.jsx("hr",{}),g.jsx(Ss,{headingStyle:"h4",level:"h3",className:"mb-16",children:u("bpr.form.publication.licence.text")}),g.jsx(tue,{})]})]}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{color:"tertiary",onClick:n,type:"button",variant:"ghost",children:u("cancel")}),g.jsx(it,{form:"libraryModalForm",type:"submit",color:"primary",variant:"filled",isLoading:v,disabled:!f||v||!m||!y,children:u("bpr.form.submit")})]}),g.jsx(m8,{appCode:i,ref:o,multiple:!1,visibility:"protected",...l})]}),document.getElementById("portal")):g.jsx(pr,{})}const Phe=({content:t,maxLength:e})=>g.jsx("p",{className:"small text-gray-700 p-2 text-end",children:t?`${t.length} / ${e}`:""}),Ihe=({isUpdating:t,selectedResource:e})=>{const[r,n]=T.useState(t&&(e==null?void 0:e.thumbnail)||"");return T.useEffect(()=>{n((e==null?void 0:e.thumbnail)||"")},[e]),{thumbnail:r,handleDeleteImage:()=>n(""),handleUploadImage:i=>n(i)}},Mhe=60,khe=400,Ohe=({isOpen:t,onCancel:e,onSuccess:r,children:n,inputMaxLength:i=Mhe,textareaMaxLength:s=khe,...o})=>{const{appCode:a,currentApp:l}=yt(),{t:u}=we(),{mode:c}=o,h=Jr(),f=T.useId(),m=c==="create",y=c==="update",v=mA(a,y?o.resourceId:""),{watch:x,register:b,handleSubmit:_,setValue:w,formState:{isSubmitting:E,isValid:A}}=DT({mode:"onChange",defaultValues:{description:y?v==null?void 0:v.description:"",enablePublic:y?v==null?void 0:v.public:!1,title:y?v==null?void 0:v.name:"",formSlug:y?v==null?void 0:v.slug:""}}),{ref:I,libraryMedia:P,...M}=s8(),{appCode:N}=yt(),{thumbnail:z,handleDeleteImage:j,handleUploadImage:H}=Ihe({isUpdating:y,selectedResource:y?v:void 0}),F=x("description"),L=async function(O){var U,V;try{const k={description:O.description||"",name:O.title,public:O.enablePublic,slug:O.enablePublic&&O.formSlug||"",thumbnail:z};if(m){const $={...k,folder:o.currentFolder===void 0||((U=o.currentFolder)==null?void 0:U.id)==="default"?void 0:parseInt(((V=o.currentFolder)==null?void 0:V.id)||""),application:a};o.createResource?await o.createResource.mutateAsync($):await Ie.resource(a).create($)}else{const $={...k,entId:v.assetId,trashed:v.trashed};o.updateResource?await o.updateResource.mutateAsync($):await Ie.resource(a).update($)}h.success(g.jsxs(g.Fragment,{children:[g.jsx("strong",{children:u(m?"explorer.resource.created":"explorer.resource.updated")}),g.jsxs("p",{children:[u("title")," : ",O.title]}),g.jsxs("p",{children:[u("description")," : ",O.description]}),a==="blog"&&g.jsxs("p",{children:["Public:",O.enablePublic?u("explorer.enable.public.yes"):u("explorer.enable.public.no")]})]})),r()}catch(k){console.error(k)}};return y&&!v?g.jsx(pr,{}):ur.createPortal(g.jsxs(Ye,{id:`${c}-resource`,size:"lg",isOpen:t,onModalClose:e,children:[g.jsx(Ye.Header,{onModalClose:e,children:u(`explorer.resource.editModal.header.${m?"create":"edit"}`)}),g.jsxs(Ye.Body,{children:[g.jsx(Ss,{headingStyle:"h4",level:"h3",className:"mb-16",children:u("explorer.resource.editModal.heading.general")}),g.jsxs("form",{id:f,onSubmit:_(L),children:[g.jsxs("div",{className:"d-block d-md-flex gap-16 mb-24",children:[g.jsx("div",{children:g.jsx(a8,{app:l,src:y&&(v==null?void 0:v.thumbnail)||"",addButtonLabel:u("explorer.imagepicker.button.add"),deleteButtonLabel:u("explorer.imagepicker.button.delete"),onUploadImage:H,onDeleteImage:j,className:"align-self-center mt-8",libraryMedia:P,mediaLibraryRef:I})}),g.jsxs("div",{className:"col",children:[g.jsxs(Ot,{id:"title",className:"mb-16",isRequired:!0,children:[g.jsx(Vi,{children:u("title")}),g.jsx(Zn,{type:"text",defaultValue:y?v==null?void 0:v.name:"",...b("title",{required:!0,maxLength:i,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:u("explorer.resource.editModal.title.placeholder"),size:"md","aria-required":!0,maxLength:i})]}),g.jsxs(Ot,{id:"description",isOptional:!0,children:[g.jsx(Vi,{children:u("description")}),g.jsx(fA,{defaultValue:(v==null?void 0:v.description)||"",...b("description",{required:!1,maxLength:s}),placeholder:u("explorer.resource.editModal.description.placeholder"),size:"md",maxLength:s}),F&&g.jsx(Phe,{content:F,maxLength:s})]})]})]}),typeof n=="function"?n(v,y,x,w,b):n]})]}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{color:"tertiary",onClick:e,type:"button",variant:"ghost",children:u("explorer.cancel")}),g.jsx(it,{form:f,type:"submit",color:"primary",isLoading:E,variant:"filled",disabled:!A||E,children:u(m?"explorer.create":"save")})]}),g.jsx(m8,{appCode:N,ref:I,multiple:!1,visibility:"protected",...M})]}),document.getElementById("portal"))},Dhe=Ohe,Nhe=({application:t,options:e})=>Ro({mutationFn:async r=>await Ie.resource(t).update(r),...e}),Lhe=Nhe,Fhe=({watch:t,setValue:e,selectedResource:r})=>{const[n,i]=T.useState(""),[s,o]=T.useState((r==null?void 0:r.public)||!1),a=T.useId(),l=t("title"),{t:u}=we(),c=Jr();T.useEffect(()=>{if(s){let m="";r?m=r.slug?r.slug:`${rk({foo:`${l}${a}`})}-${ik(l)}`:m=`${rk({foo:`${l}${a}`})}-${ik(l)}`,e("formSlug",m),i(m)}},[s,l]);function h(m){o(m)}function f(m){navigator.clipboard.writeText(`${window.location.origin}${m||window.location.pathname}/pub/${n}`),c.success(u("explorer.copy.clipboard"))}return{slug:n,uniqueId:a,isPublic:s,resourceName:l,onPublicChange:h,onCopyToClipBoard:f}},jhe=({appCode:t,isUpdating:e,resource:r,watch:n,register:i,setValue:s})=>{const{t:o}=we(),{slug:a,isPublic:l,resourceName:u,onPublicChange:c,onCopyToClipBoard:h}=Fhe({watch:n,setValue:s,selectedResource:e?r:void 0});return g.jsxs(g.Fragment,{children:[g.jsxs(Ss,{headingStyle:"h4",level:"h3",className:"mb-16",children:[o("explorer.resource.editModal.heading.access"),t]}),g.jsx(Jo,{type:"info",children:o("explorer.resource.editModal.access.alert")}),g.jsxs(Ot,{id:"flexSwitchCheckDefault",className:"form-switch d-flex gap-8 mt-16 mb-8",children:[g.jsx(Ot.Input,{type:"checkbox",role:"switch",defaultChecked:e?r.public:!1,...i("enablePublic",{disabled:!u,onChange:f=>{const m=f.target.checked;c(m)}}),className:"form-check-input mt-0",size:"md"}),g.jsx(Ot.Label,{className:"form-check-label mb-0",children:o("explorer.resource.editModal.access.flexSwitchCheckDefault.label")})]}),l&&g.jsxs(g.Fragment,{children:[g.jsx(Ot,{id:"formSlug",children:g.jsx(Zn,{type:"text",hidden:!0,defaultValue:e?a:"",...i("formSlug"),size:"sm"})},a),g.jsxs("div",{className:"d-flex flex-wrap align-items-center gap-4",children:[g.jsxs("p",{className:"text-break",children:[window.location.origin,"/blog/pub/",a]}),g.jsx(it,{color:"primary",disabled:!l,onClick:()=>h("/blog"),type:"button",leftIcon:g.jsx(U$,{}),variant:"ghost",className:"text-nowrap",children:o("explorer.resource.editModal.access.url.button")})]})]})]})},g8=jhe,Bhe=({bookmark:t,refBookmark:e,onBookmarkChange:r,onSave:n})=>{const{t:i}=we();return g.jsx("div",{className:"mt-16",children:g.jsxs(Ot,{id:"bookmarkName",className:"d-flex flex-wrap align-items-center gap-16",children:[g.jsx("div",{className:"flex-fill",children:g.jsx(Ot.Input,{ref:e,onChange:r,placeholder:i("explorer.modal.share.sharebookmark.placeholder"),size:"sm",type:"text"},t.id)}),g.jsx(it,{type:"button",color:"primary",variant:"ghost",disabled:t.name.length===0,leftIcon:g.jsx(BT,{}),onClick:n,className:"text-nowrap",children:i("explorer.modal.share.sharebookmark.save")})]})})},Uhe=(t,e)=>t.actions.filter(r=>e.id===r.id).length>0,$he=(t,e)=>t.isBookmarkMember&&e||!t.isBookmarkMember,zhe=({shareRights:t,showBookmark:e,toggleBookmark:r,shareRightActions:n,toggleRight:i,onDeleteRow:s})=>{const{t:o}=we();return t==null?void 0:t.rights.map(a=>{const l={user:g.jsx(ec,{alt:o("explorer.modal.share.avatar.shared.alt"),size:"xs",src:a.avatarUrl,variant:"circle"}),group:g.jsx("div",{className:"avatar-xs bg-primary-200 justify-content-center d-flex rounded-circle",children:g.jsx(UT,{width:16})}),sharebookmark:g.jsx(NT,{})}[a.type]||null,u=a.type==="sharebookmark",c=a.type==="user";return $he(a,e)&&g.jsxs("tr",{className:a.isBookmarkMember?"bg-light":"",children:[g.jsx("td",{children:l}),g.jsx("td",{children:g.jsxs("div",{className:"d-flex",children:[u&&g.jsx(it,{color:"tertiary",rightIcon:g.jsx(Cp,{title:o("show"),className:"w-16 min-w-0",style:{transition:"rotate 0.2s ease-out",rotate:e?"-180deg":"0deg"}}),type:"button",variant:"ghost",className:"fw-normal ps-0",onClick:r,children:a.displayName}),!u&&a.displayName,c&&` (${o(a.profile||"")})`]})}),n.map(h=>g.jsx("td",{style:{width:"80px"},className:"text-center text-white",children:g.jsx(Cm,{checked:Uhe(a,h),onChange:()=>i(a,h.id)})},h.displayName)),g.jsx("td",{children:!a.isBookmarkMember&&g.jsx(To,{"aria-label":o("close"),color:"tertiary",icon:g.jsx(LT,{}),type:"button",variant:"ghost",title:o("close"),onClick:()=>s(a)})})]},a.id)})},Hhe={searchInputValue:"",searchResults:[],searchAPIResults:[],isSearching:!1};function Vhe(t,e){switch(e.type){case"onChange":return{...t,searchInputValue:e.payload};case"isSearching":return{...t,isSearching:e.payload};case"addResult":return{...t,searchResults:e.payload};case"addApiResult":return{...t,searchAPIResults:e.payload};case"updateSearchResult":return{...t,searchResults:e.payload};case"emptyResult":return{...t,searchResults:e.payload};default:throw new Error("Unhandled action type")}}const __=[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}],Ghe=({resourceId:t,resourceCreatorId:e,shareRights:r,shareDispatch:n})=>{const[i,s]=T.useReducer(Vhe,Hhe),o=sA(i.searchInputValue,500),{isAdml:a}=i8(),{appCode:l}=yt(),{t:u}=we();T.useEffect(()=>{h(o)},[o]);const c=f=>{const m=f.target.value;s({type:"onChange",payload:m})},h=async f=>{if(t){if(s({type:"isSearching",payload:!0}),!a&&f.length>=1||a&&f.length>=3){const m=await Ie.share().searchShareSubjects(l,t,f);s({type:"addApiResult",payload:m});const y=m.filter(v=>!r.rights.find(x=>x.id===v.id)).filter(v=>!(v.type==="user"&&v.id===e)).map(v=>{let x=v.displayName;return v.type==="user"&&v.profile?x=`${x} (${u(v.profile)})`:v.type==="group"&&v.structureName&&(x=`${x} (${v.structureName})`),{value:v.id,label:x,icon:v.type==="sharebookmark"?g.jsx(NT,{}):null}});s({type:"addResult",payload:y})}else s({type:"emptyResult",payload:[]}),Promise.resolve();s({type:"isSearching",payload:!1})}};return{state:i,showSearchAdmlHint:()=>a&&i.searchInputValue.length<3,showSearchLoading:()=>i.isSearching,showSearchNoResults:()=>!i.isSearching&&!a&&o.length>0&&i.searchResults.length===0||!i.isSearching&&a&&o.length>3&&i.searchResults.length===0,getSearchMinLength:()=>a?3:1,handleSearchInputChange:c,handleSearchResultsChange:async f=>{const m=i.searchAPIResults.find(y=>y.id===f[0]);if(m){let y=[];if(m.type==="sharebookmark"){const v=await Ie.directory().getBookMarkById(m.id);y.push({...v,type:"sharebookmark",avatarUrl:"",directoryUrl:"",actions:__}),v==null||v.users.filter(x=>!r.rights.find(b=>b.id===x.id)).forEach(x=>{y.push({...x,type:"user",avatarUrl:"",directoryUrl:"",actions:__,isBookmarkMember:!0})}),v.groups.filter(x=>!r.rights.find(b=>b.id===x.id)).forEach(x=>{y.push({...x,type:"group",avatarUrl:"",directoryUrl:"",actions:__,isBookmarkMember:!0})})}else y=[{...m,actions:[{id:"read",displayName:"read"},{id:"comment",displayName:"comment"}]}];n({type:"updateShareRights",payload:{...r,rights:[...r.rights,...y]}}),s({type:"updateSearchResult",payload:i.searchResults.filter(v=>v.value!==f[0])})}}}},Whe={isSharing:!1,shareRights:{rights:[],visibleBookmarks:[],visibleGroups:[],visibleUsers:[]},shareRightActions:[]};function Xhe(t,e){switch(e.type){case"init":return{...t,...e.payload};case"deleteRow":return{...t,shareRights:e.payload};case"updateShareRights":return{...t,shareRights:e.payload};case"toggleRight":return{...t,shareRights:e.payload};case"isSharing":return{...t,isSharing:e.payload};default:throw new Error("Unhandled action type")}}function qhe({resourceId:t,resourceRights:e,resourceCreatorId:r,shareResource:n,setIsLoading:i,onSuccess:s}){const{appCode:o}=yt(),{user:a,avatar:l}=_h(),u=Jr(),{t:c}=we(),[h,f]=T.useReducer(Xhe,Whe);T.useEffect(()=>{t&&(async()=>{try{const[v,x]=await Promise.all([Ie.share().getActionsForApp(o),Ie.share().getRightsForResource(o,t)]);f({type:"init",payload:{shareRightActions:v,shareRights:x}})}catch(v){console.error(v)}i(!1)})()},[t]);const m=(v,x)=>{var b,_;const{rights:w,...E}=h.shareRights,A=[...w],I=A.findIndex(M=>M.id===v.id),P=h.shareRightActions.filter(M=>M.id===x)[0];if(A[I].actions.findIndex(M=>M.id===x)>-1){let M=A[I].actions.filter(z=>z.id!==x);const N=h.shareRightActions.filter(z=>{var j;return(j=z.requires)==null?void 0:j.includes(x)});M=M.filter(z=>!N.find(j=>j.id===z.id)),A[I]={...A[I],actions:M}}else{const M=h.shareRightActions.filter(N=>{var z;return((z=P.requires)==null?void 0:z.includes(N.id))&&!A[I].actions.find(j=>j.id===N.id)});A[I]={...A[I],actions:[...A[I].actions,P,...M]}}v.type==="sharebookmark"&&((b=A[I].users)==null||b.forEach(M=>{const N=A.findIndex(z=>z.id===M.id);A[N]={...A[N],actions:A[I].actions}}),(_=A[I].groups)==null||_.forEach(M=>{const N=A.findIndex(z=>z.id===M.id);A[N]={...A[N],actions:A[I].actions}})),f({type:"toggleRight",payload:{rights:A,...E}})},y=v=>{Object.keys(v)[0]==="error"?(u.error(c("explorer.shared.status.error")),console.error("Failed to save share",v)):u.success(c("explorer.shared.status.saved"))};return{state:h,dispatch:f,currentIsAuthor:()=>r===(a==null?void 0:a.userId),myAvatar:l,handleDeleteRow:v=>{f({type:"deleteRow",payload:{...h.shareRights,rights:h.shareRights.rights.filter(x=>{var b,_;return x.id!==v.id&&!((b=v.users)!=null&&b.find(w=>w.id===x.id))&&!((_=v.groups)!=null&&_.find(w=>w.id===x.id))})}})},handleShare:async()=>{f({type:"isSharing",payload:!0});try{const v=e.filter(b=>a&&b.includes(`user:${a.userId}`)).map(b=>b.split(":")[2]).filter(b=>!!b),x=[...h.shareRights.rights];if(v.length>0){const b=v.map(_=>({displayName:_,id:_}));x.push({actions:b,avatarUrl:"",directoryUrl:"",displayName:a.username,id:a.userId,type:"user"})}if(n){const b=await n.mutateAsync({resourceId:t,rights:x});y(b)}else{const b=await Ie.share().saveRights(o,t,x);y(b)}s()}catch(v){typeof v=="string"&&u.error(c("explorer.shared.status.error")),console.error("Failed to save share",v)}finally{f({type:"isSharing",payload:!1})}},toggleRight:m}}const Yhe=({shareRights:t,shareDispatch:e})=>{const r=Jr(),{t:n}=we(),i=T.useRef(null),[s,o]=T.useState({name:"",id:T.useId()}),[a,l]=Am(!1),[u,c]=T.useState(!1),h=()=>{l()},f=()=>{o(y=>{var v;return{...y,name:((v=i.current)==null?void 0:v.value)||""}})},m=async y=>{try{const v=await Ie.directory().saveBookmarks(y,{users:t.rights.filter(x=>x.type==="user").map(x=>x.id),groups:t.rights.filter(x=>x.type==="group").map(x=>x.id),bookmarks:t.rights.filter(x=>x.type==="sharebookmark").map(x=>x.id)});r.success(n("explorer.bookmarked.status.saved")),e({type:"updateShareRights",payload:{...t,visibleBookmarks:[...t.visibleBookmarks,{displayName:y,id:v.id}]}}),o(x=>({...x,bookmarkId:x.id+new Date().getTime().toString()})),c(!1)}catch(v){console.error("Failed to save bookmark",v),r.error(n("explorer.bookmarked.status.error"))}};return{refBookmark:i,showBookmark:a,showBookmarkInput:u,bookmark:s,handleBookmarkChange:f,setBookmark:o,handleOnSave:()=>{var y;const v=((y=i.current)==null?void 0:y.value)||"";m(v)},toggleBookmark:h,toggleBookmarkInput:c}};function Qhe({isOpen:t,shareOptions:e,shareResource:r,children:n,onSuccess:i,onCancel:s}){const{resourceId:o,resourceCreatorId:a,resourceRights:l}=e,[u,c]=T.useState(!0),{state:{isSharing:h,shareRights:f,shareRightActions:m},dispatch:y,myAvatar:v,currentIsAuthor:x,handleShare:b,toggleRight:_,handleDeleteRow:w}=qhe({resourceId:o,resourceCreatorId:a,resourceRights:l,shareResource:r,setIsLoading:c,onSuccess:i}),{state:{searchResults:E,searchInputValue:A},showSearchAdmlHint:I,showSearchLoading:P,showSearchNoResults:M,getSearchMinLength:N,handleSearchInputChange:z,handleSearchResultsChange:j}=Ghe({resourceId:o,resourceCreatorId:a,shareRights:f,shareDispatch:y}),{refBookmark:H,showBookmark:F,handleBookmarkChange:L,toggleBookmark:O,bookmark:U,handleOnSave:V,showBookmarkInput:k,toggleBookmarkInput:$}=Yhe({shareRights:f,shareDispatch:y}),{t:B}=we(),X=I()?B("explorer.search.adml.hint"):B("explorer.modal.share.search.placeholder");return ur.createPortal(g.jsxs(Ye,{id:"share_modal",size:"lg",isOpen:t,onModalClose:s,children:[g.jsx(Ye.Header,{onModalClose:s,children:B("share.title")}),g.jsxs(Ye.Body,{children:[g.jsx(Ss,{headingStyle:"h4",level:"h3",className:"mb-16",children:B("explorer.modal.share.usersWithAccess")}),g.jsx("div",{className:"table-responsive",children:u?g.jsx(pr,{}):g.jsxs("table",{className:"table border align-middle mb-0",children:[g.jsx("thead",{className:"bg-secondary",children:g.jsxs("tr",{children:[g.jsx("th",{scope:"col",className:"w-32",children:g.jsx(fl,{children:B("explorer.modal.share.avatar.shared.alt")})}),g.jsx("th",{scope:"col",children:g.jsx(fl,{children:B("explorer.modal.share.search.placeholder")})}),m.map(K=>g.jsx("th",{scope:"col",className:"text-center text-white",children:B(K.displayName)},K.displayName)),g.jsx("th",{scope:"col",children:g.jsx(fl,{children:B("close")})})]})}),g.jsxs("tbody",{children:[x()&&g.jsxs("tr",{children:[g.jsx("th",{scope:"row",children:g.jsx(ec,{alt:B("explorer.modal.share.avatar.me.alt"),size:"xs",src:v,variant:"circle"})}),g.jsx("td",{children:B("share.me")}),m.map(K=>g.jsx("td",{style:{width:"80px"},className:"text-center text-white",children:g.jsx(Cm,{checked:!0,disabled:!0})},K.displayName)),g.jsx("td",{})]}),g.jsx(zhe,{showBookmark:F,shareRightActions:m,shareRights:f,onDeleteRow:w,toggleRight:_,toggleBookmark:O})]})]})}),g.jsxs("div",{className:"mt-16",children:[g.jsx(it,{color:"tertiary",leftIcon:g.jsx(NT,{}),rightIcon:g.jsx(Cp,{title:B("show"),className:"w-16 min-w-0",style:{transition:"rotate 0.2s ease-out",rotate:k?"-180deg":"0deg"}}),type:"button",variant:"ghost",className:"fw-normal",onClick:()=>$(!k),children:B("share.save.sharebookmark")}),k&&g.jsx(Bhe,{refBookmark:H,bookmark:U,onBookmarkChange:L,onSave:V})]}),g.jsx("hr",{}),g.jsxs(Ss,{headingStyle:"h4",level:"h3",className:"mb-16 d-flex align-items-center",children:[g.jsx("div",{className:"me-8",children:B("explorer.modal.share.search")}),g.jsx(co,{message:"Vos favoris de partage s’affichent en priorité dans votre liste lorsque vous recherchez un groupe ou une personne, vous pouvez les retrouver dans l’annuaire.",placement:"top",children:g.jsx(FN,{className:"c-pointer",height:"18"})})]}),g.jsx("div",{className:"row",children:g.jsx("div",{className:"col-10",children:g.jsx(hce,{value:A,placeholder:X,isLoading:P(),noResult:M(),options:E,searchMinLength:N(),onSearchInputChange:z,onSearchResultsChange:j})})}),n]}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{type:"button",color:"tertiary",variant:"ghost",onClick:s,children:B("explorer.cancel")}),g.jsx(it,{type:"button",color:"primary",variant:"filled",isLoading:h,onClick:b,disabled:h,children:B("share")})]})]}),document.getElementById("portal"))}function Khe({resourceId:t,updateResource:e}){const{appCode:r}=yt(),{t:n}=we(r),i=mA("blog",t),s=i&&i["publish-type"],[o,a]=T.useState(s??"RESTRAINT");T.useEffect(()=>{s&&a(s)},[s]);const l=async u=>{const c=u.target.value,h={description:i.description||"",entId:i.assetId,name:i.name,public:!!i.public,slug:i.slug||"",thumbnail:i.thumbnail,trashed:i.trashed,"publish-type":c};e?await e.mutateAsync(h):await Ie.resource("blog").update(h),a(c)};return g.jsxs(g.Fragment,{children:[g.jsx("hr",{}),g.jsx(Ss,{headingStyle:"h4",level:"h3",className:"mb-16",children:n("explorer.publication.steps")}),g.jsx(T2,{label:n("explorer.immediat.publication"),id:"publication-now",name:"publication",value:"IMMEDIATE",model:o,checked:o==="IMMEDIATE",onChange:l}),g.jsx(T2,{label:n("explorer.validate.publication"),id:"publication-validate",name:"publication",value:"RESTRAINT",checked:o==="RESTRAINT",model:o,onChange:l})]})}const Zhe=({application:t,options:e})=>Ro({mutationFn:async({resourceId:r,rights:n})=>await Ie.share().saveRights(t,r,n),...e}),Jhe=Zhe;function efe(t){return{getPreference:async()=>await Ie.conf().getPreference(t),savePreference:async e=>await Ie.conf().savePreference(t,JSON.stringify(e))}}function tfe(){const[t,e]=T.useState(!1),{getPreference:r,savePreference:n}=efe("rgpdCookies");return T.useEffect(()=>{(async()=>{const i=await r();e(i===null?!0:i.showInfoTip)})()},[]),{showCookiesConsent:t,handleConsultCookies:()=>{document.location.href="/userbook/mon-compte",n({showInfoTip:!1}),e(!1)},handleCloseCookiesConsent:()=>{n({showInfoTip:!1}),e(!1)}}}function S_({children:t}){return g.jsx("span",{className:"position-absolute badge rounded-pill bg-warning",children:t})}function E_({children:t,className:e,...r}){const n=Me("navbar",e);return g.jsx("nav",{className:n,...r,children:t})}function Ck({children:t,className:e,...r}){const n=Me("navbar-nav",e);return g.jsx("ul",{className:n,...r,children:t})}const yr=T.forwardRef(({children:t,className:e,...r},n)=>{const i=Me("nav-item",e);return g.jsx("li",{ref:n,className:i,...r,children:t})});function gf({link:t,className:e,children:r,translate:n,...i}){const s=Me("nav-link",e);return g.jsxs("a",{href:t,className:s,...i,children:[r,n&&g.jsx(fl,{children:g.jsx("span",{className:"nav-text",children:n})})]})}const rfe=()=>{const{t}=we();return g.jsx("div",{className:"widget-footer",children:g.jsx("div",{className:"widget-footer-action",children:g.jsx("a",{href:"/welcome",className:"link",children:t("plus")})})})},nfe=({bookmarkedApps:t})=>{const{t:e}=we();return g.jsxs("div",{className:"widget-body d-flex flex-wrap",children:[!t.length&&g.jsx("div",{className:"text-dark",children:e("navbar.myapps.more")}),t.slice(0,6).map((r,n)=>g.jsx("a",{href:r.address,className:"bookmarked-app",children:g.jsx(ga,{app:r,size:"32"})},n))]})};function Ak({isHelpOpen:t,setIsHelpOpen:e,parsedHeadline:r,parsedContent:n,error:i}){const{t:s}=we(),o=()=>{e(!1)};return t?ur.createPortal(g.jsxs(Ye,{id:"help-modal",isOpen:t,onModalClose:o,scrollable:!0,size:"lg",children:[g.jsx(Ye.Header,{onModalClose:o,children:s("navbar.help")}),g.jsx(Ye.Subtitle,{children:i?s("help.notfound.title"):r}),g.jsx(Ye.Body,{className:i?"d-flex":null,children:i?s("help.notfound.text"):n})]}),document.getElementById("portal")):null}function ife(){var t,e,r,n,i;const{appCode:s}=yt(),{theme:o}=ya(),[a,l]=T.useState(""),[u,c]=T.useState(!0),[h,f]=T.useState(!1),[m,y]=T.useState(!1),v=o!=null&&o.is1d?"/help-1d":"/help-2d";T.useEffect(()=>{(async()=>{let w="";w=v+"/application/"+s+"/",!s&&window.location.pathname!=="/adapter"?w=v+"/application/portal/":window.location.pathname==="/adapter"?w=v+"/application/"+window.location.search.split("eliot=")[1].split("&")[0]+"/":window.location.pathname.includes("/directory/class-admin")?w=v+"/application/parametrage-de-la-classe/":(window.location.pathname.includes("/userbook/mon-compte")||window.location.pathname.includes("/timeline/preferencesView")||window.location.pathname.includes("/timeline/historyView"))&&(w=v+"/application/userbook/");try{const E=await fetch(w),A=await E.text();if(E.status===404){y(!0);return}l(A),y(!1)}catch(E){y(!0),console.error(E)}})()},[s,v]);const x=Vl(a,{replace:w=>{const E=w;if(E.attribs&&E.attribs.id==="TOC")return g.jsxs("nav",{id:"TOC",children:[g.jsx(it,{onClick:()=>{c(!u)},children:g.jsx(L$,{})}),R0(E.children,{replace:A=>{const I=A;if(I.attribs&&I.name==="ul")return g.jsx("ul",{id:"TOC-list",style:{display:u?"block":"none"},children:R0(I.children,{replace:P=>{const M=P;if(M.attribs&&M.name==="a")return g.jsx("a",{...v_(M.attribs),children:g.jsx("span",{onClick:()=>{c(!1)},children:R0(M.children)})})}})})}})]});if(E.attribs&&E.attribs.class==="section level2"){const A=v_(w.attribs);return g.jsx("div",{...A,className:"section level2",style:{display:E.attribs.id!=="présentation"?"none":"block"},children:R0(E.children,{replace:I=>{const P=I;if(P.attribs&&P.name==="img"){const M=I.attribs.src;return g.jsx("img",{...v_(P.attribs),src:`${v}/${M}`,alt:""})}}})})}}}),b=(r=(e=(t=x==null?void 0:x.props)==null?void 0:t.children.find(w=>w.type==="body"))==null?void 0:e.props)==null?void 0:r.children,_=(i=(n=b==null?void 0:b.find(w=>w.type==="p"))==null?void 0:n.props)==null?void 0:i.children;return{html:a,visibility:u,isModalOpen:h,setIsModalOpen:f,parsedContent:b,parsedHeadline:_,error:m}}const sfe=()=>{const[t,e]=j6(),r=T.useRef(null),n=T.useId(),{t:i}=we();function s(){if(r.current){const o=r.current.value;window.location.href=`/searchengine#/${o}`}}return g.jsxs(yr,{id:n,ref:t,className:"position-relative","aria-haspopup":"true","aria-expanded":e,children:[g.jsxs("a",{href:"/searchengine",className:"nav-link dropdown-item",children:[g.jsx(vX,{className:"icon search"}),g.jsx("span",{className:"nav-text",children:i("navbar.search")})]}),g.jsx(r8,{id:n,isVisible:e,className:"d-none d-md-flex",children:g.jsxs(Ot,{id:"my-search-input",className:"search-text input-group py-8 px-12",children:[g.jsx(Ot.Input,{ref:r,size:"sm",type:"text",name:"my-search-input",placeholder:"Rechercher"}),g.jsx(oA,{type:"submit",size:"sm",onClick:s,"aria-label":i("navbar.search")})]})})]})},ofe=sfe,afe=({is1d:t=!1,src:e=""})=>{const{t:r}=we(),{messages:n,msgLink:i,zimbraWorkflow:s}=Bce(),{user:o,avatar:a}=_h(),{currentLanguage:l,currentApp:u}=yt(),c=Gi("org.entcore.portal.controllers.PortalController|oldHelpEnable")||!1,{isModalOpen:h,setIsModalOpen:f,parsedContent:m,parsedHeadline:y,error:v}=ife(),x=Me("header",{"no-2d":t,"no-1d":!t}),{title:b,bookmarkedApps:_,appsRef:w,isAppsHovered:E,popoverAppsId:A,userAvatar:I,userName:P,welcomeUser:M,communityWorkflow:N,conversationWorflow:z,searchWorkflow:j,isCollapsed:H,toggleCollapsedNav:F,handleLogout:L}=Uce({user:o,avatar:a}),O=n>0,{theme:U}=ya();return g.jsx("header",{className:x,children:t?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"container-fluid",children:g.jsxs(E_,{children:[g.jsx("a",{className:"navbar-title d-md-none text-truncate h4",href:u?u.address:"/timeline/timeline",children:b}),g.jsxs("div",{className:"d-none d-md-inline-flex gap-12 align-items-center",children:[g.jsx(ec,{alt:P,size:"sm",src:I,variant:"circle",width:"32",height:"32"}),g.jsx("span",{className:"navbar-text",children:M})]}),g.jsxs(Ck,{className:"gap-8","aria-hidden":"false","aria-label":r("navbar.main.navigation"),children:[z&&g.jsx(yr,{children:g.jsxs("a",{href:"/conversation/conversation",className:"nav-link",children:[g.jsx(pX,{className:"icon notification"}),O&&g.jsx(S_,{children:n}),g.jsx(fl,{children:r("navbar.messages")})]})}),g.jsx(yr,{children:g.jsx(gf,{link:"/userbook/mon-compte",className:"dropdown-item",translate:r("navbar.myaccount"),children:g.jsx(iC,{className:"icon user"})})}),l==="fr"&&c?g.jsxs(yr,{children:[g.jsxs("button",{className:"nav-link",onClick:()=>{f(!0)},children:[g.jsx(hX,{className:"icon help"}),g.jsx(fl,{children:r("navbar.help")})]}),g.jsx(Ak,{isHelpOpen:h,setIsHelpOpen:f,parsedContent:m,parsedHeadline:y,error:v})]}):null,g.jsx(yr,{children:g.jsxs("button",{className:"nav-link",onClick:L,children:[g.jsx(m3,{className:"icon logout"}),g.jsx(fl,{children:r("navbar.disconnect")})]})}),g.jsx(yr,{className:"d-md-none",children:g.jsx("button",{className:"nav-link btn btn-naked",type:"button","aria-controls":"navbarCollapsed","aria-expanded":!H,"aria-label":r("navbar.secondary.navigation"),onClick:F,children:g.jsx(Cp,{className:"icon rafter-down",width:"20",height:"20"})})})]})]})}),g.jsx(E_,{className:"no-2d navbar-secondary navbar-expand-md","aria-label":r("navbar.secondary.navigation"),children:g.jsx("div",{className:"container-fluid",children:g.jsxs("div",{className:`collapse navbar-collapse ${H?"":"show"}`,id:"navbarCollapsed",children:[g.jsx(Ek,{is1d:!0,src:`${e}/img/illustrations/logo.png`,translate:r("navbar.home")}),g.jsxs(Ck,{className:"gap-8",children:[g.jsx(yr,{children:g.jsxs("a",{href:"/timeline/timeline",className:"button",children:[g.jsx(cX,{color:"#fff",className:"d-md-none"}),g.jsx("span",{className:"d-inline-block",children:r("portal.header.navigation.whatsnew")})]})}),g.jsx(yr,{children:g.jsxs("a",{href:"/userbook/annuaire",className:"button",children:[g.jsx(xX,{color:"#fff",className:"d-md-none"}),g.jsx("span",{className:"d-inline-block",children:r("portal.header.navigation.classMembers")})]})}),g.jsx(yr,{children:g.jsxs("a",{href:"/welcome",className:"button",children:[g.jsx(g3,{color:"#fff",className:"d-md-none"}),g.jsx("span",{className:"d-inline-block",children:r("portal.header.navigation.myapps")})]})})]})]})})})]}):g.jsx(E_,{className:"navbar-expand-md",children:g.jsxs("div",{className:"container-fluid",children:[g.jsx(Ek,{src:`${e}/img/illustrations/logo.png`}),g.jsx("a",{href:u?u.address:"/timeline/timeline",className:"navbar-title text-truncate d-md-none",children:b}),g.jsxs("ul",{className:"navbar-nav",children:[g.jsx(yr,{children:g.jsx(gf,{link:"/timeline/timeline",translate:r("navbar.home"),children:g.jsx(iX,{color:"#fff"})})}),g.jsxs(yr,{className:"position-relative",ref:w,id:A,"aria-haspopup":"true","aria-expanded":E,children:[g.jsx(gf,{link:"/welcome",translate:r("navbar.applications"),children:g.jsx(g3,{color:"#fff"})}),g.jsxs(r8,{className:"top-100 widget",id:A,isVisible:E,children:[g.jsx(Rce,{children:g.jsx(nfe,{bookmarkedApps:_})}),g.jsx(Pce,{className:"widget-footer border-top border-ghost",children:g.jsx(rfe,{})})]})]}),z&&g.jsx(yr,{children:g.jsxs(gf,{className:"position-relative",link:"/conversation/conversation",translate:r("conversation"),children:[g.jsx(v3,{color:"#fff"}),O&&g.jsx(S_,{children:n})]})}),s&&g.jsx(yr,{children:g.jsxs(gf,{className:"position-relative",link:i,translate:r("conversation"),children:[g.jsx(v3,{color:"#fff"}),O&&g.jsx(S_,{children:n})]})}),l==="fr"&&c?g.jsxs(yr,{children:[g.jsxs("button",{className:"nav-link btn btn-naked",onClick:()=>{f(!0)},children:[g.jsx(aX,{color:"#fff"}),g.jsx(fl,{children:r("support")})]}),g.jsx(Ak,{isHelpOpen:h,setIsHelpOpen:f,parsedContent:m,parsedHeadline:y,error:v})]}):null,g.jsx(yr,{children:g.jsxs("div",{className:"dropdown",children:[g.jsx("button",{className:"nav-link btn btn-naked d-md-none",type:"button","aria-controls":"dropdown-navbar","aria-expanded":!H,"aria-label":r("navbar.open.menu"),onClick:F,children:g.jsx(Cp,{className:"icon rafter-down",width:"20",height:"20",color:"#fff"})}),g.jsxs("ul",{className:`dropdown-menu dropdown-menu-end ${H?"":"show"}`,id:"dropdown-navbar",children:[N&&g.jsx(yr,{children:g.jsxs("a",{href:"/community",className:"nav-link dropdown-item",children:[g.jsx(tX,{className:"icon community"}),g.jsx("span",{className:"nav-text",children:r("navbar.community")})]})}),j?g.jsx(ofe,{}):null,g.jsx(yr,{children:g.jsxs("a",{href:"/userbook/mon-compte",className:"nav-link dropdown-item",children:[g.jsx(ec,{alt:P,size:"sm",src:I,variant:"circle",className:"bg-white",width:"32",height:"32"}),g.jsx("span",{className:"nav-text",children:r("navbar.myaccount")})]})}),g.jsx(yr,{children:g.jsx("hr",{className:"dropdown-divider"})}),g.jsx(yr,{children:g.jsxs("a",{href:"/auth/logout?callback="+((U==null?void 0:U.logoutCallback)??"/"),className:"nav-link dropdown-item",children:[g.jsx(m3,{className:"icon logout"}),g.jsx("span",{id:"logout-label",className:"nav-text",children:r("navbar.disconnect")})]})})]})]})})]})]})})})},lfe=afe,ufe=({children:t,headless:e=!1,...r})=>{const{theme:n}=ya(),{t:i}=we(),{showCookiesConsent:s,handleConsultCookies:o,handleCloseCookiesConsent:a}=tfe();Jce(),ede();const l=Me("d-flex flex-column bg-white",{"container-fluid":!e,"rounded-4 border":(n==null?void 0:n.is1d)&&!e,"mt-24":(n==null?void 0:n.is1d)&&!e}),u=e?null:g.jsx(lfe,{is1d:n==null?void 0:n.is1d,src:n==null?void 0:n.basePath}),c=s&&g.jsx(Jo,{type:"info",className:"m-12 rgpd",isConfirm:!0,position:"bottom-right",button:g.jsx(it,{color:"tertiary",variant:"ghost",onClick:o,children:i("rgpd.cookies.banner.button.consult")}),onClose:a,children:i("rgpd.cookies.banner.text1")}),h=g.jsx(BG,{containerClassName:"toaster-container",toastOptions:{position:"top-right"}});return g.jsxs(g.Fragment,{children:[u,g.jsx("main",{className:l,...r,children:t}),h,c]})},cfe=ufe,dfe="modulepreload",hfe=function(t){return"/"+t},Rk={},dr=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),o=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));i=Promise.all(r.map(a=>{if(a=hfe(a),a in Rk)return;Rk[a]=!0;const l=a.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${u}`))return;const c=document.createElement("link");if(c.rel=l?"stylesheet":dfe,l||(c.as="script",c.crossOrigin=""),c.href=a,o&&c.setAttribute("nonce",o),document.head.appendChild(c),l)return new Promise((h,f)=>{c.addEventListener("load",h),c.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${a}`)))})}))}return i.then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})},ffe=t=>{let{activatorEvent:e,draggingNodeRect:r,transform:n}=t;if(r&&e){const i=Ly(e);if(!i)return n;const s=i.x-r.left,o=i.y-r.top;return{...n,x:n.x+s-r.width/2,y:n.y+o-r.height/2}}return n},pfe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},mfe=t=>{let e;const r=new Set,n=(c,h)=>{const f=typeof c=="function"?c(e):c;if(!Object.is(f,e)){const m=e;e=h??(typeof f!="object"||f===null)?f:Object.assign({},e,f),r.forEach(y=>y(e,m))}},i=()=>e,l={setState:n,getState:i,getInitialState:()=>u,subscribe:c=>(r.add(c),()=>r.delete(c)),destroy:()=>{(pfe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},u=e=t(n,i,l);return l},gfe=t=>mfe;var v8={exports:{}},y8={},x8={exports:{}},b8={};/**
1391
1391
  * @license React
1392
1392
  * use-sync-external-store-shim.production.min.js
1393
1393
  *
@@ -1403,4 +1403,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1403
1403
  *
1404
1404
  * This source code is licensed under the MIT license found in the
1405
1405
  * LICENSE file in the root directory of this source tree.
1406
- */var tx=T,Afe=Cfe;function Rfe(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Pfe=typeof Object.is=="function"?Object.is:Rfe,Ife=Afe.useSyncExternalStore,Mfe=tx.useRef,kfe=tx.useEffect,Ofe=tx.useMemo,Dfe=tx.useDebugValue;y8.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var s=Mfe(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=Ofe(function(){function l(m){if(!u){if(u=!0,c=m,m=n(m),i!==void 0&&o.hasValue){var y=o.value;if(i(y,m))return h=y}return h=m}if(y=h,Pfe(c,m))return y;var v=n(m);return i!==void 0&&i(y,v)?y:(c=m,h=v)}var u=!1,c,h,f=r===void 0?null:r;return[function(){return l(e())},f===null?void 0:function(){return l(f())}]},[e,r,n,i]);var a=Ife(t,s[0],s[1]);return kfe(function(){o.hasValue=!0,o.value=a},[a]),Dfe(a),a};v8.exports=y8;var Nfe=v8.exports;const Lfe=Co(Nfe),Ffe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},{useDebugValue:jfe}=Pe,{useSyncExternalStoreWithSelector:Bfe}=Lfe;let Pk=!1;const Ufe=t=>t;function $fe(t,e=Ufe,r){(Ffe?"production":void 0)!=="production"&&r&&!Pk&&(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"),Pk=!0);const n=Bfe(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,r);return jfe(n),n}const w8=async t=>{const e=await Ie.resource(t.application).searchContext(t);return{...e,folders:e.folders.filter(r=>!r.trashed)}},zfe=async({searchParams:t,name:e,parentId:r})=>{const n={name:e,parentId:r,application:t.application,type:t.types[0]};return await Ie.resource(t.application).createFolder(n)},Hfe=async({folderId:t,searchParams:e,parentId:r,name:n})=>{const i={folderId:t,name:n,parentId:r,application:e.application,type:e.types[0]};return await Ie.resource(e.application).updateFolder(i)},Vfe=async({searchParams:t,resourceIds:e,useAssetIds:r,folderIds:n})=>{const i={application:t.application,resourceType:t.types[0],resourceIds:e,folderIds:n};return await Ie.resource(t.application).trashAll(i,r)},Gfe=async({searchParams:t,resourceIds:e,useAssetIds:r,folderIds:n})=>{const i={application:t.application,resourceType:t.types[0],resourceIds:e,folderIds:n};return await Ie.resource(t.application).deleteAll(i,r)},Wfe=async({searchParams:t,resourceIds:e,folderIds:r,useAssetIds:n})=>{const i={application:t.application,resourceType:t.types[0],resourceIds:e,folderIds:r};return await Ie.resource(t.application).restoreAll(i,n)},Xfe=async(t,e)=>await Ie.resource(t.application).copy({application:t.application,resourceId:e}),_8=async({searchParams:t,resourceIds:e,folderId:r,folderIds:n,useAssetIds:i})=>{const s={application:t.application,folderId:r,resourceIds:e,folderIds:n};return await Ie.resource(t.application).moveToFolder(s,i)},qfe=async t=>await Ie.rights().sessionHasWorkflowRights(t),Yfe=({searchParams:t,assetId:e})=>{const r=Ie.resource(t.application).getViewUrl(e);window.open(r,"_self")},Qfe=({searchParams:t,params:e})=>Ie.resource(t.application).create(e),Kfe=({searchParams:t,assetId:e})=>{const r=Ie.resource(t.application).getPrintUrl(e);return window.open(r,"_blank")},Zfe=({searchParams:t,folderId:e})=>{const r=Ie.resource(t.application).getFormUrl(e);return window.open(r,"_self")},Jfe=({searchParams:t,assetId:e})=>{const r=Ie.resource(t.application).getEditUrl(e);return window.open(r,"_self")},epe=({searchParams:t,assetId:e})=>{const r=Ie.resource(t.application).getExportUrl(e);return window.open(r,"_self")},S8={id:Tr.DEFAULT,name:_n("explorer.filters.mine"),section:!0,children:[]},tpe={config:void 0,searchConfig:{minLength:1},searchParams:{filters:{folder:Tr.DEFAULT,owner:void 0,shared:void 0,public:void 0},orders:{updatedAt:LB.DESC},application:"",types:[],pagination:{startIdx:0,pageSize:48,maxIdx:0},trashed:!1},treeData:S8,selectedNodeId:"default",currentFolder:{id:"default"},selectedFolders:[],selectedResources:[],folderIds:[],resourceIds:[],resourceIsTrash:!1,resourceOrFolderIsDraggable:{isDrag:!1,elementDrag:void 0},elementDragOver:{isOver:!1,isTreeview:!1,canMove:!0,overId:void 0},resourceActionDisable:!1,status:void 0},rpe=gfe()((t,e)=>({...tpe,actions:{setConfig:r=>t({config:r}),setSearchConfig:r=>t(n=>({searchConfig:{...n.searchConfig,...r}})),setTreeData:r=>t(()=>({treeData:r})),setSearchParams:r=>{t(n=>{const{searchParams:i}=n;return i.search!==r.search?r.search?{...n,selectedFolders:[],selectedNodeId:void 0,selectedResources:[],currentFolder:void 0,searchParams:{...i,...r,trashed:!1,filters:{...i.filters,folder:void 0}}}:{...n,selectedFolders:[],selectedNodeId:"default",selectedResources:[],currentFolder:{id:"default"},searchParams:{...i,...r,trashed:!1,filters:{...i.filters}}}:{searchParams:{...i,...r}}})},setSelectedFolders:r=>t(()=>({selectedFolders:r})),setSelectedResources:r=>t(()=>({selectedResources:r})),setFolderIds:r=>t(()=>({folderIds:r})),setResourceIds:r=>t(()=>({resourceIds:r})),setResourceIsTrash:r=>t(()=>({resourceIsTrash:r})),setResourceOrFolderIsDraggable:r=>t(()=>({resourceOrFolderIsDraggable:r})),setElementDragOver:r=>t(()=>({elementDragOver:r})),setResourceActionDisable:r=>t(()=>({resourceActionDisable:r})),clearSelectedItems:()=>t(()=>({selectedFolders:[],selectedResources:[]})),clearSelectedIds:()=>t(()=>({resourceIds:[],folderIds:[]})),openResource:r=>{try{const{searchParams:n}=e();Yfe({searchParams:n,assetId:r.assetId})}catch(n){console.error("explorer open failed: ",n)}},printSelectedResource:()=>{try{const{searchParams:r,selectedResources:n,resourceIds:i}=e();if(n.length!==1)throw new Error("Cannot open more than 1 resource");const s=n.find(o=>o.id===i[0]);Kfe({searchParams:r,assetId:s.assetId})}catch(r){console.error("explorer print failed: ",r)}},openFolder:({folderId:r,folder:n,queryClient:i})=>{const{searchParams:s}=e(),o=s.filters.folder,a=r;o!==r&&(e().actions.fetchTreeData(r,i),t(l=>({...l,folderIds:[],resourceIds:[],selectedNodeId:a,currentFolder:n||{id:r},searchParams:{...s,search:void 0,filters:{...s.filters,folder:r},trashed:r===Tr.BIN}})))},foldTreeItem:()=>t(r=>({...r,status:"fold"})),fetchTreeData:async(r,n)=>{const i=Qi(e().treeData,r),s=i==null?void 0:i.id;if(Array.isArray(i==null?void 0:i.children)&&i.children.length)return;const o=await n.fetchQuery({queryKey:["prefetchContext",{folderId:s,trashed:!1}],queryFn:async()=>await w8({...e().searchParams,filters:{...e().searchParams.filters,folder:s}})});e().actions.setTreeData(mue(e().treeData,o==null?void 0:o.folders,s||Tr.DEFAULT))},selectTreeItem:(r,n)=>{const{treeData:i}=e(),{openFolder:s,fetchTreeData:o}=e().actions,a=Qi(i,r);o(r,n),t(l=>({...l,searchParams:{...l.searchParams,search:void 0},status:"select",selectedResources:[]})),s({folder:a,folderId:r})},gotoPreviousFolder:()=>{const{selectedNodeId:r,treeData:n,searchParams:i}=e(),{openFolder:s}=e().actions;if(i.search&&s({folder:S8,folderId:Tr.DEFAULT}),!r)return;const o=G6(n,r);s({folder:o,folderId:(o==null?void 0:o.id)||Tr.DEFAULT})},goToTrash:()=>{t(r=>({...r,selectedNodeId:void 0,selectedResources:[],resourceIds:[],folderIds:[],status:"select",searchParams:{...r.searchParams,search:void 0,filters:{folder:Tr.BIN},trashed:!0},currentFolder:{id:Tr.BIN}}))}}}));function ir(t){return $fe(rpe,t)}const npe=t=>t.treeData,ipe=t=>t.actions,hc=()=>ir(npe),sr=()=>ir(ipe),Pr=()=>ir(t=>t.searchParams),bA=()=>ir(t=>t.selectedNodeId),rx=()=>ir(t=>t.selectedFolders),Im=()=>ir(t=>t.selectedResources),spe=()=>ir(t=>t.searchConfig),Sh=()=>ir(t=>t.folderIds),Eh=()=>ir(t=>t.resourceIds),nx=()=>ir(t=>t.selectedResources.map(e=>e.assetId)),ix=()=>ir(t=>t.selectedResources.filter(e=>e.assetId===e.id)),xa=()=>ir(t=>t.currentFolder),Gl=()=>{const t=xa();return(t==null?void 0:t.id)===Tr.BIN},E8=()=>ir(t=>t.resourceIsTrash),sx=()=>ir(t=>t.resourceOrFolderIsDraggable),T8=()=>ir(t=>t.elementDragOver),ope=()=>ir(t=>t.resourceActionDisable),ape=()=>{const t=xa();return(t==null?void 0:t.id)==="default"},lpe=()=>ir(t=>t.status),upe=()=>{const t=ope(),{clearSelectedIds:e,setResourceActionDisable:r,clearSelectedItems:n}=sr();return{isActionDisableModalOpen:t,onActionDisableCancel:()=>{e(),n(),r(!1)}}},cpe=()=>{const t=E8(),{clearSelectedIds:e,setResourceIsTrash:r,clearSelectedItems:n}=sr();return{isTrashedModalOpen:t,onTrashedCancel:()=>{e(),n(),r(!1)}}},dpe=175,hpe=10,C8="blog",A8="blog";class R8 extends Vk{getEditUrl(){throw new Error("Method not implemented.")}async create(e){const r=e.thumbnail?await this.getThumbnailPath(e.thumbnail):"",n=e.public?"/blog/pub":"/blog",i=await this.http.post(n,{title:e.name,description:e.description,visibility:e.public?"PUBLIC":"OWNER",thumbnail:r,trashed:!1,folder:e.folder,slug:e.public?e.slug:"","publish-type":e.publishType||"RESTRAINT","comment-type":"IMMEDIATE"});return this.checkHttpResponse(i),i}async update(e){const r=e.thumbnail?await this.getThumbnailPath(e.thumbnail):"",n=await this.http.put(`/blog/${e.entId}`,{trashed:e.trashed,_id:e.entId,title:e.name,thumbnail:r,description:e.description,visibility:e.public?"PUBLIC":"OWNER",slug:e.public?e.slug:"","publish-type":e["publish-type"]||"RESTRAINT","comment-type":"IMMEDIATE"});return this.checkHttpResponse(n),{thumbnail:r,entId:e.entId}}getResourceType(){return A8}getApplication(){return C8}getFormUrl(e){return e?`/blog?folderid=${e}#/edit/new`:"/blog#/edit/new"}getViewUrl(e){return`/blog/id/${e}`}getPrintUrl(e){return`/blog/print/${e}`}}Vk.register({application:C8,resourceType:A8},t=>new R8(t));const du=document.querySelector("[data-explorer-config]");let Ik;function P8(){var t;if((t=du==null?void 0:du.dataset)!=null&&t.explorerConfig){const{explorerConfig:e}=du.dataset;try{const r=JSON.parse(e);Ik={...r,service:R8,enableOnboarding:r.enableOnboarding!==void 0?r.enableOnboarding:!0}}catch(r){console.error("[Explorer Config] could not parse app params from root data attributes:",du==null?void 0:du.dataset,r)}}return Ik}const fpe=(t,e)=>{const r=t.map(i=>i.workflow),n=new Set(r);return{queryKey:[...n],queryFn:()=>qfe([...n]),select:i=>t.filter(s=>i[s.workflow]).map(s=>({...s,available:!0})),staleTime:1/0,enabled:!!e}},ox=t=>{const e=ir(r=>r.config);return qT(fpe(t,e))},ppe=()=>{const t=ir(o=>o.config),e=Pr(),{filters:r,trashed:n,search:i}=e,s=["context",{folderId:r.folder,filters:r,trashed:n,search:i}];return PV({queryKey:s,queryFn:async({pageParam:o})=>await w8({...e,application:t==null?void 0:t.app,types:t==null?void 0:t.types,pagination:{...e.pagination,startIdx:o}}),staleTime:5e3,initialPageParam:0,enabled:!!t,retry:!1,getNextPageParam:o=>o.pagination.startIdx+o.pagination.pageSize})},mpe=()=>{const t=Jr(),e=Zr(),r=Pr(),n=hc(),i=Sh(),s=nx(),o=Eh(),a=ix().length>0,l=a?s:o,{clearSelectedItems:u,clearSelectedIds:c,setTreeData:h,setSearchParams:f}=sr(),{filters:m,trashed:y}=r,v=["context",{folderId:m.folder,filters:m,trashed:y}];return Ro({mutationFn:async()=>await Vfe({searchParams:r,folderIds:i,resourceIds:l,useAssetIds:a}),onError(x){typeof x=="string"&&t.error(_n(x))},onSuccess:async x=>{if(await e.cancelQueries({queryKey:v}),e.getQueryData(v))return t.success(_n("explorer.trash.title")),e.setQueryData(v,_=>{var w;if(_){const E={..._,pages:_==null?void 0:_.pages.map(I=>{var P;return{...I,folders:I.folders.filter(M=>!i.includes(M.id)),pagination:{...I.pagination,maxIdx:((P=I==null?void 0:I.pagination)==null?void 0:P.maxIdx)-x.resources.length},resources:I.resources.filter(M=>a?!s.includes(M.assetId):!l.includes(M.id))}})},A=fue(n,{folders:i});return h(A),f({...r,pagination:{...r.pagination,maxIdx:((w=r.pagination)==null?void 0:w.maxIdx)-x.resources.length}}),E}})},onSettled:()=>{u(),c()}})},gpe=()=>{const t=Jr(),e=Zr(),r=Pr(),n=Sh(),i=nx(),s=Eh(),o=ix().length>0,a=o?i:s,{setFolderIds:l,setResourceIds:u,setSelectedResources:c,setSelectedFolders:h}=sr(),{filters:f,trashed:m}=r,y=["context",{folderId:f.folder,filters:f,trashed:m}];return Ro({mutationFn:async()=>await Wfe({searchParams:r,folderIds:n,resourceIds:a,useAssetIds:o}),onError(v){typeof v=="string"&&t.error(_n(v))},onSuccess:async()=>{if(await e.cancelQueries({queryKey:y}),e.getQueryData(y))return t.success(_n("explorer.trash.toast")),e.setQueryData(y,x=>{if(x)return{...x,pages:x==null?void 0:x.pages.map(b=>({...b,folders:b.folders.filter(_=>!n.includes(_.id)),resources:b.resources.filter(_=>o?!i.includes(_.assetId):!a.includes(_.id))}))}})},onSettled:()=>{u([]),c([]),l([]),h([])}})},vpe=()=>{const t=Jr(),e=Zr(),r=Pr(),n=Sh(),i=nx(),s=Eh(),o=ix().length>0,a=o?i:s,{clearSelectedItems:l,clearSelectedIds:u}=sr(),{filters:c,trashed:h}=r,f=["context",{folderId:c.folder,filters:c,trashed:h}];return Ro({mutationFn:async()=>await Gfe({searchParams:r,folderIds:n,resourceIds:a,useAssetIds:o}),onError(m){typeof m=="string"&&t.error(_n(m))},onSuccess:async()=>{if(await e.cancelQueries({queryKey:f}),e.getQueryData(f))return t.success(_n("explorer.removed.from.trash")),e.setQueryData(f,y=>{if(y)return{...y,pages:y==null?void 0:y.pages.map(x=>({...x,folders:x.folders.filter(b=>!n.includes(b.id)),resources:x.resources.filter(b=>o?!i.includes(b.assetId):!a.includes(b.id))}))}})},onSettled:()=>{l(),u()}})},ype=()=>{const t=Jr(),e=Pr(),r=Zr(),{user:n}=_h(),i=xa(),{filters:s,trashed:o}=e,a="duplicate_start",l=["context",{folderId:s.folder,filters:s,trashed:o}];return Ro({mutationFn:async u=>(t.info(_n("duplicate.start"),{id:a}),await Xfe(e,u.assetId)),onSuccess:async(u,c)=>{t.remove(a),t.success(_n("duplicate.done")),await r.cancelQueries({queryKey:l});const h=r.getQueryData(l),f={...c,name:`${c.name}${_n("duplicate.suffix")}`,assetId:u.duplicateId,id:u.duplicateId,creatorId:n==null?void 0:n.userId,creatorName:n==null?void 0:n.username,createdAt:Date.now(),slug:c.slug||"",modifiedAt:Date.now(),modifierId:(n==null?void 0:n.userId)||"",modifierName:(n==null?void 0:n.username)||"",updatedAt:Date.now(),trashed:!1,rights:[`creator:${n==null?void 0:n.userId}`]};h&&r.setQueryData(l,m=>{if(m)return{...m,pages:m==null?void 0:m.pages.map(y=>({...y,resources:[f,...y.resources]}))}}),i.id&&i.id!==Tr.DEFAULT&&_8({searchParams:e,resourceIds:[u.duplicateId],folderId:i.id,folderIds:[],useAssetIds:!0})},onError:u=>{t.remove(a),typeof u=="string"&&t.error(`${_n("duplicate.error")}: ${u}`)}})},I8=()=>{const t=Jr(),e=Zr(),r=Pr(),n=hc(),i=Sh(),s=nx(),o=Eh(),a=ix().length>0,l=a?s:o,{clearSelectedIds:u,clearSelectedItems:c,setTreeData:h,setSearchParams:f}=sr(),{filters:m,trashed:y}=r,v=["context",{folderId:m.folder,filters:m,trashed:y}];return Ro({mutationFn:async x=>await _8({searchParams:r,folderId:x,folderIds:i,resourceIds:l,useAssetIds:a}),onError(x){typeof x=="string"&&t.error(_n(x))},onSuccess:async(x,b)=>{if(e.getQueryData(v))return e.setQueryData(v,w=>{var E;if(w){const A=pue(n,{destinationId:b,folders:i}),I={...w,pages:w==null?void 0:w.pages.map(P=>{var M;return{...P,folders:P.folders.filter(N=>!i.includes(N.id)),pagination:{...P.pagination,maxIdx:((M=P.pagination)==null?void 0:M.maxIdx)-x.resources.length},resources:P.resources.filter(N=>a?!s.includes(N.assetId):!l.includes(N.id))}})};return h(A),f({...r,pagination:{...r.pagination,maxIdx:((E=r.pagination)==null?void 0:E.maxIdx)-x.resources.length}}),I}});e.invalidateQueries()},onSettled:()=>{c(),u()}})},xpe=()=>{const t=Jr(),e=Zr(),r=Pr(),n=hc(),{setTreeData:i}=sr(),{filters:s,trashed:o}=r,a=["context",{folderId:s.folder,filters:s,trashed:o}];return Ro({mutationFn:async({name:l,parentId:u})=>await zfe({searchParams:r,name:l,parentId:u}),onError(l){typeof l=="string"&&t.error(_n(l))},onSuccess:async(l,u)=>{await e.cancelQueries({queryKey:a});const c=e.getQueryData(a),h={...l,parentId:u.parentId,children:[],rights:[`creator:${l==null?void 0:l.creator_id}`]};if(c)return e.setQueryData(a,f=>{if(f){const m={...f,pages:f==null?void 0:f.pages.map(v=>({...v,folders:[...v.folders,h]}))},y=hue(n,{parentId:u.parentId,newFolder:h});return i(y),m}})}})},bpe=()=>{const t=Jr(),e=Zr(),r=Pr(),n=hc(),{setFolderIds:i,setSelectedFolders:s,setTreeData:o}=sr(),{filters:a,trashed:l}=r,u=["context",{folderId:a.folder,filters:a,trashed:l}];return Ro({mutationFn:async({folderId:c,name:h,parentId:f})=>await Hfe({searchParams:r,folderId:c,parentId:f,name:h}),onError(c){typeof c=="string"&&t.error(_n(c))},onSuccess:async(c,h)=>{if(await e.cancelQueries({queryKey:u}),e.getQueryData(u))return e.setQueryData(u,m=>{if(m){const y={...m,pages:m==null?void 0:m.pages.map(x=>({...x,folders:x.folders.map(b=>b.id===c.id?{...c,parentId:h.parentId,rights:b.rights}:b)}))},v=gue(n,{folderId:h.folderId,newFolder:c});return o(v),y}})},onSettled:()=>{i([]),s([])}})},wpe=t=>{const e=Zr(),r=Pr(),{setResourceIds:n,setSelectedResources:i}=sr(),{filters:s,trashed:o}=r,a=["context",{folderId:s.folder,filters:s,trashed:o}];return Jhe({application:t,options:{onSuccess:async(l,u)=>{if(await e.cancelQueries({queryKey:a}),e.getQueryData(a))return e.setQueryData(a,h=>{if(h)return{...h,pages:h==null?void 0:h.pages.map(f=>({...f,resources:f.resources.map(m=>{if(m.assetId===(u==null?void 0:u.resourceId)){let y=[`creator:${m.creatorId}`];return(u==null?void 0:u.rights.length)>=1&&(y=[...y,...u.rights.flatMap(v=>v.actions.map(x=>`${v.type}:${v.id}:${x.id}`))]),{...m,rights:y}}else return m})}))}})},onSettled:()=>{n([]),i([])}}})},_pe=t=>{const e=Zr(),r=Pr(),{filters:n,trashed:i}=r,s=["context",{folderId:n.folder,filters:n,trashed:i}];return Lhe({application:t,options:{onSuccess:async(o,a)=>{if(await e.cancelQueries({queryKey:s}),e.getQueryData(s))return e.setQueryData(s,u=>{if(u)return{...u,pages:u==null?void 0:u.pages.map(c=>({...c,resources:c.resources.map(h=>{if(h.assetId===(a==null?void 0:a.entId)){const{name:f,thumbnail:m,public:y,description:v,slug:x,...b}=a;return{...h,...b,name:f,thumbnail:typeof m=="string"?m:URL.createObjectURL(m),public:y,description:v,slug:x}}else return h})}))}})}}})},Spe=()=>{const t=Jr(),e=Zr(),r=Pr(),{user:n}=_h(),{appCode:i}=yt(),s=["context",{folderId:r.filters.folder,filters:r.filters,trashed:r.trashed}];return Ro({mutationFn:async o=>await Qfe({searchParams:r,params:o}),onError(o){typeof o=="string"&&t.error(_n(o))},onSuccess:async(o,a)=>{var c,h,f;await e.cancelQueries({queryKey:s});const l=e.getQueryData(s),u={...a,thumbnail:o.thumbnail||"",application:i,assetId:o._id||o.entId||"",id:o._id||o.entId||"",creatorId:n==null?void 0:n.userId,creatorName:n==null?void 0:n.username,createdAt:Date.now(),slug:a.slug||"",modifiedAt:((c=o.modified)==null?void 0:c.$date)||"",modifierId:((h=o.author)==null?void 0:h.userId)||"",modifierName:((f=o.author)==null?void 0:f.username)||"",updatedAt:Date.now(),trashed:!1,rights:[`creator:${n==null?void 0:n.userId}`]};if(l)return e.setQueryData(s,m=>{if(m)return{...m,pages:m==null?void 0:m.pages.map(y=>({...y,resources:[u,...y.resources]}))}})}})};function Mk(t,e){var n;const r=Qi(t,e);return(n=r==null?void 0:r.folder)!=null&&n.childrenIds?[...(r==null?void 0:r.folder.childrenIds)||[],e]:e===Tr.BIN?[Tr.BIN]:[Tr.DEFAULT]}function Epe(){const t=Zr(),e=I8(),r=Jr(),{appCode:n}=yt(),{t:i}=we(["common",n]),s=i("explorer.filters.mine",{ns:n}),{setResourceOrFolderIsDraggable:o,setElementDragOver:a,setResourceIds:l,setFolderIds:u,fetchTreeData:c}=sr(),h=hc(),f={delay:dpe,tolerance:hpe},m=r_(WC,{activationConstraint:f}),y=r_(jj,{activationConstraint:f}),v=r_(VC),x=Bne(m,y,v),b=(A,I)=>{var P;((P=A.data.current)==null?void 0:P.type)==="resource"?r.success(g.jsxs(g.Fragment,{children:[i("explorer.dragged.resource")," ",g.jsx("strong",{children:I})]})):r.success(g.jsxs(g.Fragment,{children:[i("explorer.dragged.folder")," ",g.jsx("strong",{children:I})]}))};return{handleDragEnd:async A=>{const{over:I,active:P}=A,M=I==null?void 0:I.data.current,N=P.data.current,z=A2(h,M==null?void 0:M.id),j=Mk(h,M==null?void 0:M.id);if((N==null?void 0:N.id)==(M==null?void 0:M.id)||z.includes(N==null?void 0:N.id)||j.includes(N==null?void 0:N.id))l([]),u([]);else{const H=(M==null?void 0:M.name)??s;if(I)try{await e.mutate(M==null?void 0:M.id),b(P,H)}catch(F){console.error(F)}finally{a({isOver:!1,overId:void 0,canMove:!0,isTreeview:!1})}}o({isDrag:!1,elementDrag:void 0})},handleDragStart:A=>{const{active:I}=A,P=I.data.current;(P==null?void 0:P.type)==="resource"?l([P==null?void 0:P.id]):(P==null?void 0:P.type)==="folder"&&u([P==null?void 0:P.id]),o({isDrag:!0,elementDrag:P==null?void 0:P.id})},handleDragOver:A=>{const{over:I,active:P}=A,M=I==null?void 0:I.data.current,N=P==null?void 0:P.data.current,z=A2(h,M==null?void 0:M.id),j=Mk(h,M==null?void 0:M.id);if(I){const H={isOver:!0,canMove:!1,overId:M==null?void 0:M.id,isTreeview:M==null?void 0:M.isTreeview};(N==null?void 0:N.id)===(M==null?void 0:M.id)||z.includes(N==null?void 0:N.id)||j.includes(N==null?void 0:N.id)?a({...H,canMove:!1}):(c(M==null?void 0:M.id,t),a({...H,canMove:!0}))}else a({isOver:!1,overId:void 0,canMove:!0,isTreeview:!1})},sensors:x}}const Tpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Jpe),void 0)),Cpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>tme),void 0)),Ape=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>nme),void 0)),Rpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>sme),void 0)),Ppe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>ame),void 0)),Ipe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>cme),void 0)),Mpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>fme),void 0)),kpe=()=>{const t=ape(),e=Gl(),r=bA(),n=Pr(),i=xa(),s=Jr(),o=Zr(),{appCode:a}=yt(),{t:l}=we([a]),{setSearchParams:u,setSearchConfig:c,fetchTreeData:h}=sr(),{data:f,isError:m,error:y,isLoading:v,isFetching:x,fetchNextPage:b}=ppe(),_=(f==null?void 0:f.pages[0].folders.length)===0,w=(f==null?void 0:f.pages[0].resources.length)===0,E=_&&w;return T.useEffect(()=>{var A,I;f&&((A=f==null?void 0:f.pages[0])!=null&&A.searchConfig&&c(f.pages[0].searchConfig),!n.search&&i.id==="default"&&h(i.id,o),u({...n,pagination:(I=f==null?void 0:f.pages[(f==null?void 0:f.pages.length)-1])==null?void 0:I.pagination}))},[f]),T.useEffect(()=>{y&&typeof y=="string"&&s.error(l(y))},[y]),v?g.jsx(pr,{}):m?g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:g.jsx(Ape,{})}):n.search&&E?g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:g.jsx(Cpe,{})}):t&&E?g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:g.jsx(Tpe,{})}):r&&E&&!e?g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:g.jsx(Rpe,{})}):e&&(f==null?void 0:f.pages[0].resources.length)===0?g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:g.jsx(Ppe,{})}):g.jsxs(T.Suspense,{fallback:g.jsx(pr,{}),children:[g.jsx(Ipe,{data:f,isFetching:x}),g.jsx(Mpe,{data:f,isFetching:x,fetchNextPage:b})]})},M8=()=>{const t=Pr(),[e,r]=T.useState(""),n=spe(),i=lpe(),s=T.useRef(null),{setSearchParams:o}=sr(),a=c=>{const h=c.target.value;r(h.toString())},l=c=>{(c.key==="Enter"||c.key==="Return")&&(c.preventDefault(),o({search:e||void 0}))},u=c=>{c.preventDefault(),o({search:e||void 0})};return T.useEffect(()=>{const h=e.length==0||e.length>=n.minLength?{search:e||void 0}:{};o({...t,...h})},[e,n.minLength]),T.useEffect(()=>{i==="select"&&r("")},[i]),T.useEffect(()=>{r(()=>{var c;return((c=t.search)==null?void 0:c.toString())??""})},[t]),{formRef:s,inputSearch:e,handleInputSearchChange:a,handleKeyPress:l,handleSearchSubmit:u}},Ope=()=>{const{appCode:t,currentApp:e}=yt(),{t:r}=we(),[n,i]=T.useState(""),s=c=>{if(c==="0"){i("");return}i(c)},o=xa(),a=Pr(),{setSearchParams:l}=sr();T.useEffect(()=>{const c=()=>n.includes("1")?!0:void 0,h=()=>n.includes("2")?!0:void 0,f=()=>n.includes("7")?!0:void 0;l({...a,filters:{owner:c(),public:f(),shared:h(),folder:o?o.id:"default"}})},[o,l,n]);const u=[{label:r("explorer.filter.all",{ns:t}),value:"0"},{label:r("explorer.filter.owner",{ns:t}),value:"1"},{label:r("explorer.filter.shared",{ns:t}),value:"2"},...(e==null?void 0:e.displayName)=="exercizer"?[{label:"Exercices interactifs",value:"3"}]:[],...(e==null?void 0:e.displayName)=="exercizer"?[{label:"Exercices à rendre",value:"4"}]:[],...(e==null?void 0:e.displayName)=="pages"?[{label:"Projets publics",value:"5"}]:[],...(e==null?void 0:e.displayName)=="pages"?[{label:"Projets internes",value:"6"}]:[],...(e==null?void 0:e.displayName)=="blog"?[{label:r("explorer.filter.public",{ns:t}),value:"7"}]:[]];return{selectedFilters:n,options:u,handleOnSelectFilter:s}},Dpe=()=>{const{appCode:t}=yt(),{t:e}=we(),{selectedFilters:r,options:n,handleOnSelectFilter:i}=Ope(),{formRef:s,inputSearch:o,handleInputSearchChange:a,handleKeyPress:l,handleSearchSubmit:u}=M8(),c=r.length>0?r.length:void 0;return g.jsxs("form",{noValidate:!0,className:"bg-light p-16 ps-24 ms-n16 ms-lg-n24 me-n16 position-relative d-flex gap-8",ref:s,children:[g.jsxs(Ot,{id:"search",className:"input-group",children:[g.jsx(Zn,{type:"search",placeholder:e("explorer.label.search",{ns:t}),size:"lg",noValidationIcon:!0,value:o,onChange:a,onKeyDown:l}),g.jsx(oA,{type:"submit","aria-label":e("explorer.label.search",{ns:t}),onClick:u})]}),g.jsxs(xt,{placement:"bottom-end",children:[g.jsx(xt.Trigger,{label:e("explorer.filters"),icon:g.jsx(Z$,{width:20}),variant:"ghost",badgeContent:c}),g.jsx(xt.Menu,{children:n.map(h=>h.value==="0"?g.jsxs(T.Fragment,{children:[g.jsx(xt.RadioItem,{value:h.value,model:r,onChange:()=>i(h.value),children:h.label}),g.jsx(xt.Separator,{})]},"0"):g.jsx(xt.RadioItem,{value:h.value,model:r,onChange:()=>i(h.value),children:h.label},h.value))})]})]})},Npe=({id:t,selected:e,onSelect:r})=>{const{t:n}=we();return g.jsx("div",{className:"treeview",children:g.jsx("ul",{role:"tree",className:"m-0 p-0",children:g.jsx("li",{id:t,role:"treeitem","aria-selected":e,children:g.jsx("div",{children:g.jsx("div",{className:"action-container",children:g.jsx("div",{onClick:r,role:"button",tabIndex:0,children:g.jsxs("div",{className:"d-flex align-items-center gap-8 py-8 ps-24",children:[g.jsx(DN,{width:"20",height:"20"}),g.jsx("span",{children:n("explorer.tree.trash")})]})})})})})})})},Lpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>L8),void 0)),Fpe=()=>{const[t,e]=Am(),r=Zr(),n=hc(),i=Gl(),s=bA(),o=T8(),a=B6(),l=i?Tr.BIN:s,{appCode:u}=yt(),{t:c}=we(["common",u]),h={...n,name:c("explorer.filters.mine",{ns:u})},{goToTrash:f,selectTreeItem:m,clearSelectedItems:y,clearSelectedIds:v,fetchTreeData:x}=sr(),b=E=>{m(E,r),a()},_=E=>{var P,M;const A=Qi(n,E),I=(P=A==null?void 0:A.children)==null?void 0:P.some(N=>{var z;return Array.isArray(N==null?void 0:N.children)&&((z=N.children)==null?void 0:z.length)>0});(M=A==null?void 0:A.children)==null||M.forEach(N=>{I||x(N.id,r)})},w=()=>{y(),v(),e()};return g.jsxs(g.Fragment,{children:[g.jsx(dd,{data:h,selectedNodeId:l,draggedNode:o!=null&&o.isTreeview?o:void 0,onTreeItemClick:b,onTreeItemUnfold:_}),g.jsx(Npe,{id:Tr.BIN,selected:i,onSelect:f}),g.jsx("div",{className:"d-grid my-16",children:g.jsx(it,{disabled:i,type:"button",color:"primary",variant:"outline",leftIcon:g.jsx(c1,{}),onClick:w,children:c("explorer.folder.new")})}),g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:t&&g.jsx(Lpe,{edit:!1,isOpen:t,onSuccess:e,onCancel:e})})]})};function jpe(){const{appCode:t}=yt(),{gotoPreviousFolder:e}=sr(),{t:r}=we(["common",t]),{inputSearch:n}=M8(),i=bA(),s=Gl(),o=xa(),a=r("explorer.tree.trash"),l=r("explorer.tree.search"),u=r("explorer.filters.mine",{ns:t}),c=(o==null?void 0:o.name)||u;return g.jsx("div",{className:"py-16",children:i&&i!=="bin"&&i!=="default"&&!s?g.jsxs("div",{className:"d-flex align-items-center gap-8",children:[g.jsx(To,{icon:g.jsx(I$,{}),variant:"ghost",color:"tertiary","aria-label":r("back"),className:"ms-n16",onClick:e}),g.jsx("p",{className:"body py-8 text-truncate",children:g.jsx("strong",{children:c})})]}):g.jsx("h2",{className:"body py-8 fw-bold",children:n.length!==0?l:s?a:u})})}const Bpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>yme),void 0)),Upe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>wme),void 0)),$pe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Mme),void 0)),zpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Ome),void 0)),Hpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Nme),void 0)),Vpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Lme),void 0)),Gpe=({config:t})=>{const e=Pr(),{setConfig:r,setSearchParams:n}=sr();T.useEffect(()=>{r(t||{}),n({...e,application:t.app,types:t.types})},[t]);const{currentApp:i}=yt(),{data:s}=ox(t.actions),{isTrashedModalOpen:o,onTrashedCancel:a}=cpe(),{isActionDisableModalOpen:l,onActionDisableCancel:u}=upe(),{handleDragEnd:c,handleDragOver:h,handleDragStart:f,sensors:m}=Epe();Zce();const y=Hy("publish",s),v=Hy("create",s);return t&&g.jsxs(g.Fragment,{children:[g.jsx(lue,{render:()=>v?g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:g.jsx(Bpe,{})}):null,children:g.jsx(zue,{app:i})}),g.jsx(io,{className:"flex-grow-1",children:g.jsxs(Uie,{sensors:m,modifiers:[ffe],onDragStart:f,onDragEnd:c,onDragOver:h,children:[g.jsx(io.Col,{sm:"3",lg:"2",xl:"3",className:"border-end pt-16 pe-16 d-none d-lg-block",as:"aside",children:g.jsxs(T.Suspense,{fallback:g.jsx(pr,{}),children:[g.jsx(Fpe,{}),y&&g.jsx(Upe,{})]})}),g.jsxs(io.Col,{sm:"4",md:"8",lg:"6",xl:"9",children:[g.jsx(Dpe,{}),g.jsx(jpe,{}),g.jsx(kpe,{})]}),g.jsxs(T.Suspense,{fallback:g.jsx(pr,{}),children:[g.jsx($pe,{}),t.enableOnboarding&&g.jsx(Vpe,{id:"showOnboardingTrash",items:[{src:"onboarding/illu-trash-menu.svg",alt:"explorer.modal.onboarding.trash.screen1.alt",text:"explorer.modal.onboarding.trash.screen1.title"},{src:"onboarding/illu-trash-notif.svg",alt:"explorer.modal.onboarding.trash.screen2.alt",text:"explorer.modal.onboarding.trash.screen2.alt"},{src:"onboarding/illu-trash-delete.svg",alt:"explorer.modal.onboarding.trash.screen3.alt",text:"explorer.modal.onboarding.trash.screen3.title"}],modalOptions:{title:"explorer.modal.onboarding.trash.title",prevText:"explorer.modal.onboarding.trash.prev",nextText:"explorer.modal.onboarding.trash.next",closeText:"explorer.modal.onboarding.trash.close"}}),o&&g.jsx(Hpe,{isOpen:o,onCancel:a}),l&&g.jsx(zpe,{isOpen:l,onCancel:u})]})]})})]})};function Wpe(){const{init:t}=yt(),e=P8();return t?g.jsx(cfe,{children:g.jsx(Gpe,{config:e})}):g.jsx(pr,{position:!1})}var Xpe=function(){return null};const qpe=new fV({queryCache:new fL({onError:t=>{typeof t=="string"&&t===Hk.NOT_LOGGED_IN&&window.location.replace("/auth/login")}}),defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}),Ype=P8(),Qpe=({children:t})=>g.jsxs(yV,{client:qpe,children:[g.jsx(DV,{params:{app:Ype.app},children:g.jsx(iue,{children:t})}),g.jsx(Xpe,{initialIsOpen:!1})]}),Kpe=document.getElementById("root");vN(Kpe).render(g.jsx(T.StrictMode,{children:g.jsx(Qpe,{children:g.jsx(Wpe,{})})}));function Zpe(){const[t]=Pn(),{appCode:e}=yt(),{theme:r}=ya(),{t:n}=we(),i=ir(u=>u.config),{data:s}=ox(i==null?void 0:i.actions),o=s==null?void 0:s.find(u=>u.id==="create"),a=()=>o!=null&&o.available&&(r!=null&&r.is1d)?n("explorer.emptyScreen.txt1d.create",{ns:e}):o!=null&&o.available&&!(r!=null&&r.is1d)?n("explorer.emptyScreen.txt2d.create",{ns:e}):!(o!=null&&o.available)&&(r!=null&&r.is1d)?n("explorer.emptyScreen.txt1d.consultation",{ns:e}):n("explorer.emptyScreen.txt2d.consultation",{ns:e}),l=()=>o!=null&&o.available&&(r!=null&&r.is1d)?n("explorer.emptyScreen.title1d.create",{ns:e}):o!=null&&o.available&&!(r!=null&&r.is1d)?n("explorer.emptyScreen.title2d.create",{ns:e}):!(o!=null&&o.available)&&(r!=null&&r.is1d)?n("explorer.emptyScreen.title1d.consultation",{ns:e}):n("explorer.emptyScreen.title2d.consultation",{ns:e});return g.jsx(ua,{imageSrc:`${t}/emptyscreen/illu-${e}.svg`,imageAlt:n("explorer.emptyScreen.app.alt",{ns:e}),title:l(),text:a()})}const Jpe=Object.freeze(Object.defineProperty({__proto__:null,default:Zpe},Symbol.toStringTag,{value:"Module"}));function eme(){const{appCode:t}=yt(),[e]=Pn(),{t:r}=we();return g.jsx(ua,{imageSrc:`${e}/emptyscreen/illu-search.svg`,imageAlt:r("explorer.emptyScreen.search.alt",{ns:t}),text:r("explorer.emptyScreen.search.text",{ns:t})})}const tme=Object.freeze(Object.defineProperty({__proto__:null,default:eme},Symbol.toStringTag,{value:"Module"}));function rme(){const[t]=Pn(),{t:e}=we();return g.jsx(ua,{imageSrc:`${t}/emptyscreen/illu-error.svg`,imageAlt:e("explorer.emptyScreen.error.alt"),text:"explorer.emptyScreen.error.text"})}const nme=Object.freeze(Object.defineProperty({__proto__:null,default:rme},Symbol.toStringTag,{value:"Module"}));function ime(){const[t]=Pn(),{appCode:e}=yt(),{t:r}=we();return g.jsx(ua,{imageSrc:`${t}/emptyscreen/illu-no-content-in-folder.svg`,imageAlt:r("explorer.emptyScreen.folder.empty.alt",{ns:e}),text:r("explorer.emptyScreen.label",{ns:e})})}const sme=Object.freeze(Object.defineProperty({__proto__:null,default:ime},Symbol.toStringTag,{value:"Module"}));function ome(){const{appCode:t}=yt(),[e]=Pn(),{t:r}=we();return g.jsx(ua,{imageSrc:`${e}/emptyscreen/illu-trash.svg`,imageAlt:r("explorer.emptyScreen.trash.alt"),title:r("explorer.emptyScreen.trash.title"),text:r("explorer.emptyScreen.trash.empty",{ns:t})})}const ame=Object.freeze(Object.defineProperty({__proto__:null,default:ome},Symbol.toStringTag,{value:"Module"}));function lme({app:t,type:e}){return e==="folder"?g.jsx(NN,{width:"24",height:"24",className:`color-app-${t==null?void 0:t.displayName}`}):e==="resource"?g.jsx(ga,{app:t,iconFit:"ratio",size:"24",variant:"rounded"}):null}const k8=({app:t,type:e,name:r})=>{const n={flexDirection:"row",width:"252px",height:"32px",boxShadow:"0 0.2rem 0.6em rgba(0, 0, 0, 0.15)"};return g.jsxs("div",{className:"d-inline-flex align-items-center card is-selected gap-8",style:n,children:[g.jsx("div",{className:"ms-8",children:g.jsx(lme,{app:t,type:e})}),g.jsx("div",{className:"text-truncate",children:r})]})},O8=({app:t,name:e,idFolder:r,isSelected:n=!1,isSelectable:i=!0,onClick:s,onSelect:o})=>{const[a,l]=T.useState(!1),u=T.useId(),{setNodeRef:c}=Hj({id:u,data:{id:r,name:e,isTreeview:!1,accepts:["folder","resource"]}}),{attributes:h,listeners:f,setNodeRef:m,transform:y}=zj({id:u,data:{id:r,type:"folder"}}),v=sx(),x=T8(),b=A=>{m(A),c(A)},_=x.overId===r,w=!x.canMove&&x.isTreeview?"no-drop":a?"grabbing":"default",E={transform:`translate3d(${((y==null?void 0:y.x)??0)/1}px, ${((y==null?void 0:y.y)??0)/1}px, 0)`,cursor:w};return T.useEffect(()=>{const A=v.elementDrag===r;l(A)},[v]),g.jsx("div",{ref:b,...f,...h,style:{...E},children:a?g.jsx(k8,{name:e,app:t,type:"folder"}):g.jsx(tr,{app:t,isSelectable:!a&&i,isSelected:!a&&n||_&&a,isFocused:_,onClick:s,onSelect:o,children:A=>g.jsxs(tr.Body,{children:[g.jsx(NN,{width:"48",height:"48",className:`color-app-${A}`}),g.jsx(tr.Title,{children:e})]})})})};O8.displayName="FolderCard";const ume=({data:t})=>{var m,y;const e=Zr(),r=rx(),n=Sh(),i=sx(),s=B6(),{currentApp:o}=yt(),{setSelectedFolders:a,setFolderIds:l,openFolder:u}=sr();function c(v){n.includes(v.id)?(l(n.filter(x=>x!==v.id)),a(r.filter(x=>x.id!==v.id))):(l([v.id,...n]),a([v,...r]))}function h(v){s(),u({folder:v,folderId:v.id,queryClient:e})}const f=Ej({from:{opacity:0},to:{opacity:1}});return(m=t==null?void 0:t.pages[0])!=null&&m.folders.length?g.jsx(kl.ul,{className:"grid ps-0 list-unstyled mb-24",children:(y=t==null?void 0:t.pages[0])==null?void 0:y.folders.map(v=>{const{id:x,name:b}=v,_=i.elementDrag===x;return g.jsx(kl.li,{className:`g-col-4 ${_?"z-2000":"z-1"}`,style:{position:"relative",...f},children:g.jsx(O8,{name:b,idFolder:x,app:o,isSelected:n.includes(v.id),onClick:w=>{w.stopPropagation(),h(v)},onSelect:()=>c(v)})},x)})}):null},cme=Object.freeze(Object.defineProperty({__proto__:null,default:ume},Symbol.toStringTag,{value:"Module"}));function D8(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=D8(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function dme(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=D8(t))&&(n&&(n+=" "),n+=e);return n}const N8=({app:t,resource:e,time:r,isSelected:n=!1,isSelectable:i=!0,onClick:s,onSelect:o})=>{const[a,l]=T.useState(!1),u=`/userbook/avatar/${e==null?void 0:e.creatorId}`;function c(E){const{rights:A,creatorId:I}=E||{};return A.filter(M=>!M.includes(I)).length>=1}const{attributes:h,listeners:f,setNodeRef:m,transform:y}=zj({id:e.id,data:{id:e.id,type:"resource"}}),v=c(e),x=e==null?void 0:e.public,b=sx(),{t:_}=we(),w={position:a?"absolute":"relative",zIndex:a?2e3:1,transform:`translate3d(${((y==null?void 0:y.x)??0)/1}px, ${((y==null?void 0:y.y)??0)/1}px, 0)`};return T.useEffect(()=>{const E=b.elementDrag===e.id;l(E)},[b]),g.jsx("div",{ref:m,...f,...h,style:{...w},children:a?g.jsx(k8,{app:t,type:"resource",name:e==null?void 0:e.name}):g.jsx(tr,{app:t,isSelected:!a&&n,isSelectable:!a&&i,onClick:s,onSelect:o,children:E=>g.jsxs(g.Fragment,{children:[g.jsxs(tr.Body,{children:[g.jsx("div",{className:"card-image medium",children:e!=null&&e.thumbnail?g.jsx(yo,{alt:"",src:`${e==null?void 0:e.thumbnail}?thumbnail=80x80`,objectFit:"cover",className:"h-full w-100"}):g.jsx(ga,{app:t,iconFit:"ratio",size:"80",variant:"rounded"})}),g.jsxs("div",{className:"text-truncate",children:[g.jsx(tr.Title,{children:e==null?void 0:e.name}),g.jsx(tr.Text,{children:g.jsx("em",{children:r})})]})]}),g.jsxs(tr.Footer,{children:[g.jsxs("div",{className:"d-inline-flex align-items-center gap-8 text-truncate",children:[u?g.jsx(ec,{alt:(e==null?void 0:e.creatorName)||"",size:"xs",src:u,variant:"circle",width:"24",height:"24"}):g.jsx(iC,{}),g.jsx(tr.Text,{children:e==null?void 0:e.creatorName})]}),g.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[v&&g.jsx(co,{message:_("tooltip.shared",{ns:E}),placement:"top",children:g.jsx(UT,{width:16,height:16})}),x&&g.jsx(co,{message:_("tooltip.public",{ns:E}),placement:"top",children:g.jsx(FT,{width:16,height:16})})]})]})]})})})};N8.displayName="ResourceCard";const hme=({data:t,fetchNextPage:e})=>{const{currentApp:r}=yt(),{t:n}=we(),{fromNow:i}=RL(),s=Pr(),o=Eh(),a=Im(),{setSelectedResources:l,setResourceIds:u,openResource:c,setResourceIsTrash:h}=sr(),f=Gl(),m=Ej({from:{opacity:0},to:{opacity:1}}),v=s.pagination.startIdx+s.pagination.pageSize<(s.pagination.maxIdx||0),x=T.useCallback(()=>{e()},[]),b=E=>{f?(h(!0),u([E.id]),l([E])):c(E)};async function _(E){if(o.includes(E.id)){u(o.filter(A=>A!==E.id)),l(a.filter(A=>A.id!==E.id));return}u([...o,E.id]),l([...a,E])}const w=dme("grid ps-0 list-unstyled");return g.jsxs(Pe.Fragment,{children:[g.jsx(kl.ul,{className:w,children:t==null?void 0:t.pages.map((E,A)=>g.jsx(Pe.Fragment,{children:E.resources.map(I=>{const{id:P,updatedAt:M}=I,N=i(M);return g.jsx(kl.li,{className:"g-col-4",style:{position:"relative",...m},children:g.jsx(N8,{app:r,resource:I,time:N,isSelectable:!0,isSelected:o.includes(I.id),onClick:z=>{z.stopPropagation(),b(I)},onSelect:()=>_(I)})},P)})},A))}),v&&g.jsx("div",{className:"d-grid gap-2 col-4 mx-auto my-24",children:g.jsx(it,{type:"button",color:"secondary",variant:"filled",onClick:x,children:n("explorer.see.more")})})]})},fme=Object.freeze(Object.defineProperty({__proto__:null,default:hme},Symbol.toStringTag,{value:"Module"}));function pme({edit:t,onSuccess:e,onClose:r}){var E;const n=rx(),i=xa(),s=xpe(),o=bpe(),a=t?(E=n[0])==null?void 0:E.name:void 0,{reset:l,register:u,handleSubmit:c,setFocus:h,formState:{errors:f,isSubmitting:m,isDirty:y,isValid:v}}=DT({mode:"onChange",values:{name:a||""}}),x=T.useId(),b=async function({name:A}){var I;try{if(t){const P=(I=n[0])==null?void 0:I.parentId,N=n[0].id;await o.mutate({folderId:N,parentId:P,name:A}),l(),e==null||e()}else{const P=(i==null?void 0:i.id)||Tr.DEFAULT;await s.mutate({name:A,parentId:P}),l(),e==null||e()}}catch(P){console.error(P)}};function _(){l(),r()}return{formId:`createModal_${x}`,errors:f,isSubmitting:m,isDirty:y,isValid:v,register:u,setFocus:h,handleSubmit:c,onCancel:_,onSubmit:b}}function mme({isOpen:t,edit:e,onSuccess:r,onCancel:n}){const{t:i}=we(),{isDirty:s,isValid:o,isSubmitting:a,formId:l,onSubmit:u,onCancel:c,handleSubmit:h,register:f,setFocus:m}=pme({edit:e,onSuccess:r,onClose:n});return T.useEffect(()=>{t&&m("name")},[t,m]),t?ur.createPortal(g.jsxs(Ye,{isOpen:t,onModalClose:c,id:"modal_"+l,children:[g.jsx(Ye.Header,{onModalClose:c,children:i(e?"explorer.rename.folder":"explorer.create.folder")}),g.jsx(Ye.Body,{children:g.jsx("form",{id:l,onSubmit:h(u),children:g.jsxs(Ot,{id:"nameFolder",isRequired:!0,children:[g.jsx(Vi,{children:i("explorer.create.folder.name")}),g.jsx(Zn,{type:"text",...f("name",{required:!0,maxLength:60,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:i("explorer.create.folder.name"),size:"md","aria-required":!0,maxLength:60})]})})}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{color:"tertiary",onClick:c,type:"button",variant:"ghost",children:i("explorer.cancel")}),g.jsx(it,{form:l,type:"submit",color:"primary",variant:"filled",disabled:!s||!o||a,children:i(e?"explorer.rename":"explorer.create")})]})]}),document.getElementById("portal")):null}const L8=Object.freeze(Object.defineProperty({__proto__:null,default:mme},Symbol.toStringTag,{value:"Module"})),gme=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>j8),void 0));function vme(){const[t,e]=Am(),r=ir(m=>m.config),{appCode:n}=yt(),{t:i}=we(n),{clearSelectedItems:s,clearSelectedIds:o}=sr(),{data:a}=ox(r==null?void 0:r.actions),l=a==null?void 0:a.find(m=>m.id==="create"),u=xa(),c=Spe(),h=Pr(),f=()=>{if(n=="scrapbook"){Zfe({searchParams:h,folderId:u.id});return}s(),o(),e()};return l?g.jsxs(g.Fragment,{children:[g.jsx(it,{type:"button",color:"primary",variant:"filled",leftIcon:g.jsx(c1,{}),className:"ms-auto",onClick:f,children:i("explorer.create.title")}),g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:t&&g.jsx(gme,{mode:"create",currentFolder:u,createResource:c,isOpen:t,onSuccess:e,onCancel:e,children:(m,y,v,x,b)=>n==="blog"&&Hy("createPublic",a)&&g.jsx(g8,{appCode:n,isUpdating:y,resource:m,watch:v,setValue:x,register:b})})})]}):null}const yme=Object.freeze(Object.defineProperty({__proto__:null,default:vme},Symbol.toStringTag,{value:"Module"})),xme=()=>{const{theme:t}=ya(),[e]=Pn(),r=Vce(),n=`${e}/${t==null?void 0:t.bootstrapVersion}/image-library.svg`;return{libraryUrl:r,imageFullURL:n,handleClick:()=>{r&&(window.open(r,"_blank"),Ie.data().trackAccessLibraryFromExplorer())}}},bme=()=>{const{libraryUrl:t,imageFullURL:e,handleClick:r}=xme(),{t:n}=we();return t&&g.jsxs("div",{className:"p-16",children:[g.jsx(yo,{width:"270",height:"140",loading:"lazy",className:"rounded",src:e,alt:n("explorer.libray.img.alt")}),g.jsx("p",{className:"m-8",children:n("explorer.libray.title")}),g.jsxs("button",{type:"button",onClick:r,rel:"noreferrer",className:"btn btn-ghost-primary d-inline-flex align-items-center gap-4 p-8",children:[g.jsx("span",{children:n("explorer.libray.btn")}),g.jsx(CS,{})]})]})},wme=Object.freeze(Object.defineProperty({__proto__:null,default:bme},Symbol.toStringTag,{value:"Module"}));function _me({roles:t,rights:e,action:r}){const[n,i]=T.useState(!1),{user:s}=_h(),o=Gl();T.useEffect(()=>{u()},[t,e]);const a=async function(c){const h=c instanceof Array?c:[c];if(t instanceof Array){const f=await Ie.rights().sessionHasAtLeastOneResourceRight(t,h);i(f)}else{const f=await Ie.rights().sessionHasResourceRight(t,h);i(f)}},l=async function(c){if(t instanceof Array){const h=await Ie.rights().sessionHasAtLeastOneResourceRightForEachList(t,c);i(h)}else{const h=await Ie.rights().sessionHasResourceRightForEachList(t,c);i(h)}},u=async function(){var c,h,f;if(t===void 0){i(!0);return}if(o&&((h=(c=e[0])==null?void 0:c.trashedBy)!=null&&h.includes(s==null?void 0:s.userId))&&r==="restore"&&!((f=e[0])!=null&&f.trashed)){i(!0);return}if(e instanceof Array)if(e.length>0)if(typeof e[0]=="string")await a(e);else{const m=e.map(y=>y.rights);await l(m)}else i(!1);else typeof e=="string"?await a(e):await a(e.rights)};return{visible:n,refreshState:u}}function F8(){const[t,e]=T.useState(!1),[r,n]=T.useState("void"),[i,s]=T.useState(),o=ir(de=>de.config),a=xa(),l=Eh(),u=Im(),c=rx(),h=Sh(),f=Gl(),m=gpe(),y=E8(),v=Pr(),x=ype(),b=sx(),{openResource:_,printSelectedResource:w,openFolder:E,clearSelectedItems:A,clearSelectedIds:I}=sr(),{data:P}=ox(o==null?void 0:o.actions);T.useEffect(()=>{if(l.length===0&&h.length===0){e(!1);return}if(y){e(!1);return}if(b.isDrag){e(!1);return}e(!0)},[l,h]);async function M(de){var Be;switch((Be=document.getElementById("root"))==null||Be.setAttribute("aria-hidden","true"),s(de),de.id){case Gr.OPEN:return l.length>0?_(u[0]):E({folder:c[0],folderId:c[0].id});case Gr.COPY:return xe();case Gr.MOVE:return n("move");case Gr.PRINT:return w();case Gr.DELETE:return n("delete");case Gr.RESTORE:return await j();case Gr.PUBLISH:return n("publish");case Gr.UPD_PROPS:case"edit":return _e();case Gr.SHARE:return n("share");case Gr.EXPORT:return n("export");default:throw Error(`Unknown action: ${de.id}`)}}function N(de){const Be=l.length+h.length,je=l.length===1||h.length===1,ut=Be===1,Re=h.length===0;switch(de.id){case Gr.OPEN:return ut;case Gr.MANAGE:return je;case Gr.COPY:return je&&Re;case Gr.PUBLISH:return je&&Re;case Gr.UPD_PROPS:return je&&Re;case Gr.SHARE:return Re&&je;case"export":return je&&Re;case Gr.PRINT:return je&&Re;case"edit":return ut;default:return!0}}const z=()=>!0;async function j(){try{if(f)await m.mutate();else throw new Error("Cannot restore untrashed resources");H()}catch(de){console.error(de)}}function H(){var de;n("void"),i!=null&&i.id&&((de=document.getElementById(i==null?void 0:i.id))==null||de.focus())}const F=de=>()=>{r===de&&(H(),A(),I())},L=F("move"),O=F("move"),U=F("delete"),V=F("delete"),k=F("publish"),$=F("publish"),B=F("edit_folder"),X=F("edit_folder"),K=F("edit_resource"),q=F("edit_resource"),te=F("share"),ue=F("share"),le=F("export"),me=F("export");async function xe(){if(u&&u.length>0){const de=u[0];await x.mutate(de),A(),I()}}function _e(){if(l&&l.length>0){const de=u[0].assetId;(o==null?void 0:o.app)==="scrapbook"?Jfe({searchParams:v,assetId:de}):n("edit_resource")}else n("edit_folder")}function Te(de){return de.id==="edit"&&h.length>0?"explorer.rename":`explorer.actions.${de.id}`}return{onRestore:j,actions:f?o==null?void 0:o.trashActions:P,selectedElement:[...u,...c],currentFolderId:a==null?void 0:a.id,overrideLabel:Te,handleClick:M,isActivable:f?z:N,isActionBarOpen:t,isMoveModalOpen:r==="move",onMoveCancel:L,onMoveSuccess:O,isDeleteModalOpen:r==="delete",onDeleteCancel:V,onDeleteSuccess:U,isPublishModalOpen:r==="publish",onPublishCancel:$,onPublishSuccess:k,isEditFolderOpen:r==="edit_folder",onEditFolderCancel:X,onEditFolderSuccess:B,isEditResourceOpen:r==="edit_resource",onEditResourceCancel:q,onEditResourceSuccess:K,isShareResourceOpen:r==="share",onShareResourceCancel:ue,onShareResourceSuccess:te,isExportModalOpen:r==="export",onExportCancel:le,onExportSuccess:me,onClearActionBar:H}}function Sme({resourceRights:t,roleExpected:e,action:r,children:n,renderWhenForbidden:i}){const{t:s}=we(),{overrideLabel:o}=F8(),{visible:a}=_me({roles:e,rights:t,action:r==null?void 0:r.id}),{setResourceActionDisable:l}=sr(),u=Gl();return a?g.jsx(g.Fragment,{children:n}):i?i():u&&!a?g.jsx(it,{type:"button",color:"primary",variant:"filled",onClick:()=>{l(!0)},children:s(o(r))}):g.jsx(g.Fragment,{})}const Eme=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Fme),void 0)),Tme=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>j8),void 0)),Cme=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Ume),void 0)),Ame=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Hme),void 0)),Rme=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>L8),void 0)),Pme=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Wme),void 0));function Ime(){const{appCode:t}=yt(),{t:e}=we(),{actions:r,selectedElement:n,isMoveModalOpen:i,isDeleteModalOpen:s,isPublishModalOpen:o,isActionBarOpen:a,isEditFolderOpen:l,overrideLabel:u,onEditFolderCancel:c,onEditFolderSuccess:h,isEditResourceOpen:f,onEditResourceCancel:m,onEditResourceSuccess:y,isShareResourceOpen:v,onShareResourceCancel:x,onShareResourceSuccess:b,isExportModalOpen:_,onExportCancel:w,onExportSuccess:E,onMoveCancel:A,onMoveSuccess:I,onDeleteCancel:P,onDeleteSuccess:M,onPublishCancel:N,onPublishSuccess:z,isActivable:j,handleClick:H}=F8(),L=Im()[0],O=wpe(t),U=_pe(t),V=jC(a,{from:{opacity:0,transform:"translateY(100%)"},enter:{opacity:1,transform:"translateY(0)"},leave:{opacity:0,transform:"translateY(100%)"}});return g.jsxs(g.Fragment,{children:[V((k,$)=>$&&g.jsx(kl.div,{className:"position-fixed bottom-0 start-0 end-0",style:{...k,zIndex:4},children:g.jsx(oue,{children:r==null?void 0:r.filter(B=>B.available&&B.target==="actionbar").map(B=>j(B)&&g.jsx(Sme,{resourceRights:n,roleExpected:B.right,action:B,children:g.jsx(it,{id:B.id,type:"button",color:"primary",variant:"filled",onClick:()=>{H(B)},children:e(u(B))},B.id)},B.id))})})),g.jsxs(T.Suspense,{fallback:g.jsx(pr,{}),children:[i&&g.jsx(Ame,{isOpen:i,onCancel:A,onSuccess:I}),s&&g.jsx(Cme,{isOpen:s,onCancel:P,onSuccess:M}),o&&L&&g.jsx(Eme,{isOpen:o,resourceId:L.assetId,onCancel:N,onSuccess:z}),l&&g.jsx(Rme,{edit:!0,isOpen:l,onCancel:c,onSuccess:h}),f&&L&&g.jsx(Tme,{mode:"update",isOpen:f,resourceId:L.assetId,updateResource:U,onCancel:m,onSuccess:y,children:(k,$,B,X,K)=>t==="blog"&&Hy("createPublic",r)&&g.jsx(g8,{appCode:t,isUpdating:$,resource:k,watch:B,setValue:X,register:K})}),v&&L&&g.jsx(Qhe,{isOpen:v,shareResource:O,shareOptions:{resourceCreatorId:L.creatorId,resourceId:L.assetId,resourceRights:L.rights},onCancel:x,onSuccess:b,children:t==="blog"?g.jsx(Khe,{resourceId:L.assetId,updateResource:U}):null}),_&&L&&g.jsx(Pme,{isOpen:_,onCancel:w,onSuccess:E})]})]})}const Mme=Object.freeze(Object.defineProperty({__proto__:null,default:Ime},Symbol.toStringTag,{value:"Module"}));function kme({isOpen:t,onCancel:e=()=>({})}){const{t:r}=we();return ur.createPortal(g.jsxs(Ye,{isOpen:t,onModalClose:e,id:"trash_action_disable_resource",children:[g.jsx(Ye.Header,{onModalClose:()=>e(),children:r("explorer.trash.action.modal.title")}),g.jsx(Ye.Body,{children:g.jsx("p",{className:"body",children:r("explorer.trash.action.modal.text")})}),g.jsx(Ye.Footer,{children:g.jsx(it,{color:"primary",onClick:e,type:"button",variant:"outline",children:r("close")})})]}),document.getElementById("portal"))}const Ome=Object.freeze(Object.defineProperty({__proto__:null,default:kme},Symbol.toStringTag,{value:"Module"}));function Dme({isOpen:t,onCancel:e=()=>({})}){const{t:r}=we();return ur.createPortal(g.jsxs(Ye,{isOpen:t,onModalClose:e,id:"trash_resource",children:[g.jsx(Ye.Header,{onModalClose:()=>e(),children:r("explorer.trash.modal.title")}),g.jsx(Ye.Body,{children:g.jsx("p",{className:"body",children:r("explorer.trash.modal.text")})}),g.jsx(Ye.Footer,{children:g.jsx(it,{color:"primary",onClick:e,type:"button",variant:"outline",children:r("close")})})]}),document.getElementById("portal"))}const Nme=Object.freeze(Object.defineProperty({__proto__:null,default:Dme},Symbol.toStringTag,{value:"Module"})),Lme=Object.freeze(Object.defineProperty({__proto__:null,default:vle},Symbol.toStringTag,{value:"Module"})),j8=Object.freeze(Object.defineProperty({__proto__:null,default:Dhe},Symbol.toStringTag,{value:"Module"})),Fme=Object.freeze(Object.defineProperty({__proto__:null,default:Rhe},Symbol.toStringTag,{value:"Module"}));function jme({onSuccess:t}){const e=vpe(),r=mpe(),n=Gl();async function i(){try{n?await e.mutate():await r.mutate(),t==null||t()}catch(s){console.error(s)}}return{isTrashFolder:n,onDelete:i}}function Bme({isOpen:t,onSuccess:e=()=>({}),onCancel:r=()=>({})}){const{t:n}=we(),{isTrashFolder:i,onDelete:s}=jme({onSuccess:e});return ur.createPortal(g.jsxs(Ye,{isOpen:t,onModalClose:r,id:"deleteModal",children:[g.jsx(Ye.Header,{onModalClose:r,children:n(i?"explorer.delete.title":"explorer.trash.title")}),g.jsx(Ye.Body,{children:g.jsx("p",{className:"body",children:n(i?"explorer.delete.subtitle":"explorer.trash.subtitle")})}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:n("explorer.cancel")}),g.jsx(it,{color:"danger",onClick:s,type:"button",variant:"filled",children:n(i?"explorer.delete":"explorer.trash")})]})]}),document.getElementById("portal"))}const Ume=Object.freeze(Object.defineProperty({__proto__:null,default:Bme},Symbol.toStringTag,{value:"Module"}));function $me({onSuccess:t}){const[e,r]=T.useState(),n=Zr(),i=I8(),s=rx(),o=Im(),a=hc(),{fetchTreeData:l}=sr();async function u(){try{if(!e)throw new Error("explorer.move.selection.empty");await i.mutate(e),await(t==null?void 0:t())}catch(h){console.error(h)}}const c=h=>{var m,y;const f=A2(a,h);for(const v of s)if(h===v.id||h===v.parentId||(m=v.childrenIds)!=null&&m.includes(h)||f.includes(v.id))return!1;for(const v of o)if(h===((v==null?void 0:v.folderIds)&&v.folderIds[0])||((y=v==null?void 0:v.folderIds)==null?void 0:y.length)===0&&h==="default")return!1;return!0};return{treeData:a,disableSubmit:!e,handleTreeItemSelect:h=>{c(h)?r(h):r(void 0)},handleOnTreeItemUnfold:h=>{var y,v;const f=Qi(a,h),m=(y=f==null?void 0:f.children)==null?void 0:y.some(x=>{var b;return Array.isArray(x==null?void 0:x.children)&&((b=x.children)==null?void 0:b.length)>0});(v=f==null?void 0:f.children)==null||v.forEach(x=>{m||l(x.id,n)})},onMove:()=>u()}}function zme({isOpen:t,onSuccess:e,onCancel:r}){const{appCode:n}=yt(),{t:i}=we(),{treeData:s,handleTreeItemSelect:o,handleOnTreeItemUnfold:a,onMove:l,disableSubmit:u}=$me({onSuccess:e}),c={...s,name:i("explorer.filters.mine",{ns:n})};return ur.createPortal(g.jsxs(Ye,{isOpen:t,onModalClose:r,id:"moveModal",children:[g.jsx(Ye.Header,{onModalClose:r,children:i("explorer.move.title")}),g.jsx(Ye.Subtitle,{children:i("explorer.move.subtitle")}),g.jsx(Ye.Body,{children:g.jsx(dd,{data:c,onTreeItemClick:o,onTreeItemUnfold:a})}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:i("explorer.cancel")}),g.jsx(it,{color:"primary",onClick:l,type:"button",variant:"filled",disabled:u,children:i("explorer.move")})]})]}),document.getElementById("portal"))}const Hme=Object.freeze(Object.defineProperty({__proto__:null,default:zme},Symbol.toStringTag,{value:"Module"})),Vme=t=>{const e=Im(),r=Pr(),n=Jr(),{t:i}=we();return{handleExportClick:()=>{e.length?(epe({searchParams:r,assetId:e[0].assetId}),t()):n.error(i("explorer.error.noResourceSelected"))}}};function Gme({isOpen:t,onSuccess:e,onCancel:r}){const{handleExportClick:n}=Vme(e),{t:i}=we();return ur.createPortal(g.jsxs(Ye,{isOpen:t,onModalClose:r,id:"exportModal",children:[g.jsx(Ye.Header,{onModalClose:r,children:i("explorer.export.title")}),g.jsxs(Ye.Body,{children:[g.jsxs("ul",{children:[g.jsx("li",{children:i("explorer.export.body.info.1")}),g.jsx("li",{children:i("explorer.export.body.info.2")}),g.jsx("li",{children:i("explorer.export.body.info.3")})]}),g.jsx(Jo,{type:"warning",children:i("explorer.export.body.warning")})]}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:i("explorer.cancel")}),g.jsx(it,{color:"primary",onClick:n,type:"button",variant:"filled",children:i("explorer.actions.export")})]})]}),document.getElementById("portal"))}const Wme=Object.freeze(Object.defineProperty({__proto__:null,default:Gme},Symbol.toStringTag,{value:"Module"}))});export default Xme();
1406
+ */var tx=T,Afe=Cfe;function Rfe(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Pfe=typeof Object.is=="function"?Object.is:Rfe,Ife=Afe.useSyncExternalStore,Mfe=tx.useRef,kfe=tx.useEffect,Ofe=tx.useMemo,Dfe=tx.useDebugValue;y8.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var s=Mfe(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=Ofe(function(){function l(m){if(!u){if(u=!0,c=m,m=n(m),i!==void 0&&o.hasValue){var y=o.value;if(i(y,m))return h=y}return h=m}if(y=h,Pfe(c,m))return y;var v=n(m);return i!==void 0&&i(y,v)?y:(c=m,h=v)}var u=!1,c,h,f=r===void 0?null:r;return[function(){return l(e())},f===null?void 0:function(){return l(f())}]},[e,r,n,i]);var a=Ife(t,s[0],s[1]);return kfe(function(){o.hasValue=!0,o.value=a},[a]),Dfe(a),a};v8.exports=y8;var Nfe=v8.exports;const Lfe=Co(Nfe),Ffe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},{useDebugValue:jfe}=Pe,{useSyncExternalStoreWithSelector:Bfe}=Lfe;let Pk=!1;const Ufe=t=>t;function $fe(t,e=Ufe,r){(Ffe?"production":void 0)!=="production"&&r&&!Pk&&(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"),Pk=!0);const n=Bfe(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,r);return jfe(n),n}const w8=async t=>{const e=await Ie.resource(t.application).searchContext(t);return{...e,folders:e.folders.filter(r=>!r.trashed)}},zfe=async({searchParams:t,name:e,parentId:r})=>{const n={name:e,parentId:r,application:t.application,type:t.types[0]};return await Ie.resource(t.application).createFolder(n)},Hfe=async({folderId:t,searchParams:e,parentId:r,name:n})=>{const i={folderId:t,name:n,parentId:r,application:e.application,type:e.types[0]};return await Ie.resource(e.application).updateFolder(i)},Vfe=async({searchParams:t,resourceIds:e,useAssetIds:r,folderIds:n})=>{const i={application:t.application,resourceType:t.types[0],resourceIds:e,folderIds:n};return await Ie.resource(t.application).trashAll(i,r)},Gfe=async({searchParams:t,resourceIds:e,useAssetIds:r,folderIds:n})=>{const i={application:t.application,resourceType:t.types[0],resourceIds:e,folderIds:n};return await Ie.resource(t.application).deleteAll(i,r)},Wfe=async({searchParams:t,resourceIds:e,folderIds:r,useAssetIds:n})=>{const i={application:t.application,resourceType:t.types[0],resourceIds:e,folderIds:r};return await Ie.resource(t.application).restoreAll(i,n)},Xfe=async(t,e)=>await Ie.resource(t.application).copy({application:t.application,resourceId:e}),_8=async({searchParams:t,resourceIds:e,folderId:r,folderIds:n,useAssetIds:i})=>{const s={application:t.application,folderId:r,resourceIds:e,folderIds:n};return await Ie.resource(t.application).moveToFolder(s,i)},qfe=async t=>await Ie.rights().sessionHasWorkflowRights(t),Yfe=({searchParams:t,assetId:e})=>{const r=Ie.resource(t.application).getViewUrl(e);window.open(r,"_self")},Qfe=({searchParams:t,params:e})=>Ie.resource(t.application).create(e),Kfe=({searchParams:t,assetId:e})=>{const r=Ie.resource(t.application).getPrintUrl(e);return window.open(r,"_blank")},Zfe=({searchParams:t,folderId:e})=>{const r=Ie.resource(t.application).getFormUrl(e);return window.open(r,"_self")},Jfe=({searchParams:t,assetId:e})=>{const r=Ie.resource(t.application).getEditUrl(e);return window.open(r,"_self")},epe=({searchParams:t,assetId:e})=>{const r=Ie.resource(t.application).getExportUrl(e);return window.open(r,"_self")},S8={id:Tr.DEFAULT,name:_n("explorer.filters.mine"),section:!0,children:[]},tpe={config:void 0,searchConfig:{minLength:1},searchParams:{filters:{folder:Tr.DEFAULT,owner:void 0,shared:void 0,public:void 0},orders:{updatedAt:LB.DESC},application:"",types:[],pagination:{startIdx:0,pageSize:48,maxIdx:0},trashed:!1},treeData:S8,selectedNodeId:"default",currentFolder:{id:"default"},selectedFolders:[],selectedResources:[],folderIds:[],resourceIds:[],resourceIsTrash:!1,resourceOrFolderIsDraggable:{isDrag:!1,elementDrag:void 0},elementDragOver:{isOver:!1,isTreeview:!1,canMove:!0,overId:void 0},resourceActionDisable:!1,status:void 0},rpe=gfe()((t,e)=>({...tpe,actions:{setConfig:r=>t({config:r}),setSearchConfig:r=>t(n=>({searchConfig:{...n.searchConfig,...r}})),setTreeData:r=>t(()=>({treeData:r})),setSearchParams:r=>{t(n=>{const{searchParams:i}=n;return i.search!==r.search?r.search?{...n,selectedFolders:[],selectedNodeId:void 0,selectedResources:[],currentFolder:void 0,searchParams:{...i,...r,trashed:!1,filters:{...i.filters,folder:void 0}}}:{...n,selectedFolders:[],selectedNodeId:"default",selectedResources:[],currentFolder:{id:"default"},searchParams:{...i,...r,trashed:!1,filters:{...i.filters}}}:{searchParams:{...i,...r}}})},setSelectedFolders:r=>t(()=>({selectedFolders:r})),setSelectedResources:r=>t(()=>({selectedResources:r})),setFolderIds:r=>t(()=>({folderIds:r})),setResourceIds:r=>t(()=>({resourceIds:r})),setResourceIsTrash:r=>t(()=>({resourceIsTrash:r})),setResourceOrFolderIsDraggable:r=>t(()=>({resourceOrFolderIsDraggable:r})),setElementDragOver:r=>t(()=>({elementDragOver:r})),setResourceActionDisable:r=>t(()=>({resourceActionDisable:r})),clearSelectedItems:()=>t(()=>({selectedFolders:[],selectedResources:[]})),clearSelectedIds:()=>t(()=>({resourceIds:[],folderIds:[]})),openResource:r=>{try{const{searchParams:n}=e();Yfe({searchParams:n,assetId:r.assetId})}catch(n){console.error("explorer open failed: ",n)}},printSelectedResource:()=>{try{const{searchParams:r,selectedResources:n,resourceIds:i}=e();if(n.length!==1)throw new Error("Cannot open more than 1 resource");const s=n.find(o=>o.id===i[0]);Kfe({searchParams:r,assetId:s.assetId})}catch(r){console.error("explorer print failed: ",r)}},openFolder:({folderId:r,folder:n,queryClient:i})=>{const{searchParams:s}=e(),o=s.filters.folder,a=r;o!==r&&(e().actions.fetchTreeData(r,i),t(l=>({...l,folderIds:[],resourceIds:[],selectedNodeId:a,currentFolder:n||{id:r},searchParams:{...s,search:void 0,filters:{...s.filters,folder:r},trashed:r===Tr.BIN}})))},foldTreeItem:()=>t(r=>({...r,status:"fold"})),fetchTreeData:async(r,n)=>{const i=Qi(e().treeData,r),s=i==null?void 0:i.id;if(Array.isArray(i==null?void 0:i.children)&&i.children.length)return;const o=await n.fetchQuery({queryKey:["prefetchContext",{folderId:s,trashed:!1}],queryFn:async()=>await w8({...e().searchParams,filters:{...e().searchParams.filters,folder:s}})});e().actions.setTreeData(fue(e().treeData,o==null?void 0:o.folders,s||Tr.DEFAULT))},selectTreeItem:(r,n)=>{const{treeData:i}=e(),{openFolder:s,fetchTreeData:o}=e().actions,a=Qi(i,r);o(r,n),t(l=>({...l,searchParams:{...l.searchParams,search:void 0},status:"select",selectedResources:[]})),s({folder:a,folderId:r})},gotoPreviousFolder:()=>{const{selectedNodeId:r,treeData:n,searchParams:i}=e(),{openFolder:s}=e().actions;if(i.search&&s({folder:S8,folderId:Tr.DEFAULT}),!r)return;const o=z6(n,r);s({folder:o,folderId:(o==null?void 0:o.id)||Tr.DEFAULT})},goToTrash:()=>{t(r=>({...r,selectedNodeId:void 0,selectedResources:[],resourceIds:[],folderIds:[],status:"select",searchParams:{...r.searchParams,search:void 0,filters:{folder:Tr.BIN},trashed:!0},currentFolder:{id:Tr.BIN}}))}}}));function ir(t){return $fe(rpe,t)}const npe=t=>t.treeData,ipe=t=>t.actions,hc=()=>ir(npe),sr=()=>ir(ipe),Pr=()=>ir(t=>t.searchParams),bA=()=>ir(t=>t.selectedNodeId),rx=()=>ir(t=>t.selectedFolders),Im=()=>ir(t=>t.selectedResources),spe=()=>ir(t=>t.searchConfig),Sh=()=>ir(t=>t.folderIds),Eh=()=>ir(t=>t.resourceIds),nx=()=>ir(t=>t.selectedResources.map(e=>e.assetId)),ix=()=>ir(t=>t.selectedResources.filter(e=>e.assetId===e.id)),xa=()=>ir(t=>t.currentFolder),Gl=()=>{const t=xa();return(t==null?void 0:t.id)===Tr.BIN},E8=()=>ir(t=>t.resourceIsTrash),sx=()=>ir(t=>t.resourceOrFolderIsDraggable),T8=()=>ir(t=>t.elementDragOver),ope=()=>ir(t=>t.resourceActionDisable),ape=()=>{const t=xa();return(t==null?void 0:t.id)==="default"},lpe=()=>ir(t=>t.status),upe=()=>{const t=ope(),{clearSelectedIds:e,setResourceActionDisable:r,clearSelectedItems:n}=sr();return{isActionDisableModalOpen:t,onActionDisableCancel:()=>{e(),n(),r(!1)}}},cpe=()=>{const t=E8(),{clearSelectedIds:e,setResourceIsTrash:r,clearSelectedItems:n}=sr();return{isTrashedModalOpen:t,onTrashedCancel:()=>{e(),n(),r(!1)}}},dpe=175,hpe=10,C8="blog",A8="blog";class R8 extends Vk{getEditUrl(){throw new Error("Method not implemented.")}async create(e){const r=e.thumbnail?await this.getThumbnailPath(e.thumbnail):"",n=e.public?"/blog/pub":"/blog",i=await this.http.post(n,{title:e.name,description:e.description,visibility:e.public?"PUBLIC":"OWNER",thumbnail:r,trashed:!1,folder:e.folder,slug:e.public?e.slug:"","publish-type":e.publishType||"RESTRAINT","comment-type":"IMMEDIATE"});return this.checkHttpResponse(i),i}async update(e){const r=e.thumbnail?await this.getThumbnailPath(e.thumbnail):"",n=await this.http.put(`/blog/${e.entId}`,{trashed:e.trashed,_id:e.entId,title:e.name,thumbnail:r,description:e.description,visibility:e.public?"PUBLIC":"OWNER",slug:e.public?e.slug:"","publish-type":e["publish-type"]||"RESTRAINT","comment-type":"IMMEDIATE"});return this.checkHttpResponse(n),{thumbnail:r,entId:e.entId}}getResourceType(){return A8}getApplication(){return C8}getFormUrl(e){return e?`/blog?folderid=${e}#/edit/new`:"/blog#/edit/new"}getViewUrl(e){return`/blog/id/${e}`}getPrintUrl(e){return`/blog/print/${e}`}}Vk.register({application:C8,resourceType:A8},t=>new R8(t));const du=document.querySelector("[data-explorer-config]");let Ik;function P8(){var t;if((t=du==null?void 0:du.dataset)!=null&&t.explorerConfig){const{explorerConfig:e}=du.dataset;try{const r=JSON.parse(e);Ik={...r,service:R8,enableOnboarding:r.enableOnboarding!==void 0?r.enableOnboarding:!0}}catch(r){console.error("[Explorer Config] could not parse app params from root data attributes:",du==null?void 0:du.dataset,r)}}return Ik}const fpe=(t,e)=>{const r=t.map(i=>i.workflow),n=new Set(r);return{queryKey:[...n],queryFn:()=>qfe([...n]),select:i=>t.filter(s=>i[s.workflow]).map(s=>({...s,available:!0})),staleTime:1/0,enabled:!!e}},ox=t=>{const e=ir(r=>r.config);return qT(fpe(t,e))},ppe=()=>{const t=ir(o=>o.config),e=Pr(),{filters:r,trashed:n,search:i}=e,s=["context",{folderId:r.folder,filters:r,trashed:n,search:i}];return PV({queryKey:s,queryFn:async({pageParam:o})=>await w8({...e,application:t==null?void 0:t.app,types:t==null?void 0:t.types,pagination:{...e.pagination,startIdx:o}}),staleTime:5e3,initialPageParam:0,enabled:!!t,retry:!1,getNextPageParam:o=>o.pagination.startIdx+o.pagination.pageSize})},mpe=()=>{const t=Jr(),e=Zr(),r=Pr(),n=hc(),i=Sh(),s=nx(),o=Eh(),a=ix().length>0,l=a?s:o,{clearSelectedItems:u,clearSelectedIds:c,setTreeData:h,setSearchParams:f}=sr(),{filters:m,trashed:y}=r,v=["context",{folderId:m.folder,filters:m,trashed:y}];return Ro({mutationFn:async()=>await Vfe({searchParams:r,folderIds:i,resourceIds:l,useAssetIds:a}),onError(x){typeof x=="string"&&t.error(_n(x))},onSuccess:async x=>{if(await e.cancelQueries({queryKey:v}),e.getQueryData(v))return t.success(_n("explorer.trash.title")),e.setQueryData(v,_=>{var w;if(_){const E={..._,pages:_==null?void 0:_.pages.map(I=>{var P;return{...I,folders:I.folders.filter(M=>!i.includes(M.id)),pagination:{...I.pagination,maxIdx:((P=I==null?void 0:I.pagination)==null?void 0:P.maxIdx)-x.resources.length},resources:I.resources.filter(M=>a?!s.includes(M.assetId):!l.includes(M.id))}})},A=due(n,{folders:i});return h(A),f({...r,pagination:{...r.pagination,maxIdx:((w=r.pagination)==null?void 0:w.maxIdx)-x.resources.length}}),E}})},onSettled:()=>{u(),c()}})},gpe=()=>{const t=Jr(),e=Zr(),r=Pr(),n=Sh(),i=nx(),s=Eh(),o=ix().length>0,a=o?i:s,{setFolderIds:l,setResourceIds:u,setSelectedResources:c,setSelectedFolders:h}=sr(),{filters:f,trashed:m}=r,y=["context",{folderId:f.folder,filters:f,trashed:m}];return Ro({mutationFn:async()=>await Wfe({searchParams:r,folderIds:n,resourceIds:a,useAssetIds:o}),onError(v){typeof v=="string"&&t.error(_n(v))},onSuccess:async()=>{if(await e.cancelQueries({queryKey:y}),e.getQueryData(y))return t.success(_n("explorer.trash.toast")),e.setQueryData(y,x=>{if(x)return{...x,pages:x==null?void 0:x.pages.map(b=>({...b,folders:b.folders.filter(_=>!n.includes(_.id)),resources:b.resources.filter(_=>o?!i.includes(_.assetId):!a.includes(_.id))}))}})},onSettled:()=>{u([]),c([]),l([]),h([])}})},vpe=()=>{const t=Jr(),e=Zr(),r=Pr(),n=Sh(),i=nx(),s=Eh(),o=ix().length>0,a=o?i:s,{clearSelectedItems:l,clearSelectedIds:u}=sr(),{filters:c,trashed:h}=r,f=["context",{folderId:c.folder,filters:c,trashed:h}];return Ro({mutationFn:async()=>await Gfe({searchParams:r,folderIds:n,resourceIds:a,useAssetIds:o}),onError(m){typeof m=="string"&&t.error(_n(m))},onSuccess:async()=>{if(await e.cancelQueries({queryKey:f}),e.getQueryData(f))return t.success(_n("explorer.removed.from.trash")),e.setQueryData(f,y=>{if(y)return{...y,pages:y==null?void 0:y.pages.map(x=>({...x,folders:x.folders.filter(b=>!n.includes(b.id)),resources:x.resources.filter(b=>o?!i.includes(b.assetId):!a.includes(b.id))}))}})},onSettled:()=>{l(),u()}})},ype=()=>{const t=Jr(),e=Pr(),r=Zr(),{user:n}=_h(),i=xa(),{filters:s,trashed:o}=e,a="duplicate_start",l=["context",{folderId:s.folder,filters:s,trashed:o}];return Ro({mutationFn:async u=>(t.info(_n("duplicate.start"),{id:a}),await Xfe(e,u.assetId)),onSuccess:async(u,c)=>{t.remove(a),t.success(_n("duplicate.done")),await r.cancelQueries({queryKey:l});const h=r.getQueryData(l),f={...c,name:`${c.name}${_n("duplicate.suffix")}`,assetId:u.duplicateId,id:u.duplicateId,creatorId:n==null?void 0:n.userId,creatorName:n==null?void 0:n.username,createdAt:Date.now(),slug:c.slug||"",modifiedAt:Date.now(),modifierId:(n==null?void 0:n.userId)||"",modifierName:(n==null?void 0:n.username)||"",updatedAt:Date.now(),trashed:!1,rights:[`creator:${n==null?void 0:n.userId}`]};h&&r.setQueryData(l,m=>{if(m)return{...m,pages:m==null?void 0:m.pages.map(y=>({...y,resources:[f,...y.resources]}))}}),i.id&&i.id!==Tr.DEFAULT&&_8({searchParams:e,resourceIds:[u.duplicateId],folderId:i.id,folderIds:[],useAssetIds:!0})},onError:u=>{t.remove(a),typeof u=="string"&&t.error(`${_n("duplicate.error")}: ${u}`)}})},I8=()=>{const t=Jr(),e=Zr(),r=Pr(),n=hc(),i=Sh(),s=nx(),o=Eh(),a=ix().length>0,l=a?s:o,{clearSelectedIds:u,clearSelectedItems:c,setTreeData:h,setSearchParams:f}=sr(),{filters:m,trashed:y}=r,v=["context",{folderId:m.folder,filters:m,trashed:y}];return Ro({mutationFn:async x=>await _8({searchParams:r,folderId:x,folderIds:i,resourceIds:l,useAssetIds:a}),onError(x){typeof x=="string"&&t.error(_n(x))},onSuccess:async(x,b)=>{if(e.getQueryData(v))return e.setQueryData(v,w=>{var E;if(w){const A=hue(n,{destinationId:b,folders:i}),I={...w,pages:w==null?void 0:w.pages.map(P=>{var M;return{...P,folders:P.folders.filter(N=>!i.includes(N.id)),pagination:{...P.pagination,maxIdx:((M=P.pagination)==null?void 0:M.maxIdx)-x.resources.length},resources:P.resources.filter(N=>a?!s.includes(N.assetId):!l.includes(N.id))}})};return h(A),f({...r,pagination:{...r.pagination,maxIdx:((E=r.pagination)==null?void 0:E.maxIdx)-x.resources.length}}),I}});e.invalidateQueries()},onSettled:()=>{c(),u()}})},xpe=()=>{const t=Jr(),e=Zr(),r=Pr(),n=hc(),{setTreeData:i}=sr(),{filters:s,trashed:o}=r,a=["context",{folderId:s.folder,filters:s,trashed:o}];return Ro({mutationFn:async({name:l,parentId:u})=>await zfe({searchParams:r,name:l,parentId:u}),onError(l){typeof l=="string"&&t.error(_n(l))},onSuccess:async(l,u)=>{await e.cancelQueries({queryKey:a});const c=e.getQueryData(a),h={...l,parentId:u.parentId,children:[],rights:[`creator:${l==null?void 0:l.creator_id}`]};if(c)return e.setQueryData(a,f=>{if(f){const m={...f,pages:f==null?void 0:f.pages.map(v=>({...v,folders:[...v.folders,h]}))},y=cue(n,{parentId:u.parentId,newFolder:h});return i(y),m}})}})},bpe=()=>{const t=Jr(),e=Zr(),r=Pr(),n=hc(),{setFolderIds:i,setSelectedFolders:s,setTreeData:o}=sr(),{filters:a,trashed:l}=r,u=["context",{folderId:a.folder,filters:a,trashed:l}];return Ro({mutationFn:async({folderId:c,name:h,parentId:f})=>await Hfe({searchParams:r,folderId:c,parentId:f,name:h}),onError(c){typeof c=="string"&&t.error(_n(c))},onSuccess:async(c,h)=>{if(await e.cancelQueries({queryKey:u}),e.getQueryData(u))return e.setQueryData(u,m=>{if(m){const y={...m,pages:m==null?void 0:m.pages.map(x=>({...x,folders:x.folders.map(b=>b.id===c.id?{...c,parentId:h.parentId,rights:b.rights}:b)}))},v=pue(n,{folderId:h.folderId,newFolder:c});return o(v),y}})},onSettled:()=>{i([]),s([])}})},wpe=t=>{const e=Zr(),r=Pr(),{setResourceIds:n,setSelectedResources:i}=sr(),{filters:s,trashed:o}=r,a=["context",{folderId:s.folder,filters:s,trashed:o}];return Jhe({application:t,options:{onSuccess:async(l,u)=>{if(await e.cancelQueries({queryKey:a}),e.getQueryData(a))return e.setQueryData(a,h=>{if(h)return{...h,pages:h==null?void 0:h.pages.map(f=>({...f,resources:f.resources.map(m=>{if(m.assetId===(u==null?void 0:u.resourceId)){let y=[`creator:${m.creatorId}`];return(u==null?void 0:u.rights.length)>=1&&(y=[...y,...u.rights.flatMap(v=>v.actions.map(x=>`${v.type}:${v.id}:${x.id}`))]),{...m,rights:y}}else return m})}))}})},onSettled:()=>{n([]),i([])}}})},_pe=t=>{const e=Zr(),r=Pr(),{filters:n,trashed:i}=r,s=["context",{folderId:n.folder,filters:n,trashed:i}];return Lhe({application:t,options:{onSuccess:async(o,a)=>{if(await e.cancelQueries({queryKey:s}),e.getQueryData(s))return e.setQueryData(s,u=>{if(u)return{...u,pages:u==null?void 0:u.pages.map(c=>({...c,resources:c.resources.map(h=>{if(h.assetId===(a==null?void 0:a.entId)){const{name:f,thumbnail:m,public:y,description:v,slug:x,...b}=a;return{...h,...b,name:f,thumbnail:typeof m=="string"?m:URL.createObjectURL(m),public:y,description:v,slug:x}}else return h})}))}})}}})},Spe=()=>{const t=Jr(),e=Zr(),r=Pr(),{user:n}=_h(),{appCode:i}=yt(),s=["context",{folderId:r.filters.folder,filters:r.filters,trashed:r.trashed}];return Ro({mutationFn:async o=>await Qfe({searchParams:r,params:o}),onError(o){typeof o=="string"&&t.error(_n(o))},onSuccess:async(o,a)=>{var c,h,f;await e.cancelQueries({queryKey:s});const l=e.getQueryData(s),u={...a,thumbnail:o.thumbnail||"",application:i,assetId:o._id||o.entId||"",id:o._id||o.entId||"",creatorId:n==null?void 0:n.userId,creatorName:n==null?void 0:n.username,createdAt:Date.now(),slug:a.slug||"",modifiedAt:((c=o.modified)==null?void 0:c.$date)||"",modifierId:((h=o.author)==null?void 0:h.userId)||"",modifierName:((f=o.author)==null?void 0:f.username)||"",updatedAt:Date.now(),trashed:!1,rights:[`creator:${n==null?void 0:n.userId}`]};if(l)return e.setQueryData(s,m=>{if(m)return{...m,pages:m==null?void 0:m.pages.map(y=>({...y,resources:[u,...y.resources]}))}})}})};function Mk(t,e){var n;const r=Qi(t,e);return(n=r==null?void 0:r.folder)!=null&&n.childrenIds?[...(r==null?void 0:r.folder.childrenIds)||[],e]:e===Tr.BIN?[Tr.BIN]:[Tr.DEFAULT]}function Epe(){const t=Zr(),e=I8(),r=Jr(),{appCode:n}=yt(),{t:i}=we(["common",n]),s=i("explorer.filters.mine",{ns:n}),{setResourceOrFolderIsDraggable:o,setElementDragOver:a,setResourceIds:l,setFolderIds:u,fetchTreeData:c}=sr(),h=hc(),f={delay:dpe,tolerance:hpe},m=r_(WC,{activationConstraint:f}),y=r_(jj,{activationConstraint:f}),v=r_(VC),x=Bne(m,y,v),b=(A,I)=>{var P;((P=A.data.current)==null?void 0:P.type)==="resource"?r.success(g.jsxs(g.Fragment,{children:[i("explorer.dragged.resource")," ",g.jsx("strong",{children:I})]})):r.success(g.jsxs(g.Fragment,{children:[i("explorer.dragged.folder")," ",g.jsx("strong",{children:I})]}))};return{handleDragEnd:async A=>{const{over:I,active:P}=A,M=I==null?void 0:I.data.current,N=P.data.current,z=A2(h,M==null?void 0:M.id),j=Mk(h,M==null?void 0:M.id);if((N==null?void 0:N.id)==(M==null?void 0:M.id)||z.includes(N==null?void 0:N.id)||j.includes(N==null?void 0:N.id))l([]),u([]);else{const H=(M==null?void 0:M.name)??s;if(I)try{await e.mutate(M==null?void 0:M.id),b(P,H)}catch(F){console.error(F)}finally{a({isOver:!1,overId:void 0,canMove:!0,isTreeview:!1})}}o({isDrag:!1,elementDrag:void 0})},handleDragStart:A=>{const{active:I}=A,P=I.data.current;(P==null?void 0:P.type)==="resource"?l([P==null?void 0:P.id]):(P==null?void 0:P.type)==="folder"&&u([P==null?void 0:P.id]),o({isDrag:!0,elementDrag:P==null?void 0:P.id})},handleDragOver:A=>{const{over:I,active:P}=A,M=I==null?void 0:I.data.current,N=P==null?void 0:P.data.current,z=A2(h,M==null?void 0:M.id),j=Mk(h,M==null?void 0:M.id);if(I){const H={isOver:!0,canMove:!1,overId:M==null?void 0:M.id,isTreeview:M==null?void 0:M.isTreeview};(N==null?void 0:N.id)===(M==null?void 0:M.id)||z.includes(N==null?void 0:N.id)||j.includes(N==null?void 0:N.id)?a({...H,canMove:!1}):(c(M==null?void 0:M.id,t),a({...H,canMove:!0}))}else a({isOver:!1,overId:void 0,canMove:!0,isTreeview:!1})},sensors:x}}const Tpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Jpe),void 0)),Cpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>tme),void 0)),Ape=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>nme),void 0)),Rpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>sme),void 0)),Ppe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>ame),void 0)),Ipe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>cme),void 0)),Mpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>fme),void 0)),kpe=()=>{const t=ape(),e=Gl(),r=bA(),n=Pr(),i=xa(),s=Jr(),o=Zr(),{appCode:a}=yt(),{t:l}=we([a]),{setSearchParams:u,setSearchConfig:c,fetchTreeData:h}=sr(),{data:f,isError:m,error:y,isLoading:v,isFetching:x,fetchNextPage:b}=ppe(),_=(f==null?void 0:f.pages[0].folders.length)===0,w=(f==null?void 0:f.pages[0].resources.length)===0,E=_&&w;return T.useEffect(()=>{var A,I;f&&((A=f==null?void 0:f.pages[0])!=null&&A.searchConfig&&c(f.pages[0].searchConfig),!n.search&&i.id==="default"&&h(i.id,o),u({...n,pagination:(I=f==null?void 0:f.pages[(f==null?void 0:f.pages.length)-1])==null?void 0:I.pagination}))},[f]),T.useEffect(()=>{y&&typeof y=="string"&&s.error(l(y))},[y]),v?g.jsx(pr,{}):m?g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:g.jsx(Ape,{})}):n.search&&E?g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:g.jsx(Cpe,{})}):t&&E?g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:g.jsx(Tpe,{})}):r&&E&&!e?g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:g.jsx(Rpe,{})}):e&&(f==null?void 0:f.pages[0].resources.length)===0?g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:g.jsx(Ppe,{})}):g.jsxs(T.Suspense,{fallback:g.jsx(pr,{}),children:[g.jsx(Ipe,{data:f,isFetching:x}),g.jsx(Mpe,{data:f,isFetching:x,fetchNextPage:b})]})},M8=()=>{const t=Pr(),[e,r]=T.useState(""),n=spe(),i=lpe(),s=T.useRef(null),{setSearchParams:o}=sr(),a=c=>{const h=c.target.value;r(h.toString())},l=c=>{(c.key==="Enter"||c.key==="Return")&&(c.preventDefault(),o({search:e||void 0}))},u=c=>{c.preventDefault(),o({search:e||void 0})};return T.useEffect(()=>{const h=e.length==0||e.length>=n.minLength?{search:e||void 0}:{};o({...t,...h})},[e,n.minLength]),T.useEffect(()=>{i==="select"&&r("")},[i]),T.useEffect(()=>{r(()=>{var c;return((c=t.search)==null?void 0:c.toString())??""})},[t]),{formRef:s,inputSearch:e,handleInputSearchChange:a,handleKeyPress:l,handleSearchSubmit:u}},Ope=()=>{const{appCode:t,currentApp:e}=yt(),{t:r}=we(),[n,i]=T.useState(""),s=c=>{if(c==="0"){i("");return}i(c)},o=xa(),a=Pr(),{setSearchParams:l}=sr();T.useEffect(()=>{const c=()=>n.includes("1")?!0:void 0,h=()=>n.includes("2")?!0:void 0,f=()=>n.includes("7")?!0:void 0;l({...a,filters:{owner:c(),public:f(),shared:h(),folder:o?o.id:"default"}})},[o,l,n]);const u=[{label:r("explorer.filter.all",{ns:t}),value:"0"},{label:r("explorer.filter.owner",{ns:t}),value:"1"},{label:r("explorer.filter.shared",{ns:t}),value:"2"},...(e==null?void 0:e.displayName)=="exercizer"?[{label:"Exercices interactifs",value:"3"}]:[],...(e==null?void 0:e.displayName)=="exercizer"?[{label:"Exercices à rendre",value:"4"}]:[],...(e==null?void 0:e.displayName)=="pages"?[{label:"Projets publics",value:"5"}]:[],...(e==null?void 0:e.displayName)=="pages"?[{label:"Projets internes",value:"6"}]:[],...(e==null?void 0:e.displayName)=="blog"?[{label:r("explorer.filter.public",{ns:t}),value:"7"}]:[]];return{selectedFilters:n,options:u,handleOnSelectFilter:s}},Dpe=()=>{const{appCode:t}=yt(),{t:e}=we(),{selectedFilters:r,options:n,handleOnSelectFilter:i}=Ope(),{formRef:s,inputSearch:o,handleInputSearchChange:a,handleKeyPress:l,handleSearchSubmit:u}=M8(),c=r.length>0?r.length:void 0;return g.jsxs("form",{noValidate:!0,className:"bg-light p-16 ps-24 ms-n16 ms-lg-n24 me-n16 position-relative d-flex gap-8",ref:s,children:[g.jsxs(Ot,{id:"search",className:"input-group",children:[g.jsx(Zn,{type:"search",placeholder:e("explorer.label.search",{ns:t}),size:"lg",noValidationIcon:!0,value:o,onChange:a,onKeyDown:l}),g.jsx(oA,{type:"submit","aria-label":e("explorer.label.search",{ns:t}),onClick:u})]}),g.jsxs(xt,{placement:"bottom-end",children:[g.jsx(xt.Trigger,{label:e("explorer.filters"),icon:g.jsx(Z$,{width:20}),variant:"ghost",badgeContent:c}),g.jsx(xt.Menu,{children:n.map(h=>h.value==="0"?g.jsxs(T.Fragment,{children:[g.jsx(xt.RadioItem,{value:h.value,model:r,onChange:()=>i(h.value),children:h.label}),g.jsx(xt.Separator,{})]},"0"):g.jsx(xt.RadioItem,{value:h.value,model:r,onChange:()=>i(h.value),children:h.label},h.value))})]})]})},Npe=({id:t,selected:e,onSelect:r})=>{const{t:n}=we();return g.jsx("div",{className:"treeview",children:g.jsx("ul",{role:"tree",className:"m-0 p-0",children:g.jsx("li",{id:t,role:"treeitem","aria-selected":e,children:g.jsx("div",{children:g.jsx("div",{className:"action-container",children:g.jsx("div",{onClick:r,role:"button",tabIndex:0,children:g.jsxs("div",{className:"d-flex align-items-center gap-8 py-8 ps-24",children:[g.jsx(DN,{width:"20",height:"20"}),g.jsx("span",{children:n("explorer.tree.trash")})]})})})})})})})},Lpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>L8),void 0)),Fpe=()=>{const[t,e]=Am(),r=Zr(),n=hc(),i=Gl(),s=bA(),o=T8(),a=B6(),l=i?Tr.BIN:s,{appCode:u}=yt(),{t:c}=we(["common",u]),h={...n,name:c("explorer.filters.mine",{ns:u})},{goToTrash:f,selectTreeItem:m,clearSelectedItems:y,clearSelectedIds:v,fetchTreeData:x}=sr(),b=E=>{m(E,r),a()},_=E=>{var P,M;const A=Qi(n,E),I=(P=A==null?void 0:A.children)==null?void 0:P.some(N=>{var z;return Array.isArray(N==null?void 0:N.children)&&((z=N.children)==null?void 0:z.length)>0});(M=A==null?void 0:A.children)==null||M.forEach(N=>{I||x(N.id,r)})},w=()=>{y(),v(),e()};return g.jsxs(g.Fragment,{children:[g.jsx(dd,{data:h,selectedNodeId:l,draggedNode:o!=null&&o.isTreeview?o:void 0,onTreeItemClick:b,onTreeItemUnfold:_}),g.jsx(Npe,{id:Tr.BIN,selected:i,onSelect:f}),g.jsx("div",{className:"d-grid my-16",children:g.jsx(it,{disabled:i,type:"button",color:"primary",variant:"outline",leftIcon:g.jsx(c1,{}),onClick:w,children:c("explorer.folder.new")})}),g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:t&&g.jsx(Lpe,{edit:!1,isOpen:t,onSuccess:e,onCancel:e})})]})};function jpe(){const{appCode:t}=yt(),{gotoPreviousFolder:e}=sr(),{t:r}=we(["common",t]),{inputSearch:n}=M8(),i=bA(),s=Gl(),o=xa(),a=r("explorer.tree.trash"),l=r("explorer.tree.search"),u=r("explorer.filters.mine",{ns:t}),c=(o==null?void 0:o.name)||u;return g.jsx("div",{className:"py-16",children:i&&i!=="bin"&&i!=="default"&&!s?g.jsxs("div",{className:"d-flex align-items-center gap-8",children:[g.jsx(To,{icon:g.jsx(I$,{}),variant:"ghost",color:"tertiary","aria-label":r("back"),className:"ms-n16",onClick:e}),g.jsx("p",{className:"body py-8 text-truncate",children:g.jsx("strong",{children:c})})]}):g.jsx("h2",{className:"body py-8 fw-bold",children:n.length!==0?l:s?a:u})})}const Bpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>yme),void 0)),Upe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>wme),void 0)),$pe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Mme),void 0)),zpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Ome),void 0)),Hpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Nme),void 0)),Vpe=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Lme),void 0)),Gpe=({config:t})=>{const e=Pr(),{setConfig:r,setSearchParams:n}=sr();T.useEffect(()=>{r(t||{}),n({...e,application:t.app,types:t.types})},[t]);const{currentApp:i}=yt(),{data:s}=ox(t.actions),{isTrashedModalOpen:o,onTrashedCancel:a}=cpe(),{isActionDisableModalOpen:l,onActionDisableCancel:u}=upe(),{handleDragEnd:c,handleDragOver:h,handleDragStart:f,sensors:m}=Epe();Zce();const y=Hy("publish",s),v=Hy("create",s);return t&&g.jsxs(g.Fragment,{children:[g.jsx(lue,{render:()=>v?g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:g.jsx(Bpe,{})}):null,children:g.jsx(zue,{app:i})}),g.jsx(io,{className:"flex-grow-1",children:g.jsxs(Uie,{sensors:m,modifiers:[ffe],onDragStart:f,onDragEnd:c,onDragOver:h,children:[g.jsx(io.Col,{sm:"3",lg:"2",xl:"3",className:"border-end pt-16 pe-16 d-none d-lg-block",as:"aside",children:g.jsxs(T.Suspense,{fallback:g.jsx(pr,{}),children:[g.jsx(Fpe,{}),y&&g.jsx(Upe,{})]})}),g.jsxs(io.Col,{sm:"4",md:"8",lg:"6",xl:"9",children:[g.jsx(Dpe,{}),g.jsx(jpe,{}),g.jsx(kpe,{})]}),g.jsxs(T.Suspense,{fallback:g.jsx(pr,{}),children:[g.jsx($pe,{}),t.enableOnboarding&&g.jsx(Vpe,{id:"showOnboardingTrash",items:[{src:"onboarding/illu-trash-menu.svg",alt:"explorer.modal.onboarding.trash.screen1.alt",text:"explorer.modal.onboarding.trash.screen1.title"},{src:"onboarding/illu-trash-notif.svg",alt:"explorer.modal.onboarding.trash.screen2.alt",text:"explorer.modal.onboarding.trash.screen2.alt"},{src:"onboarding/illu-trash-delete.svg",alt:"explorer.modal.onboarding.trash.screen3.alt",text:"explorer.modal.onboarding.trash.screen3.title"}],modalOptions:{title:"explorer.modal.onboarding.trash.title",prevText:"explorer.modal.onboarding.trash.prev",nextText:"explorer.modal.onboarding.trash.next",closeText:"explorer.modal.onboarding.trash.close"}}),o&&g.jsx(Hpe,{isOpen:o,onCancel:a}),l&&g.jsx(zpe,{isOpen:l,onCancel:u})]})]})})]})};function Wpe(){const{init:t}=yt(),e=P8();return t?g.jsx(cfe,{children:g.jsx(Gpe,{config:e})}):g.jsx(pr,{position:!1})}var Xpe=function(){return null};const qpe=new fV({queryCache:new fL({onError:t=>{typeof t=="string"&&t===Hk.NOT_LOGGED_IN&&window.location.replace("/auth/login")}}),defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}),Ype=P8(),Qpe=({children:t})=>g.jsxs(yV,{client:qpe,children:[g.jsx(DV,{params:{app:Ype.app},children:g.jsx(iue,{children:t})}),g.jsx(Xpe,{initialIsOpen:!1})]}),Kpe=document.getElementById("root");vN(Kpe).render(g.jsx(T.StrictMode,{children:g.jsx(Qpe,{children:g.jsx(Wpe,{})})}));function Zpe(){const[t]=Pn(),{appCode:e}=yt(),{theme:r}=ya(),{t:n}=we(),i=ir(u=>u.config),{data:s}=ox(i==null?void 0:i.actions),o=s==null?void 0:s.find(u=>u.id==="create"),a=()=>o!=null&&o.available&&(r!=null&&r.is1d)?n("explorer.emptyScreen.txt1d.create",{ns:e}):o!=null&&o.available&&!(r!=null&&r.is1d)?n("explorer.emptyScreen.txt2d.create",{ns:e}):!(o!=null&&o.available)&&(r!=null&&r.is1d)?n("explorer.emptyScreen.txt1d.consultation",{ns:e}):n("explorer.emptyScreen.txt2d.consultation",{ns:e}),l=()=>o!=null&&o.available&&(r!=null&&r.is1d)?n("explorer.emptyScreen.title1d.create",{ns:e}):o!=null&&o.available&&!(r!=null&&r.is1d)?n("explorer.emptyScreen.title2d.create",{ns:e}):!(o!=null&&o.available)&&(r!=null&&r.is1d)?n("explorer.emptyScreen.title1d.consultation",{ns:e}):n("explorer.emptyScreen.title2d.consultation",{ns:e});return g.jsx(ua,{imageSrc:`${t}/emptyscreen/illu-${e}.svg`,imageAlt:n("explorer.emptyScreen.app.alt",{ns:e}),title:l(),text:a()})}const Jpe=Object.freeze(Object.defineProperty({__proto__:null,default:Zpe},Symbol.toStringTag,{value:"Module"}));function eme(){const{appCode:t}=yt(),[e]=Pn(),{t:r}=we();return g.jsx(ua,{imageSrc:`${e}/emptyscreen/illu-search.svg`,imageAlt:r("explorer.emptyScreen.search.alt",{ns:t}),text:r("explorer.emptyScreen.search.text",{ns:t})})}const tme=Object.freeze(Object.defineProperty({__proto__:null,default:eme},Symbol.toStringTag,{value:"Module"}));function rme(){const[t]=Pn(),{t:e}=we();return g.jsx(ua,{imageSrc:`${t}/emptyscreen/illu-error.svg`,imageAlt:e("explorer.emptyScreen.error.alt"),text:"explorer.emptyScreen.error.text"})}const nme=Object.freeze(Object.defineProperty({__proto__:null,default:rme},Symbol.toStringTag,{value:"Module"}));function ime(){const[t]=Pn(),{appCode:e}=yt(),{t:r}=we();return g.jsx(ua,{imageSrc:`${t}/emptyscreen/illu-no-content-in-folder.svg`,imageAlt:r("explorer.emptyScreen.folder.empty.alt",{ns:e}),text:r("explorer.emptyScreen.label",{ns:e})})}const sme=Object.freeze(Object.defineProperty({__proto__:null,default:ime},Symbol.toStringTag,{value:"Module"}));function ome(){const{appCode:t}=yt(),[e]=Pn(),{t:r}=we();return g.jsx(ua,{imageSrc:`${e}/emptyscreen/illu-trash.svg`,imageAlt:r("explorer.emptyScreen.trash.alt"),title:r("explorer.emptyScreen.trash.title"),text:r("explorer.emptyScreen.trash.empty",{ns:t})})}const ame=Object.freeze(Object.defineProperty({__proto__:null,default:ome},Symbol.toStringTag,{value:"Module"}));function lme({app:t,type:e}){return e==="folder"?g.jsx(NN,{width:"24",height:"24",className:`color-app-${t==null?void 0:t.displayName}`}):e==="resource"?g.jsx(ga,{app:t,iconFit:"ratio",size:"24",variant:"rounded"}):null}const k8=({app:t,type:e,name:r})=>{const n={flexDirection:"row",width:"252px",height:"32px",boxShadow:"0 0.2rem 0.6em rgba(0, 0, 0, 0.15)"};return g.jsxs("div",{className:"d-inline-flex align-items-center card is-selected gap-8",style:n,children:[g.jsx("div",{className:"ms-8",children:g.jsx(lme,{app:t,type:e})}),g.jsx("div",{className:"text-truncate",children:r})]})},O8=({app:t,name:e,idFolder:r,isSelected:n=!1,isSelectable:i=!0,onClick:s,onSelect:o})=>{const[a,l]=T.useState(!1),u=T.useId(),{setNodeRef:c}=Hj({id:u,data:{id:r,name:e,isTreeview:!1,accepts:["folder","resource"]}}),{attributes:h,listeners:f,setNodeRef:m,transform:y}=zj({id:u,data:{id:r,type:"folder"}}),v=sx(),x=T8(),b=A=>{m(A),c(A)},_=x.overId===r,w=!x.canMove&&x.isTreeview?"no-drop":a?"grabbing":"default",E={transform:`translate3d(${((y==null?void 0:y.x)??0)/1}px, ${((y==null?void 0:y.y)??0)/1}px, 0)`,cursor:w};return T.useEffect(()=>{const A=v.elementDrag===r;l(A)},[v]),g.jsx("div",{ref:b,...f,...h,style:{...E},children:a?g.jsx(k8,{name:e,app:t,type:"folder"}):g.jsx(tr,{app:t,isSelectable:!a&&i,isSelected:!a&&n||_&&a,isFocused:_,onClick:s,onSelect:o,children:A=>g.jsxs(tr.Body,{children:[g.jsx(NN,{width:"48",height:"48",className:`color-app-${A}`}),g.jsx(tr.Title,{children:e})]})})})};O8.displayName="FolderCard";const ume=({data:t})=>{var m,y;const e=Zr(),r=rx(),n=Sh(),i=sx(),s=B6(),{currentApp:o}=yt(),{setSelectedFolders:a,setFolderIds:l,openFolder:u}=sr();function c(v){n.includes(v.id)?(l(n.filter(x=>x!==v.id)),a(r.filter(x=>x.id!==v.id))):(l([v.id,...n]),a([v,...r]))}function h(v){s(),u({folder:v,folderId:v.id,queryClient:e})}const f=Ej({from:{opacity:0},to:{opacity:1}});return(m=t==null?void 0:t.pages[0])!=null&&m.folders.length?g.jsx(kl.ul,{className:"grid ps-0 list-unstyled mb-24",children:(y=t==null?void 0:t.pages[0])==null?void 0:y.folders.map(v=>{const{id:x,name:b}=v,_=i.elementDrag===x;return g.jsx(kl.li,{className:`g-col-4 ${_?"z-2000":"z-1"}`,style:{position:"relative",...f},children:g.jsx(O8,{name:b,idFolder:x,app:o,isSelected:n.includes(v.id),onClick:w=>{w.stopPropagation(),h(v)},onSelect:()=>c(v)})},x)})}):null},cme=Object.freeze(Object.defineProperty({__proto__:null,default:ume},Symbol.toStringTag,{value:"Module"}));function D8(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=D8(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function dme(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=D8(t))&&(n&&(n+=" "),n+=e);return n}const N8=({app:t,resource:e,time:r,isSelected:n=!1,isSelectable:i=!0,onClick:s,onSelect:o})=>{const[a,l]=T.useState(!1),u=`/userbook/avatar/${e==null?void 0:e.creatorId}`;function c(E){const{rights:A,creatorId:I}=E||{};return A.filter(M=>!M.includes(I)).length>=1}const{attributes:h,listeners:f,setNodeRef:m,transform:y}=zj({id:e.id,data:{id:e.id,type:"resource"}}),v=c(e),x=e==null?void 0:e.public,b=sx(),{t:_}=we(),w={position:a?"absolute":"relative",zIndex:a?2e3:1,transform:`translate3d(${((y==null?void 0:y.x)??0)/1}px, ${((y==null?void 0:y.y)??0)/1}px, 0)`};return T.useEffect(()=>{const E=b.elementDrag===e.id;l(E)},[b]),g.jsx("div",{ref:m,...f,...h,style:{...w},children:a?g.jsx(k8,{app:t,type:"resource",name:e==null?void 0:e.name}):g.jsx(tr,{app:t,isSelected:!a&&n,isSelectable:!a&&i,onClick:s,onSelect:o,children:E=>g.jsxs(g.Fragment,{children:[g.jsxs(tr.Body,{children:[g.jsx("div",{className:"card-image medium",children:e!=null&&e.thumbnail?g.jsx(yo,{alt:"",src:`${e==null?void 0:e.thumbnail}?thumbnail=80x80`,objectFit:"cover",className:"h-full w-100"}):g.jsx(ga,{app:t,iconFit:"ratio",size:"80",variant:"rounded"})}),g.jsxs("div",{className:"text-truncate",children:[g.jsx(tr.Title,{children:e==null?void 0:e.name}),g.jsx(tr.Text,{children:g.jsx("em",{children:r})})]})]}),g.jsxs(tr.Footer,{children:[g.jsxs("div",{className:"d-inline-flex align-items-center gap-8 text-truncate",children:[u?g.jsx(ec,{alt:(e==null?void 0:e.creatorName)||"",size:"xs",src:u,variant:"circle",width:"24",height:"24"}):g.jsx(iC,{}),g.jsx(tr.Text,{children:e==null?void 0:e.creatorName})]}),g.jsxs("div",{className:"d-inline-flex align-items-center gap-8",children:[v&&g.jsx(co,{message:_("tooltip.shared",{ns:E}),placement:"top",children:g.jsx(UT,{width:16,height:16})}),x&&g.jsx(co,{message:_("tooltip.public",{ns:E}),placement:"top",children:g.jsx(FT,{width:16,height:16})})]})]})]})})})};N8.displayName="ResourceCard";const hme=({data:t,fetchNextPage:e})=>{const{currentApp:r}=yt(),{t:n}=we(),{fromNow:i}=RL(),s=Pr(),o=Eh(),a=Im(),{setSelectedResources:l,setResourceIds:u,openResource:c,setResourceIsTrash:h}=sr(),f=Gl(),m=Ej({from:{opacity:0},to:{opacity:1}}),v=s.pagination.startIdx+s.pagination.pageSize<(s.pagination.maxIdx||0),x=T.useCallback(()=>{e()},[]),b=E=>{f?(h(!0),u([E.id]),l([E])):c(E)};async function _(E){if(o.includes(E.id)){u(o.filter(A=>A!==E.id)),l(a.filter(A=>A.id!==E.id));return}u([...o,E.id]),l([...a,E])}const w=dme("grid ps-0 list-unstyled");return g.jsxs(Pe.Fragment,{children:[g.jsx(kl.ul,{className:w,children:t==null?void 0:t.pages.map((E,A)=>g.jsx(Pe.Fragment,{children:E.resources.map(I=>{const{id:P,updatedAt:M}=I,N=i(M);return g.jsx(kl.li,{className:"g-col-4",style:{position:"relative",...m},children:g.jsx(N8,{app:r,resource:I,time:N,isSelectable:!0,isSelected:o.includes(I.id),onClick:z=>{z.stopPropagation(),b(I)},onSelect:()=>_(I)})},P)})},A))}),v&&g.jsx("div",{className:"d-grid gap-2 col-4 mx-auto my-24",children:g.jsx(it,{type:"button",color:"secondary",variant:"filled",onClick:x,children:n("explorer.see.more")})})]})},fme=Object.freeze(Object.defineProperty({__proto__:null,default:hme},Symbol.toStringTag,{value:"Module"}));function pme({edit:t,onSuccess:e,onClose:r}){var E;const n=rx(),i=xa(),s=xpe(),o=bpe(),a=t?(E=n[0])==null?void 0:E.name:void 0,{reset:l,register:u,handleSubmit:c,setFocus:h,formState:{errors:f,isSubmitting:m,isDirty:y,isValid:v}}=DT({mode:"onChange",values:{name:a||""}}),x=T.useId(),b=async function({name:A}){var I;try{if(t){const P=(I=n[0])==null?void 0:I.parentId,N=n[0].id;await o.mutate({folderId:N,parentId:P,name:A}),l(),e==null||e()}else{const P=(i==null?void 0:i.id)||Tr.DEFAULT;await s.mutate({name:A,parentId:P}),l(),e==null||e()}}catch(P){console.error(P)}};function _(){l(),r()}return{formId:`createModal_${x}`,errors:f,isSubmitting:m,isDirty:y,isValid:v,register:u,setFocus:h,handleSubmit:c,onCancel:_,onSubmit:b}}function mme({isOpen:t,edit:e,onSuccess:r,onCancel:n}){const{t:i}=we(),{isDirty:s,isValid:o,isSubmitting:a,formId:l,onSubmit:u,onCancel:c,handleSubmit:h,register:f,setFocus:m}=pme({edit:e,onSuccess:r,onClose:n});return T.useEffect(()=>{t&&m("name")},[t,m]),t?ur.createPortal(g.jsxs(Ye,{isOpen:t,onModalClose:c,id:"modal_"+l,children:[g.jsx(Ye.Header,{onModalClose:c,children:i(e?"explorer.rename.folder":"explorer.create.folder")}),g.jsx(Ye.Body,{children:g.jsx("form",{id:l,onSubmit:h(u),children:g.jsxs(Ot,{id:"nameFolder",isRequired:!0,children:[g.jsx(Vi,{children:i("explorer.create.folder.name")}),g.jsx(Zn,{type:"text",...f("name",{required:!0,maxLength:60,pattern:{value:/[^ ]/,message:"invalid title"}}),placeholder:i("explorer.create.folder.name"),size:"md","aria-required":!0,maxLength:60})]})})}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{color:"tertiary",onClick:c,type:"button",variant:"ghost",children:i("explorer.cancel")}),g.jsx(it,{form:l,type:"submit",color:"primary",variant:"filled",disabled:!s||!o||a,children:i(e?"explorer.rename":"explorer.create")})]})]}),document.getElementById("portal")):null}const L8=Object.freeze(Object.defineProperty({__proto__:null,default:mme},Symbol.toStringTag,{value:"Module"})),gme=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>j8),void 0));function vme(){const[t,e]=Am(),r=ir(m=>m.config),{appCode:n}=yt(),{t:i}=we(n),{clearSelectedItems:s,clearSelectedIds:o}=sr(),{data:a}=ox(r==null?void 0:r.actions),l=a==null?void 0:a.find(m=>m.id==="create"),u=xa(),c=Spe(),h=Pr(),f=()=>{if(n=="scrapbook"){Zfe({searchParams:h,folderId:u.id});return}s(),o(),e()};return l?g.jsxs(g.Fragment,{children:[g.jsx(it,{type:"button",color:"primary",variant:"filled",leftIcon:g.jsx(c1,{}),className:"ms-auto",onClick:f,children:i("explorer.create.title")}),g.jsx(T.Suspense,{fallback:g.jsx(pr,{}),children:t&&g.jsx(gme,{mode:"create",currentFolder:u,createResource:c,isOpen:t,onSuccess:e,onCancel:e,children:(m,y,v,x,b)=>n==="blog"&&Hy("createPublic",a)&&g.jsx(g8,{appCode:n,isUpdating:y,resource:m,watch:v,setValue:x,register:b})})})]}):null}const yme=Object.freeze(Object.defineProperty({__proto__:null,default:vme},Symbol.toStringTag,{value:"Module"})),xme=()=>{const{theme:t}=ya(),[e]=Pn(),r=Vce(),n=`${e}/${t==null?void 0:t.bootstrapVersion}/image-library.svg`;return{libraryUrl:r,imageFullURL:n,handleClick:()=>{r&&(window.open(r,"_blank"),Ie.data().trackAccessLibraryFromExplorer())}}},bme=()=>{const{libraryUrl:t,imageFullURL:e,handleClick:r}=xme(),{t:n}=we();return t&&g.jsxs("div",{className:"p-16",children:[g.jsx(yo,{width:"270",height:"140",loading:"lazy",className:"rounded",src:e,alt:n("explorer.libray.img.alt")}),g.jsx("p",{className:"m-8",children:n("explorer.libray.title")}),g.jsxs("button",{type:"button",onClick:r,rel:"noreferrer",className:"btn btn-ghost-primary d-inline-flex align-items-center gap-4 p-8",children:[g.jsx("span",{children:n("explorer.libray.btn")}),g.jsx(CS,{})]})]})},wme=Object.freeze(Object.defineProperty({__proto__:null,default:bme},Symbol.toStringTag,{value:"Module"}));function _me({roles:t,rights:e,action:r}){const[n,i]=T.useState(!1),{user:s}=_h(),o=Gl();T.useEffect(()=>{u()},[t,e]);const a=async function(c){const h=c instanceof Array?c:[c];if(t instanceof Array){const f=await Ie.rights().sessionHasAtLeastOneResourceRight(t,h);i(f)}else{const f=await Ie.rights().sessionHasResourceRight(t,h);i(f)}},l=async function(c){if(t instanceof Array){const h=await Ie.rights().sessionHasAtLeastOneResourceRightForEachList(t,c);i(h)}else{const h=await Ie.rights().sessionHasResourceRightForEachList(t,c);i(h)}},u=async function(){var c,h,f;if(t===void 0){i(!0);return}if(o&&((h=(c=e[0])==null?void 0:c.trashedBy)!=null&&h.includes(s==null?void 0:s.userId))&&r==="restore"&&!((f=e[0])!=null&&f.trashed)){i(!0);return}if(e instanceof Array)if(e.length>0)if(typeof e[0]=="string")await a(e);else{const m=e.map(y=>y.rights);await l(m)}else i(!1);else typeof e=="string"?await a(e):await a(e.rights)};return{visible:n,refreshState:u}}function F8(){const[t,e]=T.useState(!1),[r,n]=T.useState("void"),[i,s]=T.useState(),o=ir(de=>de.config),a=xa(),l=Eh(),u=Im(),c=rx(),h=Sh(),f=Gl(),m=gpe(),y=E8(),v=Pr(),x=ype(),b=sx(),{openResource:_,printSelectedResource:w,openFolder:E,clearSelectedItems:A,clearSelectedIds:I}=sr(),{data:P}=ox(o==null?void 0:o.actions);T.useEffect(()=>{if(l.length===0&&h.length===0){e(!1);return}if(y){e(!1);return}if(b.isDrag){e(!1);return}e(!0)},[l,h]);async function M(de){var Be;switch((Be=document.getElementById("root"))==null||Be.setAttribute("aria-hidden","true"),s(de),de.id){case Gr.OPEN:return l.length>0?_(u[0]):E({folder:c[0],folderId:c[0].id});case Gr.COPY:return xe();case Gr.MOVE:return n("move");case Gr.PRINT:return w();case Gr.DELETE:return n("delete");case Gr.RESTORE:return await j();case Gr.PUBLISH:return n("publish");case Gr.UPD_PROPS:case"edit":return _e();case Gr.SHARE:return n("share");case Gr.EXPORT:return n("export");default:throw Error(`Unknown action: ${de.id}`)}}function N(de){const Be=l.length+h.length,je=l.length===1||h.length===1,ut=Be===1,Re=h.length===0;switch(de.id){case Gr.OPEN:return ut;case Gr.MANAGE:return je;case Gr.COPY:return je&&Re;case Gr.PUBLISH:return je&&Re;case Gr.UPD_PROPS:return je&&Re;case Gr.SHARE:return Re&&je;case"export":return je&&Re;case Gr.PRINT:return je&&Re;case"edit":return ut;default:return!0}}const z=()=>!0;async function j(){try{if(f)await m.mutate();else throw new Error("Cannot restore untrashed resources");H()}catch(de){console.error(de)}}function H(){var de;n("void"),i!=null&&i.id&&((de=document.getElementById(i==null?void 0:i.id))==null||de.focus())}const F=de=>()=>{r===de&&(H(),A(),I())},L=F("move"),O=F("move"),U=F("delete"),V=F("delete"),k=F("publish"),$=F("publish"),B=F("edit_folder"),X=F("edit_folder"),K=F("edit_resource"),q=F("edit_resource"),te=F("share"),ue=F("share"),le=F("export"),me=F("export");async function xe(){if(u&&u.length>0){const de=u[0];await x.mutate(de),A(),I()}}function _e(){if(l&&l.length>0){const de=u[0].assetId;(o==null?void 0:o.app)==="scrapbook"?Jfe({searchParams:v,assetId:de}):n("edit_resource")}else n("edit_folder")}function Te(de){return de.id==="edit"&&h.length>0?"explorer.rename":`explorer.actions.${de.id}`}return{onRestore:j,actions:f?o==null?void 0:o.trashActions:P,selectedElement:[...u,...c],currentFolderId:a==null?void 0:a.id,overrideLabel:Te,handleClick:M,isActivable:f?z:N,isActionBarOpen:t,isMoveModalOpen:r==="move",onMoveCancel:L,onMoveSuccess:O,isDeleteModalOpen:r==="delete",onDeleteCancel:V,onDeleteSuccess:U,isPublishModalOpen:r==="publish",onPublishCancel:$,onPublishSuccess:k,isEditFolderOpen:r==="edit_folder",onEditFolderCancel:X,onEditFolderSuccess:B,isEditResourceOpen:r==="edit_resource",onEditResourceCancel:q,onEditResourceSuccess:K,isShareResourceOpen:r==="share",onShareResourceCancel:ue,onShareResourceSuccess:te,isExportModalOpen:r==="export",onExportCancel:le,onExportSuccess:me,onClearActionBar:H}}function Sme({resourceRights:t,roleExpected:e,action:r,children:n,renderWhenForbidden:i}){const{t:s}=we(),{overrideLabel:o}=F8(),{visible:a}=_me({roles:e,rights:t,action:r==null?void 0:r.id}),{setResourceActionDisable:l}=sr(),u=Gl();return a?g.jsx(g.Fragment,{children:n}):i?i():u&&!a?g.jsx(it,{type:"button",color:"primary",variant:"filled",onClick:()=>{l(!0)},children:s(o(r))}):g.jsx(g.Fragment,{})}const Eme=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Fme),void 0)),Tme=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>j8),void 0)),Cme=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Ume),void 0)),Ame=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Hme),void 0)),Rme=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>L8),void 0)),Pme=T.lazy(async()=>await dr(()=>Promise.resolve().then(()=>Wme),void 0));function Ime(){const{appCode:t}=yt(),{t:e}=we(),{actions:r,selectedElement:n,isMoveModalOpen:i,isDeleteModalOpen:s,isPublishModalOpen:o,isActionBarOpen:a,isEditFolderOpen:l,overrideLabel:u,onEditFolderCancel:c,onEditFolderSuccess:h,isEditResourceOpen:f,onEditResourceCancel:m,onEditResourceSuccess:y,isShareResourceOpen:v,onShareResourceCancel:x,onShareResourceSuccess:b,isExportModalOpen:_,onExportCancel:w,onExportSuccess:E,onMoveCancel:A,onMoveSuccess:I,onDeleteCancel:P,onDeleteSuccess:M,onPublishCancel:N,onPublishSuccess:z,isActivable:j,handleClick:H}=F8(),L=Im()[0],O=wpe(t),U=_pe(t),V=jC(a,{from:{opacity:0,transform:"translateY(100%)"},enter:{opacity:1,transform:"translateY(0)"},leave:{opacity:0,transform:"translateY(100%)"}});return g.jsxs(g.Fragment,{children:[V((k,$)=>$&&g.jsx(kl.div,{className:"position-fixed bottom-0 start-0 end-0",style:{...k,zIndex:4},children:g.jsx(oue,{children:r==null?void 0:r.filter(B=>B.available&&B.target==="actionbar").map(B=>j(B)&&g.jsx(Sme,{resourceRights:n,roleExpected:B.right,action:B,children:g.jsx(it,{id:B.id,type:"button",color:"primary",variant:"filled",onClick:()=>{H(B)},children:e(u(B))},B.id)},B.id))})})),g.jsxs(T.Suspense,{fallback:g.jsx(pr,{}),children:[i&&g.jsx(Ame,{isOpen:i,onCancel:A,onSuccess:I}),s&&g.jsx(Cme,{isOpen:s,onCancel:P,onSuccess:M}),o&&L&&g.jsx(Eme,{isOpen:o,resourceId:L.assetId,onCancel:N,onSuccess:z}),l&&g.jsx(Rme,{edit:!0,isOpen:l,onCancel:c,onSuccess:h}),f&&L&&g.jsx(Tme,{mode:"update",isOpen:f,resourceId:L.assetId,updateResource:U,onCancel:m,onSuccess:y,children:(k,$,B,X,K)=>t==="blog"&&Hy("createPublic",r)&&g.jsx(g8,{appCode:t,isUpdating:$,resource:k,watch:B,setValue:X,register:K})}),v&&L&&g.jsx(Qhe,{isOpen:v,shareResource:O,shareOptions:{resourceCreatorId:L.creatorId,resourceId:L.assetId,resourceRights:L.rights},onCancel:x,onSuccess:b,children:t==="blog"?g.jsx(Khe,{resourceId:L.assetId,updateResource:U}):null}),_&&L&&g.jsx(Pme,{isOpen:_,onCancel:w,onSuccess:E})]})]})}const Mme=Object.freeze(Object.defineProperty({__proto__:null,default:Ime},Symbol.toStringTag,{value:"Module"}));function kme({isOpen:t,onCancel:e=()=>({})}){const{t:r}=we();return ur.createPortal(g.jsxs(Ye,{isOpen:t,onModalClose:e,id:"trash_action_disable_resource",children:[g.jsx(Ye.Header,{onModalClose:()=>e(),children:r("explorer.trash.action.modal.title")}),g.jsx(Ye.Body,{children:g.jsx("p",{className:"body",children:r("explorer.trash.action.modal.text")})}),g.jsx(Ye.Footer,{children:g.jsx(it,{color:"primary",onClick:e,type:"button",variant:"outline",children:r("close")})})]}),document.getElementById("portal"))}const Ome=Object.freeze(Object.defineProperty({__proto__:null,default:kme},Symbol.toStringTag,{value:"Module"}));function Dme({isOpen:t,onCancel:e=()=>({})}){const{t:r}=we();return ur.createPortal(g.jsxs(Ye,{isOpen:t,onModalClose:e,id:"trash_resource",children:[g.jsx(Ye.Header,{onModalClose:()=>e(),children:r("explorer.trash.modal.title")}),g.jsx(Ye.Body,{children:g.jsx("p",{className:"body",children:r("explorer.trash.modal.text")})}),g.jsx(Ye.Footer,{children:g.jsx(it,{color:"primary",onClick:e,type:"button",variant:"outline",children:r("close")})})]}),document.getElementById("portal"))}const Nme=Object.freeze(Object.defineProperty({__proto__:null,default:Dme},Symbol.toStringTag,{value:"Module"})),Lme=Object.freeze(Object.defineProperty({__proto__:null,default:vle},Symbol.toStringTag,{value:"Module"})),j8=Object.freeze(Object.defineProperty({__proto__:null,default:Dhe},Symbol.toStringTag,{value:"Module"})),Fme=Object.freeze(Object.defineProperty({__proto__:null,default:Rhe},Symbol.toStringTag,{value:"Module"}));function jme({onSuccess:t}){const e=vpe(),r=mpe(),n=Gl();async function i(){try{n?await e.mutate():await r.mutate(),t==null||t()}catch(s){console.error(s)}}return{isTrashFolder:n,onDelete:i}}function Bme({isOpen:t,onSuccess:e=()=>({}),onCancel:r=()=>({})}){const{t:n}=we(),{isTrashFolder:i,onDelete:s}=jme({onSuccess:e});return ur.createPortal(g.jsxs(Ye,{isOpen:t,onModalClose:r,id:"deleteModal",children:[g.jsx(Ye.Header,{onModalClose:r,children:n(i?"explorer.delete.title":"explorer.trash.title")}),g.jsx(Ye.Body,{children:g.jsx("p",{className:"body",children:n(i?"explorer.delete.subtitle":"explorer.trash.subtitle")})}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:n("explorer.cancel")}),g.jsx(it,{color:"danger",onClick:s,type:"button",variant:"filled",children:n(i?"explorer.delete":"explorer.trash")})]})]}),document.getElementById("portal"))}const Ume=Object.freeze(Object.defineProperty({__proto__:null,default:Bme},Symbol.toStringTag,{value:"Module"}));function $me({onSuccess:t}){const[e,r]=T.useState(),n=Zr(),i=I8(),s=rx(),o=Im(),a=hc(),{fetchTreeData:l}=sr();async function u(){try{if(!e)throw new Error("explorer.move.selection.empty");await i.mutate(e),await(t==null?void 0:t())}catch(h){console.error(h)}}const c=h=>{var m,y;const f=A2(a,h);for(const v of s)if(h===v.id||h===v.parentId||(m=v.childrenIds)!=null&&m.includes(h)||f.includes(v.id))return!1;for(const v of o)if(h===((v==null?void 0:v.folderIds)&&v.folderIds[0])||((y=v==null?void 0:v.folderIds)==null?void 0:y.length)===0&&h==="default")return!1;return!0};return{treeData:a,disableSubmit:!e,handleTreeItemSelect:h=>{c(h)?r(h):r(void 0)},handleOnTreeItemUnfold:h=>{var y,v;const f=Qi(a,h),m=(y=f==null?void 0:f.children)==null?void 0:y.some(x=>{var b;return Array.isArray(x==null?void 0:x.children)&&((b=x.children)==null?void 0:b.length)>0});(v=f==null?void 0:f.children)==null||v.forEach(x=>{m||l(x.id,n)})},onMove:()=>u()}}function zme({isOpen:t,onSuccess:e,onCancel:r}){const{appCode:n}=yt(),{t:i}=we(),{treeData:s,handleTreeItemSelect:o,handleOnTreeItemUnfold:a,onMove:l,disableSubmit:u}=$me({onSuccess:e}),c={...s,name:i("explorer.filters.mine",{ns:n})};return ur.createPortal(g.jsxs(Ye,{isOpen:t,onModalClose:r,id:"moveModal",children:[g.jsx(Ye.Header,{onModalClose:r,children:i("explorer.move.title")}),g.jsx(Ye.Subtitle,{children:i("explorer.move.subtitle")}),g.jsx(Ye.Body,{children:g.jsx(dd,{data:c,onTreeItemClick:o,onTreeItemUnfold:a})}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:i("explorer.cancel")}),g.jsx(it,{color:"primary",onClick:l,type:"button",variant:"filled",disabled:u,children:i("explorer.move")})]})]}),document.getElementById("portal"))}const Hme=Object.freeze(Object.defineProperty({__proto__:null,default:zme},Symbol.toStringTag,{value:"Module"})),Vme=t=>{const e=Im(),r=Pr(),n=Jr(),{t:i}=we();return{handleExportClick:()=>{e.length?(epe({searchParams:r,assetId:e[0].assetId}),t()):n.error(i("explorer.error.noResourceSelected"))}}};function Gme({isOpen:t,onSuccess:e,onCancel:r}){const{handleExportClick:n}=Vme(e),{t:i}=we();return ur.createPortal(g.jsxs(Ye,{isOpen:t,onModalClose:r,id:"exportModal",children:[g.jsx(Ye.Header,{onModalClose:r,children:i("explorer.export.title")}),g.jsxs(Ye.Body,{children:[g.jsxs("ul",{children:[g.jsx("li",{children:i("explorer.export.body.info.1")}),g.jsx("li",{children:i("explorer.export.body.info.2")}),g.jsx("li",{children:i("explorer.export.body.info.3")})]}),g.jsx(Jo,{type:"warning",children:i("explorer.export.body.warning")})]}),g.jsxs(Ye.Footer,{children:[g.jsx(it,{color:"tertiary",onClick:r,type:"button",variant:"ghost",children:i("explorer.cancel")}),g.jsx(it,{color:"primary",onClick:n,type:"button",variant:"filled",children:i("explorer.actions.export")})]})]}),document.getElementById("portal"))}const Wme=Object.freeze(Object.defineProperty({__proto__:null,default:Gme},Symbol.toStringTag,{value:"Module"}))});export default Xme();