ode-explorer 1.5.2-develop.202411261453 → 1.5.3

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.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Exploration des ressources</title>
7
7
  <link rel="icon" id="favicon" href="" />
8
- <link rel="stylesheet" href="/assets/themes/edifice-bootstrap/index.css?v=059e3b32" />
8
+ <link rel="stylesheet" href="/assets/themes/edifice-bootstrap/index.css?v=293b190f" />
9
9
  <script type="module" crossorigin src="/index.js"></script>
10
10
  </head>
11
11
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var sP=t=>{throw TypeError(t)};var DB=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Sb=(t,e,r)=>e.has(t)||sP("Cannot "+r);var Y=(t,e,r)=>(Sb(t,e,"read from private field"),r?r.call(t):e.get(t)),Ze=(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)=>(Sb(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),lt=(t,e,r)=>(Sb(t,e,"access private method"),r);var wg=(t,e,r,n)=>({set _(i){Ne(t,e,i,r)},get _(){return Y(t,e,n)}});import{odeServices as Me,FOLDER as Er,LAYER_NAME as NB,SnipletsService as Eb,DocumentHelper as Vk,StringUtils as LB,ERROR_CODE as Gk,SORT_ORDER as FB,ResourceService as Wk,ACTION as Wr}from"/assets/js/edifice-ts-client/index.js?v=059e3b32";var Kme=DB((ige,C1)=>{function Xk(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 Po(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function qk(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 Yk={exports:{}},Gy={},Qk={exports:{}},ft={};/**
1
+ var sP=t=>{throw TypeError(t)};var DB=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Sb=(t,e,r)=>e.has(t)||sP("Cannot "+r);var Y=(t,e,r)=>(Sb(t,e,"read from private field"),r?r.call(t):e.get(t)),Ze=(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)=>(Sb(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),lt=(t,e,r)=>(Sb(t,e,"access private method"),r);var wg=(t,e,r,n)=>({set _(i){Ne(t,e,i,r)},get _(){return Y(t,e,n)}});import{odeServices as Me,FOLDER as Er,LAYER_NAME as NB,SnipletsService as Eb,DocumentHelper as Vk,StringUtils as LB,ERROR_CODE as Gk,SORT_ORDER as FB,ResourceService as Wk,ACTION as Wr}from"/assets/js/edifice-ts-client/index.js?v=293b190f";var Kme=DB((ige,C1)=>{function Xk(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 Po(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function qk(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 Yk={exports:{}},Gy={},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 u6="[native code] }",Ooe=u6.length;function rk(t){return typeof t!="function"?!1:Function.prototype.toString.call(t).slice(-Ooe)===u6}class Cl{constructor(e,r){e=this.words=e||[],this.sigBytes=r===void 0?e.length*4:r}toString(e){return(e||Doe).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 Cl([...this.words])}}const Doe={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("")}},Noe={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("")}},Loe={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 Cl(r,e)}},Foe={parse(t){return Loe.parse(unescape(encodeURIComponent(t)))}};class joe{constructor(){this._data=new Cl,this._nDataBytes=0,this._minBufferSize=0,this.blockSize=512/32}reset(){this._data=new Cl,this._nDataBytes=0}_append(e){typeof e=="string"&&(e=Foe.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 Cl(r,s)}}class Boe extends joe{update(e){return this._append(e),this._process(),this}finalize(e){e&&this._append(e)}}const nk=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],Uoe=[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],hu=[];class $oe extends Boe{constructor(){super(...arguments),this._hash=new Cl([...nk])}reset(){super.reset(),this._hash=new Cl([...nk])}_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)hu[f]=e[r+f]|0;else{const w=hu[f-15],E=(w<<25|w>>>7)^(w<<14|w>>>18)^w>>>3,A=hu[f-2],P=(A<<15|A>>>17)^(A<<13|A>>>19)^A>>>10;hu[f]=E+hu[f-7]+P+hu[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+Uoe[f]+hu[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 zoe(t){return new $oe().finalize(t).toString(Noe)}function ik(t,e={}){const r=typeof t=="string"?t:Moe(t,e);return zoe(r).slice(0,10)}var c6={};Object.defineProperty(c6,"__esModule",{value:!0});const Hoe=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)},Voe=t=>t.split("").map(e=>`\\${e}`).join(""),sk=(t,e,r=!1)=>{const n=Hoe(t).trim().toLowerCase(),i=Voe(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"),"")},If=(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=sk(n,r,!0),s=sk(String(t),r);return i?`${i}${r}${s}`:s}return"children"in t?If(t.children):"type"in t?If(t.props.children,e):Symbol.iterator in t?If(Array.from(t).map(i=>If(i,{delimiter:r})).join(r),e):""};var ok=c6.default=If;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={},Vl=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)}}(),ip=rr&&rr.__assign||function(){return ip=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},ip.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 Qn=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 G1=function(t){Vl(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=G1;var d6=function(t){Vl(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=Qn.ElementType.Text,r}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),e}(G1);dt.Text=d6;var h6=function(t){Vl(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=Qn.ElementType.Comment,r}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),e}(G1);dt.Comment=h6;var f6=function(t){Vl(e,t);function e(r,n){var i=t.call(this,n)||this;return i.name=r,i.type=Qn.ElementType.Directive,i}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),e}(G1);dt.ProcessingInstruction=f6;var W1=function(t){Vl(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=W1;var p6=function(t){Vl(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=Qn.ElementType.CDATA,r}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),e}(W1);dt.CDATA=p6;var m6=function(t){Vl(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type=Qn.ElementType.Root,r}return Object.defineProperty(e.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),e}(W1);dt.Document=m6;var g6=function(t){Vl(e,t);function e(r,n,i,s){i===void 0&&(i=[]),s===void 0&&(s=r==="script"?Qn.ElementType.Script:r==="style"?Qn.ElementType.Style:Qn.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}(W1);dt.Element=g6;function v6(t){return(0,Qn.isTag)(t)}dt.isTag=v6;function y6(t){return t.type===Qn.ElementType.CDATA}dt.isCDATA=y6;function x6(t){return t.type===Qn.ElementType.Text}dt.isText=x6;function b6(t){return t.type===Qn.ElementType.Comment}dt.isComment=b6;function w6(t){return t.type===Qn.ElementType.Directive}dt.isDirective=w6;function _6(t){return t.type===Qn.ElementType.Root}dt.isDocument=_6;function Goe(t){return Object.prototype.hasOwnProperty.call(t,"children")}dt.hasChildren=Goe;function ZC(t,e){e===void 0&&(e=!1);var r;if(x6(t))r=new d6(t.data);else if(b6(t))r=new h6(t.data);else if(v6(t)){var n=e?f_(t.children):[],i=new g6(t.name,ip({},t.attribs),n);n.forEach(function(l){return l.parent=i}),t.namespace!=null&&(i.namespace=t.namespace),t["x-attribsNamespace"]&&(i["x-attribsNamespace"]=ip({},t["x-attribsNamespace"])),t["x-attribsPrefix"]&&(i["x-attribsPrefix"]=ip({},t["x-attribsPrefix"])),r=i}else if(y6(t)){var n=e?f_(t.children):[],s=new p6(n);n.forEach(function(u){return u.parent=s}),r=s}else if(_6(t)){var n=e?f_(t.children):[],o=new m6(n);n.forEach(function(u){return u.parent=o}),t["x-mode"]&&(o["x-mode"]=t["x-mode"]),r=o}else if(w6(t)){var a=new f6(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 ak="html",lk="head",R0="body",Woe=/<([a-zA-Z]+[0-9]?)/,uk=/<head[^]*>/i,ck=/<body[^]*>/i,Hy=function(){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},_2=function(){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},dk=typeof window=="object"&&window.DOMParser;if(typeof dk=="function"){var Xoe=new dk,qoe="text/html";_2=function(t,e){return e&&(t="<"+e+">"+t+"</"+e+">"),Xoe.parseFromString(t,qoe)},Hy=_2}if(typeof document=="object"&&document.implementation){var P0=document.implementation.createHTMLDocument();Hy=function(t,e){if(e){var r=P0.documentElement.querySelector(e);return r.innerHTML=t,P0}return P0.documentElement.innerHTML=t,P0}}var p_=typeof document=="object"?document.createElement("template"):{},S2;p_.content&&(S2=function(t){return p_.innerHTML=t,p_.content.childNodes});function Yoe(t){var e,r=t.match(Woe);r&&r[1]&&(e=r[1].toLowerCase());var n,i,s;switch(e){case ak:return n=_2(t),uk.test(t)||(i=n.querySelector(lk),i&&i.parentNode.removeChild(i)),ck.test(t)||(i=n.querySelector(R0),i&&i.parentNode.removeChild(i)),n.querySelectorAll(ak);case lk:case R0:return n=Hy(t),s=n.querySelectorAll(e),ck.test(t)&&uk.test(t)?s[0].parentNode.childNodes:s;default:return S2?S2(t):(i=Hy(t,R0).querySelector(R0),i.childNodes)}}var Qoe=Yoe,JC={},S6={};S6.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 X1=YC,Koe=S6,hk=Koe.CASE_SENSITIVE_TAG_NAMES,Zoe=X1.Comment,Joe=X1.Element,eae=X1.ProcessingInstruction,tae=X1.Text,E6={},m_;for(var g_=0,rae=hk.length;g_<rae;g_++)m_=hk[g_],E6[m_.toLowerCase()]=m_;function nae(t){return E6[t]}function T6(t){for(var e={},r,n=0,i=t.length;n<i;n++)r=t[n],e[r.name]=r.value;return e}function iae(t){t=t.toLowerCase();var e=nae(t);return e||t}function C6(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=iae(a.nodeName),l=new Joe(i,T6(a.attributes)),l.children=C6(i==="template"?a.content.childNodes:a.childNodes,l);break;case 3:l=new tae(a.nodeValue);break;case 8:l=new Zoe(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 eae(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=T6;JC.formatDOM=C6;var sae=Qoe,oae=JC,aae=oae.formatDOM,lae=/<(![a-zA-Z\s]+)>/;function uae(t){if(typeof t!="string")throw new TypeError("First argument must be a string");if(t==="")return[];var e=t.match(lae),r;return e&&e[1]&&(r=e[1]),aae(sae(t),null,r)}var cae=uae,Zi={},q1={},dae=0;q1.SAME=dae;var hae=1;q1.CAMELCASE=hae;q1.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(Zi,"__esModule",{value:!0});function fae(t,e){return pae(t)||mae(t,e)||gae(t,e)||vae()}function pae(t){if(Array.isArray(t))return t}function mae(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 gae(t,e){if(t){if(typeof t=="string")return fk(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 fk(t,e)}}function fk(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 vae(){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 A6=0,Gl=1,Y1=2,Q1=3,eA=4,R6=5,P6=6;function yae(t){return Zr.hasOwnProperty(t)?Zr[t]:null}function In(t,e,r,n,i,s,o){this.acceptsBooleans=e===Y1||e===Q1||e===eA,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Zr={},xae=["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"];xae.forEach(function(t){Zr[t]=new In(t,A6,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=fae(t,2),r=e[0],n=e[1];Zr[r]=new In(r,Gl,!1,n,null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Zr[t]=new In(t,Y1,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Zr[t]=new In(t,Y1,!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){Zr[t]=new In(t,Q1,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Zr[t]=new In(t,Q1,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Zr[t]=new In(t,eA,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Zr[t]=new In(t,P6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Zr[t]=new In(t,R6,!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);Zr[e]=new In(e,Gl,!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);Zr[e]=new In(e,Gl,!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);Zr[e]=new In(e,Gl,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Zr[t]=new In(t,Gl,!1,t.toLowerCase(),null,!1,!1)});var bae="xlinkHref";Zr[bae]=new In("xlinkHref",Gl,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Zr[t]=new In(t,Gl,!1,t.toLowerCase(),null,!0,!0)});var nA=q1,wae=nA.CAMELCASE,_ae=nA.SAME,pk=nA.possibleStandardNames,Sae=":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",Eae=Sae+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Tae=RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+Eae+"]*$")),Cae=Object.keys(pk).reduce(function(t,e){var r=pk[e];return r===_ae?t[e]=e:r===wae?t[e.toLowerCase()]=e:t[e]=r,t},{});Zi.BOOLEAN=Q1;Zi.BOOLEANISH_STRING=Y1;Zi.NUMERIC=R6;Zi.OVERLOADED_BOOLEAN=eA;Zi.POSITIVE_NUMERIC=P6;Zi.RESERVED=A6;Zi.STRING=Gl;Zi.getPropertyInfo=yae;Zi.isCustomAttribute=Tae;Zi.possibleStandardNames=Cae;var I6={},iA={exports:{}},mk=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Aae=/\n/g,Rae=/^\s*/,Pae=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Iae=/^:\s*/,Mae=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,kae=/^[;\s]*/,Oae=/^\s+|\s+$/g,Dae=`
1390
- `,gk="/",vk="*",Eu="",Nae="comment",Lae="declaration",Fae=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(Aae);v&&(r+=v.length);var x=y.lastIndexOf(Dae);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(Rae)}function c(y){var v;for(y=y||[];v=h();)v!==!1&&y.push(v);return y}function h(){var y=s();if(!(gk!=t.charAt(0)||vk!=t.charAt(1))){for(var v=2;Eu!=t.charAt(v)&&(vk!=t.charAt(v)||gk!=t.charAt(v+1));)++v;if(v+=2,Eu===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:Nae,comment:x})}}function f(){var y=s(),v=l(Pae);if(v){if(h(),!l(Iae))return a("property missing ':'");var x=l(Mae),b=y({type:Lae,property:yk(v[0].replace(mk,Eu)),value:x?yk(x[0].replace(mk,Eu)):Eu});return l(kae),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 yk(t){return t?t.replace(Oae,Eu):Eu}var jae=Fae;function M6(t,e){var r=null;if(!t||typeof t!="string")return r;for(var n,i=jae(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=M6;iA.exports.default=M6;var Bae=iA.exports,K1={};K1.__esModule=!0;K1.camelCase=void 0;var Uae=/^--[a-zA-Z0-9-]+$/,$ae=/-([a-z])/g,zae=/^[^-]+$/,Hae=/^-(webkit|moz|ms|o|khtml)-/,Vae=/^-(ms)-/,Gae=function(t){return!t||zae.test(t)||Uae.test(t)},Wae=function(t,e){return e.toUpperCase()},xk=function(t,e){return"".concat(e,"-")},Xae=function(t,e){return e===void 0&&(e={}),Gae(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(Vae,xk):t=t.replace(Hae,xk),t.replace($ae,Wae))};K1.camelCase=Xae;(function(t){var e=rr&&rr.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};t.__esModule=!0;var r=e(Bae),n=K1;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})(I6);var qae=T,Yae=I6.default;function Qae(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 Kae=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function Zae(t,e){return t.indexOf("-")===-1?e&&typeof e.is=="string":!Kae.has(t)}var Jae={reactCompat:!0};function ele(t,e){if(t!=null)try{e.style=Yae(t,Jae)}catch{e.style={}}}var tle=qae.version.split(".")[0]>=16,k6=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);function rle(t){return!k6.has(t.name)}function nle(t){return t}var O6={PRESERVE_CUSTOM_ATTRIBUTES:tle,ELEMENTS_WITH_NO_TEXT_CHILDREN:k6,invertObject:Qae,isCustomComponent:Zae,setStyleProp:ele,canTextBeChildOfNode:rle,returnFirstArg:nle},Mf=Zi,bk=O6,ile=["checked","value"],sle=["input","select","textarea"],ole={reset:!0,submit:!0},D6=function(e,r){e=e||{};var n,i,s,o,a,l={},u=e.type&&ole[e.type];for(n in e){if(s=e[n],Mf.isCustomAttribute(n)){l[n]=s;continue}if(i=n.toLowerCase(),o=wk(i),o){switch(a=Mf.getPropertyInfo(o),ile.indexOf(o)!==-1&&sle.indexOf(r)!==-1&&!u&&(o=wk("default"+i)),l[o]=s,a&&a.type){case Mf.BOOLEAN:l[o]=!0;break;case Mf.OVERLOADED_BOOLEAN:s===""&&(l[o]=!0);break}continue}bk.PRESERVE_CUSTOM_ATTRIBUTES&&(l[n]=s)}return bk.setStyleProp(e.style,l),l};function wk(t){return Mf.possibleStandardNames[t]}var ale=T,lle=D6,Kp=O6,ule=Kp.setStyleProp,cle=Kp.canTextBeChildOfNode;function N6(t,e){e=e||{};for(var r=e.library||ale,n=r.cloneElement,i=r.createElement,s=r.isValidElement,o=[],a,l,u=typeof e.replace=="function",c=e.transform||Kp.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&&!cle(a.parent)||y&&l)continue;o.push(c(a.data,a,v));continue}switch(f=a.attribs,dle(a)?ule(f.style,f):f&&(f=lle(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=N6(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 dle(t){return Kp.PRESERVE_CUSTOM_ATTRIBUTES&&t.type==="tag"&&Kp.isCustomComponent(t.name,t.attribs)}var hle=N6,Z1=YC,cd=cae,fle=D6,L6=hle;cd=typeof cd.default=="function"?cd.default:cd;var ple={lowerCaseAttributeNames:!1};function Ao(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");return t===""?[]:(e=e||{},L6(cd(t,e.htmlparser2||ple),e))}Ao.domToReact=L6;Ao.htmlToDOM=cd;Ao.attributesToProps=fle;Ao.Comment=Z1.Comment;Ao.Element=Z1.Element;Ao.ProcessingInstruction=Z1.ProcessingInstruction;Ao.Text=Z1.Text;var mle=Ao;Ao.default=Ao;const Wl=Po(mle);var I0=Wl.domToReact;Wl.htmlToDOM;var v_=Wl.attributesToProps;Wl.Comment;Wl.Element;Wl.ProcessingInstruction;Wl.Text;var gle=Object.defineProperty,vle=(t,e,r)=>e in t?gle(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ff=(t,e,r)=>(vle(t,typeof e!="symbol"?e+"":e,r),r);const yle=async t=>await Me.conf().getPreference(t),xle=async t=>await Me.conf().savePreference(t,JSON.stringify({key:!1})),ble=t=>{const[e,r]=T.useState(!0),[n,i]=T.useState(!1);return T.useEffect(()=>{(async()=>{const s=await yle(t);if(s){const{key:o}=s;i(o);return}i(!0)})()},[t]),{isOpen:e,setIsOpen:r,isOnboarding:n,handleSavePreference:async()=>{await xle(t),r(!1)}}},wle=({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}=ble(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?mr.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(o6,{modules:[cse],onSwiper:b=>{s(b)},onSlideChange:b=>{a(b.progress)},pagination:{clickable:!0},children:e.map((b,_)=>g.jsxs(a6,{children:[g.jsx(wo,{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},_le=wle,F6=T.createContext(null),bh=()=>{const t=T.useContext(F6);if(!t)throw new Error("Cannot be rendered outside the Dropdown Component");return t},Sle=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:Re(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})]})}),Tm=Sle,Ele=({children:t,value:e,model:r,onChange:n})=>{const{itemProps:i,itemRefs:s,isFocused:o}=bh(),{onMenuItemKeyDown:a,onMenuItemMouseEnter:l}=i,u=T.useId(),c=r.includes(e),h={value:e,model:r,checked:c,readOnly:!0},f=Re("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(Tm,{...h})]})})},Tle=Ele,Cle=({type:t="action",icon:e,onClick:r,children:n,className:i,...s})=>{const{itemProps:o,itemRefs:a,isFocused:l}=bh(),{onMenuItemKeyDown:u,onMenuItemMouseEnter:c,onMenuItemClick:h}=o,f=v=>{r==null||r(v),t==="action"&&(h(),v.stopPropagation())},m=T.useId(),y=Re("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]})})},Ale=Cle,Rle=T.forwardRef(({children:t,block:e,unstyled:r,...n},i)=>{const{menuProps:s,visible:o}=bh(),a=Re({"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}),Ple=Rle,Ile=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]})),Mle=Ile,kle=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:Re(s.className,"form-check-input c-pointer",e&&"d-none"),id:a},u={...s,...l};return g.jsxs("div",{className:Re("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:Re("c-pointer",t!==s.value&&"text-muted"),children:e}),!e&&r&&g.jsx("label",{className:"form-check-label",htmlFor:u.id,children:r})]})}),E2=kle,Ole=({children:t,value:e,model:r,onChange:n})=>{const{itemProps:i,itemRefs:s,isFocused:o}=bh(),{onMenuItemKeyDown:a,onMenuItemMouseEnter:l}=i,u=T.useId(),c={value:e,model:r,checked:e===r,readOnly:!0},h=Re("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(E2,{...c,className:"position-absolute start-0 end-0 top-0 bottom-0 opacity-0"})]})})},Dle=Ole,Nle=()=>g.jsx("div",{role:"separator",className:"px-4",children:g.jsx("hr",{className:"m-0"})}),Lle=Nle,Fle=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}=bh(),h=Re("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(vz,{width:16,height:16,className:"dropdown-toggle-caret"})]})}),jle=Fle;function j6(){return{xs:$c("only screen and (min-width: 0)"),sm:$c("only screen and (min-width: 375px)"),md:$c("only screen and (min-width: 768px)"),lg:$c("only screen and (min-width: 1024px)"),xl:$c("only screen and (min-width: 1280px)"),xxl:$c("only screen and (min-width: 1400px)")}}function B6(t){var e,r,n;const i=new Hq(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 _k=["mousedown","touchstart"];function U6(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 _k.forEach(s=>{document.addEventListener(s,i)}),()=>{_k.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 T2(...t){return e=>{Ble(e,...t)}}function Ble(t,...e){e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}const Ule=(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}=QH({placement:t,open:i,onOpenChange:s,whileElementsMounted:AH,middleware:[OH(4),NH({apply({rects:j,elements:H}){H.floating.style.minWidth=`${j.reference.width}px`}}),DH({padding:0})]});GH(f,{enabled:r,delay:{open:200},handleClose:ZH()});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))},[]),P=(j,H)=>{j&&(H.stopPropagation(),H.preventDefault())},I=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),P(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}P(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:T2(y,c.setReference),id:`dropdown-toggle-${n}`,"aria-haspopup":"menu","aria-controls":`dropdown-${n}`,"aria-expanded":!!i,className:`${i?"selected":""}`,onClick:z,onKeyDown:I,"aria-activedescendant":l},menuProps:{ref:T2(m,c.setFloating),className:"dropdown-menu","aria-labelledby":`dropdown-toggle-${n}`,style:{...h}},itemProps:{onMenuItemMouseEnter:M,onMenuItemClick:A,onMenuItemKeyDown:N},setVisible:s}},$le=Ule,zle=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 P=A.name.toLowerCase();(w.some(I=>P.endsWith(I))||E.some(I=>A.type.includes(I)))&&b.push(A)})}return b},c=v=>{let x=v.map(b=>new File([b],b.name.replace(/[!:,;="']/g,""),{type:b.type}));t!=null&&t.forceFilters?(x=u(x),x&&x.length&&i(b=>[...b,...x])):i(b=>[...b,...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}},Hle=zle;function $6(){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 Vle(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 z6(){const t=document.querySelector("html");return()=>{t&&t.scrollIntoView()}}const Gle=T.forwardRef(({icon:t,className:e,...r},n)=>{const i={...r,className:Re("btn-icon btn-sm",e)};return g.jsx(it,{ref:n,...i,children:t})}),Ro=Gle,Wle=T.forwardRef(({icon:t=g.jsx(AS,{}),onClick:e,className:r,...n},i)=>{const s=Re("btn-search",r);return g.jsx(Ro,{ref:i,className:s,icon:t,onClick:e,...n})}),oA=Wle,Xle=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(WN,{}),classModifier:"alert-success"},warning:{icon:g.jsx(R$,{}),classModifier:"alert-warning"},info:{icon:g.jsx(BN,{}),classModifier:"alert-info"},danger:{icon:g.jsx(Q$,{}),classModifier:"alert-danger"}},E={"is-dismissible":i,"is-toast ":s},A={"is-confirm":o},P=Re("alert gap-12",w[t].classModifier,E,A,a,e);return g.jsx(g.Fragment,{children:m?g.jsxs("div",{ref:v,className:P,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})}),ta=Xle,M0="top-right";function en(){return{success:(t,e)=>lu.custom(g.jsx(ta,{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)??M0}),error:(t,e)=>lu.custom(g.jsx(ta,{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)??M0}),info:(t,e)=>lu.custom(g.jsx(ta,{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)??M0}),warning:(t,e)=>lu.custom(g.jsx(ta,{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)??M0}),loading:lu.loading,dismiss:t=>lu.dismiss(t),remove:t=>lu.remove(t)}}function Cm(t=!1){const[e,r]=T.useState(t),n=T.useCallback(()=>{r(i=>!i)},[]);return[e,n]}function qle(){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 Yle=({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}=$le(n,i,o),y=U6(()=>{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=Re("dropdown",{"w-100":e,overflow:r});return T.useEffect(()=>{s==null||s(a)},[a]),g.jsx(F6.Provider,{value:v,children:g.jsx("div",{ref:y,className:x,children:typeof t=="function"?t(u,f,m):t})})},Qle=Object.assign(Yle,{Trigger:jle,Menu:Ple,Item:Ale,Separator:Lle,CheckboxItem:Tle,RadioItem:Dle,MenuGroup:Mle}),xt=Qle,Kle=()=>{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")}]},Zle=({control:t,selectedActivities:e,selectActivities:r})=>{const n=Kle(),{t:i}=we();return g.jsx("div",{className:"col d-flex",children:g.jsx(u1,{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))})]})})})},Jle=t=>g.jsx(xt.Trigger,{...t,"aria-haspopup":"listbox",role:"combobox"}),eue=Jle,tue=({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(eue,{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=tue,rue=["3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"],Sk=({name:t,control:e,placeholderOption:r,validate:n})=>g.jsx(u1,{name:t,control:e,rules:{required:!0,validate:n},render:({field:{onChange:i}})=>g.jsx(aA,{block:!0,size:"md",onValueChange:i,options:rue,"aria-required":!0,placeholderOption:r})}),nue=()=>{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")}]},iue="bpr.form.publication.language",sue=({control:t})=>{const e=nue();return g.jsx("div",{className:"col",children:g.jsx(u1,{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:iue})})})},oue=()=>{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(ta,{type:"info",className:"mb-12",children:t("bpr.form.publication.licence.text.3")}),g.jsx(ta,{type:"warning",children:t("bpr.form.publication.licence.text.4")})]})},aue=()=>{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")}]},lue=({control:t,selectedSubjectAreas:e,selectSubjects:r})=>{const n=aue(),{t:i}=we();return g.jsx("div",{className:"col d-flex",children:g.jsx(u1,{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))})]})})})},H6=T.createContext(null);function uue({defaultTheme:t,children:e}){var r;const{appCode:n}=yt(),i=TL({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(H6.Provider,{value:s,children:e})}function ba(){const t=T.useContext(H6);if(!t)throw new Error("Cannot be used outside of OdeClientProvider");return t}const cue=({children:t,space:e=null,flexDirection:r="row"})=>{const n=Re("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})},due=cue,V6=T.createContext(null),G6=()=>{const t=T.useContext(V6);if(!t)throw new Error("Cannot be rendered outside the Card component");return t},hue=({children:t})=>g.jsx("div",{className:"card-footer gap-16",children:t}),fue=hue,pue=()=>{const{isSelectable:t,isClickable:e,onClick:r,onSelect:n}=G6(),{t:i}=we();return t||e?g.jsxs("div",{className:"card-header",children:[t?g.jsx(Ro,{"aria-label":i("card.open.menu"),className:"z-3 bg-white",color:"secondary",icon:g.jsx(lz,{}),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},mue=pue,gue=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 I=Re("h-full",i);return g.jsx(wo,{src:b,alt:_,objectFit:"contain",width:e,height:e,className:I,style:{minWidth:e+"px"}})}const P=Re("app-icon",{...y,...v,...x,[`bg-light-${A}`]:A&&!f,[`color-app-${A}`]:A},i);return g.jsx("div",{className:P,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}`})})})}),ya=gue,vue=({imageSrc:t,className:e,variant:r="medium"})=>{const{app:n}=G6(),i=r==="landscape"?{width:"100%",height:"auto"}:null;return g.jsx("div",{className:Re("card-image",r),children:t?g.jsx(wo,{alt:"",src:t,objectFit:"cover",className:Re("h-full w-100",e)}):g.jsx(ya,{app:n,iconFit:"ratio",size:"80",variant:"rounded",...i})})},yue=vue,xue=({children:t,className:e})=>{const r=Re("card-text small text-break text-truncate text-truncate-1",e);return g.jsx("p",{className:r,children:t})},bue=xue,wue=({children:t,className:e})=>{const r=Re("card-title body text-break text-truncate text-truncate-2",e);return g.jsx("h3",{className:r,children:g.jsx("strong",{children:t})})},_ue=wue,Sue=({userSrc:t,creatorName:e})=>t?g.jsx(rc,{alt:e||"",size:"xs",src:t,variant:"circle",width:"24",height:"24"}):g.jsx(bC,{}),Eue=Sue,Tue=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(V6.Provider,{value:f,children:g.jsxs("div",{ref:u,className:Re("card",{"drag-focus":i,"is-selected":n,"c-pointer":r},l),children:[g.jsx(W6.Header,{}),typeof a=="function"?a(h):a]})})}),W6=Object.assign(Tue,{Title:_ue,Text:bue,Image:yue,Body:due,User:Eue,Footer:fue,Header:mue}),tr=W6;function Cue(t,e){const[r,n]=T.useState(null),{ref:i,inView:s}=tse({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 Aue=({type:t,roleMap:e})=>{const r=typeof(e==null?void 0:e.icon)!="string"&&t!=="unknown",n=Re("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(cz,{})})},Rue=Aue,Pue=({doc:t,isClickable:e=!0,isSelectable:r=!1,isSelected:n=!1,onClick:i,className:s})=>{var o;const a=T.useRef(null),l=Vk.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(c1,{width:22,height:22}),color:"bg-red-200"},ppt:{icon:".PPT",color:"bg-yellow-200"},img:{icon:g.jsx(iz,{width:22,height:22}),color:"bg-green-200"},video:{icon:g.jsx(Gz,{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(Uz,{width:22,height:22}),color:"bg-gray-300"}};return v[y]||v.unknown}const c=Re("file position-relative rounded",((o=u(l??"default"))==null?void 0:o.color)??"bg-yellow-200"),h=l==="img"||l==="video"?Me.workspace().getThumbnailUrl(t):null,f=Cue(h,{ref:a}),m=f&&{backgroundImage:`url(${h})`,backgroundSize:"cover"};return g.jsx(tr,{className:Re("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(Rue,{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})]})]})})},Iue=Pue,Mue=({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(GN,{}),variant:"ghost",color:"tertiary",onClick:o,children:l("tiptap.upload.retry")}),image:g.jsx(wo,{alt:"",src:`${a}/common/image-status-error.svg`,objectFit:"cover"})},idle:b,loading:{text:"",context:g.jsx(fo,{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(fo,{message:l("tiptap.tooltip.upload.loaded"),placement:"top",children:g.jsx(WN,{className:"text-success"})}),image:g.jsx(wo,{alt:"",src:u??"",width:"48",objectFit:"cover",className:"rounded",style:{aspectRatio:1/1}})},unknown:b},w=()=>v&&g.jsx(fo,{message:l("tiptap.tooltip.upload.edit"),placement:"top",children:g.jsx(Ro,{icon:g.jsx(Xz,{}),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(fo,{message:l("tiptap.tooltip.upload.delete"),placement:"top",children:g.jsx(Ro,{icon:g.jsx(NT,{}),variant:"ghost","aria-label":l("tiptap.tooltip.upload.delete"),color:"tertiary",onClick:i})})]})})]})})},kue=Mue,Oue=T.forwardRef(({children:t},e)=>g.jsx("div",{ref:e,className:"actionbar",children:t})),Due=Oue,Nue=T.forwardRef(({children:t,render:e,isFullscreen:r=!1,...n},i)=>{const s=Re("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=Nue;function Ki(t,e){if(Array.isArray(t))for(const r of t){const n=Ki(r,e);if(n)return n}else{if(t.id===e)return t;if(t.children)for(const r of t.children){const n=Ki(r,e);if(n)return n}}}function Fue(t,{parentId:e,newFolder:r}){return Am(t,n=>{var i;if(n.id===e){const s=[...((i=n.folder)==null?void 0:i.ancestors)||[]],o=X6([...s,n.id]);return{...n,children:[...n.children||[],new lA({...r,ancestors:o})]}}else return n})}function X6(t){return t.filter((e,r)=>t.indexOf(e)===r)}function jue(t,{folders:e}){return Am(t,r=>{if(!e.includes(r.id))return r})}const q6=(t,e)=>{if(t.children)for(const r of t.children){if(r.id===e)return t;const n=q6(r,e);if(n)return n}};function C2(t,e){var r;const n=Ki(t,e);return(r=n==null?void 0:n.folder)!=null&&r.ancestors?[...(n==null?void 0:n.folder.ancestors)||[],e]:e===Er.BIN?[Er.BIN]:[Er.DEFAULT]}function Am(t,e){return Y6(t,e)||t}function Y6(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=Y6(o,e,i);a&&s.push(a)}return{...i,children:s}}return i}function Bue(t,{destinationId:e,folders:r}){return Am(t,(n,i)=>{var s,o;if(e===n.id){const a=[...((s=n.folder)==null?void 0:s.ancestors)||[]],l=X6([...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=Ki(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 Uue=(t,e,r)=>Am(t,n=>(n.id===r&&(n.children=e==null?void 0:e.map(i=>new lA(i))),n));function $ue(t,{folderId:e,newFolder:r}){return Am(t,n=>n.id===e?new lA(r):n)}function zue(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){ff(this,"id"),ff(this,"name"),ff(this,"childNumber"),ff(this,"section",!1),ff(this,"children",[]),this.folder=e,this.id=e.id,this.name=e.name,this.childNumber=e.childNumber}}const Hue=T.createContext(null);function Q6(){return T.useContext(Hue)}class Ek{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 pf=(t,e)=>{const r="virtualID";if(!Object.hasOwnProperty.apply(t,[r])){const n=e??`${LB.generateVirtualId()}#${t.size}`;Object.defineProperty(t,r,{value:n,writable:!1})}return t[r]};function K6(t,e){if(e(t))return t;if(Array.isArray(t.children))for(const r of t.children){const n=K6(r,e);if(n)return n}}const Vy=(t,e)=>{const r=e==null?void 0:e.filter(n=>n.id===t&&n.available);return r&&r.length>0},Z6={blog:"Blog",mindmap:"MindMap",scrapbook:"ScrapBook",collaborativewall:"CollaborativeWall",timelinegenerator:"TimelineGenerator",wiki:"Wiki",exercizer:"Exercizer"},pl=t=>{if(t>0){let e=Math.floor(t/1e3),r=Math.floor(e/60);return e=e%60,r=r%60,Tk(r)+":"+Tk(e)}return"00:00"},Tk=t=>t.toString().padStart(2,"0"),Gue=()=>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",J6=T.createContext({ariaLabelId:"",ariaDescriptionId:"",focusId:""}),e8=()=>{const t=T.useContext(J6);if(!t)throw new Error("Cannot be rendered outside the Modal component");return t},Wue=t=>{const{ariaDescriptionId:e}=e8(),{children:r,className:n}=t,i=Re("modal-body",n);return g.jsx("div",{id:e,className:i,children:r})},Xue=Wue,que=t=>g.jsx("div",{className:"modal-footer",children:t.children}),Yue=que,Que=t=>{const{onModalClose:e,children:r}=t,{ariaLabelId:n,focusId:i}=e8(),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(Ro,{ref:s,"aria-label":o("close"),color:"tertiary",icon:g.jsx(NT,{}),type:"button",variant:"ghost",title:o("close"),onClick:e,className:"btn-close"})]})},Kue=Que,Zue=t=>g.jsx("p",{className:"modal-subtitle",children:t.children}),Jue=Zue,ece=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=U6(i),m=qle();Vle(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=Re("modal fade",{"show d-block":n,"modal-scrollable":a,viewport:o,[`modal-${s}`]:s}),v=Re("modal-dialog"),x={ariaLabelId:c,ariaDescriptionId:h,focusId:l},b=hC(n,{from:{x:-50,opacity:0},enter:{x:0,opacity:1},leave:{x:50,opacity:0}});return g.jsx(J6.Provider,{value:x,children:b((_,w)=>g.jsxs(g.Fragment,{children:[w&&g.jsx(Il.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(Il.div,{className:"modal-backdrop fade show",style:{opacity:.65}})]}))})}),tce=Object.assign(ece,{Header:Kue,Subtitle:Jue,Body:Xue,Footer:Yue}),Ye=tce,rce=({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}=bq(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:Re("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})]})]})},fo=rce,t8=T.createContext(null);function uA(){const t=T.useContext(t8);if(!t)throw new Error("Tabs compound components cannot be rendered outside the Tabs component");return t}const nce=({defaultId:t,items:e,onChange:r})=>{const[n,i]=T.useState(t||""),[s,o]=T.useState(0),[a,l]=T.useState(0),u=T.useRef([]),c=T.useCallback(y=>{i(y)},[]);T.useEffect(()=>{const y=e.find(v=>v.id===n);y&&(r==null||r(y))},[n]),T.useEffect(()=>{function y(){var v;if(((v=document==null?void 0:document.activeElement)==null?void 0:v.tagName)!=="INPUT"){const x=e.findIndex(_=>_.id===n);x===-1&&t&&i(t);const b=u.current[x];b&&(b.focus(),l((b==null?void 0:b.offsetLeft)??0),o((b==null?void 0:b.clientWidth)??0))}}return y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[n,e,t]);const h=T.useCallback(y=>{var v,x,b;const _=e.findIndex(w=>w.id===y);y===((v=e[0])==null?void 0:v.id)?i((x=e[e.length-1])==null?void 0:x.id):i((b=e[_-1])==null?void 0:b.id)},[e]),f=T.useCallback(y=>{var v,x,b;const _=e.findIndex(w=>w.id===y);y===((v=e[e.length-1])==null?void 0:v.id)?i((x=e[0])==null?void 0:x.id):i((b=e[_+1])==null?void 0:b.id)},[e]),m=T.useCallback(y=>{var v,x;switch(y.code){case"ArrowLeft":h(n);break;case"ArrowRight":f(n);break;case"Home":i((v=e[0])==null?void 0:v.id);break;case"End":i((x=e[e.length-1])==null?void 0:x.id);break}},[n,e,f,h]);return{activeTab:n,setSelectedTab:c,tabsRef:u,tabUnderlineLeft:a,tabUnderlineWidth:s,onKeyDown:m}},ice=({icon:t,label:e,id:r,order:n})=>{const{activeTab:i,setSelectedTab:s,onKeyDown:o,tabsRef:a}=uA(),{t:l}=we(),u=Re("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)})]})})},sce=ice,oce=t=>{const{items:e,tabUnderlineLeft:r,tabUnderlineWidth:n}=uA(),{className:i,...s}=t,o=Re("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(oa.Item,{order:l,...a},a.id))}),g.jsx("span",{className:"nav-slide",style:{left:r,width:n}})]})},ace=oce,lce=({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})})},uce=lce,oa=({defaultId:t,items:e,onChange:r,children:n})=>{const{activeTab:i,setSelectedTab:s,tabsRef:o,tabUnderlineLeft:a,tabUnderlineWidth:l,onKeyDown:u}=nce({defaultId:t,items:e,onChange:r}),c=T.useMemo(()=>({activeTab:i,items:e,setSelectedTab:s,tabsRef:o,tabUnderlineLeft:a,tabUnderlineWidth:l,onKeyDown:u}),[i,e,u,s,a,l,o]),h=e.find(f=>f.id===i);return g.jsx(t8.Provider,{value:c,children:typeof n=="function"?n(h):g.jsxs(g.Fragment,{children:[g.jsx(oa.List,{}),g.jsx(oa.Panel,{currentItem:h,children:h==null?void 0:h.content})]})})};oa.Item=sce;oa.Panel=uce;oa.List=ace;const cce=T.forwardRef(({children:t,className:e,...r},n)=>{const i=Re("breadcrumb-item",e);return g.jsx("li",{ref:n,className:i,...r,children:t})}),k0=cce,dce=T.forwardRef(({children:t,className:e},r)=>{const n=Re("breadcrumb d-flex flex-nowrap align-items-center mb-0",e);return g.jsx("ol",{ref:r,className:n,children:t})}),hce=dce;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 fce=T.forwardRef(({children:t,app:e,className:r},n)=>{const{t:i}=we(),{getIconClass:s}=cA(),o=Re("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})}),pce=fce,mce=T.forwardRef(({app:t,name:e},r)=>{const{t:n}=we();return g.jsx(pce,{app:t,ref:r,className:"mw-100",children:g.jsx(hce,{className:"gap-12 mw-100",children:e?g.jsxs(g.Fragment,{children:[g.jsx(k0,{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(ya,{app:t,size:"40"})})}),g.jsx(k0,{children:g.jsx(zN,{color:"var(--edifice-gray-600)",width:20,height:20})}),g.jsx(k0,{className:"text-truncate",children:g.jsx(Ss,{level:"h1",headingStyle:"h3",className:"text-truncate",children:e})})]}):g.jsxs(k0,{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(ya,{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)})]})})})}),gce=mce,r8=T.createContext(null),J1=()=>{const t=T.useContext(r8);if(!t)throw new Error("Cannot be rendered outside the FormControl component");return t},vce=({children:t})=>{const{status:e}=J1(),r=Re("form-text",{"is-invalid":e==="invalid",valid:e==="valid"});return g.jsx("p",{className:r,children:g.jsx("em",{children:t})})},yce=vce,xce=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}=J1(),h=Re({"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})}),Kn=xce,bce=T.forwardRef(({leftIcon:t,optionalText:e,requiredText:r="*",children:n,className:i},s)=>{const{id:o,isOptional:a,isRequired:l}=J1(),{t:u}=we(),c=Re("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})]})}),Gi=bce,wce=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(r8.Provider,{value:u,children:g.jsx("div",{ref:l,className:e,...a,children:t})})}),_ce=Object.assign(wce,{Label:Gi,Input:Kn,Text:yce}),Ot=_ce,Sce=({placeholder:t,value:e="",searchMinLength:r=3,handleSearchInputChange:n})=>{const{triggerProps:i,itemProps:s,setVisible:o}=bh(),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(Kn,{...a,className:"max-w-512",noValidationIcon:!0,placeholder:t,size:"md",type:"search",onKeyDown:s.onMenuItemKeyDown})})},Ece=Sce,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=Ece;const Tce=dA,n8=T.createContext(null);function hA(){const t=T.useContext(n8);if(!t)throw new Error("Cannot be rendered outside Dropzone Provider");return t}const Cce=()=>{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")})})})},Ace=Cce,Rce=({children:t,multiple:e})=>{const{t:r}=we(),{files:n,inputRef:i}=hA(),s=n&&n.length>0,o=Re("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(d1,{}),disabled:!e,onClick:()=>{var a;return(a=i==null?void 0:i.current)==null?void 0:a.click()},children:r("dropzone.add.more")})})}),g.jsx("div",{className:"p-8",children:t})]})},Pce=Rce,Ice=()=>{const{t}=we(),{files:e,inputRef:r}=hA(),n=e&&e.length>0,i=Re("dropzone-import-wrapper",{"d-flex":!n,"d-none":n});return g.jsxs("div",{className:i,children:[g.jsx(W$,{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")})]})},Mce=Ice,Wu=({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}=Hle(e?{forceFilters:!0}:void 0),v=Re("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(n8.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:"d-flex flex-fill",children:[n?null:g.jsxs(g.Fragment,{children:[g.jsx(Wu.File,{multiple:r,children:i}),g.jsx(Wu.Import,{})]}),g.jsx(Wu.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})]})})};Wu.File=Pce;Wu.Import=Mce;Wu.Drag=Ace;const kce=Wu,so=({children:t,className:e,...r})=>{const n=Re("grid",e);return g.jsx("div",{className:n,...r,children:t})},Oce=({sm:t,md:e,lg:r,xl:n,children:i,className:s,as:o,...a})=>{const l=o||"div",u=Re({[`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})};so.Col=Oce;const Dce=T.forwardRef(({position:t=!0,caption:e},r)=>{const[n]=Pn(),i=`${n}/loading/screen-loading.gif`,s=Re("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=Re("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"})]})}),fr=Dce,Nce=T.forwardRef(({src:t,is1d:e,translate:r="Retour accueil"},n)=>{const i=Re("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"})})}),Ck=Nce,Lce=({children:t,className:e})=>{const r=Re("popover-body",e);return g.jsx("div",{className:r,children:t})},Fce=({children:t,className:e})=>{const r=Re("popover-footer p-8",e);return g.jsx("div",{className:r,children:t})},i8=T.forwardRef(({children:t,className:e,id:r,isVisible:n,...i},s)=>{const o=Re("popover d-block position-absolute top-100 start-50 translate-middle-x",e);return hC(n,{from:{opacity:0},enter:{opacity:1},leave:{opacity:0},config:{duration:0}})((a,l)=>l&&g.jsx(Il.div,{ref:s,"aria-labelledby":r,className:o,role:"tooltip",style:a,...i,children:t}))}),jce=({isVariant:t=!1,size:e="md",placeholder:r="search",className:n,disabled:i,onChange:s,onClick:o,...a})=>{const{t:l}=we(),u=Re(n,{"input-group":!t,"position-relative":t}),c=Re({"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(AS,{})}),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(AS,{}),className:"border-start-0",onClick:h})]})},s8=jce,Bce=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}=J1(),h=Re({"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=Bce,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=Re("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 P;const I=(P=v.current)==null?void 0:P.querySelectorAll("button"),M=[];let N=!1;I==null||I.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=P=>{P.target.classList.add("focus")},_=P=>{P.target.classList.remove("focus")},w=P=>{var I,M;const N=u.indexOf(P.currentTarget);switch(P.code){case"ArrowLeft":P.currentTarget===h?m==null||m.focus():(I=u[N-1])==null||I.focus();break;case"ArrowRight":P.currentTarget===m?h==null||h.focus():(M=u[N+1])==null||M.focus();break}},E=P=>{var I;return typeof P.tooltip=="string"?P.tooltip:(I=P.tooltip)==null?void 0:I.message},A=P=>{var I;return typeof P.tooltip!="string"?(I=P.tooltip)==null?void 0:I.position:"top"};return g.jsx("div",{ref:T2(o,v),className:x,role:"toolbar","aria-label":"Text Formatting","aria-controls":i,onFocus:b,onBlur:_,children:t.map((P,I)=>{if(P.visibility==="hide")return null;switch(P.type){case"divider":return g.jsx("div",{className:"toolbar-divider"},P.name??I);case"button":return g.jsx(fo,{message:E(P),placement:A(P),children:T.createElement(it,{...P.props,key:P.name??I,color:P.props.color?P.props.color:"tertiary",variant:"ghost",tabIndex:I===a?0:-1,onKeyDown:w})},P.name??I);case"icon":return g.jsx(fo,{message:E(P),placement:A(P),children:T.createElement(Ro,{...P.props,key:P.name??I,color:P.props.color?P.props.color:"tertiary",variant:P.props.variant?P.props.variant:"ghost",tabIndex:I===a?0:-1,onKeyDown:w})},P.name??I);case"dropdown":return T.createElement(xt,{...P.props,key:P.name??I,extraTriggerKeyDownHandler:w,overflow:P.overflow});case"primary":return g.jsx(fo,{message:E(P),placement:A(P),children:g.jsx(it,{...P.props,variant:"filled",color:"primary",tabIndex:I===a?0:-1,onKeyDown:w})},P.name??I)}return null})})}),A2=({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:Re("action-container d-flex align-items-center gap-8 px-2",{"drag-focus":f,"py-4":!t.section}),arrow:Re({"py-4":!t.section,"py-8":t.section,invisible:!Array.isArray(t.children)||t.children.length===0}),button:Re("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}=Gj({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))},P=M=>g.jsx(M?Tp:zN,{title:v("foldUnfold"),width:y,height:y}),I=()=>{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:I()&&P(u)}),g.jsxs("div",{tabIndex:0,role:"button",className:m.button,onClick:()=>b(t.id),onKeyDown:E,children:[t.section&&e&&g.jsx(jN,{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(d1,{height:16,width:16})})]}),Array.isArray(t.children)&&!!t.children.length&&u&&g.jsx("ul",{role:"group",children:t.children.map(M=>g.jsx(A2,{node:M,selectedNodeId:r,expandedNodes:n,siblingsNodes:i,draggedNodeId:s,handleItemClick:o,handleToggleNode:a},M.id))})]})},t.id)},Uce=({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 $;const V=($=F.children)==null?void 0:$.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),$=(L=j.children)==null?void 0:L.filter(V=>V.id!==F.id);$!=null&&$.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(!Ki(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=zue(t,j),L=Array.from(H);F.forEach(O=>{const $=L.indexOf(O);$>-1&&L.splice($,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)},P=j=>{c.has(j)?A(j):E(j)},I=j=>{v!==j&&u(j)},M=j=>{I(j),E(j),a==null||a(j)},N=j=>{P(j)},z=j=>{Ki(t,r)&&E(j)};return{selectedNodeId:v,expandedNodes:c,siblingsNodes:f,draggedNodeId:m,handleItemClick:M,handleFoldUnfold:N}},$ce=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}=Uce({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(A2,{node:b,showIcon:l,selectedNodeId:h,expandedNodes:f,siblingsNodes:m,draggedNodeId:y,handleItemClick:v,handleToggleNode:x,handleItemAction:o},b.id)):g.jsx(A2,{node:r,selectedNodeId:h,expandedNodes:f,siblingsNodes:m,showIcon:l,draggedNodeId:y,handleItemClick:v,handleToggleNode:x})})})}),dd=$ce,zce=T.forwardRef(({children:t},e)=>g.jsx("span",{className:"visually-hidden",ref:e,children:t})),ml=zce;function Hce(){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 Wi(t){const e=Q6(),[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 Me.rights().sessionHasWorkflowRight(t):i=await Me.rights().sessionHasWorkflowRights(t);n(i)})()},[t,e]),r}const Vce=()=>{const t=Wi("fr.openent.zimbra.controllers.ZimbraController|view"),e=Wi("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 Me.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 Me.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}},Gce=Vce;function Wce({user:t,avatar:e}){const{appCode:r}=yt(),{t:n}=we(),{theme:i}=ba(),s=n(r),[o,a]=T.useState(!0),[l,u]=$6(),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=Hce(),x=Wi("net.atos.entng.community.controllers.CommunityController|view"),b=Wi("org.entcore.conversation.controllers.ConversationController|view"),_=Wi("fr.openent.searchengine.controllers.SearchEngineController|view"),w=T.useCallback(()=>{a(!o)},[o]),E=async()=>{await Me.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 Xce=t=>{const e=T.useRef(),r=en(),{t:n}=we();return T.useEffect(()=>{const i=Me.notify().events().subscribe(NB.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(Ie.createElement("div",{children:[e.current]}),t)});return()=>i.revoke()},[n,r]),e.current},qce=Xce;function o8(){const[t,e]=T.useState(!1);T.useEffect(()=>{r()},[]);const r=T.useCallback(async()=>{const n=await Me.session().isAdml();e(n)},[]);return{isAdml:t}}const Yce=()=>{var t;const{user:e,appCode:r}=yt(),n=Z6[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}`},Qce=Yce,Kce=()=>({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 Me.workspace().searchDocuments({filter:"all",id:u,limit:1}),h=c.length?c[0].name:void 0;await Me.workspace().updateFile(u,r,{alt:t,legend:n,name:h});const f=(await Me.workspace().searchDocuments({filter:"all",id:u,limit:1}))[0];return{file:f,src:`/workspace/${f.public?"pub/":""}document/${u}`}}else{const u=await Me.workspace().saveFile(r,{application:s,parentId:i,visibility:o});return`/workspace/${u.public?"pub/":""}document/${u._id}`}},create:async(t,e)=>await Me.workspace().saveFile(t,e),remove:async t=>!t||Array.isArray(t)&&t.length===0?Promise.resolve():await Me.workspace().deleteFile(Array.isArray(t)?t:[t])}),ex=Kce,Zce=()=>{const t=T.useRef(null),[e,r]=T.useState(),{remove:n}=ex();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)}}},a8=Zce,Jce=t=>{const[e,r]=T.useState([]);T.useEffect(()=>{(async()=>(await Eb.initialize(Me,t),await Eb.registerBehaviours(t),r(Eb.resourceProducingApps)))()},[]);const n=T.useCallback(async i=>{const[s]=i.types;return await Me.behaviour(t,s).loadResources(i)},[t]);return{resourceApplications:e,loadResources:n}},ede=(t,e="media-library")=>{const[r,n]=T.useState({}),{browser:i,device:s}=B6(navigator.userAgent),{create:o}=ex(),a=T.useCallback(y=>r[pf(y)],[r]),l=(y,v)=>{n(x=>{const b=pf(y);return{...x,[b]:v}})},u=y=>{n(v=>{const x=pf(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(Gk.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 Me.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 pf(v,pf(y)),c(v,x)}return{getUploadStatus:a,setUploadStatus:l,clearUploadStatus:u,uploadFile:c,uploadAlternateFile:m,uploadBlob:h}},l8=ede,tde=({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}=ex(),{getUploadStatus:f,setUploadStatus:m,clearUploadStatus:y,uploadFile:v,uploadAlternateFile:x}=l8(e,r),b=T.useCallback(P=>{P.forEach(async(I,M)=>{if(I==null)return;let N;if(I.type.startsWith("image"))try{const z=await $q.resizeImageFile(I);N=await x(I,z),u(M,z)}catch(z){console.error(z)}N||(N=await v(I)),N&&i(z=>[...z,N])})},[x,v,u]);T.useEffect(()=>{let P=0;const I=a.map(M=>{if(P>=5)return null;const N=f(M);return N==="loading"&&P++,N?null:M});I.forEach(M=>M&&m(M,"idle")),b(I)},[a,n,f,m,b]),T.useEffect(()=>{const P=_(a,n);t(P)},[n]);const _=(P,I)=>{const M=P.reduce((N,z,j)=>(N[z.name]=j,N),{});return I.sort((N,z)=>M[N.name]-M[z.name])};async function w(P){const I=n.find(M=>M.name===P.name);I&&(await c(I),y(P),i(M=>M.filter(N=>N.name!==(I==null?void 0:I.name)))),l(P)}async function E({blob:P,legend:I,altText:M}){if(s)try{const N=await h({blob:P,legend:I,alt:M,uri:A(s)});N&&typeof N=="object"&&i(z=>z.map(j=>j._id===N.file._id?{...N.file}:j))}finally{o(void 0)}}const A=(P,I)=>{const M=`/workspace/${P!=null&&P.public?"pub/":""}document/${P==null?void 0:P._id}`;return P?I?Vue(M):M:""};return{files:a,getUploadStatus:f,clearUploadStatus:y,uploadedFiles:n,editingImage:s,setEditingImage:o,getUrl:A,updateImage:E,uploadFile:v,removeFile:w}},rde=tde;function wh(){const{user:t,userDescription:e}=yt(),{theme:r}=ba();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 O0(t,e,r,n){const i=Q6(),s=Wi("org.entcore.workspace.controllers.WorkspaceController|listDocuments"),o=Wi("org.entcore.workspace.controllers.WorkspaceController|listFolders");function a(h,f){switch(f.type){case"update":{const m=Ki(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 Me.workspace().listDocuments(r,m),v=[],x=[];y.filter(b=>{if(!n||b.eType==="folder")return!0;const _=Vk.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 nde(){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 Me.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 ide(){const{currentLanguage:t}=yt(),{userDescription:e}=wh(),{isAdml:r}=o8(),{theme:n}=ba(),i=window.innerWidth<=768,s=Wi("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 Me.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 sde(){const t=Wi("org.entcore.portal.controllers.PortalController|optionalFeatureCantoo");return T.useEffect(()=>{t&&!document.getElementById("cantoo-edifice-script")&&(async()=>{const e=await Me.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 ode({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 ade({onSuccess:t,resource:e}){const{user:r,appCode:n}=yt(),i=en(),[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}}=OT({mode:"onChange"}),[x,b]=T.useState([]),[_,w]=T.useState([]),E=(A,P,I)=>{let M=[...P];const N=M.findIndex(z=>z===A);P.includes(A)?M=P.filter((z,j)=>j!==N):M=[...P,A],I(M)};return{control:a,cover:s,formState:{errors:f,isSubmitting:m,isDirty:y,isValid:v},handleDeleteImage:()=>o(""),handlePublish:async A=>{const P=r?r==null?void 0:r.userId:"";try{let I=new Blob;typeof s=="string"?I=await Me.http().get(s,{responseType:"blob"}):s?I=await Me.http().get(URL.createObjectURL(s),{responseType:"blob"}):e!=null&&e.thumbnail&&(I=await Me.http().get(e==null?void 0:e.thumbnail,{responseType:"blob"}));const M=await Me.http().get(`/userbook/avatar/${P}?thumbnail=48x48`,{responseType:"blob"}),N=await Me.http().get(`/directory/user/${P}/attachment-school`,{responseType:"json"}),z=Z6[n],j={activityType:x,age:[A.ageMin,A.ageMax],application:z,cover:I,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:P,userStructureName:N.name||(r==null?void 0:r.structureNames[0])},H=await Me.resource(n).publish(j);H.success?i.success(g.jsx(ode,{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(I){console.error(I),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 lde=(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 Me.resource(t).searchResource({application:t,id:e});n(i)}catch(i){console.error(i)}})()},[]),r},mA=lde,ude=({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=Re("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(Ro,{"aria-label":t,color:"tertiary",icon:g.jsx(q$,{}),onClick:h,type:"button",variant:"ghost"}),g.jsx(Ro,{"aria-label":e,color:"danger",disabled:!u,icon:g.jsx(LN,{width:"20",height:"20"}),onClick:f,type:"button",variant:"ghost"})]}),u?g.jsx(rc,{alt:"",src:u,size:"xl"}):g.jsx(ya,{app:o,iconFit:"ratio",size:"160",variant:"rounded"})]})},u8=ude,cde=({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(FT,{width:12,height:12,className:"me-8 text-danger"}):g.jsx(Zv,{width:12,height:12,className:"me-8 text-danger"}),pl(t!=="IDLE"?r:0)+" / "+pl(i)]}),e!=="IDLE"&&g.jsxs("div",{className:"d-flex align-items-center mx-auto",children:[g.jsx(c1,{width:12,height:12,className:"me-8"}),pl(n*1e3)," /",pl(r)]})]}),dde=cde;function hde(t,e,r=!1,n="protected",i="media-library"){var s;function o(q,re){return{...q,...re.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:P}=we(),{create:I}=ex(),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 re,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),(re=E.current)==null||re.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}),re=new AudioContext({sampleRate:N}),ue=re.createMediaStreamSource(q);try{await re.audioWorklet.addModule("/infra/public/js/audio-recorder-processor.js")}catch(me){console.error(me)}const le=new AudioWorkletNode(re,"audio-recorder-processor");le.port.addEventListener("message",z),b({type:"update",updatedState:{micStream:q,micStreamAudioSourceNode:ue,audioContext:re,recordTime:0,audioWorkletNode:le,recordState:"RECORDING",playState:"IDLE"}}),A.current=[],E.current=[],le.port.start(),ue.connect(le),le.connect(re.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 re=window.URL.createObjectURL(q.data);b({type:"update",updatedState:{isEncoding:!1}}),w.current&&(w.current.src=re),e&&e(re)})},[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]),$=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 re=(q=_.current)==null?void 0:q.value;if(!re){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],re,{type:"audio/mp3"}),_e=await I(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]),U=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=P(a==="IDLE"?"bbm.audio.record.start":"bbm.audio.record.resume"),K=[{type:"icon",name:"record",visibility:a==="RECORDING"?"hide":"show",props:{icon:g.jsx(Zv,{}),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(xz,{}),color:"danger",disabled:a!=="RECORDING",onClick:L,"aria-label":P("bbm.audio.record.pause")},tooltip:P("bbm.audio.record.pause")},{type:"divider"},{type:"icon",name:"encoding",visibility:x?"show":"hide",props:{icon:g.jsx(UN,{style:{animation:"loading 1s infinite"}}),disabled:!0}},{type:"icon",name:"play",visibility:x||l==="PLAYING"?"hide":"show",props:{icon:g.jsx($N,{}),disabled:a!=="RECORDED"&&a!=="PAUSED"&&a!=="SAVED",onClick:O,"aria-label":P("bbm.audio.play.start")},tooltip:P("bbm.audio.play.start")},{type:"icon",name:"playPause",visibility:!x&&l==="PLAYING"?"show":"hide",props:{icon:g.jsx(FT,{}),onClick:$,"aria-label":P("bbm.audio.play.pause")},tooltip:P("bbm.audio.play.pause")},{type:"icon",name:"stop",props:{icon:g.jsx(Az,{}),disabled:l!=="PLAYING"&&l!=="PAUSED",onClick:U,"aria-label":P("bbm.audio.play.stop")},tooltip:P("bbm.audio.play.stop")},{type:"divider"},{type:"icon",name:"reset",props:{icon:g.jsx(VN,{}),disabled:a!=="RECORDED"&&a!=="PAUSED"&&l!=="PLAYING"&&l!=="PAUSED",onClick:V,"aria-label":P("bbm.audio.record.reset")},tooltip:P("bbm.audio.record.reset")},{type:"icon",name:"save",visibility:r?"hide":"show",props:{icon:g.jsx(jT,{}),disabled:a!=="RECORDED"&&a!=="PAUSED"&&l!=="PLAYING"&&l!=="PAUSED"||a==="SAVED"||!((s=_.current)!=null&&s.value),onClick:k,"aria-label":P("bbm.audio.record.save")},tooltip:P("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 fde=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}=hde(t,e,r,n,"media-library"),{t:y}=we();T.useImperativeHandle(i,()=>({save:m}));const[v,x]=T.useState(0),b=Re({"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(Kn,{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(c1,{width:64,height:64,className:b})}),g.jsx(dde,{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})]})}),pde=fde,mde=({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(CS,{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")})})]})},gde=mde,vde=({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(zz,{}),"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(GN,{}),"aria-label":r("rotate"),children:r("rotate"),onClick:()=>s("ROTATE")},tooltip:r("rotate")},{type:"button",name:"crop",props:{color:"tertiary",leftIcon:g.jsx(H$,{}),"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(D$,{}),"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})},yde=vde,xde=100,Ak=100,bde=450,wde=64,_de=.5,Sde="image";function R2(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 P2(t,{spriteName:e,imgDatasource:s,settings:n});const a=t==null?void 0:t.stage.getChildByName(e,!0);o(a)}})}async function P2(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 Ar?r:await Ee.fromURL(r),o=s instanceof Ar?s:Ar.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);Ede(t,o)}function Ede(t,e){var r;const n=t.view.parentNode,i=window.innerWidth-wde,s=Math.max((n==null?void 0:n.offsetWidth)??0,Ak),o=Tde({width:e.width,height:e.height},{width:{max:Math.min(s,i),min:Ak},height:{min:xde,max:window.innerHeight-bde}}),{height:a,width:l}=o;(r=t.view)!=null&&r.style&&(t.view.style.width=`${l}px`,t.view.style.height=`${a}px`)}function Tde(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 Cde(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",_de):r("EXTRACT_FAILED")})}function Ade(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 I2(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 Rde({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 Pde({application:t,sprite:e,newHeight:r,newWidth:n}){e.anchor.x=.5,e.anchor.y=.5,e.position=new tt(n/2,r/2),t.stage.height=r,t.stage.width=n,t.renderer.resize(n,r)}const Ide=20,Mde=({maxSize:t=Ide,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=I2(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}},kde=Mde;function Ode(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 c8=20,Dde=50,vA="BRUSH_CURSOR";function Nde(t,e){const r=new Vi;for(const n of t)n&&(r.beginFill(16777215,1),r.drawCircle(n.x,n.y,c8/e),r.lineStyle(0),r.endFill());return r}function Lde(t,{spriteName:e}){return Ode(Dde,r=>t.stage.toLocal(r.global),r=>{const n=t.stage.getChildByName(e),i=gA(t);if(n==null)return;const s=new Ar(n.texture);s.filters=[new bj(8,4,Math.min(i,1))],s.width=n.width,s.height=n.height,s.scale=new tt(1,1),s.anchor=n.anchor,s.mask=Nde(r,i),n.addChild(s)})}function Fde(t){d8(t);const e=gA(t),r=new Vi;return r.lineStyle(Math.max(1,1/e),16711680),r.drawCircle(0,0,c8/e),r.endFill(),r.name=vA,t.stage.addChild(r),r}function d8(t){const e=t.stage.getChildByName(vA);e&&e.removeFromParent()}function jde(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 Bde(t,{spriteName:e}){t.stage.interactive=!0;const r=Fde(t),n=jde(t);t.stage.on("pointermove",n);const i=Lde(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 Ude(t){d8(t),t.stage.off("pointerdown"),t.stage.off("pointermove")}const $de=["TOP_LEFT","TOP_RIGHT","BOTTOM_LEFT","BOTTOM_RIGHT"],D0=0,zde=20,yA="CROP_BACKGROUND_NAME",Rm="CROP_MASK_NAME";function M2(t){return"CROP_CORNER_"+t}function Hde(t,{spriteName:e}){h8(t);const r=t.stage.getChildByName(e);if(r==null)return;const n=r.getBounds(),i=t.renderer.generateTexture(t.stage).clone(),s=new Ar(i);s.height=n.height,s.width=n.width,s.position=new tt(0,0);const o=new Vi;o.beginFill(16777215,.5),o.drawRect(0,0,n.width,n.height),o.endFill(),o.name=yA,o.position=new tt(n.x,n.y);const a=new Vi;a.beginFill(0,1),a.drawRect(0,0,n.width-2*D0,n.height-2*D0),a.endFill(),a.position=new tt(D0,D0),a.name=Rm,s.mask=a,t.stage.addChild(o),o.addChild(a),o.addChild(s)}function h8(t){const e=t.stage.getChildByName(yA,!0);e==null||e.removeFromParent()}function f8(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 Vde(t){const e=t.stage.getChildByName(Rm,!0);e!=null&&$de.forEach(r=>{const n=t.stage.getChildByName(M2(r),!0);if(n==null)return;const i=f8(r,{height:e.height,width:e.width,x:e.x,y:e.y});n.position=new tt(i.x,i.y)})}function N0(t,e,{spriteName:r}){const n=t.stage.getChildByName(M2(e),!0),i=gA(t);n==null||n.removeFromParent();const s=t.stage.getChildByName(yA,!0),o=t.stage.getChildByName(Rm,!0);if(t.stage.getChildByName(r)==null||s===null||s===void 0||o===void 0||o===null)return;const l=f8(e,{height:o.height,width:o.width,x:o.x,y:o.y}),u=new Vi;u.beginFill(4960213,1),u.arc(0,0,zde/i,l.start,l.end),u.lineTo(0,0),u.endFill(),u.position=new tt(l.x,l.y),u.name=M2(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,Gde(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 Gde(t,e,r){const n=t.stage.getChildByName(Rm,!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}}Vde(t)}function Wde(t,{spriteName:e}){xA(t),t.stage.interactive=!0,t.stage.interactiveChildren=!0,Hde(t,{spriteName:e}),N0(t,"BOTTOM_LEFT",{spriteName:e}),N0(t,"BOTTOM_RIGHT",{spriteName:e}),N0(t,"TOP_LEFT",{spriteName:e}),N0(t,"TOP_RIGHT",{spriteName:e})}function xA(t){h8(t),t.stage.off("pointermove"),t.render()}function Xde(t){const e=t.stage.getChildByName(Rm,!0);if(e==null)return;xA(t);const r=t.renderer.generateTexture(t.stage).clone(),n=new Ar(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 Ar(o)}const qde=20,tx="CONTROL_NAME";function p8(t){return"RESIZE_CORNER_"+t}function Yde(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 Qde(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 tt(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 tt(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 tt(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 tt(c,u),e.width=a-2*c,e.height=l-2*u;break}}}function kf(t,e){const r=t.stage.getChildByName(p8(e),!0);r==null||r.removeFromParent()}function L0(t,e,{spriteName:r}){kf(t,e);const n=t.stage.getChildByName(r,!0),i=t.stage.getChildByName(tx,!0);if(n==null||i===null||i===void 0)return;const s=Yde(e,i),o=new Vi;o.beginFill(4960213,1),o.arc(0,0,qde,s.start,s.end),o.lineTo(0,0),o.endFill(),o.position=new tt(s.x,s.y),o.name=p8(e),o.interactive=!0;let a=!1;t.stage.on("pointermove",c=>{if(a===!1)return;const h=t.stage.toLocal(c.global);Qde(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 Kde(t,e){m8(t);const r=t.stage.getChildByName(e,!0);if(r==null)return;const n=t.renderer.generateTexture(t.stage),i=new Ar(n);t.stage.children.forEach(o=>{o.alpha=0});const s=new Vi;s.drawRect(0,0,r.width,r.height),s.name=tx,s.interactive=!0,s.interactiveChildren=!0,t.stage.interactive=!0,t.stage.interactiveChildren=!0,t.stage.addChild(s),s.addChild(i)}function m8(t){const e=t.stage.getChildByName(tx,!0);e==null||e.removeFromParent(),t.stage.children.forEach(r=>{r.alpha=1})}function Zde(t,e){Kde(t,e),L0(t,"BOTTOM_LEFT",{spriteName:e}),L0(t,"BOTTOM_RIGHT",{spriteName:e}),L0(t,"TOP_LEFT",{spriteName:e}),L0(t,"TOP_RIGHT",{spriteName:e})}function g8(t){m8(t),kf(t,"BOTTOM_LEFT"),kf(t,"BOTTOM_RIGHT"),kf(t,"TOP_LEFT"),kf(t,"TOP_RIGHT"),t.stage.off("pointermove")}function Jde(t,e){Zde(t,e)}function ehe(t){g8(t),t.stage.off("pointermove"),t.render()}function the(t){var e;const r=(e=t==null?void 0:t.stage)==null?void 0:e.getChildByName(tx,!0),n=r?{height:r.height,width:r.width}:void 0;if(g8(t),n){const i=t.renderer.generateTexture(t.stage).clone(),s=new Ar(i);return s.width=n.width,s.height=n.height,s}else return}async function rhe(t,e){const r=t==null?void 0:t.stage.getChildByName(e,!0);if(t&&r){if(!t)return;const n=await I2(t),i=await R2(t,{imgDatasource:n,spriteName:e,settings:Rde({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,Pde({application:t,sprite:i,newHeight:i.width,newWidth:i.height}),t.render();const l=await I2(t);s!==void 0&&(a.style.maxHeight=s),o!==void 0&&(a.style.visibility=o),await R2(t,{imgDatasource:l,spriteName:e})}}function nhe({application:t,spriteName:e,onSave:r}){return{rotate:async()=>{t&&await rhe(t,e)},startCrop:()=>{t&&Wde(t,{spriteName:e})},stopCrop:n=>{if(t){if(n){const i=Xde(t);i&&r(i)}xA(t)}},startBlur:()=>{t&&Bde(t,{spriteName:e})},stopBlur:()=>{t&&Ude(t)},startResize:()=>{t&&Jde(t,e)},stopResize:n=>{if(t){if(n){const i=the(t);i&&r(i)}ehe(t)}}}}function ihe({imageSrc:t,spriteName:e=Sde}){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}=nhe({spriteName:e,application:r,onSave(_){r&&P2(r,{imgDatasource:_,spriteName:e})}}),m=()=>r?Cde(r):Promise.resolve(void 0),y=()=>{if(r)return Ade(r)},{restore:v,historize:x,historyCount:b}=kde({application:r,spriteName:e,onRestore(_,w){r&&R2(r,{imgDatasource:_,spriteName:e,settings:w})}});return T.useEffect(()=>{r&&(s(!0),P2(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 she=({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:P,rotate:I,startCrop:M,stopCrop:N,startResize:z,stopResize:j,historyCount:H,loading:F}=ihe({imageSrc:r}),L=()=>{A(),N(l==="CROP"),j(l==="RESIZE")},O=async()=>{try{h(!0),L();const k=await _();k&&await o({blob:k,legend:y,altText:f})}catch(k){s==null||s(`${k}`)}finally{h(!1)}},$=()=>{i()},V=async k=>{switch(L(),u(k),b(!0),k){case"ROTATE":{await I();break}case"UNDO":{await P();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:$,size:"lg",children:[g.jsx(Ye.Header,{onModalClose:$,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(yde,{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(lre.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(fr,{})})]}),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(Gi,{children:a("alttext")}),g.jsx(Kn,{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(Gi,{children:a("legend")}),g.jsx(Kn,{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:$,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")})]})]})},ohe=she,ahe=({doc:t,isClickable:e=!0,isSelectable:r=!1,isSelected:n=!1,onClick:i,className:s})=>{const{fromNow:o}=IL(),{fromDate:a}=T.useMemo(()=>({fromDate:o(t.modifiedAt)}),[o,t]);return g.jsx(tr,{className:Re("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(wo,{alt:"",height:48,width:48,src:t.thumbnail,objectFit:"cover",className:"rounded h-full",style:{aspectRatio:1/1}}):g.jsx(ya,{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(BT,{width:"20",height:"20"})})]})})},lhe=ahe,uhe=({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}=ba(),[h]=Pn(),{resourceApplications:f,loadResources:m}=Jce(t),[y,v]=T.useState(),[x,b]=T.useState(),[_,w]=T.useState(),E=sA(_||"",500),[A,P]=T.useState([]),I=T.useCallback((k,U)=>{var B,X,K;if(!U)return!0;const q=(U==null?void 0:U.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((U,B)=>U.modifiedAt<B.modifiedAt?1:-1),[]),N=T.useCallback(k=>{async function U(){if(o){const B=o.filter(X=>I(X,k));P(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=>I(X,k));P(M(B));return}catch{}P([])}U()},[m,x,I,M,o]),[z,j]=T.useState([]),H=k=>{n==null||n(k),b(k)},F=k=>{const U=k.target.value;w(U.toString())},L=T.useCallback(k=>{N(_),k.stopPropagation(),k.preventDefault()},[N,_]),O=T.useCallback(k=>z.findIndex(U=>U.assetId===k),[z]),$=T.useCallback(k=>{j(s?U=>[...U,k]:[k])},[j,s]),V=T.useCallback(k=>{const U=O(k.assetId);U<0?$(k):j(z.filter((B,X)=>X!==U))},[O,$,z]);return T.useEffect(()=>{(async()=>{if(a){v(a.sort((B,X)=>B.displayName.localeCompare(X.displayName)));return}const k=f.map(B=>Me.session().getWebApp(B)),U=await Promise.all(k);v(f.map((B,X)=>{var K;return{application:B,displayName:u(((K=U[X])==null?void 0:K.displayName)??B),icon:g.jsx(ya,{app:U[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 U=e??((a==null?void 0:a.length)===1&&((k=a==null?void 0:a[0])==null?void 0:k.application));if(U){const B=y==null?void 0:y.find(X=>U===X.application);b(B),N("")}},[y,e]),T.useEffect(()=>{if(r&&O(r)<0){const k=A==null?void 0:A.find(U=>r===U.assetId);k&&$(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(NN,{})}),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(s8,{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 U=z.findIndex(B=>B.assetId===k.assetId)>=0;return g.jsx(lhe,{doc:k,isSelected:U,onClick:()=>V(k)},k.path)})}),x&&A&&A.length<=0&&g.jsx("div",{className:"d-flex justify-content-center mt-16",children:g.jsx(ha,{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(ha,{imageSrc:`${h}/${c==null?void 0:c.bootstrapVersion}/illu-empty-search.svg`,text:u("bbm.linker.int.empty"),className:"mt-32"})})]})]})},che=uhe,dhe=({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]=Cm(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};!Ek.isLocalURL(o)&&!Ek.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(Gi,{children:n("bbm.linker.ext.text")}),g.jsx(Kn,{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(Gi,{children:n("bbm.linker.ext.url")}),g.jsx(Kn,{type:"text",placeholder:n("bbm.linker.ext.url.placeholder"),size:"md",value:o,onChange:c=>a(c.target.value)})]}),g.jsx(Tm,{label:n("bbm.linker.open.tab"),onChange:()=>u(),checked:l})]})})},hhe=dhe,v8=T.createContext(null);function Xl(){const t=T.useContext(v8);if(!t)throw new Error("Innertabs compound components cannot be rendered outside the MediaLibrary component");return t}const fhe=()=>{const{setResult:t,setPreSuccess:e,visibility:r}=Xl(),n=T.useRef(null);return g.jsx(pde,{ref:n,onRecordUpdated:i=>{i?(t(i),e(()=>n.current.save)):t()},onSaveSuccess:i=>{i&&t(i)},hideSaveAction:!0,visibility:r})},phe=({link:t,multiNodeSelected:e=!1})=>{const{setResult:r}=Xl();return g.jsx(hhe,{link:t,onChange:n=>{r(n)},multiNodeSelected:e})},mhe=()=>{const{setResult:t}=Xl();return g.jsx(gde,{onSuccess:e=>{e=e==null?void 0:e.replace(/<p /g,"<div ").replace(/\/p>/g,"/div>"),t(e)}})},ghe=({target:t,resourceId:e,appPrefix:r})=>{const{t:n}=we(),{setResult:i,setResultCounter:s,appCode:o,multiple:a}=Xl(),[l,u]=Cm(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(che,{appCode:o,defaultAppCode:r,defaultResourceId:e,onSelect:f,multiple:a}),g.jsx(Tm,{className:"align-items-center",checked:l,label:n("bbm.linker.open.tab"),onChange:u})]})},vhe=(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]},yhe=({onFilesChange:t,visibility:e="protected"})=>{const{files:r,uploadedFiles:n,getUploadStatus:i,uploadFile:s,removeFile:o,updateImage:a,editingImage:l,setEditingImage:u,getUrl:c}=rde({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:vhe(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(kue,{status:i(y),item:f(y),onEdit:()=>u(v),onRetry:()=>s(y),onDelete:()=>m(y)},y.name)}),l&&g.jsx(ohe,{altText:l.alt,legend:l.title,image:c(l,!0),isOpen:!!l,onCancel:()=>u(void 0),onSave:a,onError:console.error})]})},xhe=yhe,bhe=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},whe=()=>{const{type:t,visibility:e,multiple:r,setResult:n,setResultCounter:i,setCancellable:s}=Xl(),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(kce,{multiple:r,accept:bhe(t??"embedder"),children:g.jsx(xhe,{onFilesChange:o,visibility:e})})})},x_=9,b_=16,_he=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,P]=T.useState({audio:!0,video:{facingMode:"environment",aspectRatio:b_/x_}}),[I,M]=T.useState(),[N,z]=T.useState(""),[j,H]=T.useState([]),[F,L]=T.useState(),[O,$]=T.useState(0),[V,k]=T.useState(0),U=T.useRef(null),B=T.useRef(null),{uploadBlob:X}=l8(void 0,t),{device:K}=B6(navigator.userAgent);T.useImperativeHandle(o,()=>({save:de}));const{t:q}=we();T.useEffect(()=>{re(),ue()},[]),T.useEffect(()=>(I||le(A),()=>{I&&I.getTracks().forEach(Pe=>Pe.stop())}),[I]),T.useEffect(()=>{if(j.length&&!h&&U.current){const Pe=new Blob(j,{type:N});if(L(Pe),i){const Ke=window.URL.createObjectURL(Pe);i(Ke)}U.current.autoplay=!1,U.current.srcObject=null,U.current.src=window.URL.createObjectURL(Pe)}},[h,j]),T.useEffect(()=>{if(h){const Pe=Date.now(),Ke=window.setInterval(()=>$(Date.now()-Pe),500);return()=>{window.clearInterval(Ke)}}},[h]),T.useEffect(()=>{if(v){const Pe=window.setInterval(()=>k(Ke=>Ke+500),500);return()=>{window.clearInterval(Pe)}}},[v]);const re=async()=>{const Pe=await Me.video().getVideoConf();l((Pe.maxDuration??3)*60*1e3)},ue=async()=>{const Pe=(await navigator.mediaDevices.enumerateDevices()).filter(Ke=>Ke.kind==="videoinput");switch(K.type){case"mobile":case"tablet":{const Ke={deviceId:"environment",label:q("video.back.camera"),groupId:"",kind:"videoinput"},Rt={deviceId:"user",label:q("video.front.camera"),groupId:"",kind:"videoinput"};(Pe==null?void 0:Pe.length)>1?c([Ke,Rt]):c([Ke]);break}default:c(Pe);break}},le=async Pe=>{try{const Ke=await navigator.mediaDevices.getUserMedia(Pe);M(Ke),U.current&&(U.current.src&&(window.URL.revokeObjectURL(U.current.src),U.current.src=""),U.current.srcObject=Ke,U.current.autoplay=!0,U.current.volume=1,U.current.muted=!0)}catch(Ke){console.error(Ke)}},me=T.useCallback(()=>{f(!0),U&&U.current&&(U.current.muted=!0);const Pe=Gue();z(Pe),I&&(B.current=new MediaRecorder(I,{mimeType:Pe}),B.current.ondataavailable=({data:Ke})=>{Ke.size>0&&H(Rt=>[...Rt,Ke])},B.current.onerror=Ke=>console.error(Ke),B.current.start(1e3))},[I]),xe=T.useCallback(()=>{var Pe;f(!1),y(!0),((Pe=B.current)==null?void 0:Pe.state)==="recording"&&(B.current.requestData(),B.current.stop())},[B]),_e=T.useCallback(()=>{var Pe,Ke;U&&U.current&&(U.current.muted=!1),v?((Ke=U==null?void 0:U.current)==null||Ke.pause(),x(!1)):((Pe=U==null?void 0:U.current)==null||Pe.play(),x(!0))},[v]),Te=()=>{y(!1),f(!1),x(!1),E(!1),$(0),H([]),L(void 0),le(A),i&&i()},de=async()=>{var Pe;if((Pe=U==null?void 0:U.current)==null||Pe.pause(),_(!0),!F){console.error("Error while saving video: recorded video is undefined.");return}const Ke=await X(F,{duration:O});if(Ke!=null)return r==null||r([Ke]),_(!1),E(!0),[Ke];n("Error while uploading video"),_(!1),E(!0)},Be=()=>{x(!1),k(0),U.current&&(U.current.currentTime=0)},je=Pe=>{var Ke;const Rt=u.find(J=>J.label===Pe);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}},P(W),I&&(((Ke=B.current)==null?void 0:Ke.state)==="recording"&&(B.current.requestData(),B.current.stop()),I.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(Zv,{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(wz,{}),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($N,{}),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(FT,{}),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(VN,{}),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(jT,{}),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(Gi,{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(Pe=>Pe.label),onValueChange:je})]})}),g.jsxs("div",{className:"video-recorder-video-container position-relative align-self-stretch",children:[g.jsx("video",{ref:U,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(Zv,{width:12,height:12,color:"red",className:"me-4"}),g.jsxs("span",{children:[pl(O),"/",pl(a)]})]}),m&&g.jsxs(g.Fragment,{children:[g.jsx(HN,{width:14,height:14,className:"me-4"}),g.jsxs("span",{children:[pl(V),"/",pl(O)]})]})]}),I&&g.jsx(pA,{items:ut,className:"position-absolute bottom-0 start-50 bg-white"})]}),b&&g.jsx(fr,{position:!1,caption:q("bbm.video.save.loader.caption")})]})}),She=_he,Ehe=()=>{const{appCode:t,setResult:e,setPreSuccess:r}=Xl(),{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(She,{ref:i,appCode:t,caption:n("bbm.video.caption"),onRecordUpdated:s,onError:o,hideSaveAction:!0})},The=({switchType:t,onSuccess:e})=>{const{t:r}=we(),[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 _=Me.embedder().getProviderFromUrl(u,h);if(_){l(_);const w=Me.embedder().getEmbedCodeForProvider(_,h);o(w),e(w)}else l(void 0),e()}},[h,u]);const y=async()=>{const _=await Promise.all([Me.embedder().getDefault(),Me.embedder().getCustom()]).then(w=>w.flat());c(_)};function v(_){const w=_.currentTarget.value;i(w),e(w!=null&&w.length?w:void 0)}function x(){t==null||t("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(wo,{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(ha,{imageSrc:`${m}/emptyscreen/illu-error.svg`,title:r("bbm.video.previewError.title"),text:r("bbm.video.previewError.text")}),t&&g.jsxs(it,{variant:"ghost",color:"primary",onClick:x,className:"align-items-start mt-16",children:[r("bbm.video.useEmbedCode")," ",g.jsx(TS,{})]})]}):t&&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:[r("bbm.video.useEmbedCode")," ",g.jsx(TS,{})]})});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(LT,{className:"me-8"}),r("bbm.video.url.title")]}),g.jsx(Ot,{id:f,children:g.jsx(Kn,{size:"md",type:"text",placeholder:r("bbm.video.url.placeholder"),onChange:v})}),g.jsx(g.Fragment,{children:b()})]})},Che=The,Ahe=()=>{const{switchType:t,setResult:e}=Xl();return g.jsx(Che,{switchType:t,onSuccess:r=>{e(r)}})},Rhe=({roles:t,onSelect:e,multiple:r=!0,className:n,defaultFolder:i,showPublicFolder:s})=>{const{t:o}=we(),{root:a,loadContent:l}=O0("root",o("workspace.tree.owner"),"owner",t),{root:u,loadContent:c}=O0("root",o("workspace.tree.shared"),"shared",t),{root:h,loadContent:f}=O0("root",o("workspace.tree.protected"),"protected",t),{root:m,loadContent:y}=O0("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,P]=T.useState(()=>i==="public"?s?m:h:i==="protected"?h:i==="shared"?u:a),[I,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]),$=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,re){E(q);const{root:ue,othersRef:le}=O(q),me=K6(ue,xe=>xe.id===re);me&&(P(me),le.forEach(xe=>{var _e;return(_e=xe.current)==null?void 0:_e.unselectAll()}))}T.useEffect(()=>{var q;let re;switch(w){case"owner":re=v;break;case"shared":re=x;break;case"protected":re=b;break;case"public":re=_;break;default:return}(q=re==null?void 0:re.current)==null||q.select("root")},[w]),T.useEffect($,[$]),T.useEffect(()=>{if(A.files){let q=[].concat(A.files);N&&(q=q.filter(ue=>ue.name.indexOf(N)>=0));const re=j[0]==="name"?j[1]==="asc"?(ue,le)=>U(ue.name,le.name):(ue,le)=>U(le.name,ue.name):(ue,le)=>U(le.modified,ue.modified);M(()=>q.sort(re))}else M(void 0)},[A,a,h,u,m,N,j]);const k=T.useCallback(q=>{z(q.target.value)},[z]);function U(q,re){return q?re?q.localeCompare(re):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 re=[...F];r?re.includes(q)?re=re.filter(ue=>ue._id!==q._id):re=[...re,q]:re=[q],L(re),e(re)}const K=Re("workspace flex-grow-1 gap-0",n);return g.jsxs(so,{className:K,children:[g.jsx(so.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(so.Col,{sm:"12",md:"5",xl:"8",children:g.jsxs(so,{className:"flex-grow-1 gap-0",children:[g.jsxs(so.Col,{sm:"4",md:"8",xl:"12",children:[g.jsx("div",{className:"workspace-search px-16 py-8 ",children:g.jsx(s8,{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(Fz,{}),onClick:()=>H(["modified","desc"]),children:o("sort.order.modify.desc")}),g.jsx(xt.Item,{icon:g.jsx(Oz,{}),onClick:()=>H(["name","asc"]),children:o("sort.order.alpha.asc")}),g.jsx(xt.Item,{icon:g.jsx(Nz,{}),onClick:()=>H(["name","desc"]),children:o("sort.order.alpha.desc")})]})]})]})]}),g.jsx(so.Col,{sm:"4",md:"8",xl:"12",className:"p-8 gap-8",children:I?I.length!==0?g.jsx("div",{className:"grid grid-workspace",children:I.map(q=>{const re=F.includes(q);return g.jsx(Iue,{doc:q,isSelected:re,onClick:()=>X(q)},q._id)})}):g.jsx(ha,{imageSrc:"/assets/themes/edifice-bootstrap/images/emptyscreen/illu-trash.svg",text:o("workspace.empty.docSpace"),title:o("explorer.emptyScreen.trash.title")}):g.jsx(fr,{})})]})})]})},Phe=Rhe,Ihe=()=>{const{type:t,setResultCounter:e,setResult:r,multiple:n,visibility:i}=Xl();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(Phe,{roles:s(),onSelect:o,multiple:n,className:"border rounded overflow-y-auto",defaultFolder:i,showPublicFolder:i==="public"})},ja={Audio:fhe,Video:Ehe,Upload:whe,ExternalLink:phe,Workspace:Ihe,InternalLink:ghe,Iframe:mhe,VideoEmbedder:Ahe},Mhe=["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"}},khe=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:$,type:m,...u.current})),qce({isDismissible:!0,duration:1/0});const{t:c}=we(),h=Wi("org.entcore.workspace.controllers.WorkspaceController|addDocument"),f=Wi("com.opendigitaleducation.video.controllers.VideoController|capture"),[m,y]=T.useState(null),v={workspace:{id:"workspace",icon:g.jsx(jN,{}),label:c("bbm.workspace"),content:g.jsx(ja.Workspace,{}),availableFor:["audio","video","image","attachment"],isEnable:null},upload:{id:"upload",icon:g.jsx(Mz,{}),label:c("bbm.device"),content:g.jsx(ja.Upload,{}),availableFor:["audio","video","image","attachment"],isEnable:()=>!!h},"video-capture":{id:"video-capture",icon:g.jsx(HN,{}),label:c("bbm.video"),content:g.jsx(ja.Video,{}),availableFor:["video"],isEnable:()=>!!f},"audio-capture":{id:"audio-capture",icon:g.jsx(c1,{}),label:c("bbm.audio"),content:g.jsx(ja.Audio,{}),availableFor:["audio"],isEnable:()=>!!h},"external-link":{id:"external-link",icon:g.jsx(LT,{}),label:c("bbm.linker.ext"),content:g.jsx(ja.ExternalLink,{...l.current}),availableFor:["hyperlink"],isEnable:null},"internal-link":{id:"internal-link",icon:g.jsx(NN,{}),label:c("bbm.linker.int"),content:g.jsx(ja.InternalLink,{...l.current}),availableFor:["hyperlink"],isEnable:null},iframe:{id:"iframe",icon:g.jsx(CS,{}),label:c("bbm.embed"),content:g.jsx(ja.Iframe,{}),availableFor:["embedder"],isEnable:null},"video-embedder":{id:"iframe",icon:g.jsx(CS,{}),label:c("bbm.embed"),content:g.jsx(ja.VideoEmbedder,{}),availableFor:["video"],isEnable:null}},x=T.useMemo(()=>Mhe.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(),[P,I]=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)},$=K=>{l.current=K,!("resourceId"in K||"appPrefix"in K)&&_("external-link"),y("hyperlink")};T.useEffect(()=>{var K,q;const re=m||"none";!b&&typeof((K=w_[re])==null?void 0:K.defaultTab)=="string"&&_((q=w_[re])==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,I(void 0),A(void 0),_(void 0),j(void 0),N([])},U=K=>{s==null||s(K,M),k()},B=T.useCallback(()=>{const K=async q=>{q instanceof Array&&["protected","public"].findIndex(re=>re===e)>=0&&(q=await Me.workspace().transferDocuments(q,t??"media-library",e)),n(q)};z?z().then(q=>{K(q)}):P&&K(P),k()},[z,P,n,e,t]),X=()=>{i(M),k()};return m&&g.jsx(v8.Provider,{value:{appCode:t,visibility:e,multiple:r,type:m,setResultCounter:A,setResult:I,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(oa,{items:x,defaultId:x[w].id,onChange:U,children:K=>g.jsxs(g.Fragment,{children:[x.length>1&&g.jsx(oa.List,{className:"mt-16"}),g.jsx(Ye.Body,{className:"d-flex",children:g.jsx(oa.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 P>"u",onClick:B,children:E&&E>1?c("addMultiple",{number:E}):c("add")})]})]})})}),y8=khe;function Ohe({isOpen:t,resourceId:e,onSuccess:r,onCancel:n}){const{appCode:i,currentApp:s}=yt(),{ref:o,libraryMedia:a,...l}=a8(),{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:P,selectedSubjectAreas:I,selectSubjects:M}=ade({resource:c,onSuccess:r});return c?mr.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(u8,{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(Gi,{children:u("bpr.form.publication.title")}),g.jsx(Kn,{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(Gi,{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(Zle,{control:h,selectedActivities:P,selectActivities:A}),g.jsx(lue,{control:h,selectedSubjectAreas:I,selectSubjects:M}),g.jsx(sue,{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(Sk,{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(Sk,{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(Gi,{children:u("bpr.form.publication.keywords")}),g.jsx(Kn,{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(oue,{})]})]}),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(y8,{appCode:i,ref:o,multiple:!1,visibility:"protected",...l})]}),document.getElementById("portal")):g.jsx(fr,{})}const Dhe=({content:t,maxLength:e})=>g.jsx("p",{className:"small text-gray-700 p-2 text-end",children:t?`${t.length} / ${e}`:""}),Nhe=({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)}},Lhe=60,Fhe=400,jhe=({isOpen:t,onCancel:e,onSuccess:r,children:n,inputMaxLength:i=Lhe,textareaMaxLength:s=Fhe,...o})=>{const{appCode:a,currentApp:l}=yt(),{t:u}=we(),{mode:c}=o,h=en(),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}}=OT({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:P,libraryMedia:I,...M}=a8(),{appCode:N}=yt(),{thumbnail:z,handleDeleteImage:j,handleUploadImage:H}=Nhe({isUpdating:y,selectedResource:y?v:void 0}),F=x("description"),L=async function(O){var $,V;try{const k={description:O.description||"",name:O.title,public:O.enablePublic,slug:O.enablePublic&&O.formSlug||"",thumbnail:z};if(m){const U={...k,folder:o.currentFolder===void 0||(($=o.currentFolder)==null?void 0:$.id)==="default"?void 0:parseInt(((V=o.currentFolder)==null?void 0:V.id)||""),application:a};o.createResource?await o.createResource.mutateAsync(U):await Me.resource(a).create(U)}else{const U={...k,entId:v.assetId,trashed:v.trashed};o.updateResource?await o.updateResource.mutateAsync(U):await Me.resource(a).update(U)}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(fr,{}):mr.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(u8,{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:I,mediaLibraryRef:P})}),g.jsxs("div",{className:"col",children:[g.jsxs(Ot,{id:"title",className:"mb-16",isRequired:!0,children:[g.jsx(Gi,{children:u("title")}),g.jsx(Kn,{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(Gi,{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(Dhe,{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(y8,{appCode:N,ref:P,multiple:!1,visibility:"protected",...M})]}),document.getElementById("portal"))},Bhe=jhe,Uhe=({application:t,options:e})=>Mo({mutationFn:async r=>await Me.resource(t).update(r),...e}),$he=Uhe,zhe=({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=en();T.useEffect(()=>{if(s){let m="";r?m=r.slug?r.slug:`${ik({foo:`${l}${a}`})}-${ok(l)}`:m=`${ik({foo:`${l}${a}`})}-${ok(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}},Hhe=({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}=zhe({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(ta,{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(Kn,{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($$,{}),variant:"ghost",className:"text-nowrap",children:o("explorer.resource.editModal.access.url.button")})]})]})]})},x8=Hhe,Vhe=({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(jT,{}),onClick:n,className:"text-nowrap",children:i("explorer.modal.share.sharebookmark.save")})]})})},Ghe=(t,e)=>t.actions.filter(r=>e.id===r.id).length>0,Whe=(t,e)=>t.isBookmarkMember&&e||!t.isBookmarkMember,Xhe=({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(rc,{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(BT,{width:16})}),sharebookmark:g.jsx(DT,{})}[a.type]||null,u=a.type==="sharebookmark",c=a.type==="user";return Whe(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(Tp,{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(Tm,{checked:Ghe(a,h),onChange:()=>i(a,h.id)})},h.displayName)),g.jsx("td",{children:!a.isBookmarkMember&&g.jsx(Ro,{"aria-label":o("close"),color:"tertiary",icon:g.jsx(NT,{}),type:"button",variant:"ghost",title:o("close"),onClick:()=>s(a)})})]},a.id)})},qhe={searchInputValue:"",searchResults:[],searchAPIResults:[],isSearching:!1};function Yhe(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"}],Qhe=({resourceId:t,resourceCreatorId:e,shareRights:r,shareDispatch:n})=>{const[i,s]=T.useReducer(Yhe,qhe),o=sA(i.searchInputValue,500),{isAdml:a}=o8(),{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 Me.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(DT,{}):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 Me.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])})}}}},Khe={isSharing:!1,shareRights:{rights:[],visibleBookmarks:[],visibleGroups:[],visibleUsers:[]},shareRightActions:[]};function Zhe(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 Jhe({resourceId:t,resourceRights:e,resourceCreatorId:r,shareResource:n,setIsLoading:i,onSuccess:s}){const{appCode:o}=yt(),{user:a,avatar:l}=wh(),u=en(),{t:c}=we(),[h,f]=T.useReducer(Zhe,Khe);T.useEffect(()=>{t&&(async()=>{try{const[v,x]=await Promise.all([Me.share().getActionsForApp(o),Me.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],P=A.findIndex(M=>M.id===v.id),I=h.shareRightActions.filter(M=>M.id===x)[0];if(A[P].actions.findIndex(M=>M.id===x)>-1){let M=A[P].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[P]={...A[P],actions:M}}else{const M=h.shareRightActions.filter(N=>{var z;return((z=I.requires)==null?void 0:z.includes(N.id))&&!A[P].actions.find(j=>j.id===N.id)});A[P]={...A[P],actions:[...A[P].actions,I,...M]}}v.type==="sharebookmark"&&((b=A[P].users)==null||b.forEach(M=>{const N=A.findIndex(z=>z.id===M.id);A[N]={...A[N],actions:A[P].actions}}),(_=A[P].groups)==null||_.forEach(M=>{const N=A.findIndex(z=>z.id===M.id);A[N]={...A[N],actions:A[P].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 Me.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 efe=({shareRights:t,shareDispatch:e})=>{const r=en(),{t:n}=we(),i=T.useRef(null),[s,o]=T.useState({name:"",id:T.useId()}),[a,l]=Cm(!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 Me.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 tfe({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}=Jhe({resourceId:o,resourceCreatorId:a,resourceRights:l,shareResource:r,setIsLoading:c,onSuccess:i}),{state:{searchResults:E,searchInputValue:A},showSearchAdmlHint:P,showSearchLoading:I,showSearchNoResults:M,getSearchMinLength:N,handleSearchInputChange:z,handleSearchResultsChange:j}=Qhe({resourceId:o,resourceCreatorId:a,shareRights:f,shareDispatch:y}),{refBookmark:H,showBookmark:F,handleBookmarkChange:L,toggleBookmark:O,bookmark:$,handleOnSave:V,showBookmarkInput:k,toggleBookmarkInput:U}=efe({shareRights:f,shareDispatch:y}),{t:B}=we(),X=P()?B("explorer.search.adml.hint"):B("explorer.modal.share.search.placeholder");return mr.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(fr,{}):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(ml,{children:B("explorer.modal.share.avatar.shared.alt")})}),g.jsx("th",{scope:"col",children:g.jsx(ml,{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(ml,{children:B("close")})})]})}),g.jsxs("tbody",{children:[x()&&g.jsxs("tr",{children:[g.jsx("th",{scope:"row",children:g.jsx(rc,{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(Tm,{checked:!0,disabled:!0})},K.displayName)),g.jsx("td",{})]}),g.jsx(Xhe,{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(DT,{}),rightIcon:g.jsx(Tp,{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:()=>U(!k),children:B("share.save.sharebookmark")}),k&&g.jsx(Vhe,{refBookmark:H,bookmark:$,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(fo,{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(BN,{className:"c-pointer",height:"18"})})]}),g.jsx("div",{className:"row",children:g.jsx("div",{className:"col-10",children:g.jsx(Tce,{value:A,placeholder:X,isLoading:I(),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 rfe({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 Me.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(E2,{label:n("explorer.immediat.publication"),id:"publication-now",name:"publication",value:"IMMEDIATE",model:o,checked:o==="IMMEDIATE",onChange:l}),g.jsx(E2,{label:n("explorer.validate.publication"),id:"publication-validate",name:"publication",value:"RESTRAINT",checked:o==="RESTRAINT",model:o,onChange:l})]})}const nfe=({application:t,options:e})=>Mo({mutationFn:async({resourceId:r,rights:n})=>await Me.share().saveRights(t,r,n),...e}),ife=nfe;function sfe(t){return{getPreference:async()=>await Me.conf().getPreference(t),savePreference:async e=>await Me.conf().savePreference(t,JSON.stringify(e))}}function ofe(){const[t,e]=T.useState(!1),{getPreference:r,savePreference:n}=sfe("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 Rk({isHelpOpen:t,setIsHelpOpen:e,parsedHeadline:r,parsedContent:n,error:i}){const{t:s}=we(),o=()=>{e(!1)};return t?mr.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 afe(){var t,e,r,n,i;const{appCode:s}=yt(),{theme:o}=ba(),[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=Wl(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(F$,{})}),I0(E.children,{replace:A=>{const P=A;if(P.attribs&&P.name==="ul")return g.jsx("ul",{id:"TOC-list",style:{display:u?"block":"none"},children:I0(P.children,{replace:I=>{const M=I;if(M.attribs&&M.name==="a")return g.jsx("a",{...v_(M.attribs),children:g.jsx("span",{onClick:()=>{c(!1)},children:I0(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:I0(E.children,{replace:P=>{const I=P;if(I.attribs&&I.name==="img"){const M=P.attribs.src;return g.jsx("img",{...v_(I.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 vr=T.forwardRef(({children:t,className:e,...r},n)=>{const i=Re("nav-item",e);return g.jsx("li",{ref:n,className:i,...r,children:t})}),lfe=()=>{const[t,e]=$6(),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(vr,{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(jq,{className:"icon search"}),g.jsx("span",{className:"nav-text",children:i("navbar.search")})]}),g.jsx(i8,{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")})]})})]})},ufe=lfe;function S_({children:t,className:e,...r}){const n=Re("navbar",e);return g.jsx("nav",{className:n,...r,children:t})}function Pk({children:t,className:e,...r}){const n=Re("navbar-nav",e);return g.jsx("ul",{className:n,...r,children:t})}function mf({link:t,className:e,children:r,translate:n,...i}){const s=Re("nav-link",e);return g.jsxs("a",{href:t,className:s,...i,children:[r,n&&g.jsx(ml,{children:g.jsx("span",{className:"nav-text",children:n})})]})}const cfe=()=>{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")})})})},dfe=({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(ya,{app:r,size:"32"})},n))]})},hfe=({is1d:t=!1,src:e=""})=>{const{t:r}=we(),{messages:n,msgLink:i,zimbraWorkflow:s}=Gce(),{user:o,avatar:a}=wh(),{currentLanguage:l,currentApp:u}=yt(),c=Wi("org.entcore.portal.controllers.PortalController|oldHelpEnable")||!1,{isModalOpen:h,setIsModalOpen:f,parsedContent:m,parsedHeadline:y,error:v}=afe(),x=Re("header",{"no-2d":t,"no-1d":!t}),{title:b,bookmarkedApps:_,appsRef:w,isAppsHovered:E,popoverAppsId:A,userAvatar:P,userName:I,welcomeUser:M,communityWorkflow:N,conversationWorflow:z,searchWorkflow:j,isCollapsed:H,toggleCollapsedNav:F,handleLogout:L}=Wce({user:o,avatar:a}),O=n>0,{theme:$}=ba();return g.jsx("header",{className:x,children:t?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"container-fluid",children:g.jsxs(S_,{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(rc,{alt:I,size:"sm",src:P,variant:"circle",width:"32",height:"32"}),g.jsx("span",{className:"navbar-text",children:M})]}),g.jsxs(Pk,{className:"gap-8","aria-hidden":"false","aria-label":r("navbar.main.navigation"),children:[z&&g.jsx(vr,{children:g.jsxs("a",{href:"/conversation/conversation",className:"nav-link",children:[g.jsx(Nq,{className:"icon notification"}),O&&g.jsx(ow,{variant:{type:"notification",level:"danger"},className:"position-absolute",children:n}),g.jsx(ml,{children:r("navbar.messages")})]})}),g.jsx(vr,{children:g.jsx(mf,{link:"/userbook/mon-compte",className:"dropdown-item",translate:r("navbar.myaccount"),children:g.jsx(bC,{className:"icon user"})})}),l==="fr"&&c?g.jsxs(vr,{children:[g.jsxs("button",{className:"nav-link",onClick:()=>{f(!0)},children:[g.jsx(Oq,{className:"icon help"}),g.jsx(ml,{children:r("navbar.help")})]}),g.jsx(Rk,{isHelpOpen:h,setIsHelpOpen:f,parsedContent:m,parsedHeadline:y,error:v})]}):null,g.jsx(vr,{children:g.jsxs("button",{className:"nav-link",onClick:L,children:[g.jsx(F3,{className:"icon logout"}),g.jsx(ml,{children:r("navbar.disconnect")})]})}),g.jsx(vr,{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(Tp,{className:"icon rafter-down",width:"20",height:"20"})})})]})]})}),g.jsx(S_,{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(Ck,{is1d:!0,src:`${e}/img/illustrations/logo.png`,translate:r("navbar.home")}),g.jsxs(Pk,{className:"gap-8",children:[g.jsx(vr,{children:g.jsxs("a",{href:"/timeline/timeline",className:"button",children:[g.jsx(Mq,{color:"#fff",className:"d-md-none"}),g.jsx("span",{className:"d-inline-block",children:r("portal.header.navigation.whatsnew")})]})}),g.jsx(vr,{children:g.jsxs("a",{href:"/userbook/annuaire",className:"button",children:[g.jsx(Uq,{color:"#fff",className:"d-md-none"}),g.jsx("span",{className:"d-inline-block",children:r("portal.header.navigation.classMembers")})]})}),g.jsx(vr,{children:g.jsxs("a",{href:"/welcome",className:"button",children:[g.jsx(j3,{color:"#fff",className:"d-md-none"}),g.jsx("span",{className:"d-inline-block",children:r("portal.header.navigation.myapps")})]})})]})]})})})]}):g.jsx(S_,{className:"navbar-expand-md",children:g.jsxs("div",{className:"container-fluid",children:[g.jsx(Ck,{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(vr,{children:g.jsx(mf,{link:"/timeline/timeline",translate:r("navbar.home"),children:g.jsx(Tq,{color:"#fff"})})}),g.jsxs(vr,{className:"position-relative",ref:w,id:A,"aria-haspopup":"true","aria-expanded":E,children:[g.jsx(mf,{link:"/welcome",translate:r("navbar.applications"),children:g.jsx(j3,{color:"#fff"})}),g.jsxs(i8,{className:"top-100 widget",id:A,isVisible:E,children:[g.jsx(Lce,{children:g.jsx(dfe,{bookmarkedApps:_})}),g.jsx(Fce,{className:"widget-footer border-top border-ghost",children:g.jsx(cfe,{})})]})]}),z&&g.jsx(vr,{children:g.jsxs(mf,{className:"position-relative",link:"/conversation/conversation",translate:r("conversation"),children:[g.jsx(B3,{color:"#fff"}),O&&g.jsx(ow,{variant:{type:"notification",level:"warning"},className:"position-absolute",children:n})]})}),s&&g.jsx(vr,{children:g.jsxs(mf,{className:"position-relative",link:i,translate:r("conversation"),children:[g.jsx(B3,{color:"#fff"}),O&&g.jsx(ow,{variant:{type:"notification",level:"warning"},className:"position-absolute",children:n})]})}),l==="fr"&&c?g.jsxs(vr,{children:[g.jsxs("button",{className:"nav-link btn btn-naked",onClick:()=>{f(!0)},children:[g.jsx(Rq,{color:"#fff"}),g.jsx(ml,{children:r("support")})]}),g.jsx(Rk,{isHelpOpen:h,setIsHelpOpen:f,parsedContent:m,parsedHeadline:y,error:v})]}):null,g.jsx(vr,{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(Tp,{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(vr,{children:g.jsxs("a",{href:"/community",className:"nav-link dropdown-item",children:[g.jsx(_q,{className:"icon community"}),g.jsx("span",{className:"nav-text",children:r("navbar.community")})]})}),j?g.jsx(ufe,{}):null,g.jsx(vr,{children:g.jsxs("a",{href:"/userbook/mon-compte",className:"nav-link dropdown-item",children:[g.jsx(rc,{alt:I,size:"sm",src:P,variant:"circle",className:"bg-white",width:"32",height:"32"}),g.jsx("span",{className:"nav-text",children:r("navbar.myaccount")})]})}),g.jsx(vr,{children:g.jsx("hr",{className:"dropdown-divider"})}),g.jsx(vr,{children:g.jsxs("a",{href:"/auth/logout?callback="+(($==null?void 0:$.logoutCallback)??"/"),className:"nav-link dropdown-item",children:[g.jsx(F3,{className:"icon logout"}),g.jsx("span",{id:"logout-label",className:"nav-text",children:r("navbar.disconnect")})]})})]})]})})]})]})})})},ffe=hfe,pfe=({children:t,headless:e=!1,...r})=>{const{theme:n}=ba(),{t:i}=we(),{showCookiesConsent:s,handleConsultCookies:o,handleCloseCookiesConsent:a}=ofe();ide(),sde();const l=Re("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(ffe,{is1d:n==null?void 0:n.is1d,src:n==null?void 0:n.basePath}),c=s&&g.jsx(ta,{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($G,{containerClassName:"toaster-container",toastOptions:{position:"top-right"}});return g.jsxs(g.Fragment,{children:[u,g.jsx("main",{className:l,...r,children:t}),h,c]})},mfe=pfe,gfe="modulepreload",vfe=function(t){return"/"+t},Ik={},cr=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=vfe(a),a in Ik)return;Ik[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":gfe,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})},yfe=t=>{let{activatorEvent:e,draggingNodeRect:r,transform:n}=t;if(r&&e){const i=Fy(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},xfe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},bfe=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:()=>{(xfe?"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},wfe=t=>bfe;var b8={exports:{}},w8={},_8={exports:{}},S8={};/**
1390
+ `,gk="/",vk="*",Eu="",Nae="comment",Lae="declaration",Fae=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(Aae);v&&(r+=v.length);var x=y.lastIndexOf(Dae);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(Rae)}function c(y){var v;for(y=y||[];v=h();)v!==!1&&y.push(v);return y}function h(){var y=s();if(!(gk!=t.charAt(0)||vk!=t.charAt(1))){for(var v=2;Eu!=t.charAt(v)&&(vk!=t.charAt(v)||gk!=t.charAt(v+1));)++v;if(v+=2,Eu===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:Nae,comment:x})}}function f(){var y=s(),v=l(Pae);if(v){if(h(),!l(Iae))return a("property missing ':'");var x=l(Mae),b=y({type:Lae,property:yk(v[0].replace(mk,Eu)),value:x?yk(x[0].replace(mk,Eu)):Eu});return l(kae),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 yk(t){return t?t.replace(Oae,Eu):Eu}var jae=Fae;function M6(t,e){var r=null;if(!t||typeof t!="string")return r;for(var n,i=jae(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=M6;iA.exports.default=M6;var Bae=iA.exports,K1={};K1.__esModule=!0;K1.camelCase=void 0;var Uae=/^--[a-zA-Z0-9-]+$/,$ae=/-([a-z])/g,zae=/^[^-]+$/,Hae=/^-(webkit|moz|ms|o|khtml)-/,Vae=/^-(ms)-/,Gae=function(t){return!t||zae.test(t)||Uae.test(t)},Wae=function(t,e){return e.toUpperCase()},xk=function(t,e){return"".concat(e,"-")},Xae=function(t,e){return e===void 0&&(e={}),Gae(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(Vae,xk):t=t.replace(Hae,xk),t.replace($ae,Wae))};K1.camelCase=Xae;(function(t){var e=rr&&rr.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};t.__esModule=!0;var r=e(Bae),n=K1;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})(I6);var qae=T,Yae=I6.default;function Qae(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 Kae=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function Zae(t,e){return t.indexOf("-")===-1?e&&typeof e.is=="string":!Kae.has(t)}var Jae={reactCompat:!0};function ele(t,e){if(t!=null)try{e.style=Yae(t,Jae)}catch{e.style={}}}var tle=qae.version.split(".")[0]>=16,k6=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);function rle(t){return!k6.has(t.name)}function nle(t){return t}var O6={PRESERVE_CUSTOM_ATTRIBUTES:tle,ELEMENTS_WITH_NO_TEXT_CHILDREN:k6,invertObject:Qae,isCustomComponent:Zae,setStyleProp:ele,canTextBeChildOfNode:rle,returnFirstArg:nle},Mf=Zi,bk=O6,ile=["checked","value"],sle=["input","select","textarea"],ole={reset:!0,submit:!0},D6=function(e,r){e=e||{};var n,i,s,o,a,l={},u=e.type&&ole[e.type];for(n in e){if(s=e[n],Mf.isCustomAttribute(n)){l[n]=s;continue}if(i=n.toLowerCase(),o=wk(i),o){switch(a=Mf.getPropertyInfo(o),ile.indexOf(o)!==-1&&sle.indexOf(r)!==-1&&!u&&(o=wk("default"+i)),l[o]=s,a&&a.type){case Mf.BOOLEAN:l[o]=!0;break;case Mf.OVERLOADED_BOOLEAN:s===""&&(l[o]=!0);break}continue}bk.PRESERVE_CUSTOM_ATTRIBUTES&&(l[n]=s)}return bk.setStyleProp(e.style,l),l};function wk(t){return Mf.possibleStandardNames[t]}var ale=T,lle=D6,Kp=O6,ule=Kp.setStyleProp,cle=Kp.canTextBeChildOfNode;function N6(t,e){e=e||{};for(var r=e.library||ale,n=r.cloneElement,i=r.createElement,s=r.isValidElement,o=[],a,l,u=typeof e.replace=="function",c=e.transform||Kp.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&&!cle(a.parent)||y&&l)continue;o.push(c(a.data,a,v));continue}switch(f=a.attribs,dle(a)?ule(f.style,f):f&&(f=lle(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=N6(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 dle(t){return Kp.PRESERVE_CUSTOM_ATTRIBUTES&&t.type==="tag"&&Kp.isCustomComponent(t.name,t.attribs)}var hle=N6,Z1=YC,cd=cae,fle=D6,L6=hle;cd=typeof cd.default=="function"?cd.default:cd;var ple={lowerCaseAttributeNames:!1};function Ao(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");return t===""?[]:(e=e||{},L6(cd(t,e.htmlparser2||ple),e))}Ao.domToReact=L6;Ao.htmlToDOM=cd;Ao.attributesToProps=fle;Ao.Comment=Z1.Comment;Ao.Element=Z1.Element;Ao.ProcessingInstruction=Z1.ProcessingInstruction;Ao.Text=Z1.Text;var mle=Ao;Ao.default=Ao;const Wl=Po(mle);var I0=Wl.domToReact;Wl.htmlToDOM;var v_=Wl.attributesToProps;Wl.Comment;Wl.Element;Wl.ProcessingInstruction;Wl.Text;var gle=Object.defineProperty,vle=(t,e,r)=>e in t?gle(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ff=(t,e,r)=>(vle(t,typeof e!="symbol"?e+"":e,r),r);const yle=async t=>await Me.conf().getPreference(t),xle=async t=>await Me.conf().savePreference(t,JSON.stringify({key:!1})),ble=t=>{const[e,r]=T.useState(!0),[n,i]=T.useState(!1);return T.useEffect(()=>{(async()=>{const s=await yle(t);if(s){const{key:o}=s;i(o);return}i(!0)})()},[t]),{isOpen:e,setIsOpen:r,isOnboarding:n,handleSavePreference:async()=>{await xle(t),r(!1)}}},wle=({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}=ble(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?mr.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(o6,{modules:[cse],onSwiper:b=>{s(b)},onSlideChange:b=>{a(b.progress)},pagination:{clickable:!0},children:e.map((b,_)=>g.jsxs(a6,{children:[g.jsx(wo,{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},_le=wle,F6=T.createContext(null),bh=()=>{const t=T.useContext(F6);if(!t)throw new Error("Cannot be rendered outside the Dropdown Component");return t},Sle=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:Re(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})]})}),Tm=Sle,Ele=({children:t,value:e,model:r,onChange:n})=>{const{itemProps:i,itemRefs:s,isFocused:o}=bh(),{onMenuItemKeyDown:a,onMenuItemMouseEnter:l}=i,u=T.useId(),c=r.includes(e),h={value:e,model:r,checked:c,readOnly:!0},f=Re("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(Tm,{...h})]})})},Tle=Ele,Cle=({type:t="action",icon:e,onClick:r,children:n,className:i,...s})=>{const{itemProps:o,itemRefs:a,isFocused:l}=bh(),{onMenuItemKeyDown:u,onMenuItemMouseEnter:c,onMenuItemClick:h}=o,f=v=>{r==null||r(v),t==="action"&&(h(),v.stopPropagation())},m=T.useId(),y=Re("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]})})},Ale=Cle,Rle=T.forwardRef(({children:t,block:e,unstyled:r,...n},i)=>{const{menuProps:s,visible:o}=bh(),a=Re({"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}),Ple=Rle,Ile=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]})),Mle=Ile,kle=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:Re(s.className,"form-check-input c-pointer",e&&"d-none"),id:a},u={...s,...l};return g.jsxs("div",{className:Re("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:Re("c-pointer",t!==s.value&&"text-muted"),children:e}),!e&&r&&g.jsx("label",{className:"form-check-label",htmlFor:u.id,children:r})]})}),E2=kle,Ole=({children:t,value:e,model:r,onChange:n})=>{const{itemProps:i,itemRefs:s,isFocused:o}=bh(),{onMenuItemKeyDown:a,onMenuItemMouseEnter:l}=i,u=T.useId(),c={value:e,model:r,checked:e===r,readOnly:!0},h=Re("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(E2,{...c,className:"position-absolute start-0 end-0 top-0 bottom-0 opacity-0"})]})})},Dle=Ole,Nle=()=>g.jsx("div",{role:"separator",className:"px-4",children:g.jsx("hr",{className:"m-0"})}),Lle=Nle,Fle=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}=bh(),h=Re("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(vz,{width:16,height:16,className:"dropdown-toggle-caret"})]})}),jle=Fle;function j6(){return{xs:$c("only screen and (min-width: 0)"),sm:$c("only screen and (min-width: 375px)"),md:$c("only screen and (min-width: 768px)"),lg:$c("only screen and (min-width: 1024px)"),xl:$c("only screen and (min-width: 1280px)"),xxl:$c("only screen and (min-width: 1400px)")}}function B6(t){var e,r,n;const i=new Hq(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 _k=["mousedown","touchstart"];function U6(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 _k.forEach(s=>{document.addEventListener(s,i)}),()=>{_k.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 T2(...t){return e=>{Ble(e,...t)}}function Ble(t,...e){e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}const Ule=(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}=QH({placement:t,open:i,onOpenChange:s,whileElementsMounted:AH,middleware:[OH(4),NH({apply({rects:j,elements:H}){H.floating.style.minWidth=`${j.reference.width}px`}}),DH({padding:0})]});GH(f,{enabled:r,delay:{open:200},handleClose:ZH()});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))},[]),P=(j,H)=>{j&&(H.stopPropagation(),H.preventDefault())},I=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),P(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}P(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:T2(y,c.setReference),id:`dropdown-toggle-${n}`,"aria-haspopup":"menu","aria-controls":`dropdown-${n}`,"aria-expanded":!!i,className:`${i?"selected":""}`,onClick:z,onKeyDown:I,"aria-activedescendant":l},menuProps:{ref:T2(m,c.setFloating),className:"dropdown-menu","aria-labelledby":`dropdown-toggle-${n}`,style:{...h}},itemProps:{onMenuItemMouseEnter:M,onMenuItemClick:A,onMenuItemKeyDown:N},setVisible:s}},$le=Ule,zle=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 P=A.name.toLowerCase();(w.some(I=>P.endsWith(I))||E.some(I=>A.type.includes(I)))&&b.push(A)})}return b},c=v=>{let x=v.map(b=>new File([b],b.name.replace(/[!:,;="']/g,""),{type:b.type}));t!=null&&t.forceFilters?(x=u(x),x&&x.length&&i(b=>[...b,...x])):i(b=>[...b,...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}},Hle=zle;function $6(){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 Vle(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 z6(){const t=document.querySelector("html");return()=>{t&&t.scrollIntoView()}}const Gle=T.forwardRef(({icon:t,className:e,...r},n)=>{const i={...r,className:Re("btn-icon btn-sm",e)};return g.jsx(it,{ref:n,...i,children:t})}),Ro=Gle,Wle=T.forwardRef(({icon:t=g.jsx(AS,{}),onClick:e,className:r,...n},i)=>{const s=Re("btn-search",r);return g.jsx(Ro,{ref:i,className:s,icon:t,onClick:e,...n})}),oA=Wle,Xle=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(WN,{}),classModifier:"alert-success"},warning:{icon:g.jsx(R$,{}),classModifier:"alert-warning"},info:{icon:g.jsx(BN,{}),classModifier:"alert-info"},danger:{icon:g.jsx(Q$,{}),classModifier:"alert-danger"}},E={"is-dismissible":i,"is-toast ":s},A={"is-confirm":o},P=Re("alert gap-12",w[t].classModifier,E,A,a,e);return g.jsx(g.Fragment,{children:m?g.jsxs("div",{ref:v,className:P,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})}),ta=Xle,M0="top-right";function en(){return{success:(t,e)=>lu.custom(g.jsx(ta,{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)??M0}),error:(t,e)=>lu.custom(g.jsx(ta,{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)??M0}),info:(t,e)=>lu.custom(g.jsx(ta,{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)??M0}),warning:(t,e)=>lu.custom(g.jsx(ta,{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)??M0}),loading:lu.loading,dismiss:t=>lu.dismiss(t),remove:t=>lu.remove(t)}}function Cm(t=!1){const[e,r]=T.useState(t),n=T.useCallback(()=>{r(i=>!i)},[]);return[e,n]}function qle(){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 Yle=({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}=$le(n,i,o),y=U6(()=>{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=Re("dropdown",{"w-100":e,overflow:r});return T.useEffect(()=>{s==null||s(a)},[a]),g.jsx(F6.Provider,{value:v,children:g.jsx("div",{ref:y,className:x,children:typeof t=="function"?t(u,f,m):t})})},Qle=Object.assign(Yle,{Trigger:jle,Menu:Ple,Item:Ale,Separator:Lle,CheckboxItem:Tle,RadioItem:Dle,MenuGroup:Mle}),xt=Qle,Kle=()=>{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")}]},Zle=({control:t,selectedActivities:e,selectActivities:r})=>{const n=Kle(),{t:i}=we();return g.jsx("div",{className:"col d-flex",children:g.jsx(u1,{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))})]})})})},Jle=t=>g.jsx(xt.Trigger,{...t,"aria-haspopup":"listbox",role:"combobox"}),eue=Jle,tue=({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(eue,{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=tue,rue=["3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"],Sk=({name:t,control:e,placeholderOption:r,validate:n})=>g.jsx(u1,{name:t,control:e,rules:{required:!0,validate:n},render:({field:{onChange:i}})=>g.jsx(aA,{block:!0,size:"md",onValueChange:i,options:rue,"aria-required":!0,placeholderOption:r})}),nue=()=>{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")}]},iue="bpr.form.publication.language",sue=({control:t})=>{const e=nue();return g.jsx("div",{className:"col",children:g.jsx(u1,{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:iue})})})},oue=()=>{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(ta,{type:"info",className:"mb-12",children:t("bpr.form.publication.licence.text.3")}),g.jsx(ta,{type:"warning",children:t("bpr.form.publication.licence.text.4")})]})},aue=()=>{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")}]},lue=({control:t,selectedSubjectAreas:e,selectSubjects:r})=>{const n=aue(),{t:i}=we();return g.jsx("div",{className:"col d-flex",children:g.jsx(u1,{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))})]})})})},H6=T.createContext(null);function uue({defaultTheme:t,children:e}){var r;const{appCode:n}=yt(),i=TL({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(H6.Provider,{value:s,children:e})}function ba(){const t=T.useContext(H6);if(!t)throw new Error("Cannot be used outside of OdeClientProvider");return t}const cue=({children:t,space:e=null,flexDirection:r="row"})=>{const n=Re("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})},due=cue,V6=T.createContext(null),G6=()=>{const t=T.useContext(V6);if(!t)throw new Error("Cannot be rendered outside the Card component");return t},hue=({children:t})=>g.jsx("div",{className:"card-footer gap-16",children:t}),fue=hue,pue=()=>{const{isSelectable:t,isClickable:e,onClick:r,onSelect:n}=G6(),{t:i}=we();return t||e?g.jsxs("div",{className:"card-header",children:[t?g.jsx(Ro,{"aria-label":i("card.open.menu"),className:"z-3 bg-white",color:"secondary",icon:g.jsx(lz,{}),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},mue=pue,gue=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 I=Re("h-full",i);return g.jsx(wo,{src:b,alt:_,objectFit:"contain",width:e,height:e,className:I,style:{minWidth:e+"px"}})}const P=Re("app-icon",{...y,...v,...x,[`bg-light-${A}`]:A&&!f,[`color-app-${A}`]:A},i);return g.jsx("div",{className:P,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}`})})})}),ya=gue,vue=({imageSrc:t,className:e,variant:r="medium"})=>{const{app:n}=G6(),i=r==="landscape"?{width:"100%",height:"auto"}:null;return g.jsx("div",{className:Re("card-image",r),children:t?g.jsx(wo,{alt:"",src:t,objectFit:"cover",className:Re("h-full w-100",e)}):g.jsx(ya,{app:n,iconFit:"ratio",size:"80",variant:"rounded",...i})})},yue=vue,xue=({children:t,className:e})=>{const r=Re("card-text small text-break text-truncate text-truncate-1",e);return g.jsx("p",{className:r,children:t})},bue=xue,wue=({children:t,className:e})=>{const r=Re("card-title body text-break text-truncate text-truncate-2",e);return g.jsx("h3",{className:r,children:g.jsx("strong",{children:t})})},_ue=wue,Sue=({userSrc:t,creatorName:e})=>t?g.jsx(rc,{alt:e||"",size:"xs",src:t,variant:"circle",width:"24",height:"24"}):g.jsx(bC,{}),Eue=Sue,Tue=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(V6.Provider,{value:f,children:g.jsxs("div",{ref:u,className:Re("card",{"drag-focus":i,"is-selected":n,"c-pointer":r},l),children:[g.jsx(W6.Header,{}),typeof a=="function"?a(h):a]})})}),W6=Object.assign(Tue,{Title:_ue,Text:bue,Image:yue,Body:due,User:Eue,Footer:fue,Header:mue}),tr=W6;function Cue(t,e){const[r,n]=T.useState(null),{ref:i,inView:s}=tse({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 Aue=({type:t,roleMap:e})=>{const r=typeof(e==null?void 0:e.icon)!="string"&&t!=="unknown",n=Re("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(cz,{})})},Rue=Aue,Pue=({doc:t,isClickable:e=!0,isSelectable:r=!1,isSelected:n=!1,onClick:i,className:s})=>{var o;const a=T.useRef(null),l=Vk.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(c1,{width:22,height:22}),color:"bg-red-200"},ppt:{icon:".PPT",color:"bg-yellow-200"},img:{icon:g.jsx(iz,{width:22,height:22}),color:"bg-green-200"},video:{icon:g.jsx(Gz,{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(Uz,{width:22,height:22}),color:"bg-gray-300"}};return v[y]||v.unknown}const c=Re("file position-relative rounded",((o=u(l??"default"))==null?void 0:o.color)??"bg-yellow-200"),h=l==="img"||l==="video"?Me.workspace().getThumbnailUrl(t):null,f=Cue(h,{ref:a}),m=f&&{backgroundImage:`url(${h})`,backgroundSize:"cover"};return g.jsx(tr,{className:Re("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(Rue,{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})]})]})})},Iue=Pue,Mue=({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(GN,{}),variant:"ghost",color:"tertiary",onClick:o,children:l("tiptap.upload.retry")}),image:g.jsx(wo,{alt:"",src:`${a}/common/image-status-error.svg`,objectFit:"cover"})},idle:b,loading:{text:"",context:g.jsx(fo,{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(fo,{message:l("tiptap.tooltip.upload.loaded"),placement:"top",children:g.jsx(WN,{className:"text-success"})}),image:g.jsx(wo,{alt:"",src:u??"",width:"48",objectFit:"cover",className:"rounded",style:{aspectRatio:1/1}})},unknown:b},w=()=>v&&g.jsx(fo,{message:l("tiptap.tooltip.upload.edit"),placement:"top",children:g.jsx(Ro,{icon:g.jsx(Xz,{}),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(fo,{message:l("tiptap.tooltip.upload.delete"),placement:"top",children:g.jsx(Ro,{icon:g.jsx(NT,{}),variant:"ghost","aria-label":l("tiptap.tooltip.upload.delete"),color:"tertiary",onClick:i})})]})})]})})},kue=Mue,Oue=T.forwardRef(({children:t},e)=>g.jsx("div",{ref:e,className:"actionbar",children:t})),Due=Oue,Nue=T.forwardRef(({children:t,render:e,isFullscreen:r=!1,...n},i)=>{const s=Re("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=Nue;function Ki(t,e){if(Array.isArray(t))for(const r of t){const n=Ki(r,e);if(n)return n}else{if(t.id===e)return t;if(t.children)for(const r of t.children){const n=Ki(r,e);if(n)return n}}}function Fue(t,{parentId:e,newFolder:r}){return Am(t,n=>{var i;if(n.id===e){const s=[...((i=n.folder)==null?void 0:i.ancestors)||[]],o=X6([...s,n.id]);return{...n,children:[...n.children||[],new lA({...r,ancestors:o})]}}else return n})}function X6(t){return t.filter((e,r)=>t.indexOf(e)===r)}function jue(t,{folders:e}){return Am(t,r=>{if(!e.includes(r.id))return r})}const q6=(t,e)=>{if(t.children)for(const r of t.children){if(r.id===e)return t;const n=q6(r,e);if(n)return n}};function C2(t,e){var r;const n=Ki(t,e);return(r=n==null?void 0:n.folder)!=null&&r.ancestors?[...(n==null?void 0:n.folder.ancestors)||[],e]:e===Er.BIN?[Er.BIN]:[Er.DEFAULT]}function Am(t,e){return Y6(t,e)||t}function Y6(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=Y6(o,e,i);a&&s.push(a)}return{...i,children:s}}return i}function Bue(t,{destinationId:e,folders:r}){return Am(t,(n,i)=>{var s,o;if(e===n.id){const a=[...((s=n.folder)==null?void 0:s.ancestors)||[]],l=X6([...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=Ki(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 Uue=(t,e,r)=>Am(t,n=>(n.id===r&&(n.children=e==null?void 0:e.map(i=>new lA(i))),n));function $ue(t,{folderId:e,newFolder:r}){return Am(t,n=>n.id===e?new lA(r):n)}function zue(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){ff(this,"id"),ff(this,"name"),ff(this,"childNumber"),ff(this,"section",!1),ff(this,"children",[]),this.folder=e,this.id=e.id,this.name=e.name,this.childNumber=e.childNumber}}const Hue=T.createContext(null);function Q6(){return T.useContext(Hue)}class Ek{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 pf=(t,e)=>{const r="virtualID";if(!Object.hasOwnProperty.apply(t,[r])){const n=e??`${LB.generateVirtualId()}#${t.size}`;Object.defineProperty(t,r,{value:n,writable:!1})}return t[r]};function K6(t,e){if(e(t))return t;if(Array.isArray(t.children))for(const r of t.children){const n=K6(r,e);if(n)return n}}const Vy=(t,e)=>{const r=e==null?void 0:e.filter(n=>n.id===t&&n.available);return r&&r.length>0},Z6={blog:"Blog",mindmap:"MindMap",scrapbook:"ScrapBook",collaborativewall:"CollaborativeWall",timelinegenerator:"TimelineGenerator",wiki:"Wiki",exercizer:"Exercizer"},pl=t=>{if(t>0){let e=Math.floor(t/1e3),r=Math.floor(e/60);return e=e%60,r=r%60,Tk(r)+":"+Tk(e)}return"00:00"},Tk=t=>t.toString().padStart(2,"0"),Gue=()=>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",J6=T.createContext({ariaLabelId:"",ariaDescriptionId:"",focusId:""}),e8=()=>{const t=T.useContext(J6);if(!t)throw new Error("Cannot be rendered outside the Modal component");return t},Wue=t=>{const{ariaDescriptionId:e}=e8(),{children:r,className:n}=t,i=Re("modal-body",n);return g.jsx("div",{id:e,className:i,children:r})},Xue=Wue,que=t=>g.jsx("div",{className:"modal-footer",children:t.children}),Yue=que,Que=t=>{const{onModalClose:e,children:r}=t,{ariaLabelId:n,focusId:i}=e8(),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(Ro,{ref:s,"aria-label":o("close"),color:"tertiary",icon:g.jsx(NT,{}),type:"button",variant:"ghost",title:o("close"),onClick:e,className:"btn-close"})]})},Kue=Que,Zue=t=>g.jsx("p",{className:"modal-subtitle",children:t.children}),Jue=Zue,ece=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=U6(i),m=qle();Vle(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=Re("modal fade",{"show d-block":n,"modal-scrollable":a,viewport:o,[`modal-${s}`]:s}),v=Re("modal-dialog"),x={ariaLabelId:c,ariaDescriptionId:h,focusId:l},b=hC(n,{from:{x:-50,opacity:0},enter:{x:0,opacity:1},leave:{x:50,opacity:0}});return g.jsx(J6.Provider,{value:x,children:b((_,w)=>g.jsxs(g.Fragment,{children:[w&&g.jsx(Il.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(Il.div,{className:"modal-backdrop fade show",style:{opacity:.65}})]}))})}),tce=Object.assign(ece,{Header:Kue,Subtitle:Jue,Body:Xue,Footer:Yue}),Ye=tce,rce=({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}=bq(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:Re("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})]})]})},fo=rce,t8=T.createContext(null);function uA(){const t=T.useContext(t8);if(!t)throw new Error("Tabs compound components cannot be rendered outside the Tabs component");return t}const nce=({defaultId:t,items:e,onChange:r})=>{const[n,i]=T.useState(t||""),[s,o]=T.useState(0),[a,l]=T.useState(0),u=T.useRef([]),c=T.useCallback(y=>{i(y)},[]);T.useEffect(()=>{const y=e.find(v=>v.id===n);y&&(r==null||r(y))},[n]),T.useEffect(()=>{function y(){var v;if(((v=document==null?void 0:document.activeElement)==null?void 0:v.tagName)!=="INPUT"){const x=e.findIndex(_=>_.id===n);x===-1&&t&&i(t);const b=u.current[x];b&&(b.focus(),l((b==null?void 0:b.offsetLeft)??0),o((b==null?void 0:b.clientWidth)??0))}}return y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[n,e,t]);const h=T.useCallback(y=>{var v,x,b;const _=e.findIndex(w=>w.id===y);y===((v=e[0])==null?void 0:v.id)?i((x=e[e.length-1])==null?void 0:x.id):i((b=e[_-1])==null?void 0:b.id)},[e]),f=T.useCallback(y=>{var v,x,b;const _=e.findIndex(w=>w.id===y);y===((v=e[e.length-1])==null?void 0:v.id)?i((x=e[0])==null?void 0:x.id):i((b=e[_+1])==null?void 0:b.id)},[e]),m=T.useCallback(y=>{var v,x;switch(y.code){case"ArrowLeft":h(n);break;case"ArrowRight":f(n);break;case"Home":i((v=e[0])==null?void 0:v.id);break;case"End":i((x=e[e.length-1])==null?void 0:x.id);break}},[n,e,f,h]);return{activeTab:n,setSelectedTab:c,tabsRef:u,tabUnderlineLeft:a,tabUnderlineWidth:s,onKeyDown:m}},ice=({icon:t,label:e,id:r,order:n})=>{const{activeTab:i,setSelectedTab:s,onKeyDown:o,tabsRef:a}=uA(),{t:l}=we(),u=Re("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)})]})})},sce=ice,oce=t=>{const{items:e,tabUnderlineLeft:r,tabUnderlineWidth:n}=uA(),{className:i,...s}=t,o=Re("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(oa.Item,{order:l,...a},a.id))}),g.jsx("span",{className:"nav-slide",style:{left:r,width:n}})]})},ace=oce,lce=({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})})},uce=lce,oa=({defaultId:t,items:e,onChange:r,children:n})=>{const{activeTab:i,setSelectedTab:s,tabsRef:o,tabUnderlineLeft:a,tabUnderlineWidth:l,onKeyDown:u}=nce({defaultId:t,items:e,onChange:r}),c=T.useMemo(()=>({activeTab:i,items:e,setSelectedTab:s,tabsRef:o,tabUnderlineLeft:a,tabUnderlineWidth:l,onKeyDown:u}),[i,e,u,s,a,l,o]),h=e.find(f=>f.id===i);return g.jsx(t8.Provider,{value:c,children:typeof n=="function"?n(h):g.jsxs(g.Fragment,{children:[g.jsx(oa.List,{}),g.jsx(oa.Panel,{currentItem:h,children:h==null?void 0:h.content})]})})};oa.Item=sce;oa.Panel=uce;oa.List=ace;const cce=T.forwardRef(({children:t,className:e,...r},n)=>{const i=Re("breadcrumb-item",e);return g.jsx("li",{ref:n,className:i,...r,children:t})}),k0=cce,dce=T.forwardRef(({children:t,className:e},r)=>{const n=Re("breadcrumb d-flex flex-nowrap align-items-center mb-0",e);return g.jsx("ol",{ref:r,className:n,children:t})}),hce=dce;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 fce=T.forwardRef(({children:t,app:e,className:r},n)=>{const{t:i}=we(),{getIconClass:s}=cA(),o=Re("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})}),pce=fce,mce=T.forwardRef(({app:t,name:e},r)=>{const{t:n}=we();return g.jsx(pce,{app:t,ref:r,className:"mw-100",children:g.jsx(hce,{className:"gap-12 mw-100",children:e?g.jsxs(g.Fragment,{children:[g.jsx(k0,{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(ya,{app:t,size:"40"})})}),g.jsx(k0,{children:g.jsx(zN,{color:"var(--edifice-gray-600)",width:20,height:20})}),g.jsx(k0,{className:"text-truncate",children:g.jsx(Ss,{level:"h1",headingStyle:"h3",className:"text-truncate",children:e})})]}):g.jsxs(k0,{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(ya,{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)})]})})})}),gce=mce,r8=T.createContext(null),J1=()=>{const t=T.useContext(r8);if(!t)throw new Error("Cannot be rendered outside the FormControl component");return t},vce=({children:t})=>{const{status:e}=J1(),r=Re("form-text",{"is-invalid":e==="invalid",valid:e==="valid"});return g.jsx("p",{className:r,children:g.jsx("em",{children:t})})},yce=vce,xce=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}=J1(),h=Re({"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})}),Kn=xce,bce=T.forwardRef(({leftIcon:t,optionalText:e,requiredText:r="*",children:n,className:i},s)=>{const{id:o,isOptional:a,isRequired:l}=J1(),{t:u}=we(),c=Re("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})]})}),Gi=bce,wce=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(r8.Provider,{value:u,children:g.jsx("div",{ref:l,className:e,...a,children:t})})}),_ce=Object.assign(wce,{Label:Gi,Input:Kn,Text:yce}),Ot=_ce,Sce=({placeholder:t,value:e="",searchMinLength:r=3,handleSearchInputChange:n})=>{const{triggerProps:i,itemProps:s,setVisible:o}=bh(),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(Kn,{...a,className:"max-w-512",noValidationIcon:!0,placeholder:t,size:"md",type:"search",onKeyDown:s.onMenuItemKeyDown})})},Ece=Sce,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=Ece;const Tce=dA,n8=T.createContext(null);function hA(){const t=T.useContext(n8);if(!t)throw new Error("Cannot be rendered outside Dropzone Provider");return t}const Cce=()=>{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")})})})},Ace=Cce,Rce=({children:t,multiple:e})=>{const{t:r}=we(),{files:n,inputRef:i}=hA(),s=n&&n.length>0,o=Re("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(d1,{}),disabled:!e,onClick:()=>{var a;return(a=i==null?void 0:i.current)==null?void 0:a.click()},children:r("dropzone.add.more")})})}),g.jsx("div",{className:"p-8",children:t})]})},Pce=Rce,Ice=()=>{const{t}=we(),{files:e,inputRef:r}=hA(),n=e&&e.length>0,i=Re("dropzone-import-wrapper",{"d-flex":!n,"d-none":n});return g.jsxs("div",{className:i,children:[g.jsx(W$,{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")})]})},Mce=Ice,Wu=({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}=Hle(e?{forceFilters:!0}:void 0),v=Re("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(n8.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:"d-flex flex-fill",children:[n?null:g.jsxs(g.Fragment,{children:[g.jsx(Wu.File,{multiple:r,children:i}),g.jsx(Wu.Import,{})]}),g.jsx(Wu.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})]})})};Wu.File=Pce;Wu.Import=Mce;Wu.Drag=Ace;const kce=Wu,so=({children:t,className:e,...r})=>{const n=Re("grid",e);return g.jsx("div",{className:n,...r,children:t})},Oce=({sm:t,md:e,lg:r,xl:n,children:i,className:s,as:o,...a})=>{const l=o||"div",u=Re({[`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})};so.Col=Oce;const Dce=T.forwardRef(({position:t=!0,caption:e},r)=>{const[n]=Pn(),i=`${n}/loading/screen-loading.gif`,s=Re("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=Re("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"})]})}),fr=Dce,Nce=T.forwardRef(({src:t,is1d:e,translate:r="Retour accueil"},n)=>{const i=Re("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"})})}),Ck=Nce,Lce=({children:t,className:e})=>{const r=Re("popover-body",e);return g.jsx("div",{className:r,children:t})},Fce=({children:t,className:e})=>{const r=Re("popover-footer p-8",e);return g.jsx("div",{className:r,children:t})},i8=T.forwardRef(({children:t,className:e,id:r,isVisible:n,...i},s)=>{const o=Re("popover d-block position-absolute top-100 start-50 translate-middle-x",e);return hC(n,{from:{opacity:0},enter:{opacity:1},leave:{opacity:0},config:{duration:0}})((a,l)=>l&&g.jsx(Il.div,{ref:s,"aria-labelledby":r,className:o,role:"tooltip",style:a,...i,children:t}))}),jce=({isVariant:t=!1,size:e="md",placeholder:r="search",className:n,disabled:i,onChange:s,onClick:o,...a})=>{const{t:l}=we(),u=Re(n,{"input-group":!t,"position-relative":t}),c=Re({"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(AS,{})}),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(AS,{}),className:"border-start-0",onClick:h})]})},s8=jce,Bce=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}=J1(),h=Re({"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=Bce,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=Re("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 P;const I=(P=v.current)==null?void 0:P.querySelectorAll("button"),M=[];let N=!1;I==null||I.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=P=>{P.target.classList.add("focus")},_=P=>{P.target.classList.remove("focus")},w=P=>{var I,M;const N=u.indexOf(P.currentTarget);switch(P.code){case"ArrowLeft":P.currentTarget===h?m==null||m.focus():(I=u[N-1])==null||I.focus();break;case"ArrowRight":P.currentTarget===m?h==null||h.focus():(M=u[N+1])==null||M.focus();break}},E=P=>{var I;return typeof P.tooltip=="string"?P.tooltip:(I=P.tooltip)==null?void 0:I.message},A=P=>{var I;return typeof P.tooltip!="string"?(I=P.tooltip)==null?void 0:I.position:"top"};return g.jsx("div",{ref:T2(o,v),className:x,role:"toolbar","aria-label":"Text Formatting","aria-controls":i,onFocus:b,onBlur:_,children:t.map((P,I)=>{if(P.visibility==="hide")return null;switch(P.type){case"divider":return g.jsx("div",{className:"toolbar-divider"},P.name??I);case"button":return g.jsx(fo,{message:E(P),placement:A(P),children:T.createElement(it,{...P.props,key:P.name??I,color:P.props.color?P.props.color:"tertiary",variant:"ghost",tabIndex:I===a?0:-1,onKeyDown:w})},P.name??I);case"icon":return g.jsx(fo,{message:E(P),placement:A(P),children:T.createElement(Ro,{...P.props,key:P.name??I,color:P.props.color?P.props.color:"tertiary",variant:P.props.variant?P.props.variant:"ghost",tabIndex:I===a?0:-1,onKeyDown:w})},P.name??I);case"dropdown":return T.createElement(xt,{...P.props,key:P.name??I,extraTriggerKeyDownHandler:w,overflow:P.overflow});case"primary":return g.jsx(fo,{message:E(P),placement:A(P),children:g.jsx(it,{...P.props,variant:"filled",color:"primary",tabIndex:I===a?0:-1,onKeyDown:w})},P.name??I)}return null})})}),A2=({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:Re("action-container d-flex align-items-center gap-8 px-2",{"drag-focus":f,"py-4":!t.section}),arrow:Re({"py-4":!t.section,"py-8":t.section,invisible:!Array.isArray(t.children)||t.children.length===0}),button:Re("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}=Gj({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))},P=M=>g.jsx(M?Tp:zN,{title:v("foldUnfold"),width:y,height:y}),I=()=>{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:I()&&P(u)}),g.jsxs("div",{tabIndex:0,role:"button",className:m.button,onClick:()=>b(t.id),onKeyDown:E,children:[t.section&&e&&g.jsx(jN,{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(d1,{height:16,width:16})})]}),Array.isArray(t.children)&&!!t.children.length&&u&&g.jsx("ul",{role:"group",children:t.children.map(M=>g.jsx(A2,{node:M,selectedNodeId:r,expandedNodes:n,siblingsNodes:i,draggedNodeId:s,handleItemClick:o,handleToggleNode:a},M.id))})]})},t.id)},Uce=({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 $;const V=($=F.children)==null?void 0:$.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),$=(L=j.children)==null?void 0:L.filter(V=>V.id!==F.id);$!=null&&$.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(!Ki(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=zue(t,j),L=Array.from(H);F.forEach(O=>{const $=L.indexOf(O);$>-1&&L.splice($,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)},P=j=>{c.has(j)?A(j):E(j)},I=j=>{v!==j&&u(j)},M=j=>{I(j),E(j),a==null||a(j)},N=j=>{P(j)},z=j=>{Ki(t,r)&&E(j)};return{selectedNodeId:v,expandedNodes:c,siblingsNodes:f,draggedNodeId:m,handleItemClick:M,handleFoldUnfold:N}},$ce=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}=Uce({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(A2,{node:b,showIcon:l,selectedNodeId:h,expandedNodes:f,siblingsNodes:m,draggedNodeId:y,handleItemClick:v,handleToggleNode:x,handleItemAction:o},b.id)):g.jsx(A2,{node:r,selectedNodeId:h,expandedNodes:f,siblingsNodes:m,showIcon:l,draggedNodeId:y,handleItemClick:v,handleToggleNode:x})})})}),dd=$ce,zce=T.forwardRef(({children:t},e)=>g.jsx("span",{className:"visually-hidden",ref:e,children:t})),ml=zce;function Hce(){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 Wi(t){const e=Q6(),[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 Me.rights().sessionHasWorkflowRight(t):i=await Me.rights().sessionHasWorkflowRights(t);n(i)})()},[t,e]),r}const Vce=()=>{const t=Wi("fr.openent.zimbra.controllers.ZimbraController|view"),e=Wi("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 Me.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 Me.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}},Gce=Vce;function Wce({user:t,avatar:e}){const{appCode:r}=yt(),{t:n}=we(),{theme:i}=ba(),s=n(r),[o,a]=T.useState(!0),[l,u]=$6(),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=Hce(),x=Wi("net.atos.entng.community.controllers.CommunityController|view"),b=Wi("org.entcore.conversation.controllers.ConversationController|view"),_=Wi("fr.openent.searchengine.controllers.SearchEngineController|view"),w=T.useCallback(()=>{a(!o)},[o]),E=async()=>{await Me.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 Xce=t=>{const e=T.useRef(),r=en(),{t:n}=we();return T.useEffect(()=>{const i=Me.notify().events().subscribe(NB.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(Ie.createElement("div",{children:[e.current]}),t)});return()=>i.revoke()},[n,r]),e.current},qce=Xce;function o8(){const[t,e]=T.useState(!1);T.useEffect(()=>{r()},[]);const r=T.useCallback(async()=>{const n=await Me.session().isAdml();e(n)},[]);return{isAdml:t}}const Yce=()=>{var t;const{user:e,appCode:r}=yt(),n=Z6[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}`},Qce=Yce,Kce=()=>({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 Me.workspace().searchDocuments({filter:"all",id:u,limit:1}),h=c.length?c[0].name:void 0;await Me.workspace().updateFile(u,r,{alt:t,legend:n,name:h});const f=(await Me.workspace().searchDocuments({filter:"all",id:u,limit:1}))[0];return{file:f,src:`/workspace/${f.public?"pub/":""}document/${u}`}}else{const u=await Me.workspace().saveFile(r,{application:s,parentId:i,visibility:o});return`/workspace/${u.public?"pub/":""}document/${u._id}`}},create:async(t,e)=>await Me.workspace().saveFile(t,e),remove:async t=>!t||Array.isArray(t)&&t.length===0?Promise.resolve():await Me.workspace().deleteFile(Array.isArray(t)?t:[t])}),ex=Kce,Zce=()=>{const t=T.useRef(null),[e,r]=T.useState(),{remove:n}=ex();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)}}},a8=Zce,Jce=t=>{const[e,r]=T.useState([]);T.useEffect(()=>{(async()=>(await Eb.initialize(Me,t),await Eb.registerBehaviours(t),r(Eb.resourceProducingApps)))()},[]);const n=T.useCallback(async i=>{const[s]=i.types;return await Me.behaviour(t,s).loadResources(i)},[t]);return{resourceApplications:e,loadResources:n}},ede=(t,e="media-library")=>{const[r,n]=T.useState({}),{browser:i,device:s}=B6(navigator.userAgent),{create:o}=ex(),a=T.useCallback(y=>r[pf(y)],[r]),l=(y,v)=>{n(x=>{const b=pf(y);return{...x,[b]:v}})},u=y=>{n(v=>{const x=pf(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(Gk.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 Me.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 pf(v,pf(y)),c(v,x)}return{getUploadStatus:a,setUploadStatus:l,clearUploadStatus:u,uploadFile:c,uploadAlternateFile:m,uploadBlob:h}},l8=ede,tde=({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}=ex(),{getUploadStatus:f,setUploadStatus:m,clearUploadStatus:y,uploadFile:v,uploadAlternateFile:x}=l8(e,r),b=T.useCallback(P=>{P.forEach(async(I,M)=>{if(I==null)return;let N;if(I.type.startsWith("image"))try{const z=await $q.resizeImageFile(I);N=await x(I,z),u(M,z)}catch(z){console.error(z)}N||(N=await v(I)),N&&i(z=>[...z,N])})},[x,v,u]);T.useEffect(()=>{let P=0;const I=a.map(M=>{if(P>=5)return null;const N=f(M);return N==="loading"&&P++,N?null:M});I.forEach(M=>M&&m(M,"idle")),b(I)},[a,n,f,m,b]),T.useEffect(()=>{const P=_(a,n);t(P)},[n]);const _=(P,I)=>{const M=P.reduce((N,z,j)=>(N[z.name]=j,N),{});return I.sort((N,z)=>M[N.name]-M[z.name])};async function w(P){const I=n.find(M=>M.name===P.name);I&&(await c(I),y(P),i(M=>M.filter(N=>N.name!==(I==null?void 0:I.name)))),l(P)}async function E({blob:P,legend:I,altText:M}){if(s)try{const N=await h({blob:P,legend:I,alt:M,uri:A(s)});N&&typeof N=="object"&&i(z=>z.map(j=>j._id===N.file._id?{...N.file,title:I,alt:M}:j))}finally{o(void 0)}}const A=(P,I)=>{const M=`/workspace/${P!=null&&P.public?"pub/":""}document/${P==null?void 0:P._id}`;return P?I?Vue(M):M:""};return{files:a,getUploadStatus:f,clearUploadStatus:y,uploadedFiles:n,editingImage:s,setEditingImage:o,getUrl:A,updateImage:E,uploadFile:v,removeFile:w}},rde=tde;function wh(){const{user:t,userDescription:e}=yt(),{theme:r}=ba();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 O0(t,e,r,n){const i=Q6(),s=Wi("org.entcore.workspace.controllers.WorkspaceController|listDocuments"),o=Wi("org.entcore.workspace.controllers.WorkspaceController|listFolders");function a(h,f){switch(f.type){case"update":{const m=Ki(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 Me.workspace().listDocuments(r,m),v=[],x=[];y.filter(b=>{if(!n||b.eType==="folder")return!0;const _=Vk.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 nde(){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 Me.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 ide(){const{currentLanguage:t}=yt(),{userDescription:e}=wh(),{isAdml:r}=o8(),{theme:n}=ba(),i=window.innerWidth<=768,s=Wi("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 Me.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 sde(){const t=Wi("org.entcore.portal.controllers.PortalController|optionalFeatureCantoo");return T.useEffect(()=>{t&&!document.getElementById("cantoo-edifice-script")&&(async()=>{const e=await Me.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 ode({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 ade({onSuccess:t,resource:e}){const{user:r,appCode:n}=yt(),i=en(),[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}}=OT({mode:"onChange"}),[x,b]=T.useState([]),[_,w]=T.useState([]),E=(A,P,I)=>{let M=[...P];const N=M.findIndex(z=>z===A);P.includes(A)?M=P.filter((z,j)=>j!==N):M=[...P,A],I(M)};return{control:a,cover:s,formState:{errors:f,isSubmitting:m,isDirty:y,isValid:v},handleDeleteImage:()=>o(""),handlePublish:async A=>{const P=r?r==null?void 0:r.userId:"";try{let I=new Blob;typeof s=="string"?I=await Me.http().get(s,{responseType:"blob"}):s?I=await Me.http().get(URL.createObjectURL(s),{responseType:"blob"}):e!=null&&e.thumbnail&&(I=await Me.http().get(e==null?void 0:e.thumbnail,{responseType:"blob"}));const M=await Me.http().get(`/userbook/avatar/${P}?thumbnail=48x48`,{responseType:"blob"}),N=await Me.http().get(`/directory/user/${P}/attachment-school`,{responseType:"json"}),z=Z6[n],j={activityType:x,age:[A.ageMin,A.ageMax],application:z,cover:I,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:P,userStructureName:N.name||(r==null?void 0:r.structureNames[0])},H=await Me.resource(n).publish(j);H.success?i.success(g.jsx(ode,{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(I){console.error(I),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 lde=(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 Me.resource(t).searchResource({application:t,id:e});n(i)}catch(i){console.error(i)}})()},[]),r},mA=lde,ude=({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=Re("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(Ro,{"aria-label":t,color:"tertiary",icon:g.jsx(q$,{}),onClick:h,type:"button",variant:"ghost"}),g.jsx(Ro,{"aria-label":e,color:"danger",disabled:!u,icon:g.jsx(LN,{width:"20",height:"20"}),onClick:f,type:"button",variant:"ghost"})]}),u?g.jsx(rc,{alt:"",src:u,size:"xl"}):g.jsx(ya,{app:o,iconFit:"ratio",size:"160",variant:"rounded"})]})},u8=ude,cde=({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(FT,{width:12,height:12,className:"me-8 text-danger"}):g.jsx(Zv,{width:12,height:12,className:"me-8 text-danger"}),pl(t!=="IDLE"?r:0)+" / "+pl(i)]}),e!=="IDLE"&&g.jsxs("div",{className:"d-flex align-items-center mx-auto",children:[g.jsx(c1,{width:12,height:12,className:"me-8"}),pl(n*1e3)," /",pl(r)]})]}),dde=cde;function hde(t,e,r=!1,n="protected",i="media-library"){var s;function o(q,re){return{...q,...re.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:P}=we(),{create:I}=ex(),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 re,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),(re=E.current)==null||re.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}),re=new AudioContext({sampleRate:N}),ue=re.createMediaStreamSource(q);try{await re.audioWorklet.addModule("/infra/public/js/audio-recorder-processor.js")}catch(me){console.error(me)}const le=new AudioWorkletNode(re,"audio-recorder-processor");le.port.addEventListener("message",z),b({type:"update",updatedState:{micStream:q,micStreamAudioSourceNode:ue,audioContext:re,recordTime:0,audioWorkletNode:le,recordState:"RECORDING",playState:"IDLE"}}),A.current=[],E.current=[],le.port.start(),ue.connect(le),le.connect(re.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 re=window.URL.createObjectURL(q.data);b({type:"update",updatedState:{isEncoding:!1}}),w.current&&(w.current.src=re),e&&e(re)})},[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]),$=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 re=(q=_.current)==null?void 0:q.value;if(!re){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],re,{type:"audio/mp3"}),_e=await I(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]),U=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=P(a==="IDLE"?"bbm.audio.record.start":"bbm.audio.record.resume"),K=[{type:"icon",name:"record",visibility:a==="RECORDING"?"hide":"show",props:{icon:g.jsx(Zv,{}),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(xz,{}),color:"danger",disabled:a!=="RECORDING",onClick:L,"aria-label":P("bbm.audio.record.pause")},tooltip:P("bbm.audio.record.pause")},{type:"divider"},{type:"icon",name:"encoding",visibility:x?"show":"hide",props:{icon:g.jsx(UN,{style:{animation:"loading 1s infinite"}}),disabled:!0}},{type:"icon",name:"play",visibility:x||l==="PLAYING"?"hide":"show",props:{icon:g.jsx($N,{}),disabled:a!=="RECORDED"&&a!=="PAUSED"&&a!=="SAVED",onClick:O,"aria-label":P("bbm.audio.play.start")},tooltip:P("bbm.audio.play.start")},{type:"icon",name:"playPause",visibility:!x&&l==="PLAYING"?"show":"hide",props:{icon:g.jsx(FT,{}),onClick:$,"aria-label":P("bbm.audio.play.pause")},tooltip:P("bbm.audio.play.pause")},{type:"icon",name:"stop",props:{icon:g.jsx(Az,{}),disabled:l!=="PLAYING"&&l!=="PAUSED",onClick:U,"aria-label":P("bbm.audio.play.stop")},tooltip:P("bbm.audio.play.stop")},{type:"divider"},{type:"icon",name:"reset",props:{icon:g.jsx(VN,{}),disabled:a!=="RECORDED"&&a!=="PAUSED"&&l!=="PLAYING"&&l!=="PAUSED",onClick:V,"aria-label":P("bbm.audio.record.reset")},tooltip:P("bbm.audio.record.reset")},{type:"icon",name:"save",visibility:r?"hide":"show",props:{icon:g.jsx(jT,{}),disabled:a!=="RECORDED"&&a!=="PAUSED"&&l!=="PLAYING"&&l!=="PAUSED"||a==="SAVED"||!((s=_.current)!=null&&s.value),onClick:k,"aria-label":P("bbm.audio.record.save")},tooltip:P("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 fde=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}=hde(t,e,r,n,"media-library"),{t:y}=we();T.useImperativeHandle(i,()=>({save:m}));const[v,x]=T.useState(0),b=Re({"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(Kn,{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(c1,{width:64,height:64,className:b})}),g.jsx(dde,{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})]})}),pde=fde,mde=({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(CS,{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")})})]})},gde=mde,vde=({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(zz,{}),"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(GN,{}),"aria-label":r("rotate"),children:r("rotate"),onClick:()=>s("ROTATE")},tooltip:r("rotate")},{type:"button",name:"crop",props:{color:"tertiary",leftIcon:g.jsx(H$,{}),"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(D$,{}),"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})},yde=vde,xde=100,Ak=100,bde=450,wde=64,_de=.5,Sde="image";function R2(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 P2(t,{spriteName:e,imgDatasource:s,settings:n});const a=t==null?void 0:t.stage.getChildByName(e,!0);o(a)}})}async function P2(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 Ar?r:await Ee.fromURL(r),o=s instanceof Ar?s:Ar.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);Ede(t,o)}function Ede(t,e){var r;const n=t.view.parentNode,i=window.innerWidth-wde,s=Math.max((n==null?void 0:n.offsetWidth)??0,Ak),o=Tde({width:e.width,height:e.height},{width:{max:Math.min(s,i),min:Ak},height:{min:xde,max:window.innerHeight-bde}}),{height:a,width:l}=o;(r=t.view)!=null&&r.style&&(t.view.style.width=`${l}px`,t.view.style.height=`${a}px`)}function Tde(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 Cde(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",_de):r("EXTRACT_FAILED")})}function Ade(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 I2(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 Rde({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 Pde({application:t,sprite:e,newHeight:r,newWidth:n}){e.anchor.x=.5,e.anchor.y=.5,e.position=new tt(n/2,r/2),t.stage.height=r,t.stage.width=n,t.renderer.resize(n,r)}const Ide=20,Mde=({maxSize:t=Ide,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=I2(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}},kde=Mde;function Ode(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 c8=20,Dde=50,vA="BRUSH_CURSOR";function Nde(t,e){const r=new Vi;for(const n of t)n&&(r.beginFill(16777215,1),r.drawCircle(n.x,n.y,c8/e),r.lineStyle(0),r.endFill());return r}function Lde(t,{spriteName:e}){return Ode(Dde,r=>t.stage.toLocal(r.global),r=>{const n=t.stage.getChildByName(e),i=gA(t);if(n==null)return;const s=new Ar(n.texture);s.filters=[new bj(8,4,Math.min(i,1))],s.width=n.width,s.height=n.height,s.scale=new tt(1,1),s.anchor=n.anchor,s.mask=Nde(r,i),n.addChild(s)})}function Fde(t){d8(t);const e=gA(t),r=new Vi;return r.lineStyle(Math.max(1,1/e),16711680),r.drawCircle(0,0,c8/e),r.endFill(),r.name=vA,t.stage.addChild(r),r}function d8(t){const e=t.stage.getChildByName(vA);e&&e.removeFromParent()}function jde(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 Bde(t,{spriteName:e}){t.stage.interactive=!0;const r=Fde(t),n=jde(t);t.stage.on("pointermove",n);const i=Lde(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 Ude(t){d8(t),t.stage.off("pointerdown"),t.stage.off("pointermove")}const $de=["TOP_LEFT","TOP_RIGHT","BOTTOM_LEFT","BOTTOM_RIGHT"],D0=0,zde=20,yA="CROP_BACKGROUND_NAME",Rm="CROP_MASK_NAME";function M2(t){return"CROP_CORNER_"+t}function Hde(t,{spriteName:e}){h8(t);const r=t.stage.getChildByName(e);if(r==null)return;const n=r.getBounds(),i=t.renderer.generateTexture(t.stage).clone(),s=new Ar(i);s.height=n.height,s.width=n.width,s.position=new tt(0,0);const o=new Vi;o.beginFill(16777215,.5),o.drawRect(0,0,n.width,n.height),o.endFill(),o.name=yA,o.position=new tt(n.x,n.y);const a=new Vi;a.beginFill(0,1),a.drawRect(0,0,n.width-2*D0,n.height-2*D0),a.endFill(),a.position=new tt(D0,D0),a.name=Rm,s.mask=a,t.stage.addChild(o),o.addChild(a),o.addChild(s)}function h8(t){const e=t.stage.getChildByName(yA,!0);e==null||e.removeFromParent()}function f8(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 Vde(t){const e=t.stage.getChildByName(Rm,!0);e!=null&&$de.forEach(r=>{const n=t.stage.getChildByName(M2(r),!0);if(n==null)return;const i=f8(r,{height:e.height,width:e.width,x:e.x,y:e.y});n.position=new tt(i.x,i.y)})}function N0(t,e,{spriteName:r}){const n=t.stage.getChildByName(M2(e),!0),i=gA(t);n==null||n.removeFromParent();const s=t.stage.getChildByName(yA,!0),o=t.stage.getChildByName(Rm,!0);if(t.stage.getChildByName(r)==null||s===null||s===void 0||o===void 0||o===null)return;const l=f8(e,{height:o.height,width:o.width,x:o.x,y:o.y}),u=new Vi;u.beginFill(4960213,1),u.arc(0,0,zde/i,l.start,l.end),u.lineTo(0,0),u.endFill(),u.position=new tt(l.x,l.y),u.name=M2(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,Gde(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 Gde(t,e,r){const n=t.stage.getChildByName(Rm,!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}}Vde(t)}function Wde(t,{spriteName:e}){xA(t),t.stage.interactive=!0,t.stage.interactiveChildren=!0,Hde(t,{spriteName:e}),N0(t,"BOTTOM_LEFT",{spriteName:e}),N0(t,"BOTTOM_RIGHT",{spriteName:e}),N0(t,"TOP_LEFT",{spriteName:e}),N0(t,"TOP_RIGHT",{spriteName:e})}function xA(t){h8(t),t.stage.off("pointermove"),t.render()}function Xde(t){const e=t.stage.getChildByName(Rm,!0);if(e==null)return;xA(t);const r=t.renderer.generateTexture(t.stage).clone(),n=new Ar(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 Ar(o)}const qde=20,tx="CONTROL_NAME";function p8(t){return"RESIZE_CORNER_"+t}function Yde(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 Qde(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 tt(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 tt(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 tt(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 tt(c,u),e.width=a-2*c,e.height=l-2*u;break}}}function kf(t,e){const r=t.stage.getChildByName(p8(e),!0);r==null||r.removeFromParent()}function L0(t,e,{spriteName:r}){kf(t,e);const n=t.stage.getChildByName(r,!0),i=t.stage.getChildByName(tx,!0);if(n==null||i===null||i===void 0)return;const s=Yde(e,i),o=new Vi;o.beginFill(4960213,1),o.arc(0,0,qde,s.start,s.end),o.lineTo(0,0),o.endFill(),o.position=new tt(s.x,s.y),o.name=p8(e),o.interactive=!0;let a=!1;t.stage.on("pointermove",c=>{if(a===!1)return;const h=t.stage.toLocal(c.global);Qde(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 Kde(t,e){m8(t);const r=t.stage.getChildByName(e,!0);if(r==null)return;const n=t.renderer.generateTexture(t.stage),i=new Ar(n);t.stage.children.forEach(o=>{o.alpha=0});const s=new Vi;s.drawRect(0,0,r.width,r.height),s.name=tx,s.interactive=!0,s.interactiveChildren=!0,t.stage.interactive=!0,t.stage.interactiveChildren=!0,t.stage.addChild(s),s.addChild(i)}function m8(t){const e=t.stage.getChildByName(tx,!0);e==null||e.removeFromParent(),t.stage.children.forEach(r=>{r.alpha=1})}function Zde(t,e){Kde(t,e),L0(t,"BOTTOM_LEFT",{spriteName:e}),L0(t,"BOTTOM_RIGHT",{spriteName:e}),L0(t,"TOP_LEFT",{spriteName:e}),L0(t,"TOP_RIGHT",{spriteName:e})}function g8(t){m8(t),kf(t,"BOTTOM_LEFT"),kf(t,"BOTTOM_RIGHT"),kf(t,"TOP_LEFT"),kf(t,"TOP_RIGHT"),t.stage.off("pointermove")}function Jde(t,e){Zde(t,e)}function ehe(t){g8(t),t.stage.off("pointermove"),t.render()}function the(t){var e;const r=(e=t==null?void 0:t.stage)==null?void 0:e.getChildByName(tx,!0),n=r?{height:r.height,width:r.width}:void 0;if(g8(t),n){const i=t.renderer.generateTexture(t.stage).clone(),s=new Ar(i);return s.width=n.width,s.height=n.height,s}else return}async function rhe(t,e){const r=t==null?void 0:t.stage.getChildByName(e,!0);if(t&&r){if(!t)return;const n=await I2(t),i=await R2(t,{imgDatasource:n,spriteName:e,settings:Rde({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,Pde({application:t,sprite:i,newHeight:i.width,newWidth:i.height}),t.render();const l=await I2(t);s!==void 0&&(a.style.maxHeight=s),o!==void 0&&(a.style.visibility=o),await R2(t,{imgDatasource:l,spriteName:e})}}function nhe({application:t,spriteName:e,onSave:r}){return{rotate:async()=>{t&&await rhe(t,e)},startCrop:()=>{t&&Wde(t,{spriteName:e})},stopCrop:n=>{if(t){if(n){const i=Xde(t);i&&r(i)}xA(t)}},startBlur:()=>{t&&Bde(t,{spriteName:e})},stopBlur:()=>{t&&Ude(t)},startResize:()=>{t&&Jde(t,e)},stopResize:n=>{if(t){if(n){const i=the(t);i&&r(i)}ehe(t)}}}}function ihe({imageSrc:t,spriteName:e=Sde}){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}=nhe({spriteName:e,application:r,onSave(_){r&&P2(r,{imgDatasource:_,spriteName:e})}}),m=()=>r?Cde(r):Promise.resolve(void 0),y=()=>{if(r)return Ade(r)},{restore:v,historize:x,historyCount:b}=kde({application:r,spriteName:e,onRestore(_,w){r&&R2(r,{imgDatasource:_,spriteName:e,settings:w})}});return T.useEffect(()=>{r&&(s(!0),P2(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 she=({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:P,rotate:I,startCrop:M,stopCrop:N,startResize:z,stopResize:j,historyCount:H,loading:F}=ihe({imageSrc:r}),L=()=>{A(),N(l==="CROP"),j(l==="RESIZE")},O=async()=>{try{h(!0),L();const k=await _();k&&await o({blob:k,legend:y,altText:f})}catch(k){s==null||s(`${k}`)}finally{h(!1)}},$=()=>{i()},V=async k=>{switch(L(),u(k),b(!0),k){case"ROTATE":{await I();break}case"UNDO":{await P();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:$,size:"lg",children:[g.jsx(Ye.Header,{onModalClose:$,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(yde,{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(lre.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(fr,{})})]}),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(Gi,{children:a("alttext")}),g.jsx(Kn,{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(Gi,{children:a("legend")}),g.jsx(Kn,{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:$,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")})]})]})},ohe=she,ahe=({doc:t,isClickable:e=!0,isSelectable:r=!1,isSelected:n=!1,onClick:i,className:s})=>{const{fromNow:o}=IL(),{fromDate:a}=T.useMemo(()=>({fromDate:o(t.modifiedAt)}),[o,t]);return g.jsx(tr,{className:Re("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(wo,{alt:"",height:48,width:48,src:t.thumbnail,objectFit:"cover",className:"rounded h-full",style:{aspectRatio:1/1}}):g.jsx(ya,{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(BT,{width:"20",height:"20"})})]})})},lhe=ahe,uhe=({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}=ba(),[h]=Pn(),{resourceApplications:f,loadResources:m}=Jce(t),[y,v]=T.useState(),[x,b]=T.useState(),[_,w]=T.useState(),E=sA(_||"",500),[A,P]=T.useState([]),I=T.useCallback((k,U)=>{var B,X,K;if(!U)return!0;const q=(U==null?void 0:U.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((U,B)=>U.modifiedAt<B.modifiedAt?1:-1),[]),N=T.useCallback(k=>{async function U(){if(o){const B=o.filter(X=>I(X,k));P(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=>I(X,k));P(M(B));return}catch{}P([])}U()},[m,x,I,M,o]),[z,j]=T.useState([]),H=k=>{n==null||n(k),b(k)},F=k=>{const U=k.target.value;w(U.toString())},L=T.useCallback(k=>{N(_),k.stopPropagation(),k.preventDefault()},[N,_]),O=T.useCallback(k=>z.findIndex(U=>U.assetId===k),[z]),$=T.useCallback(k=>{j(s?U=>[...U,k]:[k])},[j,s]),V=T.useCallback(k=>{const U=O(k.assetId);U<0?$(k):j(z.filter((B,X)=>X!==U))},[O,$,z]);return T.useEffect(()=>{(async()=>{if(a){v(a.sort((B,X)=>B.displayName.localeCompare(X.displayName)));return}const k=f.map(B=>Me.session().getWebApp(B)),U=await Promise.all(k);v(f.map((B,X)=>{var K;return{application:B,displayName:u(((K=U[X])==null?void 0:K.displayName)??B),icon:g.jsx(ya,{app:U[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 U=e??((a==null?void 0:a.length)===1&&((k=a==null?void 0:a[0])==null?void 0:k.application));if(U){const B=y==null?void 0:y.find(X=>U===X.application);b(B),N("")}},[y,e]),T.useEffect(()=>{if(r&&O(r)<0){const k=A==null?void 0:A.find(U=>r===U.assetId);k&&$(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(NN,{})}),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(s8,{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 U=z.findIndex(B=>B.assetId===k.assetId)>=0;return g.jsx(lhe,{doc:k,isSelected:U,onClick:()=>V(k)},k.path)})}),x&&A&&A.length<=0&&g.jsx("div",{className:"d-flex justify-content-center mt-16",children:g.jsx(ha,{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(ha,{imageSrc:`${h}/${c==null?void 0:c.bootstrapVersion}/illu-empty-search.svg`,text:u("bbm.linker.int.empty"),className:"mt-32"})})]})]})},che=uhe,dhe=({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]=Cm(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};!Ek.isLocalURL(o)&&!Ek.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(Gi,{children:n("bbm.linker.ext.text")}),g.jsx(Kn,{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(Gi,{children:n("bbm.linker.ext.url")}),g.jsx(Kn,{type:"text",placeholder:n("bbm.linker.ext.url.placeholder"),size:"md",value:o,onChange:c=>a(c.target.value)})]}),g.jsx(Tm,{label:n("bbm.linker.open.tab"),onChange:()=>u(),checked:l})]})})},hhe=dhe,v8=T.createContext(null);function Xl(){const t=T.useContext(v8);if(!t)throw new Error("Innertabs compound components cannot be rendered outside the MediaLibrary component");return t}const fhe=()=>{const{setResult:t,setPreSuccess:e,visibility:r}=Xl(),n=T.useRef(null);return g.jsx(pde,{ref:n,onRecordUpdated:i=>{i?(t(i),e(()=>n.current.save)):t()},onSaveSuccess:i=>{i&&t(i)},hideSaveAction:!0,visibility:r})},phe=({link:t,multiNodeSelected:e=!1})=>{const{setResult:r}=Xl();return g.jsx(hhe,{link:t,onChange:n=>{r(n)},multiNodeSelected:e})},mhe=()=>{const{setResult:t}=Xl();return g.jsx(gde,{onSuccess:e=>{e=e==null?void 0:e.replace(/<p /g,"<div ").replace(/\/p>/g,"/div>"),t(e)}})},ghe=({target:t,resourceId:e,appPrefix:r})=>{const{t:n}=we(),{setResult:i,setResultCounter:s,appCode:o,multiple:a}=Xl(),[l,u]=Cm(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(che,{appCode:o,defaultAppCode:r,defaultResourceId:e,onSelect:f,multiple:a}),g.jsx(Tm,{className:"align-items-center",checked:l,label:n("bbm.linker.open.tab"),onChange:u})]})},vhe=(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]},yhe=({onFilesChange:t,visibility:e="protected"})=>{const{files:r,uploadedFiles:n,getUploadStatus:i,uploadFile:s,removeFile:o,updateImage:a,editingImage:l,setEditingImage:u,getUrl:c}=rde({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:vhe(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(kue,{status:i(y),item:f(y),onEdit:()=>u(v),onRetry:()=>s(y),onDelete:()=>m(y)},y.name)}),l&&g.jsx(ohe,{altText:l.alt,legend:l.title,image:c(l,!0),isOpen:!!l,onCancel:()=>u(void 0),onSave:a,onError:console.error})]})},xhe=yhe,bhe=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},whe=()=>{const{type:t,visibility:e,multiple:r,setResult:n,setResultCounter:i,setCancellable:s}=Xl(),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(kce,{multiple:r,accept:bhe(t??"embedder"),children:g.jsx(xhe,{onFilesChange:o,visibility:e})})})},x_=9,b_=16,_he=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,P]=T.useState({audio:!0,video:{facingMode:"environment",aspectRatio:b_/x_}}),[I,M]=T.useState(),[N,z]=T.useState(""),[j,H]=T.useState([]),[F,L]=T.useState(),[O,$]=T.useState(0),[V,k]=T.useState(0),U=T.useRef(null),B=T.useRef(null),{uploadBlob:X}=l8(void 0,t),{device:K}=B6(navigator.userAgent);T.useImperativeHandle(o,()=>({save:de}));const{t:q}=we();T.useEffect(()=>{re(),ue()},[]),T.useEffect(()=>(I||le(A),()=>{I&&I.getTracks().forEach(Pe=>Pe.stop())}),[I]),T.useEffect(()=>{if(j.length&&!h&&U.current){const Pe=new Blob(j,{type:N});if(L(Pe),i){const Ke=window.URL.createObjectURL(Pe);i(Ke)}U.current.autoplay=!1,U.current.srcObject=null,U.current.src=window.URL.createObjectURL(Pe)}},[h,j]),T.useEffect(()=>{if(h){const Pe=Date.now(),Ke=window.setInterval(()=>$(Date.now()-Pe),500);return()=>{window.clearInterval(Ke)}}},[h]),T.useEffect(()=>{if(v){const Pe=window.setInterval(()=>k(Ke=>Ke+500),500);return()=>{window.clearInterval(Pe)}}},[v]);const re=async()=>{const Pe=await Me.video().getVideoConf();l((Pe.maxDuration??3)*60*1e3)},ue=async()=>{const Pe=(await navigator.mediaDevices.enumerateDevices()).filter(Ke=>Ke.kind==="videoinput");switch(K.type){case"mobile":case"tablet":{const Ke={deviceId:"environment",label:q("video.back.camera"),groupId:"",kind:"videoinput"},Rt={deviceId:"user",label:q("video.front.camera"),groupId:"",kind:"videoinput"};(Pe==null?void 0:Pe.length)>1?c([Ke,Rt]):c([Ke]);break}default:c(Pe);break}},le=async Pe=>{try{const Ke=await navigator.mediaDevices.getUserMedia(Pe);M(Ke),U.current&&(U.current.src&&(window.URL.revokeObjectURL(U.current.src),U.current.src=""),U.current.srcObject=Ke,U.current.autoplay=!0,U.current.volume=1,U.current.muted=!0)}catch(Ke){console.error(Ke)}},me=T.useCallback(()=>{f(!0),U&&U.current&&(U.current.muted=!0);const Pe=Gue();z(Pe),I&&(B.current=new MediaRecorder(I,{mimeType:Pe}),B.current.ondataavailable=({data:Ke})=>{Ke.size>0&&H(Rt=>[...Rt,Ke])},B.current.onerror=Ke=>console.error(Ke),B.current.start(1e3))},[I]),xe=T.useCallback(()=>{var Pe;f(!1),y(!0),((Pe=B.current)==null?void 0:Pe.state)==="recording"&&(B.current.requestData(),B.current.stop())},[B]),_e=T.useCallback(()=>{var Pe,Ke;U&&U.current&&(U.current.muted=!1),v?((Ke=U==null?void 0:U.current)==null||Ke.pause(),x(!1)):((Pe=U==null?void 0:U.current)==null||Pe.play(),x(!0))},[v]),Te=()=>{y(!1),f(!1),x(!1),E(!1),$(0),H([]),L(void 0),le(A),i&&i()},de=async()=>{var Pe;if((Pe=U==null?void 0:U.current)==null||Pe.pause(),_(!0),!F){console.error("Error while saving video: recorded video is undefined.");return}const Ke=await X(F,{duration:O});if(Ke!=null)return r==null||r([Ke]),_(!1),E(!0),[Ke];n("Error while uploading video"),_(!1),E(!0)},Be=()=>{x(!1),k(0),U.current&&(U.current.currentTime=0)},je=Pe=>{var Ke;const Rt=u.find(J=>J.label===Pe);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}},P(W),I&&(((Ke=B.current)==null?void 0:Ke.state)==="recording"&&(B.current.requestData(),B.current.stop()),I.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(Zv,{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(wz,{}),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($N,{}),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(FT,{}),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(VN,{}),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(jT,{}),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(Gi,{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(Pe=>Pe.label),onValueChange:je})]})}),g.jsxs("div",{className:"video-recorder-video-container position-relative align-self-stretch",children:[g.jsx("video",{ref:U,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(Zv,{width:12,height:12,color:"red",className:"me-4"}),g.jsxs("span",{children:[pl(O),"/",pl(a)]})]}),m&&g.jsxs(g.Fragment,{children:[g.jsx(HN,{width:14,height:14,className:"me-4"}),g.jsxs("span",{children:[pl(V),"/",pl(O)]})]})]}),I&&g.jsx(pA,{items:ut,className:"position-absolute bottom-0 start-50 bg-white"})]}),b&&g.jsx(fr,{position:!1,caption:q("bbm.video.save.loader.caption")})]})}),She=_he,Ehe=()=>{const{appCode:t,setResult:e,setPreSuccess:r}=Xl(),{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(She,{ref:i,appCode:t,caption:n("bbm.video.caption"),onRecordUpdated:s,onError:o,hideSaveAction:!0})},The=({switchType:t,onSuccess:e})=>{const{t:r}=we(),[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 _=Me.embedder().getProviderFromUrl(u,h);if(_){l(_);const w=Me.embedder().getEmbedCodeForProvider(_,h);o(w),e(w)}else l(void 0),e()}},[h,u]);const y=async()=>{const _=await Promise.all([Me.embedder().getDefault(),Me.embedder().getCustom()]).then(w=>w.flat());c(_)};function v(_){const w=_.currentTarget.value;i(w),e(w!=null&&w.length?w:void 0)}function x(){t==null||t("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(wo,{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(ha,{imageSrc:`${m}/emptyscreen/illu-error.svg`,title:r("bbm.video.previewError.title"),text:r("bbm.video.previewError.text")}),t&&g.jsxs(it,{variant:"ghost",color:"primary",onClick:x,className:"align-items-start mt-16",children:[r("bbm.video.useEmbedCode")," ",g.jsx(TS,{})]})]}):t&&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:[r("bbm.video.useEmbedCode")," ",g.jsx(TS,{})]})});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(LT,{className:"me-8"}),r("bbm.video.url.title")]}),g.jsx(Ot,{id:f,children:g.jsx(Kn,{size:"md",type:"text",placeholder:r("bbm.video.url.placeholder"),onChange:v})}),g.jsx(g.Fragment,{children:b()})]})},Che=The,Ahe=()=>{const{switchType:t,setResult:e}=Xl();return g.jsx(Che,{switchType:t,onSuccess:r=>{e(r)}})},Rhe=({roles:t,onSelect:e,multiple:r=!0,className:n,defaultFolder:i,showPublicFolder:s})=>{const{t:o}=we(),{root:a,loadContent:l}=O0("root",o("workspace.tree.owner"),"owner",t),{root:u,loadContent:c}=O0("root",o("workspace.tree.shared"),"shared",t),{root:h,loadContent:f}=O0("root",o("workspace.tree.protected"),"protected",t),{root:m,loadContent:y}=O0("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,P]=T.useState(()=>i==="public"?s?m:h:i==="protected"?h:i==="shared"?u:a),[I,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]),$=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,re){E(q);const{root:ue,othersRef:le}=O(q),me=K6(ue,xe=>xe.id===re);me&&(P(me),le.forEach(xe=>{var _e;return(_e=xe.current)==null?void 0:_e.unselectAll()}))}T.useEffect(()=>{var q;let re;switch(w){case"owner":re=v;break;case"shared":re=x;break;case"protected":re=b;break;case"public":re=_;break;default:return}(q=re==null?void 0:re.current)==null||q.select("root")},[w]),T.useEffect($,[$]),T.useEffect(()=>{if(A.files){let q=[].concat(A.files);N&&(q=q.filter(ue=>ue.name.indexOf(N)>=0));const re=j[0]==="name"?j[1]==="asc"?(ue,le)=>U(ue.name,le.name):(ue,le)=>U(le.name,ue.name):(ue,le)=>U(le.modified,ue.modified);M(()=>q.sort(re))}else M(void 0)},[A,a,h,u,m,N,j]);const k=T.useCallback(q=>{z(q.target.value)},[z]);function U(q,re){return q?re?q.localeCompare(re):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 re=[...F];r?re.includes(q)?re=re.filter(ue=>ue._id!==q._id):re=[...re,q]:re=[q],L(re),e(re)}const K=Re("workspace flex-grow-1 gap-0",n);return g.jsxs(so,{className:K,children:[g.jsx(so.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(so.Col,{sm:"12",md:"5",xl:"8",children:g.jsxs(so,{className:"flex-grow-1 gap-0",children:[g.jsxs(so.Col,{sm:"4",md:"8",xl:"12",children:[g.jsx("div",{className:"workspace-search px-16 py-8 ",children:g.jsx(s8,{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(Fz,{}),onClick:()=>H(["modified","desc"]),children:o("sort.order.modify.desc")}),g.jsx(xt.Item,{icon:g.jsx(Oz,{}),onClick:()=>H(["name","asc"]),children:o("sort.order.alpha.asc")}),g.jsx(xt.Item,{icon:g.jsx(Nz,{}),onClick:()=>H(["name","desc"]),children:o("sort.order.alpha.desc")})]})]})]})]}),g.jsx(so.Col,{sm:"4",md:"8",xl:"12",className:"p-8 gap-8",children:I?I.length!==0?g.jsx("div",{className:"grid grid-workspace",children:I.map(q=>{const re=F.includes(q);return g.jsx(Iue,{doc:q,isSelected:re,onClick:()=>X(q)},q._id)})}):g.jsx(ha,{imageSrc:"/assets/themes/edifice-bootstrap/images/emptyscreen/illu-trash.svg",text:o("workspace.empty.docSpace"),title:o("explorer.emptyScreen.trash.title")}):g.jsx(fr,{})})]})})]})},Phe=Rhe,Ihe=()=>{const{type:t,setResultCounter:e,setResult:r,multiple:n,visibility:i}=Xl();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(Phe,{roles:s(),onSelect:o,multiple:n,className:"border rounded overflow-y-auto",defaultFolder:i,showPublicFolder:i==="public"})},ja={Audio:fhe,Video:Ehe,Upload:whe,ExternalLink:phe,Workspace:Ihe,InternalLink:ghe,Iframe:mhe,VideoEmbedder:Ahe},Mhe=["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"}},khe=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:$,type:m,...u.current})),qce({isDismissible:!0,duration:1/0});const{t:c}=we(),h=Wi("org.entcore.workspace.controllers.WorkspaceController|addDocument"),f=Wi("com.opendigitaleducation.video.controllers.VideoController|capture"),[m,y]=T.useState(null),v={workspace:{id:"workspace",icon:g.jsx(jN,{}),label:c("bbm.workspace"),content:g.jsx(ja.Workspace,{}),availableFor:["audio","video","image","attachment"],isEnable:null},upload:{id:"upload",icon:g.jsx(Mz,{}),label:c("bbm.device"),content:g.jsx(ja.Upload,{}),availableFor:["audio","video","image","attachment"],isEnable:()=>!!h},"video-capture":{id:"video-capture",icon:g.jsx(HN,{}),label:c("bbm.video"),content:g.jsx(ja.Video,{}),availableFor:["video"],isEnable:()=>!!f},"audio-capture":{id:"audio-capture",icon:g.jsx(c1,{}),label:c("bbm.audio"),content:g.jsx(ja.Audio,{}),availableFor:["audio"],isEnable:()=>!!h},"external-link":{id:"external-link",icon:g.jsx(LT,{}),label:c("bbm.linker.ext"),content:g.jsx(ja.ExternalLink,{...l.current}),availableFor:["hyperlink"],isEnable:null},"internal-link":{id:"internal-link",icon:g.jsx(NN,{}),label:c("bbm.linker.int"),content:g.jsx(ja.InternalLink,{...l.current}),availableFor:["hyperlink"],isEnable:null},iframe:{id:"iframe",icon:g.jsx(CS,{}),label:c("bbm.embed"),content:g.jsx(ja.Iframe,{}),availableFor:["embedder"],isEnable:null},"video-embedder":{id:"iframe",icon:g.jsx(CS,{}),label:c("bbm.embed"),content:g.jsx(ja.VideoEmbedder,{}),availableFor:["video"],isEnable:null}},x=T.useMemo(()=>Mhe.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(),[P,I]=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)},$=K=>{l.current=K,!("resourceId"in K||"appPrefix"in K)&&_("external-link"),y("hyperlink")};T.useEffect(()=>{var K,q;const re=m||"none";!b&&typeof((K=w_[re])==null?void 0:K.defaultTab)=="string"&&_((q=w_[re])==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,I(void 0),A(void 0),_(void 0),j(void 0),N([])},U=K=>{s==null||s(K,M),k()},B=T.useCallback(()=>{const K=async q=>{q instanceof Array&&["protected","public"].findIndex(re=>re===e)>=0&&(q=await Me.workspace().transferDocuments(q,t??"media-library",e)),n(q)};z?z().then(q=>{K(q)}):P&&K(P),k()},[z,P,n,e,t]),X=()=>{i(M),k()};return m&&g.jsx(v8.Provider,{value:{appCode:t,visibility:e,multiple:r,type:m,setResultCounter:A,setResult:I,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(oa,{items:x,defaultId:x[w].id,onChange:U,children:K=>g.jsxs(g.Fragment,{children:[x.length>1&&g.jsx(oa.List,{className:"mt-16"}),g.jsx(Ye.Body,{className:"d-flex",children:g.jsx(oa.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 P>"u",onClick:B,children:E&&E>1?c("addMultiple",{number:E}):c("add")})]})]})})}),y8=khe;function Ohe({isOpen:t,resourceId:e,onSuccess:r,onCancel:n}){const{appCode:i,currentApp:s}=yt(),{ref:o,libraryMedia:a,...l}=a8(),{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:P,selectedSubjectAreas:I,selectSubjects:M}=ade({resource:c,onSuccess:r});return c?mr.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(u8,{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(Gi,{children:u("bpr.form.publication.title")}),g.jsx(Kn,{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(Gi,{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(Zle,{control:h,selectedActivities:P,selectActivities:A}),g.jsx(lue,{control:h,selectedSubjectAreas:I,selectSubjects:M}),g.jsx(sue,{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(Sk,{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(Sk,{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(Gi,{children:u("bpr.form.publication.keywords")}),g.jsx(Kn,{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(oue,{})]})]}),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(y8,{appCode:i,ref:o,multiple:!1,visibility:"protected",...l})]}),document.getElementById("portal")):g.jsx(fr,{})}const Dhe=({content:t,maxLength:e})=>g.jsx("p",{className:"small text-gray-700 p-2 text-end",children:t?`${t.length} / ${e}`:""}),Nhe=({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)}},Lhe=60,Fhe=400,jhe=({isOpen:t,onCancel:e,onSuccess:r,children:n,inputMaxLength:i=Lhe,textareaMaxLength:s=Fhe,...o})=>{const{appCode:a,currentApp:l}=yt(),{t:u}=we(),{mode:c}=o,h=en(),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}}=OT({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:P,libraryMedia:I,...M}=a8(),{appCode:N}=yt(),{thumbnail:z,handleDeleteImage:j,handleUploadImage:H}=Nhe({isUpdating:y,selectedResource:y?v:void 0}),F=x("description"),L=async function(O){var $,V;try{const k={description:O.description||"",name:O.title,public:O.enablePublic,slug:O.enablePublic&&O.formSlug||"",thumbnail:z};if(m){const U={...k,folder:o.currentFolder===void 0||(($=o.currentFolder)==null?void 0:$.id)==="default"?void 0:parseInt(((V=o.currentFolder)==null?void 0:V.id)||""),application:a};o.createResource?await o.createResource.mutateAsync(U):await Me.resource(a).create(U)}else{const U={...k,entId:v.assetId,trashed:v.trashed};o.updateResource?await o.updateResource.mutateAsync(U):await Me.resource(a).update(U)}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(fr,{}):mr.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(u8,{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:I,mediaLibraryRef:P})}),g.jsxs("div",{className:"col",children:[g.jsxs(Ot,{id:"title",className:"mb-16",isRequired:!0,children:[g.jsx(Gi,{children:u("title")}),g.jsx(Kn,{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(Gi,{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(Dhe,{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(y8,{appCode:N,ref:P,multiple:!1,visibility:"protected",...M})]}),document.getElementById("portal"))},Bhe=jhe,Uhe=({application:t,options:e})=>Mo({mutationFn:async r=>await Me.resource(t).update(r),...e}),$he=Uhe,zhe=({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=en();T.useEffect(()=>{if(s){let m="";r?m=r.slug?r.slug:`${ik({foo:`${l}${a}`})}-${ok(l)}`:m=`${ik({foo:`${l}${a}`})}-${ok(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}},Hhe=({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}=zhe({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(ta,{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(Kn,{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($$,{}),variant:"ghost",className:"text-nowrap",children:o("explorer.resource.editModal.access.url.button")})]})]})]})},x8=Hhe,Vhe=({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(jT,{}),onClick:n,className:"text-nowrap",children:i("explorer.modal.share.sharebookmark.save")})]})})},Ghe=(t,e)=>t.actions.filter(r=>e.id===r.id).length>0,Whe=(t,e)=>t.isBookmarkMember&&e||!t.isBookmarkMember,Xhe=({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(rc,{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(BT,{width:16})}),sharebookmark:g.jsx(DT,{})}[a.type]||null,u=a.type==="sharebookmark",c=a.type==="user";return Whe(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(Tp,{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(Tm,{checked:Ghe(a,h),onChange:()=>i(a,h.id)})},h.displayName)),g.jsx("td",{children:!a.isBookmarkMember&&g.jsx(Ro,{"aria-label":o("close"),color:"tertiary",icon:g.jsx(NT,{}),type:"button",variant:"ghost",title:o("close"),onClick:()=>s(a)})})]},a.id)})},qhe={searchInputValue:"",searchResults:[],searchAPIResults:[],isSearching:!1};function Yhe(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"}],Qhe=({resourceId:t,resourceCreatorId:e,shareRights:r,shareDispatch:n})=>{const[i,s]=T.useReducer(Yhe,qhe),o=sA(i.searchInputValue,500),{isAdml:a}=o8(),{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 Me.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(DT,{}):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 Me.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])})}}}},Khe={isSharing:!1,shareRights:{rights:[],visibleBookmarks:[],visibleGroups:[],visibleUsers:[]},shareRightActions:[]};function Zhe(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 Jhe({resourceId:t,resourceRights:e,resourceCreatorId:r,shareResource:n,setIsLoading:i,onSuccess:s}){const{appCode:o}=yt(),{user:a,avatar:l}=wh(),u=en(),{t:c}=we(),[h,f]=T.useReducer(Zhe,Khe);T.useEffect(()=>{t&&(async()=>{try{const[v,x]=await Promise.all([Me.share().getActionsForApp(o),Me.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],P=A.findIndex(M=>M.id===v.id),I=h.shareRightActions.filter(M=>M.id===x)[0];if(A[P].actions.findIndex(M=>M.id===x)>-1){let M=A[P].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[P]={...A[P],actions:M}}else{const M=h.shareRightActions.filter(N=>{var z;return((z=I.requires)==null?void 0:z.includes(N.id))&&!A[P].actions.find(j=>j.id===N.id)});A[P]={...A[P],actions:[...A[P].actions,I,...M]}}v.type==="sharebookmark"&&((b=A[P].users)==null||b.forEach(M=>{const N=A.findIndex(z=>z.id===M.id);A[N]={...A[N],actions:A[P].actions}}),(_=A[P].groups)==null||_.forEach(M=>{const N=A.findIndex(z=>z.id===M.id);A[N]={...A[N],actions:A[P].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 Me.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 efe=({shareRights:t,shareDispatch:e})=>{const r=en(),{t:n}=we(),i=T.useRef(null),[s,o]=T.useState({name:"",id:T.useId()}),[a,l]=Cm(!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 Me.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 tfe({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}=Jhe({resourceId:o,resourceCreatorId:a,resourceRights:l,shareResource:r,setIsLoading:c,onSuccess:i}),{state:{searchResults:E,searchInputValue:A},showSearchAdmlHint:P,showSearchLoading:I,showSearchNoResults:M,getSearchMinLength:N,handleSearchInputChange:z,handleSearchResultsChange:j}=Qhe({resourceId:o,resourceCreatorId:a,shareRights:f,shareDispatch:y}),{refBookmark:H,showBookmark:F,handleBookmarkChange:L,toggleBookmark:O,bookmark:$,handleOnSave:V,showBookmarkInput:k,toggleBookmarkInput:U}=efe({shareRights:f,shareDispatch:y}),{t:B}=we(),X=P()?B("explorer.search.adml.hint"):B("explorer.modal.share.search.placeholder");return mr.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(fr,{}):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(ml,{children:B("explorer.modal.share.avatar.shared.alt")})}),g.jsx("th",{scope:"col",children:g.jsx(ml,{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(ml,{children:B("close")})})]})}),g.jsxs("tbody",{children:[x()&&g.jsxs("tr",{children:[g.jsx("th",{scope:"row",children:g.jsx(rc,{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(Tm,{checked:!0,disabled:!0})},K.displayName)),g.jsx("td",{})]}),g.jsx(Xhe,{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(DT,{}),rightIcon:g.jsx(Tp,{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:()=>U(!k),children:B("share.save.sharebookmark")}),k&&g.jsx(Vhe,{refBookmark:H,bookmark:$,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(fo,{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(BN,{className:"c-pointer",height:"18"})})]}),g.jsx("div",{className:"row",children:g.jsx("div",{className:"col-10",children:g.jsx(Tce,{value:A,placeholder:X,isLoading:I(),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 rfe({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 Me.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(E2,{label:n("explorer.immediat.publication"),id:"publication-now",name:"publication",value:"IMMEDIATE",model:o,checked:o==="IMMEDIATE",onChange:l}),g.jsx(E2,{label:n("explorer.validate.publication"),id:"publication-validate",name:"publication",value:"RESTRAINT",checked:o==="RESTRAINT",model:o,onChange:l})]})}const nfe=({application:t,options:e})=>Mo({mutationFn:async({resourceId:r,rights:n})=>await Me.share().saveRights(t,r,n),...e}),ife=nfe;function sfe(t){return{getPreference:async()=>await Me.conf().getPreference(t),savePreference:async e=>await Me.conf().savePreference(t,JSON.stringify(e))}}function ofe(){const[t,e]=T.useState(!1),{getPreference:r,savePreference:n}=sfe("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 Rk({isHelpOpen:t,setIsHelpOpen:e,parsedHeadline:r,parsedContent:n,error:i}){const{t:s}=we(),o=()=>{e(!1)};return t?mr.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 afe(){var t,e,r,n,i;const{appCode:s}=yt(),{theme:o}=ba(),[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=Wl(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(F$,{})}),I0(E.children,{replace:A=>{const P=A;if(P.attribs&&P.name==="ul")return g.jsx("ul",{id:"TOC-list",style:{display:u?"block":"none"},children:I0(P.children,{replace:I=>{const M=I;if(M.attribs&&M.name==="a")return g.jsx("a",{...v_(M.attribs),children:g.jsx("span",{onClick:()=>{c(!1)},children:I0(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:I0(E.children,{replace:P=>{const I=P;if(I.attribs&&I.name==="img"){const M=P.attribs.src;return g.jsx("img",{...v_(I.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 vr=T.forwardRef(({children:t,className:e,...r},n)=>{const i=Re("nav-item",e);return g.jsx("li",{ref:n,className:i,...r,children:t})}),lfe=()=>{const[t,e]=$6(),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(vr,{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(jq,{className:"icon search"}),g.jsx("span",{className:"nav-text",children:i("navbar.search")})]}),g.jsx(i8,{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")})]})})]})},ufe=lfe;function S_({children:t,className:e,...r}){const n=Re("navbar",e);return g.jsx("nav",{className:n,...r,children:t})}function Pk({children:t,className:e,...r}){const n=Re("navbar-nav",e);return g.jsx("ul",{className:n,...r,children:t})}function mf({link:t,className:e,children:r,translate:n,...i}){const s=Re("nav-link",e);return g.jsxs("a",{href:t,className:s,...i,children:[r,n&&g.jsx(ml,{children:g.jsx("span",{className:"nav-text",children:n})})]})}const cfe=()=>{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")})})})},dfe=({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(ya,{app:r,size:"32"})},n))]})},hfe=({is1d:t=!1,src:e=""})=>{const{t:r}=we(),{messages:n,msgLink:i,zimbraWorkflow:s}=Gce(),{user:o,avatar:a}=wh(),{currentLanguage:l,currentApp:u}=yt(),c=Wi("org.entcore.portal.controllers.PortalController|oldHelpEnable")||!1,{isModalOpen:h,setIsModalOpen:f,parsedContent:m,parsedHeadline:y,error:v}=afe(),x=Re("header",{"no-2d":t,"no-1d":!t}),{title:b,bookmarkedApps:_,appsRef:w,isAppsHovered:E,popoverAppsId:A,userAvatar:P,userName:I,welcomeUser:M,communityWorkflow:N,conversationWorflow:z,searchWorkflow:j,isCollapsed:H,toggleCollapsedNav:F,handleLogout:L}=Wce({user:o,avatar:a}),O=n>0,{theme:$}=ba();return g.jsx("header",{className:x,children:t?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"container-fluid",children:g.jsxs(S_,{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(rc,{alt:I,size:"sm",src:P,variant:"circle",width:"32",height:"32"}),g.jsx("span",{className:"navbar-text",children:M})]}),g.jsxs(Pk,{className:"gap-8","aria-hidden":"false","aria-label":r("navbar.main.navigation"),children:[z&&g.jsx(vr,{children:g.jsxs("a",{href:"/conversation/conversation",className:"nav-link",children:[g.jsx(Nq,{className:"icon notification"}),O&&g.jsx(ow,{variant:{type:"notification",level:"danger"},className:"position-absolute",children:n}),g.jsx(ml,{children:r("navbar.messages")})]})}),g.jsx(vr,{children:g.jsx(mf,{link:"/userbook/mon-compte",className:"dropdown-item",translate:r("navbar.myaccount"),children:g.jsx(bC,{className:"icon user"})})}),l==="fr"&&c?g.jsxs(vr,{children:[g.jsxs("button",{className:"nav-link",onClick:()=>{f(!0)},children:[g.jsx(Oq,{className:"icon help"}),g.jsx(ml,{children:r("navbar.help")})]}),g.jsx(Rk,{isHelpOpen:h,setIsHelpOpen:f,parsedContent:m,parsedHeadline:y,error:v})]}):null,g.jsx(vr,{children:g.jsxs("button",{className:"nav-link",onClick:L,children:[g.jsx(F3,{className:"icon logout"}),g.jsx(ml,{children:r("navbar.disconnect")})]})}),g.jsx(vr,{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(Tp,{className:"icon rafter-down",width:"20",height:"20"})})})]})]})}),g.jsx(S_,{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(Ck,{is1d:!0,src:`${e}/img/illustrations/logo.png`,translate:r("navbar.home")}),g.jsxs(Pk,{className:"gap-8",children:[g.jsx(vr,{children:g.jsxs("a",{href:"/timeline/timeline",className:"button",children:[g.jsx(Mq,{color:"#fff",className:"d-md-none"}),g.jsx("span",{className:"d-inline-block",children:r("portal.header.navigation.whatsnew")})]})}),g.jsx(vr,{children:g.jsxs("a",{href:"/userbook/annuaire",className:"button",children:[g.jsx(Uq,{color:"#fff",className:"d-md-none"}),g.jsx("span",{className:"d-inline-block",children:r("portal.header.navigation.classMembers")})]})}),g.jsx(vr,{children:g.jsxs("a",{href:"/welcome",className:"button",children:[g.jsx(j3,{color:"#fff",className:"d-md-none"}),g.jsx("span",{className:"d-inline-block",children:r("portal.header.navigation.myapps")})]})})]})]})})})]}):g.jsx(S_,{className:"navbar-expand-md",children:g.jsxs("div",{className:"container-fluid",children:[g.jsx(Ck,{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(vr,{children:g.jsx(mf,{link:"/timeline/timeline",translate:r("navbar.home"),children:g.jsx(Tq,{color:"#fff"})})}),g.jsxs(vr,{className:"position-relative",ref:w,id:A,"aria-haspopup":"true","aria-expanded":E,children:[g.jsx(mf,{link:"/welcome",translate:r("navbar.applications"),children:g.jsx(j3,{color:"#fff"})}),g.jsxs(i8,{className:"top-100 widget",id:A,isVisible:E,children:[g.jsx(Lce,{children:g.jsx(dfe,{bookmarkedApps:_})}),g.jsx(Fce,{className:"widget-footer border-top border-ghost",children:g.jsx(cfe,{})})]})]}),z&&g.jsx(vr,{children:g.jsxs(mf,{className:"position-relative",link:"/conversation/conversation",translate:r("conversation"),children:[g.jsx(B3,{color:"#fff"}),O&&g.jsx(ow,{variant:{type:"notification",level:"warning"},className:"position-absolute",children:n})]})}),s&&g.jsx(vr,{children:g.jsxs(mf,{className:"position-relative",link:i,translate:r("conversation"),children:[g.jsx(B3,{color:"#fff"}),O&&g.jsx(ow,{variant:{type:"notification",level:"warning"},className:"position-absolute",children:n})]})}),l==="fr"&&c?g.jsxs(vr,{children:[g.jsxs("button",{className:"nav-link btn btn-naked",onClick:()=>{f(!0)},children:[g.jsx(Rq,{color:"#fff"}),g.jsx(ml,{children:r("support")})]}),g.jsx(Rk,{isHelpOpen:h,setIsHelpOpen:f,parsedContent:m,parsedHeadline:y,error:v})]}):null,g.jsx(vr,{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(Tp,{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(vr,{children:g.jsxs("a",{href:"/community",className:"nav-link dropdown-item",children:[g.jsx(_q,{className:"icon community"}),g.jsx("span",{className:"nav-text",children:r("navbar.community")})]})}),j?g.jsx(ufe,{}):null,g.jsx(vr,{children:g.jsxs("a",{href:"/userbook/mon-compte",className:"nav-link dropdown-item",children:[g.jsx(rc,{alt:I,size:"sm",src:P,variant:"circle",className:"bg-white",width:"32",height:"32"}),g.jsx("span",{className:"nav-text",children:r("navbar.myaccount")})]})}),g.jsx(vr,{children:g.jsx("hr",{className:"dropdown-divider"})}),g.jsx(vr,{children:g.jsxs("a",{href:"/auth/logout?callback="+(($==null?void 0:$.logoutCallback)??"/"),className:"nav-link dropdown-item",children:[g.jsx(F3,{className:"icon logout"}),g.jsx("span",{id:"logout-label",className:"nav-text",children:r("navbar.disconnect")})]})})]})]})})]})]})})})},ffe=hfe,pfe=({children:t,headless:e=!1,...r})=>{const{theme:n}=ba(),{t:i}=we(),{showCookiesConsent:s,handleConsultCookies:o,handleCloseCookiesConsent:a}=ofe();ide(),sde();const l=Re("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(ffe,{is1d:n==null?void 0:n.is1d,src:n==null?void 0:n.basePath}),c=s&&g.jsx(ta,{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($G,{containerClassName:"toaster-container",toastOptions:{position:"top-right"}});return g.jsxs(g.Fragment,{children:[u,g.jsx("main",{className:l,...r,children:t}),h,c]})},mfe=pfe,gfe="modulepreload",vfe=function(t){return"/"+t},Ik={},cr=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=vfe(a),a in Ik)return;Ik[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":gfe,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})},yfe=t=>{let{activatorEvent:e,draggingNodeRect:r,transform:n}=t;if(r&&e){const i=Fy(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},xfe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},bfe=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:()=>{(xfe?"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},wfe=t=>bfe;var b8={exports:{}},w8={},_8={exports:{}},S8={};/**
1391
1391
  * @license React
1392
1392
  * use-sync-external-store-shim.production.min.js
1393
1393
  *
package/dist/version.txt CHANGED
@@ -1 +1 @@
1
- ode-explorer= 26/11/2024 14:54:23
1
+ ode-explorer= 29/11/2024 14:45:18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ode-explorer",
3
- "version": "1.5.2-develop.202411261453",
3
+ "version": "1.5.3",
4
4
  "description": "Edifice Explorer",
5
5
  "homepage": "https://github.com/edificeio/explorer#readme",
6
6
  "bugs": {
@@ -38,8 +38,8 @@
38
38
  "dependencies": {
39
39
  "@dnd-kit/core": "^6.1.0",
40
40
  "@dnd-kit/modifiers": "^7.0.0",
41
- "@edifice-ui/icons": "develop",
42
- "@edifice-ui/react": "develop",
41
+ "@edifice-ui/icons": "1.7.2",
42
+ "@edifice-ui/react": "1.7.2",
43
43
  "@react-spring/web": "^9.7.3",
44
44
  "@tanstack/react-query": "^5.59.13",
45
45
  "clsx": "^2.1.1",
@@ -68,8 +68,8 @@
68
68
  "@vitejs/plugin-react": "^4.3.2",
69
69
  "@vitest/coverage-v8": "^2.1.2",
70
70
  "@vitest/ui": "^2.1.2",
71
- "edifice-bootstrap": "develop",
72
- "edifice-ts-client": "develop",
71
+ "edifice-bootstrap": "1.7.2",
72
+ "edifice-ts-client": "1.7.2",
73
73
  "eslint": "^9.11.1",
74
74
  "eslint-plugin-react-hooks": "^5.1.0-rc.0",
75
75
  "eslint-plugin-react-refresh": "^0.4.12",