@qwanyx/stack 0.2.65 → 0.2.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";var lu=Object.defineProperty;var au=(r,e,t)=>e in r?lu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var _t=(r,e,t)=>au(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),Ji=require("react-dom");function uu(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const Ns=uu(w);class cu{constructor(e){_t(this,"config");_t(this,"defaultUploadOptions",{maxSizeMB:10,maxImageDimension:0,imageQuality:.9});if(!e.system_id)throw new Error("GraphClient: system_id is REQUIRED. No system_id → No start.");this.config=e}async callGraph(e,t={}){const n={coprocessor:"graph",method:e,system_id:this.config.system_id,params:t};try{const s=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(n)});if(!s.ok){const o=await s.text();throw new Error(`API error (${s.status}): ${o}`)}const i=await s.json();if(!i.success&&i.error)throw new Error(i.error);return i}catch(s){throw console.error("Graph API call failed:",s),s}}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getChildren(e){return(await this.callGraph("get_children",{parent_id:e})).result||[]}async getNode(e){return(await this.callGraph("get_node",{node_id:e})).result||null}async addNode(e){const t={...e,created:e.created||new Date().toISOString(),modified:new Date().toISOString()},n=await this.callGraph("add_node",t);if(!n.result)throw new Error("Failed to add node");return n.result}async updateNode(e,t){const n={node_id:e,updates:{...t,modified:new Date().toISOString()}},s=await this.callGraph("update_node",n);if(!s.result)throw new Error("Failed to update node");return s.result}async deleteNode(e,t=!1){return(await this.callGraph("delete_node",{node_id:e,cascade:t})).success===!0}async getChildrenWithEdges(e,t="children",n,s){return(await this.callGraph("get_children_with_edges",{node_id:e,display_mode:t,edge_type:n,node_type:s})).result||[]}async addEdge(e,t,n="link",s){return await this.callGraph("add_edge",{source_id:e,target_id:t,edge_type:n,data:s})}async deleteEdge(e,t,n){return await this.callGraph("delete_edge",{source_id:e,target_id:t,edge_type:n})}async getEdges(e,t,n){return(await this.callGraph("get_edges",{source_id:e,edge_type:t,target_id:n})).result||[]}async getAncestors(e){return(await this.callGraph("get_ancestors",{node_id:e})).ancestors||[]}async getTree(e,t=10){return(await this.callGraph("get_tree",{root_id:e,max_depth:t})).tree||[]}async moveNode(e,t){const n=await this.callGraph("move",{node_id:e,new_parent_id:t});if(!n.node)throw new Error("Failed to move node");return n.node}async searchNodes(e,t){return(await this.callGraph("search",{query:e,type:t})).nodes||[]}async getNodesByType(e){return(await this.callGraph("get_nodes_by_type",{type:e})).result||[]}fileToBase64(e){return new Promise((t,n)=>{const s=new FileReader;s.onload=()=>{const o=s.result.split(",")[1];t(o)},s.onerror=()=>n(new Error("Failed to read file")),s.readAsDataURL(e)})}async resizeImage(e,t,n){return e.type.startsWith("image/")?new Promise(s=>{const i=new Image,o=URL.createObjectURL(e);i.onload=()=>{if(URL.revokeObjectURL(o),i.width<=t&&i.height<=t){s(e);return}let a,l;i.width>i.height?(a=t,l=Math.round(i.height/i.width*t)):(l=t,a=Math.round(i.width/i.height*t));const u=document.createElement("canvas");u.width=a,u.height=l;const c=u.getContext("2d");if(!c){s(e);return}c.drawImage(i,0,0,a,l);const d=e.type==="image/png"?"image/png":"image/jpeg";u.toBlob(f=>{if(f){const h=new File([f],e.name,{type:d});s(h)}else s(e)},d,n)},i.onerror=()=>{URL.revokeObjectURL(o),s(e)},i.src=o}):e}async uploadFile(e,t,n,s={}){const i={...this.defaultUploadOptions,...s};try{let o=n;i.maxImageDimension>0&&n.type.startsWith("image/")&&(o=await this.resizeImage(n,i.maxImageDimension,i.imageQuality));const a=i.maxSizeMB*1024*1024;if(o.size>a)return{success:!1,error:`File too large (${(o.size/1024/1024).toFixed(1)} MB). Max: ${i.maxSizeMB} MB`};const l=await this.fileToBase64(o),u=await this.callGraph("upload_file",{node_id:e,filename:t,content:l});return u.success?{success:!0,path:u.path}:{success:!1,error:u.error||"Upload failed"}}catch(o){return{success:!1,error:o instanceof Error?o.message:"Upload failed"}}}async listFiles(e){var s;return(((s=(await this.callGraph("list_files",{node_id:e})).result)==null?void 0:s.files)||[]).map(i=>({filename:i.name,path:i.path}))}async deleteFile(e,t){return{success:(await this.callGraph("delete_file",{node_id:e,filename:t})).success||!1}}getFileUrl(e,t){return`${this.config.baseUrl}/files/${this.config.system_id}/${e}/${t}`}}const Mr=new TextEncoder,Yi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yr=new Uint8Array(256);for(var Bn=0;Bn<Yi.length;Bn++)Yr[Yi.charCodeAt(Bn)]=Bn;function Vs(r){let e=Math.ceil(r.length/4)*3;const t=r.length;let n=0;r.length%4===3?e--:r.length%4===2?e-=2:r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);const s=new ArrayBuffer(e),i=new Uint8Array(s);for(let o=0;o<t;o+=4){let a=Yr[r.charCodeAt(o)],l=Yr[r.charCodeAt(o+1)],u=Yr[r.charCodeAt(o+2)],c=Yr[r.charCodeAt(o+3)];i[n++]=a<<2|l>>4,i[n++]=(l&15)<<4|u>>2,i[n++]=(u&3)<<6|c&63}return s}function tn(r){r=r||"utf8";let e;try{e=new TextDecoder(r)}catch{e=new TextDecoder("windows-1252")}return e}async function ds(r){if("arrayBuffer"in r)return await r.arrayBuffer();const e=new FileReader;return new Promise((t,n)=>{e.onload=function(s){t(s.target.result)},e.onerror=function(s){n(e.error)},e.readAsArrayBuffer(r)})}function Xi(r){return r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70?String.fromCharCode(r):!1}function du(r,e,t){let n=r.indexOf("*");n>=0&&(r=r.substr(0,n)),e=e.toUpperCase();let s;if(e==="Q"){t=t.replace(/=\s+([0-9a-fA-F])/g,"=$1").replace(/[_\s]/g," ");let i=Mr.encode(t),o=[];for(let l=0,u=i.length;l<u;l++){let c=i[l];if(l<=u-2&&c===61){let d=Xi(i[l+1]),f=Xi(i[l+2]);if(d&&f){let h=parseInt(d+f,16);o.push(h),l+=2;continue}}o.push(c)}s=new ArrayBuffer(o.length);let a=new DataView(s);for(let l=0,u=o.length;l<u;l++)a.setUint8(l,o[l])}else e==="B"?s=Vs(t.replace(/[^a-zA-Z0-9\+\/=]+/g,"")):s=Mr.encode(t);return tn(r).decode(s)}function rn(r){let e=!0;for(;;){let t=(r||"").toString().replace(/(=\?([^?]+)\?[Bb]\?([^?]*)\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g,(n,s,i,o,a)=>e&&i===a&&o.length%4===0&&!/=$/.test(o)?s+"__\0JOIN\0__":n).replace(/(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,(n,s,i,o)=>e&&i===o?s+"__\0JOIN\0__":n).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g,"").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g,"$1").replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,(n,s,i,o)=>du(s,i,o));if(e&&t.indexOf("�")>=0)e=!1;else return t}}function fu(r,e){e=e||"utf-8";let t=[];for(let i=0;i<r.length;i++){let o=r.charAt(i);if(o==="%"&&/^[a-f0-9]{2}/i.test(r.substr(i+1,2))){let a=r.substr(i+1,2);i+=2,t.push(parseInt(a,16))}else if(o.charCodeAt(0)>126){o=Mr.encode(o);for(let a=0;a<o.length;a++)t.push(o[a])}else t.push(o.charCodeAt(0))}const n=new ArrayBuffer(t.length),s=new DataView(n);for(let i=0,o=t.length;i<o;i++)s.setUint8(i,t[i]);return tn(e).decode(n)}function hu(r){let e=new Map;Object.keys(r.params).forEach(t=>{let n=t.match(/\*((\d+)\*?)?$/);if(!n)return;let s=t.substr(0,n.index).toLowerCase(),i=Number(n[2])||0,o;e.has(s)?o=e.get(s):(o={charset:!1,values:[]},e.set(s,o));let a=r.params[t];i===0&&n[0].charAt(n[0].length-1)==="*"&&(n=a.match(/^([^']*)'[^']*'(.*)$/))&&(o.charset=n[1]||"utf-8",a=n[2]),o.values.push({nr:i,value:a}),delete r.params[t]}),e.forEach((t,n)=>{r.params[n]=fu(t.values.sort((s,i)=>s.nr-i.nr).map(s=>s.value).join(""),t.charset)})}class pu{constructor(){this.chunks=[]}update(e){this.chunks.push(e),this.chunks.push(`
2
- `)}finalize(){return ds(new Blob(this.chunks,{type:"application/octet-stream"}))}}class gu{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.chunks=[],this.remainder=""}update(e){let t=this.decoder.decode(e);if(/[^a-zA-Z0-9+\/]/.test(t)&&(t=t.replace(/[^a-zA-Z0-9+\/]+/g,"")),this.remainder+=t,this.remainder.length>=this.maxChunkSize){let n=Math.floor(this.remainder.length/4)*4,s;n===this.remainder.length?(s=this.remainder,this.remainder=""):(s=this.remainder.substr(0,n),this.remainder=this.remainder.substr(n)),s.length&&this.chunks.push(Vs(s))}}finalize(){return this.remainder&&!/^=+$/.test(this.remainder)&&this.chunks.push(Vs(this.remainder)),ds(new Blob(this.chunks,{type:"application/octet-stream"}))}}const Zi=/^=[a-f0-9]{2}$/i,mu=/(?==[a-f0-9]{2})/i,yu=/=\r?\n/g,xu=/=[a-fA-F0-9]?$/;class bu{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.remainder="",this.chunks=[]}decodeQPBytes(e){let t=new ArrayBuffer(e.length),n=new DataView(t);for(let s=0,i=e.length;s<i;s++)n.setUint8(s,parseInt(e[s],16));return t}decodeChunks(e){e=e.replace(yu,"");let t=e.split(mu),n=[];for(let s of t){if(s.charAt(0)!=="="){n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(s);continue}if(s.length===3){Zi.test(s)?n.push(s.substr(1)):(n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(s));continue}if(s.length>3){const i=s.substr(0,3);Zi.test(i)?(n.push(s.substr(1,2)),this.chunks.push(this.decodeQPBytes(n)),n=[],s=s.substr(3),this.chunks.push(s)):(n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(s))}}n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[])}update(e){let t=this.decoder.decode(e)+`
3
- `;if(t=this.remainder+t,t.length<this.maxChunkSize){this.remainder=t;return}this.remainder="";let n=t.match(xu);if(n){if(n.index===0){this.remainder=t;return}this.remainder=t.substr(n.index),t=t.substr(0,n.index)}this.decodeChunks(t)}finalize(){return this.remainder.length&&(this.decodeChunks(this.remainder),this.remainder=""),ds(new Blob(this.chunks,{type:"application/octet-stream"}))}}class eo{constructor(e){if(this.options=e||{},this.postalMime=this.options.postalMime,this.root=!!this.options.parentNode,this.childNodes=[],this.options.parentNode){if(this.parentNode=this.options.parentNode,this.depth=this.parentNode.depth+1,this.depth>this.options.maxNestingDepth)throw new Error(`Maximum MIME nesting depth of ${this.options.maxNestingDepth} levels exceeded`);this.options.parentNode.childNodes.push(this)}else this.depth=0;this.state="header",this.headerLines=[],this.headerSize=0,this.contentType={value:"text/plain",default:!0},this.contentTransferEncoding={value:"8bit"},this.contentDisposition={value:""},this.headers=[],this.contentDecoder=!1}setupContentDecoder(e){/base64/i.test(e)?this.contentDecoder=new gu:/quoted-printable/i.test(e)?this.contentDecoder=new bu({decoder:tn(this.contentType.parsed.params.charset)}):this.contentDecoder=new pu}async finalize(){if(this.state==="finished")return;this.state==="header"&&this.processHeaders();let e=this.postalMime.boundaries;for(let t=e.length-1;t>=0;t--)if(e[t].node===this){e.splice(t,1);break}await this.finalizeChildNodes(),this.content=this.contentDecoder?await this.contentDecoder.finalize():null,this.state="finished"}async finalizeChildNodes(){for(let e of this.childNodes)await e.finalize()}parseStructuredHeader(e){let t={value:!1,params:{}},n=!1,s="",i="value",o=!1,a=!1,l;for(let u=0,c=e.length;u<c;u++)switch(l=e.charAt(u),i){case"key":if(l==="="){n=s.trim().toLowerCase(),i="value",s="";break}s+=l;break;case"value":if(a)s+=l;else if(l==="\\"){a=!0;continue}else o&&l===o?o=!1:!o&&l==='"'?o=l:!o&&l===";"?(n===!1?t.value=s.trim():t.params[n]=s.trim(),i="key",s=""):s+=l;a=!1;break}return s=s.trim(),i==="value"?n===!1?t.value=s:t.params[n]=s:s&&(t.params[s.toLowerCase()]=""),t.value&&(t.value=t.value.toLowerCase()),hu(t),t}decodeFlowedText(e,t){return e.split(/\r?\n/).reduce((n,s)=>/ $/.test(n)&&!/(^|\n)-- $/.test(n)?t?n.slice(0,-1)+s:n+s:n+`
4
- `+s).replace(/^ /gm,"")}getTextContent(){if(!this.content)return"";let e=tn(this.contentType.parsed.params.charset).decode(this.content);return/^flowed$/i.test(this.contentType.parsed.params.format)&&(e=this.decodeFlowedText(e,/^yes$/i.test(this.contentType.parsed.params.delsp))),e}processHeaders(){for(let e=this.headerLines.length-1;e>=0;e--){let t=this.headerLines[e];if(e&&/^\s/.test(t))this.headerLines[e-1]+=`
5
- `+t,this.headerLines.splice(e,1);else{t=t.replace(/\s+/g," ");let n=t.indexOf(":"),s=n<0?t.trim():t.substr(0,n).trim(),i=n<0?"":t.substr(n+1).trim();switch(this.headers.push({key:s.toLowerCase(),originalKey:s,value:i}),s.toLowerCase()){case"content-type":this.contentType.default&&(this.contentType={value:i,parsed:{}});break;case"content-transfer-encoding":this.contentTransferEncoding={value:i,parsed:{}};break;case"content-disposition":this.contentDisposition={value:i,parsed:{}};break;case"content-id":this.contentId=i;break;case"content-description":this.contentDescription=i;break}}}this.contentType.parsed=this.parseStructuredHeader(this.contentType.value),this.contentType.multipart=/^multipart\//i.test(this.contentType.parsed.value)?this.contentType.parsed.value.substr(this.contentType.parsed.value.indexOf("/")+1):!1,this.contentType.multipart&&this.contentType.parsed.params.boundary&&this.postalMime.boundaries.push({value:Mr.encode(this.contentType.parsed.params.boundary),node:this}),this.contentDisposition.parsed=this.parseStructuredHeader(this.contentDisposition.value),this.contentTransferEncoding.encoding=this.contentTransferEncoding.value.toLowerCase().split(/[^\w-]/).shift(),this.setupContentDecoder(this.contentTransferEncoding.encoding)}feed(e){switch(this.state){case"header":if(!e.length)return this.state="body",this.processHeaders();if(this.headerSize+=e.length,this.headerSize>this.options.maxHeadersSize)throw new Error(`Maximum header size of ${this.options.maxHeadersSize} bytes exceeded`);this.headerLines.push(tn().decode(e));break;case"body":this.contentDecoder.update(e)}}}const to={"&AElig":"Æ","&AElig;":"Æ","&AMP":"&","&AMP;":"&","&Aacute":"Á","&Aacute;":"Á","&Abreve;":"Ă","&Acirc":"Â","&Acirc;":"Â","&Acy;":"А","&Afr;":"𝔄","&Agrave":"À","&Agrave;":"À","&Alpha;":"Α","&Amacr;":"Ā","&And;":"⩓","&Aogon;":"Ą","&Aopf;":"𝔸","&ApplyFunction;":"⁡","&Aring":"Å","&Aring;":"Å","&Ascr;":"𝒜","&Assign;":"≔","&Atilde":"Ã","&Atilde;":"Ã","&Auml":"Ä","&Auml;":"Ä","&Backslash;":"∖","&Barv;":"⫧","&Barwed;":"⌆","&Bcy;":"Б","&Because;":"∵","&Bernoullis;":"ℬ","&Beta;":"Β","&Bfr;":"𝔅","&Bopf;":"𝔹","&Breve;":"˘","&Bscr;":"ℬ","&Bumpeq;":"≎","&CHcy;":"Ч","&COPY":"©","&COPY;":"©","&Cacute;":"Ć","&Cap;":"⋒","&CapitalDifferentialD;":"ⅅ","&Cayleys;":"ℭ","&Ccaron;":"Č","&Ccedil":"Ç","&Ccedil;":"Ç","&Ccirc;":"Ĉ","&Cconint;":"∰","&Cdot;":"Ċ","&Cedilla;":"¸","&CenterDot;":"·","&Cfr;":"ℭ","&Chi;":"Χ","&CircleDot;":"⊙","&CircleMinus;":"⊖","&CirclePlus;":"⊕","&CircleTimes;":"⊗","&ClockwiseContourIntegral;":"∲","&CloseCurlyDoubleQuote;":"”","&CloseCurlyQuote;":"’","&Colon;":"∷","&Colone;":"⩴","&Congruent;":"≡","&Conint;":"∯","&ContourIntegral;":"∮","&Copf;":"ℂ","&Coproduct;":"∐","&CounterClockwiseContourIntegral;":"∳","&Cross;":"⨯","&Cscr;":"𝒞","&Cup;":"⋓","&CupCap;":"≍","&DD;":"ⅅ","&DDotrahd;":"⤑","&DJcy;":"Ђ","&DScy;":"Ѕ","&DZcy;":"Џ","&Dagger;":"‡","&Darr;":"↡","&Dashv;":"⫤","&Dcaron;":"Ď","&Dcy;":"Д","&Del;":"∇","&Delta;":"Δ","&Dfr;":"𝔇","&DiacriticalAcute;":"´","&DiacriticalDot;":"˙","&DiacriticalDoubleAcute;":"˝","&DiacriticalGrave;":"`","&DiacriticalTilde;":"˜","&Diamond;":"⋄","&DifferentialD;":"ⅆ","&Dopf;":"𝔻","&Dot;":"¨","&DotDot;":"⃜","&DotEqual;":"≐","&DoubleContourIntegral;":"∯","&DoubleDot;":"¨","&DoubleDownArrow;":"⇓","&DoubleLeftArrow;":"⇐","&DoubleLeftRightArrow;":"⇔","&DoubleLeftTee;":"⫤","&DoubleLongLeftArrow;":"⟸","&DoubleLongLeftRightArrow;":"⟺","&DoubleLongRightArrow;":"⟹","&DoubleRightArrow;":"⇒","&DoubleRightTee;":"⊨","&DoubleUpArrow;":"⇑","&DoubleUpDownArrow;":"⇕","&DoubleVerticalBar;":"∥","&DownArrow;":"↓","&DownArrowBar;":"⤓","&DownArrowUpArrow;":"⇵","&DownBreve;":"̑","&DownLeftRightVector;":"⥐","&DownLeftTeeVector;":"⥞","&DownLeftVector;":"↽","&DownLeftVectorBar;":"⥖","&DownRightTeeVector;":"⥟","&DownRightVector;":"⇁","&DownRightVectorBar;":"⥗","&DownTee;":"⊤","&DownTeeArrow;":"↧","&Downarrow;":"⇓","&Dscr;":"𝒟","&Dstrok;":"Đ","&ENG;":"Ŋ","&ETH":"Ð","&ETH;":"Ð","&Eacute":"É","&Eacute;":"É","&Ecaron;":"Ě","&Ecirc":"Ê","&Ecirc;":"Ê","&Ecy;":"Э","&Edot;":"Ė","&Efr;":"𝔈","&Egrave":"È","&Egrave;":"È","&Element;":"∈","&Emacr;":"Ē","&EmptySmallSquare;":"◻","&EmptyVerySmallSquare;":"▫","&Eogon;":"Ę","&Eopf;":"𝔼","&Epsilon;":"Ε","&Equal;":"⩵","&EqualTilde;":"≂","&Equilibrium;":"⇌","&Escr;":"ℰ","&Esim;":"⩳","&Eta;":"Η","&Euml":"Ë","&Euml;":"Ë","&Exists;":"∃","&ExponentialE;":"ⅇ","&Fcy;":"Ф","&Ffr;":"𝔉","&FilledSmallSquare;":"◼","&FilledVerySmallSquare;":"▪","&Fopf;":"𝔽","&ForAll;":"∀","&Fouriertrf;":"ℱ","&Fscr;":"ℱ","&GJcy;":"Ѓ","&GT":">","&GT;":">","&Gamma;":"Γ","&Gammad;":"Ϝ","&Gbreve;":"Ğ","&Gcedil;":"Ģ","&Gcirc;":"Ĝ","&Gcy;":"Г","&Gdot;":"Ġ","&Gfr;":"𝔊","&Gg;":"⋙","&Gopf;":"𝔾","&GreaterEqual;":"≥","&GreaterEqualLess;":"⋛","&GreaterFullEqual;":"≧","&GreaterGreater;":"⪢","&GreaterLess;":"≷","&GreaterSlantEqual;":"⩾","&GreaterTilde;":"≳","&Gscr;":"𝒢","&Gt;":"≫","&HARDcy;":"Ъ","&Hacek;":"ˇ","&Hat;":"^","&Hcirc;":"Ĥ","&Hfr;":"ℌ","&HilbertSpace;":"ℋ","&Hopf;":"ℍ","&HorizontalLine;":"─","&Hscr;":"ℋ","&Hstrok;":"Ħ","&HumpDownHump;":"≎","&HumpEqual;":"≏","&IEcy;":"Е","&IJlig;":"IJ","&IOcy;":"Ё","&Iacute":"Í","&Iacute;":"Í","&Icirc":"Î","&Icirc;":"Î","&Icy;":"И","&Idot;":"İ","&Ifr;":"ℑ","&Igrave":"Ì","&Igrave;":"Ì","&Im;":"ℑ","&Imacr;":"Ī","&ImaginaryI;":"ⅈ","&Implies;":"⇒","&Int;":"∬","&Integral;":"∫","&Intersection;":"⋂","&InvisibleComma;":"⁣","&InvisibleTimes;":"⁢","&Iogon;":"Į","&Iopf;":"𝕀","&Iota;":"Ι","&Iscr;":"ℐ","&Itilde;":"Ĩ","&Iukcy;":"І","&Iuml":"Ï","&Iuml;":"Ï","&Jcirc;":"Ĵ","&Jcy;":"Й","&Jfr;":"𝔍","&Jopf;":"𝕁","&Jscr;":"𝒥","&Jsercy;":"Ј","&Jukcy;":"Є","&KHcy;":"Х","&KJcy;":"Ќ","&Kappa;":"Κ","&Kcedil;":"Ķ","&Kcy;":"К","&Kfr;":"𝔎","&Kopf;":"𝕂","&Kscr;":"𝒦","&LJcy;":"Љ","&LT":"<","&LT;":"<","&Lacute;":"Ĺ","&Lambda;":"Λ","&Lang;":"⟪","&Laplacetrf;":"ℒ","&Larr;":"↞","&Lcaron;":"Ľ","&Lcedil;":"Ļ","&Lcy;":"Л","&LeftAngleBracket;":"⟨","&LeftArrow;":"←","&LeftArrowBar;":"⇤","&LeftArrowRightArrow;":"⇆","&LeftCeiling;":"⌈","&LeftDoubleBracket;":"⟦","&LeftDownTeeVector;":"⥡","&LeftDownVector;":"⇃","&LeftDownVectorBar;":"⥙","&LeftFloor;":"⌊","&LeftRightArrow;":"↔","&LeftRightVector;":"⥎","&LeftTee;":"⊣","&LeftTeeArrow;":"↤","&LeftTeeVector;":"⥚","&LeftTriangle;":"⊲","&LeftTriangleBar;":"⧏","&LeftTriangleEqual;":"⊴","&LeftUpDownVector;":"⥑","&LeftUpTeeVector;":"⥠","&LeftUpVector;":"↿","&LeftUpVectorBar;":"⥘","&LeftVector;":"↼","&LeftVectorBar;":"⥒","&Leftarrow;":"⇐","&Leftrightarrow;":"⇔","&LessEqualGreater;":"⋚","&LessFullEqual;":"≦","&LessGreater;":"≶","&LessLess;":"⪡","&LessSlantEqual;":"⩽","&LessTilde;":"≲","&Lfr;":"𝔏","&Ll;":"⋘","&Lleftarrow;":"⇚","&Lmidot;":"Ŀ","&LongLeftArrow;":"⟵","&LongLeftRightArrow;":"⟷","&LongRightArrow;":"⟶","&Longleftarrow;":"⟸","&Longleftrightarrow;":"⟺","&Longrightarrow;":"⟹","&Lopf;":"𝕃","&LowerLeftArrow;":"↙","&LowerRightArrow;":"↘","&Lscr;":"ℒ","&Lsh;":"↰","&Lstrok;":"Ł","&Lt;":"≪","&Map;":"⤅","&Mcy;":"М","&MediumSpace;":" ","&Mellintrf;":"ℳ","&Mfr;":"𝔐","&MinusPlus;":"∓","&Mopf;":"𝕄","&Mscr;":"ℳ","&Mu;":"Μ","&NJcy;":"Њ","&Nacute;":"Ń","&Ncaron;":"Ň","&Ncedil;":"Ņ","&Ncy;":"Н","&NegativeMediumSpace;":"​","&NegativeThickSpace;":"​","&NegativeThinSpace;":"​","&NegativeVeryThinSpace;":"​","&NestedGreaterGreater;":"≫","&NestedLessLess;":"≪","&NewLine;":`
6
- `,"&Nfr;":"𝔑","&NoBreak;":"⁠","&NonBreakingSpace;":" ","&Nopf;":"ℕ","&Not;":"⫬","&NotCongruent;":"≢","&NotCupCap;":"≭","&NotDoubleVerticalBar;":"∦","&NotElement;":"∉","&NotEqual;":"≠","&NotEqualTilde;":"≂̸","&NotExists;":"∄","&NotGreater;":"≯","&NotGreaterEqual;":"≱","&NotGreaterFullEqual;":"≧̸","&NotGreaterGreater;":"≫̸","&NotGreaterLess;":"≹","&NotGreaterSlantEqual;":"⩾̸","&NotGreaterTilde;":"≵","&NotHumpDownHump;":"≎̸","&NotHumpEqual;":"≏̸","&NotLeftTriangle;":"⋪","&NotLeftTriangleBar;":"⧏̸","&NotLeftTriangleEqual;":"⋬","&NotLess;":"≮","&NotLessEqual;":"≰","&NotLessGreater;":"≸","&NotLessLess;":"≪̸","&NotLessSlantEqual;":"⩽̸","&NotLessTilde;":"≴","&NotNestedGreaterGreater;":"⪢̸","&NotNestedLessLess;":"⪡̸","&NotPrecedes;":"⊀","&NotPrecedesEqual;":"⪯̸","&NotPrecedesSlantEqual;":"⋠","&NotReverseElement;":"∌","&NotRightTriangle;":"⋫","&NotRightTriangleBar;":"⧐̸","&NotRightTriangleEqual;":"⋭","&NotSquareSubset;":"⊏̸","&NotSquareSubsetEqual;":"⋢","&NotSquareSuperset;":"⊐̸","&NotSquareSupersetEqual;":"⋣","&NotSubset;":"⊂⃒","&NotSubsetEqual;":"⊈","&NotSucceeds;":"⊁","&NotSucceedsEqual;":"⪰̸","&NotSucceedsSlantEqual;":"⋡","&NotSucceedsTilde;":"≿̸","&NotSuperset;":"⊃⃒","&NotSupersetEqual;":"⊉","&NotTilde;":"≁","&NotTildeEqual;":"≄","&NotTildeFullEqual;":"≇","&NotTildeTilde;":"≉","&NotVerticalBar;":"∤","&Nscr;":"𝒩","&Ntilde":"Ñ","&Ntilde;":"Ñ","&Nu;":"Ν","&OElig;":"Œ","&Oacute":"Ó","&Oacute;":"Ó","&Ocirc":"Ô","&Ocirc;":"Ô","&Ocy;":"О","&Odblac;":"Ő","&Ofr;":"𝔒","&Ograve":"Ò","&Ograve;":"Ò","&Omacr;":"Ō","&Omega;":"Ω","&Omicron;":"Ο","&Oopf;":"𝕆","&OpenCurlyDoubleQuote;":"“","&OpenCurlyQuote;":"‘","&Or;":"⩔","&Oscr;":"𝒪","&Oslash":"Ø","&Oslash;":"Ø","&Otilde":"Õ","&Otilde;":"Õ","&Otimes;":"⨷","&Ouml":"Ö","&Ouml;":"Ö","&OverBar;":"‾","&OverBrace;":"⏞","&OverBracket;":"⎴","&OverParenthesis;":"⏜","&PartialD;":"∂","&Pcy;":"П","&Pfr;":"𝔓","&Phi;":"Φ","&Pi;":"Π","&PlusMinus;":"±","&Poincareplane;":"ℌ","&Popf;":"ℙ","&Pr;":"⪻","&Precedes;":"≺","&PrecedesEqual;":"⪯","&PrecedesSlantEqual;":"≼","&PrecedesTilde;":"≾","&Prime;":"″","&Product;":"∏","&Proportion;":"∷","&Proportional;":"∝","&Pscr;":"𝒫","&Psi;":"Ψ","&QUOT":'"',"&QUOT;":'"',"&Qfr;":"𝔔","&Qopf;":"ℚ","&Qscr;":"𝒬","&RBarr;":"⤐","&REG":"®","&REG;":"®","&Racute;":"Ŕ","&Rang;":"⟫","&Rarr;":"↠","&Rarrtl;":"⤖","&Rcaron;":"Ř","&Rcedil;":"Ŗ","&Rcy;":"Р","&Re;":"ℜ","&ReverseElement;":"∋","&ReverseEquilibrium;":"⇋","&ReverseUpEquilibrium;":"⥯","&Rfr;":"ℜ","&Rho;":"Ρ","&RightAngleBracket;":"⟩","&RightArrow;":"→","&RightArrowBar;":"⇥","&RightArrowLeftArrow;":"⇄","&RightCeiling;":"⌉","&RightDoubleBracket;":"⟧","&RightDownTeeVector;":"⥝","&RightDownVector;":"⇂","&RightDownVectorBar;":"⥕","&RightFloor;":"⌋","&RightTee;":"⊢","&RightTeeArrow;":"↦","&RightTeeVector;":"⥛","&RightTriangle;":"⊳","&RightTriangleBar;":"⧐","&RightTriangleEqual;":"⊵","&RightUpDownVector;":"⥏","&RightUpTeeVector;":"⥜","&RightUpVector;":"↾","&RightUpVectorBar;":"⥔","&RightVector;":"⇀","&RightVectorBar;":"⥓","&Rightarrow;":"⇒","&Ropf;":"ℝ","&RoundImplies;":"⥰","&Rrightarrow;":"⇛","&Rscr;":"ℛ","&Rsh;":"↱","&RuleDelayed;":"⧴","&SHCHcy;":"Щ","&SHcy;":"Ш","&SOFTcy;":"Ь","&Sacute;":"Ś","&Sc;":"⪼","&Scaron;":"Š","&Scedil;":"Ş","&Scirc;":"Ŝ","&Scy;":"С","&Sfr;":"𝔖","&ShortDownArrow;":"↓","&ShortLeftArrow;":"←","&ShortRightArrow;":"→","&ShortUpArrow;":"↑","&Sigma;":"Σ","&SmallCircle;":"∘","&Sopf;":"𝕊","&Sqrt;":"√","&Square;":"□","&SquareIntersection;":"⊓","&SquareSubset;":"⊏","&SquareSubsetEqual;":"⊑","&SquareSuperset;":"⊐","&SquareSupersetEqual;":"⊒","&SquareUnion;":"⊔","&Sscr;":"𝒮","&Star;":"⋆","&Sub;":"⋐","&Subset;":"⋐","&SubsetEqual;":"⊆","&Succeeds;":"≻","&SucceedsEqual;":"⪰","&SucceedsSlantEqual;":"≽","&SucceedsTilde;":"≿","&SuchThat;":"∋","&Sum;":"∑","&Sup;":"⋑","&Superset;":"⊃","&SupersetEqual;":"⊇","&Supset;":"⋑","&THORN":"Þ","&THORN;":"Þ","&TRADE;":"™","&TSHcy;":"Ћ","&TScy;":"Ц","&Tab;":" ","&Tau;":"Τ","&Tcaron;":"Ť","&Tcedil;":"Ţ","&Tcy;":"Т","&Tfr;":"𝔗","&Therefore;":"∴","&Theta;":"Θ","&ThickSpace;":"  ","&ThinSpace;":" ","&Tilde;":"∼","&TildeEqual;":"≃","&TildeFullEqual;":"≅","&TildeTilde;":"≈","&Topf;":"𝕋","&TripleDot;":"⃛","&Tscr;":"𝒯","&Tstrok;":"Ŧ","&Uacute":"Ú","&Uacute;":"Ú","&Uarr;":"↟","&Uarrocir;":"⥉","&Ubrcy;":"Ў","&Ubreve;":"Ŭ","&Ucirc":"Û","&Ucirc;":"Û","&Ucy;":"У","&Udblac;":"Ű","&Ufr;":"𝔘","&Ugrave":"Ù","&Ugrave;":"Ù","&Umacr;":"Ū","&UnderBar;":"_","&UnderBrace;":"⏟","&UnderBracket;":"⎵","&UnderParenthesis;":"⏝","&Union;":"⋃","&UnionPlus;":"⊎","&Uogon;":"Ų","&Uopf;":"𝕌","&UpArrow;":"↑","&UpArrowBar;":"⤒","&UpArrowDownArrow;":"⇅","&UpDownArrow;":"↕","&UpEquilibrium;":"⥮","&UpTee;":"⊥","&UpTeeArrow;":"↥","&Uparrow;":"⇑","&Updownarrow;":"⇕","&UpperLeftArrow;":"↖","&UpperRightArrow;":"↗","&Upsi;":"ϒ","&Upsilon;":"Υ","&Uring;":"Ů","&Uscr;":"𝒰","&Utilde;":"Ũ","&Uuml":"Ü","&Uuml;":"Ü","&VDash;":"⊫","&Vbar;":"⫫","&Vcy;":"В","&Vdash;":"⊩","&Vdashl;":"⫦","&Vee;":"⋁","&Verbar;":"‖","&Vert;":"‖","&VerticalBar;":"∣","&VerticalLine;":"|","&VerticalSeparator;":"❘","&VerticalTilde;":"≀","&VeryThinSpace;":" ","&Vfr;":"𝔙","&Vopf;":"𝕍","&Vscr;":"𝒱","&Vvdash;":"⊪","&Wcirc;":"Ŵ","&Wedge;":"⋀","&Wfr;":"𝔚","&Wopf;":"𝕎","&Wscr;":"𝒲","&Xfr;":"𝔛","&Xi;":"Ξ","&Xopf;":"𝕏","&Xscr;":"𝒳","&YAcy;":"Я","&YIcy;":"Ї","&YUcy;":"Ю","&Yacute":"Ý","&Yacute;":"Ý","&Ycirc;":"Ŷ","&Ycy;":"Ы","&Yfr;":"𝔜","&Yopf;":"𝕐","&Yscr;":"𝒴","&Yuml;":"Ÿ","&ZHcy;":"Ж","&Zacute;":"Ź","&Zcaron;":"Ž","&Zcy;":"З","&Zdot;":"Ż","&ZeroWidthSpace;":"​","&Zeta;":"Ζ","&Zfr;":"ℨ","&Zopf;":"ℤ","&Zscr;":"𝒵","&aacute":"á","&aacute;":"á","&abreve;":"ă","&ac;":"∾","&acE;":"∾̳","&acd;":"∿","&acirc":"â","&acirc;":"â","&acute":"´","&acute;":"´","&acy;":"а","&aelig":"æ","&aelig;":"æ","&af;":"⁡","&afr;":"𝔞","&agrave":"à","&agrave;":"à","&alefsym;":"ℵ","&aleph;":"ℵ","&alpha;":"α","&amacr;":"ā","&amalg;":"⨿","&amp":"&","&amp;":"&","&and;":"∧","&andand;":"⩕","&andd;":"⩜","&andslope;":"⩘","&andv;":"⩚","&ang;":"∠","&ange;":"⦤","&angle;":"∠","&angmsd;":"∡","&angmsdaa;":"⦨","&angmsdab;":"⦩","&angmsdac;":"⦪","&angmsdad;":"⦫","&angmsdae;":"⦬","&angmsdaf;":"⦭","&angmsdag;":"⦮","&angmsdah;":"⦯","&angrt;":"∟","&angrtvb;":"⊾","&angrtvbd;":"⦝","&angsph;":"∢","&angst;":"Å","&angzarr;":"⍼","&aogon;":"ą","&aopf;":"𝕒","&ap;":"≈","&apE;":"⩰","&apacir;":"⩯","&ape;":"≊","&apid;":"≋","&apos;":"'","&approx;":"≈","&approxeq;":"≊","&aring":"å","&aring;":"å","&ascr;":"𝒶","&ast;":"*","&asymp;":"≈","&asympeq;":"≍","&atilde":"ã","&atilde;":"ã","&auml":"ä","&auml;":"ä","&awconint;":"∳","&awint;":"⨑","&bNot;":"⫭","&backcong;":"≌","&backepsilon;":"϶","&backprime;":"‵","&backsim;":"∽","&backsimeq;":"⋍","&barvee;":"⊽","&barwed;":"⌅","&barwedge;":"⌅","&bbrk;":"⎵","&bbrktbrk;":"⎶","&bcong;":"≌","&bcy;":"б","&bdquo;":"„","&becaus;":"∵","&because;":"∵","&bemptyv;":"⦰","&bepsi;":"϶","&bernou;":"ℬ","&beta;":"β","&beth;":"ℶ","&between;":"≬","&bfr;":"𝔟","&bigcap;":"⋂","&bigcirc;":"◯","&bigcup;":"⋃","&bigodot;":"⨀","&bigoplus;":"⨁","&bigotimes;":"⨂","&bigsqcup;":"⨆","&bigstar;":"★","&bigtriangledown;":"▽","&bigtriangleup;":"△","&biguplus;":"⨄","&bigvee;":"⋁","&bigwedge;":"⋀","&bkarow;":"⤍","&blacklozenge;":"⧫","&blacksquare;":"▪","&blacktriangle;":"▴","&blacktriangledown;":"▾","&blacktriangleleft;":"◂","&blacktriangleright;":"▸","&blank;":"␣","&blk12;":"▒","&blk14;":"░","&blk34;":"▓","&block;":"█","&bne;":"=⃥","&bnequiv;":"≡⃥","&bnot;":"⌐","&bopf;":"𝕓","&bot;":"⊥","&bottom;":"⊥","&bowtie;":"⋈","&boxDL;":"╗","&boxDR;":"╔","&boxDl;":"╖","&boxDr;":"╓","&boxH;":"═","&boxHD;":"╦","&boxHU;":"╩","&boxHd;":"╤","&boxHu;":"╧","&boxUL;":"╝","&boxUR;":"╚","&boxUl;":"╜","&boxUr;":"╙","&boxV;":"║","&boxVH;":"╬","&boxVL;":"╣","&boxVR;":"╠","&boxVh;":"╫","&boxVl;":"╢","&boxVr;":"╟","&boxbox;":"⧉","&boxdL;":"╕","&boxdR;":"╒","&boxdl;":"┐","&boxdr;":"┌","&boxh;":"─","&boxhD;":"╥","&boxhU;":"╨","&boxhd;":"┬","&boxhu;":"┴","&boxminus;":"⊟","&boxplus;":"⊞","&boxtimes;":"⊠","&boxuL;":"╛","&boxuR;":"╘","&boxul;":"┘","&boxur;":"└","&boxv;":"│","&boxvH;":"╪","&boxvL;":"╡","&boxvR;":"╞","&boxvh;":"┼","&boxvl;":"┤","&boxvr;":"├","&bprime;":"‵","&breve;":"˘","&brvbar":"¦","&brvbar;":"¦","&bscr;":"𝒷","&bsemi;":"⁏","&bsim;":"∽","&bsime;":"⋍","&bsol;":"\\","&bsolb;":"⧅","&bsolhsub;":"⟈","&bull;":"•","&bullet;":"•","&bump;":"≎","&bumpE;":"⪮","&bumpe;":"≏","&bumpeq;":"≏","&cacute;":"ć","&cap;":"∩","&capand;":"⩄","&capbrcup;":"⩉","&capcap;":"⩋","&capcup;":"⩇","&capdot;":"⩀","&caps;":"∩︀","&caret;":"⁁","&caron;":"ˇ","&ccaps;":"⩍","&ccaron;":"č","&ccedil":"ç","&ccedil;":"ç","&ccirc;":"ĉ","&ccups;":"⩌","&ccupssm;":"⩐","&cdot;":"ċ","&cedil":"¸","&cedil;":"¸","&cemptyv;":"⦲","&cent":"¢","&cent;":"¢","&centerdot;":"·","&cfr;":"𝔠","&chcy;":"ч","&check;":"✓","&checkmark;":"✓","&chi;":"χ","&cir;":"○","&cirE;":"⧃","&circ;":"ˆ","&circeq;":"≗","&circlearrowleft;":"↺","&circlearrowright;":"↻","&circledR;":"®","&circledS;":"Ⓢ","&circledast;":"⊛","&circledcirc;":"⊚","&circleddash;":"⊝","&cire;":"≗","&cirfnint;":"⨐","&cirmid;":"⫯","&cirscir;":"⧂","&clubs;":"♣","&clubsuit;":"♣","&colon;":":","&colone;":"≔","&coloneq;":"≔","&comma;":",","&commat;":"@","&comp;":"∁","&compfn;":"∘","&complement;":"∁","&complexes;":"ℂ","&cong;":"≅","&congdot;":"⩭","&conint;":"∮","&copf;":"𝕔","&coprod;":"∐","&copy":"©","&copy;":"©","&copysr;":"℗","&crarr;":"↵","&cross;":"✗","&cscr;":"𝒸","&csub;":"⫏","&csube;":"⫑","&csup;":"⫐","&csupe;":"⫒","&ctdot;":"⋯","&cudarrl;":"⤸","&cudarrr;":"⤵","&cuepr;":"⋞","&cuesc;":"⋟","&cularr;":"↶","&cularrp;":"⤽","&cup;":"∪","&cupbrcap;":"⩈","&cupcap;":"⩆","&cupcup;":"⩊","&cupdot;":"⊍","&cupor;":"⩅","&cups;":"∪︀","&curarr;":"↷","&curarrm;":"⤼","&curlyeqprec;":"⋞","&curlyeqsucc;":"⋟","&curlyvee;":"⋎","&curlywedge;":"⋏","&curren":"¤","&curren;":"¤","&curvearrowleft;":"↶","&curvearrowright;":"↷","&cuvee;":"⋎","&cuwed;":"⋏","&cwconint;":"∲","&cwint;":"∱","&cylcty;":"⌭","&dArr;":"⇓","&dHar;":"⥥","&dagger;":"†","&daleth;":"ℸ","&darr;":"↓","&dash;":"‐","&dashv;":"⊣","&dbkarow;":"⤏","&dblac;":"˝","&dcaron;":"ď","&dcy;":"д","&dd;":"ⅆ","&ddagger;":"‡","&ddarr;":"⇊","&ddotseq;":"⩷","&deg":"°","&deg;":"°","&delta;":"δ","&demptyv;":"⦱","&dfisht;":"⥿","&dfr;":"𝔡","&dharl;":"⇃","&dharr;":"⇂","&diam;":"⋄","&diamond;":"⋄","&diamondsuit;":"♦","&diams;":"♦","&die;":"¨","&digamma;":"ϝ","&disin;":"⋲","&div;":"÷","&divide":"÷","&divide;":"÷","&divideontimes;":"⋇","&divonx;":"⋇","&djcy;":"ђ","&dlcorn;":"⌞","&dlcrop;":"⌍","&dollar;":"$","&dopf;":"𝕕","&dot;":"˙","&doteq;":"≐","&doteqdot;":"≑","&dotminus;":"∸","&dotplus;":"∔","&dotsquare;":"⊡","&doublebarwedge;":"⌆","&downarrow;":"↓","&downdownarrows;":"⇊","&downharpoonleft;":"⇃","&downharpoonright;":"⇂","&drbkarow;":"⤐","&drcorn;":"⌟","&drcrop;":"⌌","&dscr;":"𝒹","&dscy;":"ѕ","&dsol;":"⧶","&dstrok;":"đ","&dtdot;":"⋱","&dtri;":"▿","&dtrif;":"▾","&duarr;":"⇵","&duhar;":"⥯","&dwangle;":"⦦","&dzcy;":"џ","&dzigrarr;":"⟿","&eDDot;":"⩷","&eDot;":"≑","&eacute":"é","&eacute;":"é","&easter;":"⩮","&ecaron;":"ě","&ecir;":"≖","&ecirc":"ê","&ecirc;":"ê","&ecolon;":"≕","&ecy;":"э","&edot;":"ė","&ee;":"ⅇ","&efDot;":"≒","&efr;":"𝔢","&eg;":"⪚","&egrave":"è","&egrave;":"è","&egs;":"⪖","&egsdot;":"⪘","&el;":"⪙","&elinters;":"⏧","&ell;":"ℓ","&els;":"⪕","&elsdot;":"⪗","&emacr;":"ē","&empty;":"∅","&emptyset;":"∅","&emptyv;":"∅","&emsp13;":" ","&emsp14;":" ","&emsp;":" ","&eng;":"ŋ","&ensp;":" ","&eogon;":"ę","&eopf;":"𝕖","&epar;":"⋕","&eparsl;":"⧣","&eplus;":"⩱","&epsi;":"ε","&epsilon;":"ε","&epsiv;":"ϵ","&eqcirc;":"≖","&eqcolon;":"≕","&eqsim;":"≂","&eqslantgtr;":"⪖","&eqslantless;":"⪕","&equals;":"=","&equest;":"≟","&equiv;":"≡","&equivDD;":"⩸","&eqvparsl;":"⧥","&erDot;":"≓","&erarr;":"⥱","&escr;":"ℯ","&esdot;":"≐","&esim;":"≂","&eta;":"η","&eth":"ð","&eth;":"ð","&euml":"ë","&euml;":"ë","&euro;":"€","&excl;":"!","&exist;":"∃","&expectation;":"ℰ","&exponentiale;":"ⅇ","&fallingdotseq;":"≒","&fcy;":"ф","&female;":"♀","&ffilig;":"ffi","&fflig;":"ff","&ffllig;":"ffl","&ffr;":"𝔣","&filig;":"fi","&fjlig;":"fj","&flat;":"♭","&fllig;":"fl","&fltns;":"▱","&fnof;":"ƒ","&fopf;":"𝕗","&forall;":"∀","&fork;":"⋔","&forkv;":"⫙","&fpartint;":"⨍","&frac12":"½","&frac12;":"½","&frac13;":"⅓","&frac14":"¼","&frac14;":"¼","&frac15;":"⅕","&frac16;":"⅙","&frac18;":"⅛","&frac23;":"⅔","&frac25;":"⅖","&frac34":"¾","&frac34;":"¾","&frac35;":"⅗","&frac38;":"⅜","&frac45;":"⅘","&frac56;":"⅚","&frac58;":"⅝","&frac78;":"⅞","&frasl;":"⁄","&frown;":"⌢","&fscr;":"𝒻","&gE;":"≧","&gEl;":"⪌","&gacute;":"ǵ","&gamma;":"γ","&gammad;":"ϝ","&gap;":"⪆","&gbreve;":"ğ","&gcirc;":"ĝ","&gcy;":"г","&gdot;":"ġ","&ge;":"≥","&gel;":"⋛","&geq;":"≥","&geqq;":"≧","&geqslant;":"⩾","&ges;":"⩾","&gescc;":"⪩","&gesdot;":"⪀","&gesdoto;":"⪂","&gesdotol;":"⪄","&gesl;":"⋛︀","&gesles;":"⪔","&gfr;":"𝔤","&gg;":"≫","&ggg;":"⋙","&gimel;":"ℷ","&gjcy;":"ѓ","&gl;":"≷","&glE;":"⪒","&gla;":"⪥","&glj;":"⪤","&gnE;":"≩","&gnap;":"⪊","&gnapprox;":"⪊","&gne;":"⪈","&gneq;":"⪈","&gneqq;":"≩","&gnsim;":"⋧","&gopf;":"𝕘","&grave;":"`","&gscr;":"ℊ","&gsim;":"≳","&gsime;":"⪎","&gsiml;":"⪐","&gt":">","&gt;":">","&gtcc;":"⪧","&gtcir;":"⩺","&gtdot;":"⋗","&gtlPar;":"⦕","&gtquest;":"⩼","&gtrapprox;":"⪆","&gtrarr;":"⥸","&gtrdot;":"⋗","&gtreqless;":"⋛","&gtreqqless;":"⪌","&gtrless;":"≷","&gtrsim;":"≳","&gvertneqq;":"≩︀","&gvnE;":"≩︀","&hArr;":"⇔","&hairsp;":" ","&half;":"½","&hamilt;":"ℋ","&hardcy;":"ъ","&harr;":"↔","&harrcir;":"⥈","&harrw;":"↭","&hbar;":"ℏ","&hcirc;":"ĥ","&hearts;":"♥","&heartsuit;":"♥","&hellip;":"…","&hercon;":"⊹","&hfr;":"𝔥","&hksearow;":"⤥","&hkswarow;":"⤦","&hoarr;":"⇿","&homtht;":"∻","&hookleftarrow;":"↩","&hookrightarrow;":"↪","&hopf;":"𝕙","&horbar;":"―","&hscr;":"𝒽","&hslash;":"ℏ","&hstrok;":"ħ","&hybull;":"⁃","&hyphen;":"‐","&iacute":"í","&iacute;":"í","&ic;":"⁣","&icirc":"î","&icirc;":"î","&icy;":"и","&iecy;":"е","&iexcl":"¡","&iexcl;":"¡","&iff;":"⇔","&ifr;":"𝔦","&igrave":"ì","&igrave;":"ì","&ii;":"ⅈ","&iiiint;":"⨌","&iiint;":"∭","&iinfin;":"⧜","&iiota;":"℩","&ijlig;":"ij","&imacr;":"ī","&image;":"ℑ","&imagline;":"ℐ","&imagpart;":"ℑ","&imath;":"ı","&imof;":"⊷","&imped;":"Ƶ","&in;":"∈","&incare;":"℅","&infin;":"∞","&infintie;":"⧝","&inodot;":"ı","&int;":"∫","&intcal;":"⊺","&integers;":"ℤ","&intercal;":"⊺","&intlarhk;":"⨗","&intprod;":"⨼","&iocy;":"ё","&iogon;":"į","&iopf;":"𝕚","&iota;":"ι","&iprod;":"⨼","&iquest":"¿","&iquest;":"¿","&iscr;":"𝒾","&isin;":"∈","&isinE;":"⋹","&isindot;":"⋵","&isins;":"⋴","&isinsv;":"⋳","&isinv;":"∈","&it;":"⁢","&itilde;":"ĩ","&iukcy;":"і","&iuml":"ï","&iuml;":"ï","&jcirc;":"ĵ","&jcy;":"й","&jfr;":"𝔧","&jmath;":"ȷ","&jopf;":"𝕛","&jscr;":"𝒿","&jsercy;":"ј","&jukcy;":"є","&kappa;":"κ","&kappav;":"ϰ","&kcedil;":"ķ","&kcy;":"к","&kfr;":"𝔨","&kgreen;":"ĸ","&khcy;":"х","&kjcy;":"ќ","&kopf;":"𝕜","&kscr;":"𝓀","&lAarr;":"⇚","&lArr;":"⇐","&lAtail;":"⤛","&lBarr;":"⤎","&lE;":"≦","&lEg;":"⪋","&lHar;":"⥢","&lacute;":"ĺ","&laemptyv;":"⦴","&lagran;":"ℒ","&lambda;":"λ","&lang;":"⟨","&langd;":"⦑","&langle;":"⟨","&lap;":"⪅","&laquo":"«","&laquo;":"«","&larr;":"←","&larrb;":"⇤","&larrbfs;":"⤟","&larrfs;":"⤝","&larrhk;":"↩","&larrlp;":"↫","&larrpl;":"⤹","&larrsim;":"⥳","&larrtl;":"↢","&lat;":"⪫","&latail;":"⤙","&late;":"⪭","&lates;":"⪭︀","&lbarr;":"⤌","&lbbrk;":"❲","&lbrace;":"{","&lbrack;":"[","&lbrke;":"⦋","&lbrksld;":"⦏","&lbrkslu;":"⦍","&lcaron;":"ľ","&lcedil;":"ļ","&lceil;":"⌈","&lcub;":"{","&lcy;":"л","&ldca;":"⤶","&ldquo;":"“","&ldquor;":"„","&ldrdhar;":"⥧","&ldrushar;":"⥋","&ldsh;":"↲","&le;":"≤","&leftarrow;":"←","&leftarrowtail;":"↢","&leftharpoondown;":"↽","&leftharpoonup;":"↼","&leftleftarrows;":"⇇","&leftrightarrow;":"↔","&leftrightarrows;":"⇆","&leftrightharpoons;":"⇋","&leftrightsquigarrow;":"↭","&leftthreetimes;":"⋋","&leg;":"⋚","&leq;":"≤","&leqq;":"≦","&leqslant;":"⩽","&les;":"⩽","&lescc;":"⪨","&lesdot;":"⩿","&lesdoto;":"⪁","&lesdotor;":"⪃","&lesg;":"⋚︀","&lesges;":"⪓","&lessapprox;":"⪅","&lessdot;":"⋖","&lesseqgtr;":"⋚","&lesseqqgtr;":"⪋","&lessgtr;":"≶","&lesssim;":"≲","&lfisht;":"⥼","&lfloor;":"⌊","&lfr;":"𝔩","&lg;":"≶","&lgE;":"⪑","&lhard;":"↽","&lharu;":"↼","&lharul;":"⥪","&lhblk;":"▄","&ljcy;":"љ","&ll;":"≪","&llarr;":"⇇","&llcorner;":"⌞","&llhard;":"⥫","&lltri;":"◺","&lmidot;":"ŀ","&lmoust;":"⎰","&lmoustache;":"⎰","&lnE;":"≨","&lnap;":"⪉","&lnapprox;":"⪉","&lne;":"⪇","&lneq;":"⪇","&lneqq;":"≨","&lnsim;":"⋦","&loang;":"⟬","&loarr;":"⇽","&lobrk;":"⟦","&longleftarrow;":"⟵","&longleftrightarrow;":"⟷","&longmapsto;":"⟼","&longrightarrow;":"⟶","&looparrowleft;":"↫","&looparrowright;":"↬","&lopar;":"⦅","&lopf;":"𝕝","&loplus;":"⨭","&lotimes;":"⨴","&lowast;":"∗","&lowbar;":"_","&loz;":"◊","&lozenge;":"◊","&lozf;":"⧫","&lpar;":"(","&lparlt;":"⦓","&lrarr;":"⇆","&lrcorner;":"⌟","&lrhar;":"⇋","&lrhard;":"⥭","&lrm;":"‎","&lrtri;":"⊿","&lsaquo;":"‹","&lscr;":"𝓁","&lsh;":"↰","&lsim;":"≲","&lsime;":"⪍","&lsimg;":"⪏","&lsqb;":"[","&lsquo;":"‘","&lsquor;":"‚","&lstrok;":"ł","&lt":"<","&lt;":"<","&ltcc;":"⪦","&ltcir;":"⩹","&ltdot;":"⋖","&lthree;":"⋋","&ltimes;":"⋉","&ltlarr;":"⥶","&ltquest;":"⩻","&ltrPar;":"⦖","&ltri;":"◃","&ltrie;":"⊴","&ltrif;":"◂","&lurdshar;":"⥊","&luruhar;":"⥦","&lvertneqq;":"≨︀","&lvnE;":"≨︀","&mDDot;":"∺","&macr":"¯","&macr;":"¯","&male;":"♂","&malt;":"✠","&maltese;":"✠","&map;":"↦","&mapsto;":"↦","&mapstodown;":"↧","&mapstoleft;":"↤","&mapstoup;":"↥","&marker;":"▮","&mcomma;":"⨩","&mcy;":"м","&mdash;":"—","&measuredangle;":"∡","&mfr;":"𝔪","&mho;":"℧","&micro":"µ","&micro;":"µ","&mid;":"∣","&midast;":"*","&midcir;":"⫰","&middot":"·","&middot;":"·","&minus;":"−","&minusb;":"⊟","&minusd;":"∸","&minusdu;":"⨪","&mlcp;":"⫛","&mldr;":"…","&mnplus;":"∓","&models;":"⊧","&mopf;":"𝕞","&mp;":"∓","&mscr;":"𝓂","&mstpos;":"∾","&mu;":"μ","&multimap;":"⊸","&mumap;":"⊸","&nGg;":"⋙̸","&nGt;":"≫⃒","&nGtv;":"≫̸","&nLeftarrow;":"⇍","&nLeftrightarrow;":"⇎","&nLl;":"⋘̸","&nLt;":"≪⃒","&nLtv;":"≪̸","&nRightarrow;":"⇏","&nVDash;":"⊯","&nVdash;":"⊮","&nabla;":"∇","&nacute;":"ń","&nang;":"∠⃒","&nap;":"≉","&napE;":"⩰̸","&napid;":"≋̸","&napos;":"ʼn","&napprox;":"≉","&natur;":"♮","&natural;":"♮","&naturals;":"ℕ","&nbsp":" ","&nbsp;":" ","&nbump;":"≎̸","&nbumpe;":"≏̸","&ncap;":"⩃","&ncaron;":"ň","&ncedil;":"ņ","&ncong;":"≇","&ncongdot;":"⩭̸","&ncup;":"⩂","&ncy;":"н","&ndash;":"–","&ne;":"≠","&neArr;":"⇗","&nearhk;":"⤤","&nearr;":"↗","&nearrow;":"↗","&nedot;":"≐̸","&nequiv;":"≢","&nesear;":"⤨","&nesim;":"≂̸","&nexist;":"∄","&nexists;":"∄","&nfr;":"𝔫","&ngE;":"≧̸","&nge;":"≱","&ngeq;":"≱","&ngeqq;":"≧̸","&ngeqslant;":"⩾̸","&nges;":"⩾̸","&ngsim;":"≵","&ngt;":"≯","&ngtr;":"≯","&nhArr;":"⇎","&nharr;":"↮","&nhpar;":"⫲","&ni;":"∋","&nis;":"⋼","&nisd;":"⋺","&niv;":"∋","&njcy;":"њ","&nlArr;":"⇍","&nlE;":"≦̸","&nlarr;":"↚","&nldr;":"‥","&nle;":"≰","&nleftarrow;":"↚","&nleftrightarrow;":"↮","&nleq;":"≰","&nleqq;":"≦̸","&nleqslant;":"⩽̸","&nles;":"⩽̸","&nless;":"≮","&nlsim;":"≴","&nlt;":"≮","&nltri;":"⋪","&nltrie;":"⋬","&nmid;":"∤","&nopf;":"𝕟","&not":"¬","&not;":"¬","&notin;":"∉","&notinE;":"⋹̸","&notindot;":"⋵̸","&notinva;":"∉","&notinvb;":"⋷","&notinvc;":"⋶","&notni;":"∌","&notniva;":"∌","&notnivb;":"⋾","&notnivc;":"⋽","&npar;":"∦","&nparallel;":"∦","&nparsl;":"⫽⃥","&npart;":"∂̸","&npolint;":"⨔","&npr;":"⊀","&nprcue;":"⋠","&npre;":"⪯̸","&nprec;":"⊀","&npreceq;":"⪯̸","&nrArr;":"⇏","&nrarr;":"↛","&nrarrc;":"⤳̸","&nrarrw;":"↝̸","&nrightarrow;":"↛","&nrtri;":"⋫","&nrtrie;":"⋭","&nsc;":"⊁","&nsccue;":"⋡","&nsce;":"⪰̸","&nscr;":"𝓃","&nshortmid;":"∤","&nshortparallel;":"∦","&nsim;":"≁","&nsime;":"≄","&nsimeq;":"≄","&nsmid;":"∤","&nspar;":"∦","&nsqsube;":"⋢","&nsqsupe;":"⋣","&nsub;":"⊄","&nsubE;":"⫅̸","&nsube;":"⊈","&nsubset;":"⊂⃒","&nsubseteq;":"⊈","&nsubseteqq;":"⫅̸","&nsucc;":"⊁","&nsucceq;":"⪰̸","&nsup;":"⊅","&nsupE;":"⫆̸","&nsupe;":"⊉","&nsupset;":"⊃⃒","&nsupseteq;":"⊉","&nsupseteqq;":"⫆̸","&ntgl;":"≹","&ntilde":"ñ","&ntilde;":"ñ","&ntlg;":"≸","&ntriangleleft;":"⋪","&ntrianglelefteq;":"⋬","&ntriangleright;":"⋫","&ntrianglerighteq;":"⋭","&nu;":"ν","&num;":"#","&numero;":"№","&numsp;":" ","&nvDash;":"⊭","&nvHarr;":"⤄","&nvap;":"≍⃒","&nvdash;":"⊬","&nvge;":"≥⃒","&nvgt;":">⃒","&nvinfin;":"⧞","&nvlArr;":"⤂","&nvle;":"≤⃒","&nvlt;":"<⃒","&nvltrie;":"⊴⃒","&nvrArr;":"⤃","&nvrtrie;":"⊵⃒","&nvsim;":"∼⃒","&nwArr;":"⇖","&nwarhk;":"⤣","&nwarr;":"↖","&nwarrow;":"↖","&nwnear;":"⤧","&oS;":"Ⓢ","&oacute":"ó","&oacute;":"ó","&oast;":"⊛","&ocir;":"⊚","&ocirc":"ô","&ocirc;":"ô","&ocy;":"о","&odash;":"⊝","&odblac;":"ő","&odiv;":"⨸","&odot;":"⊙","&odsold;":"⦼","&oelig;":"œ","&ofcir;":"⦿","&ofr;":"𝔬","&ogon;":"˛","&ograve":"ò","&ograve;":"ò","&ogt;":"⧁","&ohbar;":"⦵","&ohm;":"Ω","&oint;":"∮","&olarr;":"↺","&olcir;":"⦾","&olcross;":"⦻","&oline;":"‾","&olt;":"⧀","&omacr;":"ō","&omega;":"ω","&omicron;":"ο","&omid;":"⦶","&ominus;":"⊖","&oopf;":"𝕠","&opar;":"⦷","&operp;":"⦹","&oplus;":"⊕","&or;":"∨","&orarr;":"↻","&ord;":"⩝","&order;":"ℴ","&orderof;":"ℴ","&ordf":"ª","&ordf;":"ª","&ordm":"º","&ordm;":"º","&origof;":"⊶","&oror;":"⩖","&orslope;":"⩗","&orv;":"⩛","&oscr;":"ℴ","&oslash":"ø","&oslash;":"ø","&osol;":"⊘","&otilde":"õ","&otilde;":"õ","&otimes;":"⊗","&otimesas;":"⨶","&ouml":"ö","&ouml;":"ö","&ovbar;":"⌽","&par;":"∥","&para":"¶","&para;":"¶","&parallel;":"∥","&parsim;":"⫳","&parsl;":"⫽","&part;":"∂","&pcy;":"п","&percnt;":"%","&period;":".","&permil;":"‰","&perp;":"⊥","&pertenk;":"‱","&pfr;":"𝔭","&phi;":"φ","&phiv;":"ϕ","&phmmat;":"ℳ","&phone;":"☎","&pi;":"π","&pitchfork;":"⋔","&piv;":"ϖ","&planck;":"ℏ","&planckh;":"ℎ","&plankv;":"ℏ","&plus;":"+","&plusacir;":"⨣","&plusb;":"⊞","&pluscir;":"⨢","&plusdo;":"∔","&plusdu;":"⨥","&pluse;":"⩲","&plusmn":"±","&plusmn;":"±","&plussim;":"⨦","&plustwo;":"⨧","&pm;":"±","&pointint;":"⨕","&popf;":"𝕡","&pound":"£","&pound;":"£","&pr;":"≺","&prE;":"⪳","&prap;":"⪷","&prcue;":"≼","&pre;":"⪯","&prec;":"≺","&precapprox;":"⪷","&preccurlyeq;":"≼","&preceq;":"⪯","&precnapprox;":"⪹","&precneqq;":"⪵","&precnsim;":"⋨","&precsim;":"≾","&prime;":"′","&primes;":"ℙ","&prnE;":"⪵","&prnap;":"⪹","&prnsim;":"⋨","&prod;":"∏","&profalar;":"⌮","&profline;":"⌒","&profsurf;":"⌓","&prop;":"∝","&propto;":"∝","&prsim;":"≾","&prurel;":"⊰","&pscr;":"𝓅","&psi;":"ψ","&puncsp;":" ","&qfr;":"𝔮","&qint;":"⨌","&qopf;":"𝕢","&qprime;":"⁗","&qscr;":"𝓆","&quaternions;":"ℍ","&quatint;":"⨖","&quest;":"?","&questeq;":"≟","&quot":'"',"&quot;":'"',"&rAarr;":"⇛","&rArr;":"⇒","&rAtail;":"⤜","&rBarr;":"⤏","&rHar;":"⥤","&race;":"∽̱","&racute;":"ŕ","&radic;":"√","&raemptyv;":"⦳","&rang;":"⟩","&rangd;":"⦒","&range;":"⦥","&rangle;":"⟩","&raquo":"»","&raquo;":"»","&rarr;":"→","&rarrap;":"⥵","&rarrb;":"⇥","&rarrbfs;":"⤠","&rarrc;":"⤳","&rarrfs;":"⤞","&rarrhk;":"↪","&rarrlp;":"↬","&rarrpl;":"⥅","&rarrsim;":"⥴","&rarrtl;":"↣","&rarrw;":"↝","&ratail;":"⤚","&ratio;":"∶","&rationals;":"ℚ","&rbarr;":"⤍","&rbbrk;":"❳","&rbrace;":"}","&rbrack;":"]","&rbrke;":"⦌","&rbrksld;":"⦎","&rbrkslu;":"⦐","&rcaron;":"ř","&rcedil;":"ŗ","&rceil;":"⌉","&rcub;":"}","&rcy;":"р","&rdca;":"⤷","&rdldhar;":"⥩","&rdquo;":"”","&rdquor;":"”","&rdsh;":"↳","&real;":"ℜ","&realine;":"ℛ","&realpart;":"ℜ","&reals;":"ℝ","&rect;":"▭","&reg":"®","&reg;":"®","&rfisht;":"⥽","&rfloor;":"⌋","&rfr;":"𝔯","&rhard;":"⇁","&rharu;":"⇀","&rharul;":"⥬","&rho;":"ρ","&rhov;":"ϱ","&rightarrow;":"→","&rightarrowtail;":"↣","&rightharpoondown;":"⇁","&rightharpoonup;":"⇀","&rightleftarrows;":"⇄","&rightleftharpoons;":"⇌","&rightrightarrows;":"⇉","&rightsquigarrow;":"↝","&rightthreetimes;":"⋌","&ring;":"˚","&risingdotseq;":"≓","&rlarr;":"⇄","&rlhar;":"⇌","&rlm;":"‏","&rmoust;":"⎱","&rmoustache;":"⎱","&rnmid;":"⫮","&roang;":"⟭","&roarr;":"⇾","&robrk;":"⟧","&ropar;":"⦆","&ropf;":"𝕣","&roplus;":"⨮","&rotimes;":"⨵","&rpar;":")","&rpargt;":"⦔","&rppolint;":"⨒","&rrarr;":"⇉","&rsaquo;":"›","&rscr;":"𝓇","&rsh;":"↱","&rsqb;":"]","&rsquo;":"’","&rsquor;":"’","&rthree;":"⋌","&rtimes;":"⋊","&rtri;":"▹","&rtrie;":"⊵","&rtrif;":"▸","&rtriltri;":"⧎","&ruluhar;":"⥨","&rx;":"℞","&sacute;":"ś","&sbquo;":"‚","&sc;":"≻","&scE;":"⪴","&scap;":"⪸","&scaron;":"š","&sccue;":"≽","&sce;":"⪰","&scedil;":"ş","&scirc;":"ŝ","&scnE;":"⪶","&scnap;":"⪺","&scnsim;":"⋩","&scpolint;":"⨓","&scsim;":"≿","&scy;":"с","&sdot;":"⋅","&sdotb;":"⊡","&sdote;":"⩦","&seArr;":"⇘","&searhk;":"⤥","&searr;":"↘","&searrow;":"↘","&sect":"§","&sect;":"§","&semi;":";","&seswar;":"⤩","&setminus;":"∖","&setmn;":"∖","&sext;":"✶","&sfr;":"𝔰","&sfrown;":"⌢","&sharp;":"♯","&shchcy;":"щ","&shcy;":"ш","&shortmid;":"∣","&shortparallel;":"∥","&shy":"­","&shy;":"­","&sigma;":"σ","&sigmaf;":"ς","&sigmav;":"ς","&sim;":"∼","&simdot;":"⩪","&sime;":"≃","&simeq;":"≃","&simg;":"⪞","&simgE;":"⪠","&siml;":"⪝","&simlE;":"⪟","&simne;":"≆","&simplus;":"⨤","&simrarr;":"⥲","&slarr;":"←","&smallsetminus;":"∖","&smashp;":"⨳","&smeparsl;":"⧤","&smid;":"∣","&smile;":"⌣","&smt;":"⪪","&smte;":"⪬","&smtes;":"⪬︀","&softcy;":"ь","&sol;":"/","&solb;":"⧄","&solbar;":"⌿","&sopf;":"𝕤","&spades;":"♠","&spadesuit;":"♠","&spar;":"∥","&sqcap;":"⊓","&sqcaps;":"⊓︀","&sqcup;":"⊔","&sqcups;":"⊔︀","&sqsub;":"⊏","&sqsube;":"⊑","&sqsubset;":"⊏","&sqsubseteq;":"⊑","&sqsup;":"⊐","&sqsupe;":"⊒","&sqsupset;":"⊐","&sqsupseteq;":"⊒","&squ;":"□","&square;":"□","&squarf;":"▪","&squf;":"▪","&srarr;":"→","&sscr;":"𝓈","&ssetmn;":"∖","&ssmile;":"⌣","&sstarf;":"⋆","&star;":"☆","&starf;":"★","&straightepsilon;":"ϵ","&straightphi;":"ϕ","&strns;":"¯","&sub;":"⊂","&subE;":"⫅","&subdot;":"⪽","&sube;":"⊆","&subedot;":"⫃","&submult;":"⫁","&subnE;":"⫋","&subne;":"⊊","&subplus;":"⪿","&subrarr;":"⥹","&subset;":"⊂","&subseteq;":"⊆","&subseteqq;":"⫅","&subsetneq;":"⊊","&subsetneqq;":"⫋","&subsim;":"⫇","&subsub;":"⫕","&subsup;":"⫓","&succ;":"≻","&succapprox;":"⪸","&succcurlyeq;":"≽","&succeq;":"⪰","&succnapprox;":"⪺","&succneqq;":"⪶","&succnsim;":"⋩","&succsim;":"≿","&sum;":"∑","&sung;":"♪","&sup1":"¹","&sup1;":"¹","&sup2":"²","&sup2;":"²","&sup3":"³","&sup3;":"³","&sup;":"⊃","&supE;":"⫆","&supdot;":"⪾","&supdsub;":"⫘","&supe;":"⊇","&supedot;":"⫄","&suphsol;":"⟉","&suphsub;":"⫗","&suplarr;":"⥻","&supmult;":"⫂","&supnE;":"⫌","&supne;":"⊋","&supplus;":"⫀","&supset;":"⊃","&supseteq;":"⊇","&supseteqq;":"⫆","&supsetneq;":"⊋","&supsetneqq;":"⫌","&supsim;":"⫈","&supsub;":"⫔","&supsup;":"⫖","&swArr;":"⇙","&swarhk;":"⤦","&swarr;":"↙","&swarrow;":"↙","&swnwar;":"⤪","&szlig":"ß","&szlig;":"ß","&target;":"⌖","&tau;":"τ","&tbrk;":"⎴","&tcaron;":"ť","&tcedil;":"ţ","&tcy;":"т","&tdot;":"⃛","&telrec;":"⌕","&tfr;":"𝔱","&there4;":"∴","&therefore;":"∴","&theta;":"θ","&thetasym;":"ϑ","&thetav;":"ϑ","&thickapprox;":"≈","&thicksim;":"∼","&thinsp;":" ","&thkap;":"≈","&thksim;":"∼","&thorn":"þ","&thorn;":"þ","&tilde;":"˜","&times":"×","&times;":"×","&timesb;":"⊠","&timesbar;":"⨱","&timesd;":"⨰","&tint;":"∭","&toea;":"⤨","&top;":"⊤","&topbot;":"⌶","&topcir;":"⫱","&topf;":"𝕥","&topfork;":"⫚","&tosa;":"⤩","&tprime;":"‴","&trade;":"™","&triangle;":"▵","&triangledown;":"▿","&triangleleft;":"◃","&trianglelefteq;":"⊴","&triangleq;":"≜","&triangleright;":"▹","&trianglerighteq;":"⊵","&tridot;":"◬","&trie;":"≜","&triminus;":"⨺","&triplus;":"⨹","&trisb;":"⧍","&tritime;":"⨻","&trpezium;":"⏢","&tscr;":"𝓉","&tscy;":"ц","&tshcy;":"ћ","&tstrok;":"ŧ","&twixt;":"≬","&twoheadleftarrow;":"↞","&twoheadrightarrow;":"↠","&uArr;":"⇑","&uHar;":"⥣","&uacute":"ú","&uacute;":"ú","&uarr;":"↑","&ubrcy;":"ў","&ubreve;":"ŭ","&ucirc":"û","&ucirc;":"û","&ucy;":"у","&udarr;":"⇅","&udblac;":"ű","&udhar;":"⥮","&ufisht;":"⥾","&ufr;":"𝔲","&ugrave":"ù","&ugrave;":"ù","&uharl;":"↿","&uharr;":"↾","&uhblk;":"▀","&ulcorn;":"⌜","&ulcorner;":"⌜","&ulcrop;":"⌏","&ultri;":"◸","&umacr;":"ū","&uml":"¨","&uml;":"¨","&uogon;":"ų","&uopf;":"𝕦","&uparrow;":"↑","&updownarrow;":"↕","&upharpoonleft;":"↿","&upharpoonright;":"↾","&uplus;":"⊎","&upsi;":"υ","&upsih;":"ϒ","&upsilon;":"υ","&upuparrows;":"⇈","&urcorn;":"⌝","&urcorner;":"⌝","&urcrop;":"⌎","&uring;":"ů","&urtri;":"◹","&uscr;":"𝓊","&utdot;":"⋰","&utilde;":"ũ","&utri;":"▵","&utrif;":"▴","&uuarr;":"⇈","&uuml":"ü","&uuml;":"ü","&uwangle;":"⦧","&vArr;":"⇕","&vBar;":"⫨","&vBarv;":"⫩","&vDash;":"⊨","&vangrt;":"⦜","&varepsilon;":"ϵ","&varkappa;":"ϰ","&varnothing;":"∅","&varphi;":"ϕ","&varpi;":"ϖ","&varpropto;":"∝","&varr;":"↕","&varrho;":"ϱ","&varsigma;":"ς","&varsubsetneq;":"⊊︀","&varsubsetneqq;":"⫋︀","&varsupsetneq;":"⊋︀","&varsupsetneqq;":"⫌︀","&vartheta;":"ϑ","&vartriangleleft;":"⊲","&vartriangleright;":"⊳","&vcy;":"в","&vdash;":"⊢","&vee;":"∨","&veebar;":"⊻","&veeeq;":"≚","&vellip;":"⋮","&verbar;":"|","&vert;":"|","&vfr;":"𝔳","&vltri;":"⊲","&vnsub;":"⊂⃒","&vnsup;":"⊃⃒","&vopf;":"𝕧","&vprop;":"∝","&vrtri;":"⊳","&vscr;":"𝓋","&vsubnE;":"⫋︀","&vsubne;":"⊊︀","&vsupnE;":"⫌︀","&vsupne;":"⊋︀","&vzigzag;":"⦚","&wcirc;":"ŵ","&wedbar;":"⩟","&wedge;":"∧","&wedgeq;":"≙","&weierp;":"℘","&wfr;":"𝔴","&wopf;":"𝕨","&wp;":"℘","&wr;":"≀","&wreath;":"≀","&wscr;":"𝓌","&xcap;":"⋂","&xcirc;":"◯","&xcup;":"⋃","&xdtri;":"▽","&xfr;":"𝔵","&xhArr;":"⟺","&xharr;":"⟷","&xi;":"ξ","&xlArr;":"⟸","&xlarr;":"⟵","&xmap;":"⟼","&xnis;":"⋻","&xodot;":"⨀","&xopf;":"𝕩","&xoplus;":"⨁","&xotime;":"⨂","&xrArr;":"⟹","&xrarr;":"⟶","&xscr;":"𝓍","&xsqcup;":"⨆","&xuplus;":"⨄","&xutri;":"△","&xvee;":"⋁","&xwedge;":"⋀","&yacute":"ý","&yacute;":"ý","&yacy;":"я","&ycirc;":"ŷ","&ycy;":"ы","&yen":"¥","&yen;":"¥","&yfr;":"𝔶","&yicy;":"ї","&yopf;":"𝕪","&yscr;":"𝓎","&yucy;":"ю","&yuml":"ÿ","&yuml;":"ÿ","&zacute;":"ź","&zcaron;":"ž","&zcy;":"з","&zdot;":"ż","&zeetrf;":"ℨ","&zeta;":"ζ","&zfr;":"𝔷","&zhcy;":"ж","&zigrarr;":"⇝","&zopf;":"𝕫","&zscr;":"𝓏","&zwj;":"‍","&zwnj;":"‌"};function _u(r){return r.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi,(e,t)=>{if(typeof to[e]=="string")return to[e];if(t.charAt(0)!=="#"||e.charAt(e.length-1)!==";")return e;let n;t.charAt(1)==="x"?n=parseInt(t.substr(2),16):n=parseInt(t.substr(1),10);var s="";return n>=55296&&n<=57343||n>1114111?"�":(n>65535&&(n-=65536,s+=String.fromCharCode(n>>>10&1023|55296),n=56320|n&1023),s+=String.fromCharCode(n),s)})}function dr(r){return r.trim().replace(/[<>"'?&]/g,e=>{let t=e.charCodeAt(0).toString(16);return t.length<2&&(t="0"+t),"&#x"+t.toUpperCase()+";"})}function vu(r){return"<div>"+dr(r).replace(/\n/g,"<br />")+"</div>"}function Cu(r){return r=r.replace(/\r?\n/g,"").replace(/<\!\-\-.*?\-\->/gi," ").replace(/<br\b[^>]*>/gi,`
1
+ "use strict";var Dd=Object.defineProperty;var Ad=(r,e,t)=>e in r?Dd(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var St=(r,e,t)=>Ad(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react"),ma=require("react-dom");function Td(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const Ei=Td(b);class Bd{constructor(e){St(this,"config");St(this,"defaultUploadOptions",{maxSizeMB:10,maxImageDimension:0,imageQuality:.9});if(!e.system_id)throw new Error("GraphClient: system_id is REQUIRED. No system_id → No start.");this.config=e}async callGraph(e,t={}){const n={coprocessor:"graph",method:e,system_id:this.config.system_id,params:t};try{const s=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(n)});if(!s.ok){const o=await s.text();throw new Error(`API error (${s.status}): ${o}`)}const i=await s.json();if(!i.success&&i.error)throw new Error(i.error);return i}catch(s){throw console.error("Graph API call failed:",s),s}}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getChildren(e){return(await this.callGraph("get_children",{parent_id:e})).result||[]}async getNode(e){return(await this.callGraph("get_node",{node_id:e})).result||null}async addNode(e){const t={...e,created:e.created||new Date().toISOString(),modified:new Date().toISOString()},n=await this.callGraph("add_node",t);if(!n.result)throw new Error("Failed to add node");return n.result}async updateNode(e,t){const n={node_id:e,updates:{...t,modified:new Date().toISOString()}},s=await this.callGraph("update_node",n);if(!s.result)throw new Error("Failed to update node");return s.result}async deleteNode(e,t=!1){return(await this.callGraph("delete_node",{node_id:e,cascade:t})).success===!0}async getChildrenWithEdges(e,t="children",n,s){return(await this.callGraph("get_children_with_edges",{node_id:e,display_mode:t,edge_type:n,node_type:s})).result||[]}async addEdge(e,t,n="link",s){return await this.callGraph("add_edge",{source_id:e,target_id:t,edge_type:n,data:s})}async deleteEdge(e,t,n){return await this.callGraph("delete_edge",{source_id:e,target_id:t,edge_type:n})}async getEdges(e,t,n){return(await this.callGraph("get_edges",{source_id:e,edge_type:t,target_id:n})).result||[]}async getAncestors(e){return(await this.callGraph("get_ancestors",{node_id:e})).ancestors||[]}async getTree(e,t=10){return(await this.callGraph("get_tree",{root_id:e,max_depth:t})).tree||[]}async moveNode(e,t){const n=await this.callGraph("move",{node_id:e,new_parent_id:t});if(!n.node)throw new Error("Failed to move node");return n.node}async searchNodes(e,t){return(await this.callGraph("search",{query:e,type:t})).nodes||[]}async getNodesByType(e){return(await this.callGraph("get_nodes_by_type",{type:e})).result||[]}fileToBase64(e){return new Promise((t,n)=>{const s=new FileReader;s.onload=()=>{const o=s.result.split(",")[1];t(o)},s.onerror=()=>n(new Error("Failed to read file")),s.readAsDataURL(e)})}async resizeImage(e,t,n){return e.type.startsWith("image/")?new Promise(s=>{const i=new Image,o=URL.createObjectURL(e);i.onload=()=>{if(URL.revokeObjectURL(o),i.width<=t&&i.height<=t){s(e);return}let l,a;i.width>i.height?(l=t,a=Math.round(i.height/i.width*t)):(a=t,l=Math.round(i.width/i.height*t));const u=document.createElement("canvas");u.width=l,u.height=a;const c=u.getContext("2d");if(!c){s(e);return}c.drawImage(i,0,0,l,a);const d=e.type==="image/png"?"image/png":"image/jpeg";u.toBlob(f=>{if(f){const h=new File([f],e.name,{type:d});s(h)}else s(e)},d,n)},i.onerror=()=>{URL.revokeObjectURL(o),s(e)},i.src=o}):e}async uploadFile(e,t,n,s={}){const i={...this.defaultUploadOptions,...s};try{let o=n;i.maxImageDimension>0&&n.type.startsWith("image/")&&(o=await this.resizeImage(n,i.maxImageDimension,i.imageQuality));const l=i.maxSizeMB*1024*1024;if(o.size>l)return{success:!1,error:`File too large (${(o.size/1024/1024).toFixed(1)} MB). Max: ${i.maxSizeMB} MB`};const a=await this.fileToBase64(o),u=await this.callGraph("upload_file",{node_id:e,filename:t,content:a});return u.success?{success:!0,path:u.path}:{success:!1,error:u.error||"Upload failed"}}catch(o){return{success:!1,error:o instanceof Error?o.message:"Upload failed"}}}async listFiles(e){var s;return(((s=(await this.callGraph("list_files",{node_id:e})).result)==null?void 0:s.files)||[]).map(i=>({filename:i.name,path:i.path}))}async deleteFile(e,t){return{success:(await this.callGraph("delete_file",{node_id:e,filename:t})).success||!1}}getFileUrl(e,t){return`${this.config.baseUrl}/files/${this.config.system_id}/${e}/${t}`}}const Jr=new TextEncoder,ya="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bn=new Uint8Array(256);for(var as=0;as<ya.length;as++)bn[ya.charCodeAt(as)]=as;function Vi(r){let e=Math.ceil(r.length/4)*3;const t=r.length;let n=0;r.length%4===3?e--:r.length%4===2?e-=2:r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);const s=new ArrayBuffer(e),i=new Uint8Array(s);for(let o=0;o<t;o+=4){let l=bn[r.charCodeAt(o)],a=bn[r.charCodeAt(o+1)],u=bn[r.charCodeAt(o+2)],c=bn[r.charCodeAt(o+3)];i[n++]=l<<2|a>>4,i[n++]=(a&15)<<4|u>>2,i[n++]=(u&3)<<6|c&63}return s}function En(r){r=r||"utf8";let e;try{e=new TextDecoder(r)}catch{e=new TextDecoder("windows-1252")}return e}async function ni(r){if("arrayBuffer"in r)return await r.arrayBuffer();const e=new FileReader;return new Promise((t,n)=>{e.onload=function(s){t(s.target.result)},e.onerror=function(s){n(e.error)},e.readAsArrayBuffer(r)})}function xa(r){return r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70?String.fromCharCode(r):!1}function Nd(r,e,t){let n=r.indexOf("*");n>=0&&(r=r.substr(0,n)),e=e.toUpperCase();let s;if(e==="Q"){t=t.replace(/=\s+([0-9a-fA-F])/g,"=$1").replace(/[_\s]/g," ");let i=Jr.encode(t),o=[];for(let a=0,u=i.length;a<u;a++){let c=i[a];if(a<=u-2&&c===61){let d=xa(i[a+1]),f=xa(i[a+2]);if(d&&f){let h=parseInt(d+f,16);o.push(h),a+=2;continue}}o.push(c)}s=new ArrayBuffer(o.length);let l=new DataView(s);for(let a=0,u=o.length;a<u;a++)l.setUint8(a,o[a])}else e==="B"?s=Vi(t.replace(/[^a-zA-Z0-9\+\/=]+/g,"")):s=Jr.encode(t);return En(r).decode(s)}function kn(r){let e=!0;for(;;){let t=(r||"").toString().replace(/(=\?([^?]+)\?[Bb]\?([^?]*)\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g,(n,s,i,o,l)=>e&&i===l&&o.length%4===0&&!/=$/.test(o)?s+"__\0JOIN\0__":n).replace(/(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,(n,s,i,o)=>e&&i===o?s+"__\0JOIN\0__":n).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g,"").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g,"$1").replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,(n,s,i,o)=>Nd(s,i,o));if(e&&t.indexOf("�")>=0)e=!1;else return t}}function Fd(r,e){e=e||"utf-8";let t=[];for(let i=0;i<r.length;i++){let o=r.charAt(i);if(o==="%"&&/^[a-f0-9]{2}/i.test(r.substr(i+1,2))){let l=r.substr(i+1,2);i+=2,t.push(parseInt(l,16))}else if(o.charCodeAt(0)>126){o=Jr.encode(o);for(let l=0;l<o.length;l++)t.push(o[l])}else t.push(o.charCodeAt(0))}const n=new ArrayBuffer(t.length),s=new DataView(n);for(let i=0,o=t.length;i<o;i++)s.setUint8(i,t[i]);return En(e).decode(n)}function Rd(r){let e=new Map;Object.keys(r.params).forEach(t=>{let n=t.match(/\*((\d+)\*?)?$/);if(!n)return;let s=t.substr(0,n.index).toLowerCase(),i=Number(n[2])||0,o;e.has(s)?o=e.get(s):(o={charset:!1,values:[]},e.set(s,o));let l=r.params[t];i===0&&n[0].charAt(n[0].length-1)==="*"&&(n=l.match(/^([^']*)'[^']*'(.*)$/))&&(o.charset=n[1]||"utf-8",l=n[2]),o.values.push({nr:i,value:l}),delete r.params[t]}),e.forEach((t,n)=>{r.params[n]=Fd(t.values.sort((s,i)=>s.nr-i.nr).map(s=>s.value).join(""),t.charset)})}class Md{constructor(){this.chunks=[]}update(e){this.chunks.push(e),this.chunks.push(`
2
+ `)}finalize(){return ni(new Blob(this.chunks,{type:"application/octet-stream"}))}}class jd{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.chunks=[],this.remainder=""}update(e){let t=this.decoder.decode(e);if(/[^a-zA-Z0-9+\/]/.test(t)&&(t=t.replace(/[^a-zA-Z0-9+\/]+/g,"")),this.remainder+=t,this.remainder.length>=this.maxChunkSize){let n=Math.floor(this.remainder.length/4)*4,s;n===this.remainder.length?(s=this.remainder,this.remainder=""):(s=this.remainder.substr(0,n),this.remainder=this.remainder.substr(n)),s.length&&this.chunks.push(Vi(s))}}finalize(){return this.remainder&&!/^=+$/.test(this.remainder)&&this.chunks.push(Vi(this.remainder)),ni(new Blob(this.chunks,{type:"application/octet-stream"}))}}const ba=/^=[a-f0-9]{2}$/i,Ld=/(?==[a-f0-9]{2})/i,Pd=/=\r?\n/g,Od=/=[a-fA-F0-9]?$/;class Id{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.remainder="",this.chunks=[]}decodeQPBytes(e){let t=new ArrayBuffer(e.length),n=new DataView(t);for(let s=0,i=e.length;s<i;s++)n.setUint8(s,parseInt(e[s],16));return t}decodeChunks(e){e=e.replace(Pd,"");let t=e.split(Ld),n=[];for(let s of t){if(s.charAt(0)!=="="){n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(s);continue}if(s.length===3){ba.test(s)?n.push(s.substr(1)):(n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(s));continue}if(s.length>3){const i=s.substr(0,3);ba.test(i)?(n.push(s.substr(1,2)),this.chunks.push(this.decodeQPBytes(n)),n=[],s=s.substr(3),this.chunks.push(s)):(n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(s))}}n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[])}update(e){let t=this.decoder.decode(e)+`
3
+ `;if(t=this.remainder+t,t.length<this.maxChunkSize){this.remainder=t;return}this.remainder="";let n=t.match(Od);if(n){if(n.index===0){this.remainder=t;return}this.remainder=t.substr(n.index),t=t.substr(0,n.index)}this.decodeChunks(t)}finalize(){return this.remainder.length&&(this.decodeChunks(this.remainder),this.remainder=""),ni(new Blob(this.chunks,{type:"application/octet-stream"}))}}class _a{constructor(e){if(this.options=e||{},this.postalMime=this.options.postalMime,this.root=!!this.options.parentNode,this.childNodes=[],this.options.parentNode){if(this.parentNode=this.options.parentNode,this.depth=this.parentNode.depth+1,this.depth>this.options.maxNestingDepth)throw new Error(`Maximum MIME nesting depth of ${this.options.maxNestingDepth} levels exceeded`);this.options.parentNode.childNodes.push(this)}else this.depth=0;this.state="header",this.headerLines=[],this.headerSize=0,this.contentType={value:"text/plain",default:!0},this.contentTransferEncoding={value:"8bit"},this.contentDisposition={value:""},this.headers=[],this.contentDecoder=!1}setupContentDecoder(e){/base64/i.test(e)?this.contentDecoder=new jd:/quoted-printable/i.test(e)?this.contentDecoder=new Id({decoder:En(this.contentType.parsed.params.charset)}):this.contentDecoder=new Md}async finalize(){if(this.state==="finished")return;this.state==="header"&&this.processHeaders();let e=this.postalMime.boundaries;for(let t=e.length-1;t>=0;t--)if(e[t].node===this){e.splice(t,1);break}await this.finalizeChildNodes(),this.content=this.contentDecoder?await this.contentDecoder.finalize():null,this.state="finished"}async finalizeChildNodes(){for(let e of this.childNodes)await e.finalize()}parseStructuredHeader(e){let t={value:!1,params:{}},n=!1,s="",i="value",o=!1,l=!1,a;for(let u=0,c=e.length;u<c;u++)switch(a=e.charAt(u),i){case"key":if(a==="="){n=s.trim().toLowerCase(),i="value",s="";break}s+=a;break;case"value":if(l)s+=a;else if(a==="\\"){l=!0;continue}else o&&a===o?o=!1:!o&&a==='"'?o=a:!o&&a===";"?(n===!1?t.value=s.trim():t.params[n]=s.trim(),i="key",s=""):s+=a;l=!1;break}return s=s.trim(),i==="value"?n===!1?t.value=s:t.params[n]=s:s&&(t.params[s.toLowerCase()]=""),t.value&&(t.value=t.value.toLowerCase()),Rd(t),t}decodeFlowedText(e,t){return e.split(/\r?\n/).reduce((n,s)=>/ $/.test(n)&&!/(^|\n)-- $/.test(n)?t?n.slice(0,-1)+s:n+s:n+`
4
+ `+s).replace(/^ /gm,"")}getTextContent(){if(!this.content)return"";let e=En(this.contentType.parsed.params.charset).decode(this.content);return/^flowed$/i.test(this.contentType.parsed.params.format)&&(e=this.decodeFlowedText(e,/^yes$/i.test(this.contentType.parsed.params.delsp))),e}processHeaders(){for(let e=this.headerLines.length-1;e>=0;e--){let t=this.headerLines[e];if(e&&/^\s/.test(t))this.headerLines[e-1]+=`
5
+ `+t,this.headerLines.splice(e,1);else{t=t.replace(/\s+/g," ");let n=t.indexOf(":"),s=n<0?t.trim():t.substr(0,n).trim(),i=n<0?"":t.substr(n+1).trim();switch(this.headers.push({key:s.toLowerCase(),originalKey:s,value:i}),s.toLowerCase()){case"content-type":this.contentType.default&&(this.contentType={value:i,parsed:{}});break;case"content-transfer-encoding":this.contentTransferEncoding={value:i,parsed:{}};break;case"content-disposition":this.contentDisposition={value:i,parsed:{}};break;case"content-id":this.contentId=i;break;case"content-description":this.contentDescription=i;break}}}this.contentType.parsed=this.parseStructuredHeader(this.contentType.value),this.contentType.multipart=/^multipart\//i.test(this.contentType.parsed.value)?this.contentType.parsed.value.substr(this.contentType.parsed.value.indexOf("/")+1):!1,this.contentType.multipart&&this.contentType.parsed.params.boundary&&this.postalMime.boundaries.push({value:Jr.encode(this.contentType.parsed.params.boundary),node:this}),this.contentDisposition.parsed=this.parseStructuredHeader(this.contentDisposition.value),this.contentTransferEncoding.encoding=this.contentTransferEncoding.value.toLowerCase().split(/[^\w-]/).shift(),this.setupContentDecoder(this.contentTransferEncoding.encoding)}feed(e){switch(this.state){case"header":if(!e.length)return this.state="body",this.processHeaders();if(this.headerSize+=e.length,this.headerSize>this.options.maxHeadersSize)throw new Error(`Maximum header size of ${this.options.maxHeadersSize} bytes exceeded`);this.headerLines.push(En().decode(e));break;case"body":this.contentDecoder.update(e)}}}const va={"&AElig":"Æ","&AElig;":"Æ","&AMP":"&","&AMP;":"&","&Aacute":"Á","&Aacute;":"Á","&Abreve;":"Ă","&Acirc":"Â","&Acirc;":"Â","&Acy;":"А","&Afr;":"𝔄","&Agrave":"À","&Agrave;":"À","&Alpha;":"Α","&Amacr;":"Ā","&And;":"⩓","&Aogon;":"Ą","&Aopf;":"𝔸","&ApplyFunction;":"⁡","&Aring":"Å","&Aring;":"Å","&Ascr;":"𝒜","&Assign;":"≔","&Atilde":"Ã","&Atilde;":"Ã","&Auml":"Ä","&Auml;":"Ä","&Backslash;":"∖","&Barv;":"⫧","&Barwed;":"⌆","&Bcy;":"Б","&Because;":"∵","&Bernoullis;":"ℬ","&Beta;":"Β","&Bfr;":"𝔅","&Bopf;":"𝔹","&Breve;":"˘","&Bscr;":"ℬ","&Bumpeq;":"≎","&CHcy;":"Ч","&COPY":"©","&COPY;":"©","&Cacute;":"Ć","&Cap;":"⋒","&CapitalDifferentialD;":"ⅅ","&Cayleys;":"ℭ","&Ccaron;":"Č","&Ccedil":"Ç","&Ccedil;":"Ç","&Ccirc;":"Ĉ","&Cconint;":"∰","&Cdot;":"Ċ","&Cedilla;":"¸","&CenterDot;":"·","&Cfr;":"ℭ","&Chi;":"Χ","&CircleDot;":"⊙","&CircleMinus;":"⊖","&CirclePlus;":"⊕","&CircleTimes;":"⊗","&ClockwiseContourIntegral;":"∲","&CloseCurlyDoubleQuote;":"”","&CloseCurlyQuote;":"’","&Colon;":"∷","&Colone;":"⩴","&Congruent;":"≡","&Conint;":"∯","&ContourIntegral;":"∮","&Copf;":"ℂ","&Coproduct;":"∐","&CounterClockwiseContourIntegral;":"∳","&Cross;":"⨯","&Cscr;":"𝒞","&Cup;":"⋓","&CupCap;":"≍","&DD;":"ⅅ","&DDotrahd;":"⤑","&DJcy;":"Ђ","&DScy;":"Ѕ","&DZcy;":"Џ","&Dagger;":"‡","&Darr;":"↡","&Dashv;":"⫤","&Dcaron;":"Ď","&Dcy;":"Д","&Del;":"∇","&Delta;":"Δ","&Dfr;":"𝔇","&DiacriticalAcute;":"´","&DiacriticalDot;":"˙","&DiacriticalDoubleAcute;":"˝","&DiacriticalGrave;":"`","&DiacriticalTilde;":"˜","&Diamond;":"⋄","&DifferentialD;":"ⅆ","&Dopf;":"𝔻","&Dot;":"¨","&DotDot;":"⃜","&DotEqual;":"≐","&DoubleContourIntegral;":"∯","&DoubleDot;":"¨","&DoubleDownArrow;":"⇓","&DoubleLeftArrow;":"⇐","&DoubleLeftRightArrow;":"⇔","&DoubleLeftTee;":"⫤","&DoubleLongLeftArrow;":"⟸","&DoubleLongLeftRightArrow;":"⟺","&DoubleLongRightArrow;":"⟹","&DoubleRightArrow;":"⇒","&DoubleRightTee;":"⊨","&DoubleUpArrow;":"⇑","&DoubleUpDownArrow;":"⇕","&DoubleVerticalBar;":"∥","&DownArrow;":"↓","&DownArrowBar;":"⤓","&DownArrowUpArrow;":"⇵","&DownBreve;":"̑","&DownLeftRightVector;":"⥐","&DownLeftTeeVector;":"⥞","&DownLeftVector;":"↽","&DownLeftVectorBar;":"⥖","&DownRightTeeVector;":"⥟","&DownRightVector;":"⇁","&DownRightVectorBar;":"⥗","&DownTee;":"⊤","&DownTeeArrow;":"↧","&Downarrow;":"⇓","&Dscr;":"𝒟","&Dstrok;":"Đ","&ENG;":"Ŋ","&ETH":"Ð","&ETH;":"Ð","&Eacute":"É","&Eacute;":"É","&Ecaron;":"Ě","&Ecirc":"Ê","&Ecirc;":"Ê","&Ecy;":"Э","&Edot;":"Ė","&Efr;":"𝔈","&Egrave":"È","&Egrave;":"È","&Element;":"∈","&Emacr;":"Ē","&EmptySmallSquare;":"◻","&EmptyVerySmallSquare;":"▫","&Eogon;":"Ę","&Eopf;":"𝔼","&Epsilon;":"Ε","&Equal;":"⩵","&EqualTilde;":"≂","&Equilibrium;":"⇌","&Escr;":"ℰ","&Esim;":"⩳","&Eta;":"Η","&Euml":"Ë","&Euml;":"Ë","&Exists;":"∃","&ExponentialE;":"ⅇ","&Fcy;":"Ф","&Ffr;":"𝔉","&FilledSmallSquare;":"◼","&FilledVerySmallSquare;":"▪","&Fopf;":"𝔽","&ForAll;":"∀","&Fouriertrf;":"ℱ","&Fscr;":"ℱ","&GJcy;":"Ѓ","&GT":">","&GT;":">","&Gamma;":"Γ","&Gammad;":"Ϝ","&Gbreve;":"Ğ","&Gcedil;":"Ģ","&Gcirc;":"Ĝ","&Gcy;":"Г","&Gdot;":"Ġ","&Gfr;":"𝔊","&Gg;":"⋙","&Gopf;":"𝔾","&GreaterEqual;":"≥","&GreaterEqualLess;":"⋛","&GreaterFullEqual;":"≧","&GreaterGreater;":"⪢","&GreaterLess;":"≷","&GreaterSlantEqual;":"⩾","&GreaterTilde;":"≳","&Gscr;":"𝒢","&Gt;":"≫","&HARDcy;":"Ъ","&Hacek;":"ˇ","&Hat;":"^","&Hcirc;":"Ĥ","&Hfr;":"ℌ","&HilbertSpace;":"ℋ","&Hopf;":"ℍ","&HorizontalLine;":"─","&Hscr;":"ℋ","&Hstrok;":"Ħ","&HumpDownHump;":"≎","&HumpEqual;":"≏","&IEcy;":"Е","&IJlig;":"IJ","&IOcy;":"Ё","&Iacute":"Í","&Iacute;":"Í","&Icirc":"Î","&Icirc;":"Î","&Icy;":"И","&Idot;":"İ","&Ifr;":"ℑ","&Igrave":"Ì","&Igrave;":"Ì","&Im;":"ℑ","&Imacr;":"Ī","&ImaginaryI;":"ⅈ","&Implies;":"⇒","&Int;":"∬","&Integral;":"∫","&Intersection;":"⋂","&InvisibleComma;":"⁣","&InvisibleTimes;":"⁢","&Iogon;":"Į","&Iopf;":"𝕀","&Iota;":"Ι","&Iscr;":"ℐ","&Itilde;":"Ĩ","&Iukcy;":"І","&Iuml":"Ï","&Iuml;":"Ï","&Jcirc;":"Ĵ","&Jcy;":"Й","&Jfr;":"𝔍","&Jopf;":"𝕁","&Jscr;":"𝒥","&Jsercy;":"Ј","&Jukcy;":"Є","&KHcy;":"Х","&KJcy;":"Ќ","&Kappa;":"Κ","&Kcedil;":"Ķ","&Kcy;":"К","&Kfr;":"𝔎","&Kopf;":"𝕂","&Kscr;":"𝒦","&LJcy;":"Љ","&LT":"<","&LT;":"<","&Lacute;":"Ĺ","&Lambda;":"Λ","&Lang;":"⟪","&Laplacetrf;":"ℒ","&Larr;":"↞","&Lcaron;":"Ľ","&Lcedil;":"Ļ","&Lcy;":"Л","&LeftAngleBracket;":"⟨","&LeftArrow;":"←","&LeftArrowBar;":"⇤","&LeftArrowRightArrow;":"⇆","&LeftCeiling;":"⌈","&LeftDoubleBracket;":"⟦","&LeftDownTeeVector;":"⥡","&LeftDownVector;":"⇃","&LeftDownVectorBar;":"⥙","&LeftFloor;":"⌊","&LeftRightArrow;":"↔","&LeftRightVector;":"⥎","&LeftTee;":"⊣","&LeftTeeArrow;":"↤","&LeftTeeVector;":"⥚","&LeftTriangle;":"⊲","&LeftTriangleBar;":"⧏","&LeftTriangleEqual;":"⊴","&LeftUpDownVector;":"⥑","&LeftUpTeeVector;":"⥠","&LeftUpVector;":"↿","&LeftUpVectorBar;":"⥘","&LeftVector;":"↼","&LeftVectorBar;":"⥒","&Leftarrow;":"⇐","&Leftrightarrow;":"⇔","&LessEqualGreater;":"⋚","&LessFullEqual;":"≦","&LessGreater;":"≶","&LessLess;":"⪡","&LessSlantEqual;":"⩽","&LessTilde;":"≲","&Lfr;":"𝔏","&Ll;":"⋘","&Lleftarrow;":"⇚","&Lmidot;":"Ŀ","&LongLeftArrow;":"⟵","&LongLeftRightArrow;":"⟷","&LongRightArrow;":"⟶","&Longleftarrow;":"⟸","&Longleftrightarrow;":"⟺","&Longrightarrow;":"⟹","&Lopf;":"𝕃","&LowerLeftArrow;":"↙","&LowerRightArrow;":"↘","&Lscr;":"ℒ","&Lsh;":"↰","&Lstrok;":"Ł","&Lt;":"≪","&Map;":"⤅","&Mcy;":"М","&MediumSpace;":" ","&Mellintrf;":"ℳ","&Mfr;":"𝔐","&MinusPlus;":"∓","&Mopf;":"𝕄","&Mscr;":"ℳ","&Mu;":"Μ","&NJcy;":"Њ","&Nacute;":"Ń","&Ncaron;":"Ň","&Ncedil;":"Ņ","&Ncy;":"Н","&NegativeMediumSpace;":"​","&NegativeThickSpace;":"​","&NegativeThinSpace;":"​","&NegativeVeryThinSpace;":"​","&NestedGreaterGreater;":"≫","&NestedLessLess;":"≪","&NewLine;":`
6
+ `,"&Nfr;":"𝔑","&NoBreak;":"⁠","&NonBreakingSpace;":" ","&Nopf;":"ℕ","&Not;":"⫬","&NotCongruent;":"≢","&NotCupCap;":"≭","&NotDoubleVerticalBar;":"∦","&NotElement;":"∉","&NotEqual;":"≠","&NotEqualTilde;":"≂̸","&NotExists;":"∄","&NotGreater;":"≯","&NotGreaterEqual;":"≱","&NotGreaterFullEqual;":"≧̸","&NotGreaterGreater;":"≫̸","&NotGreaterLess;":"≹","&NotGreaterSlantEqual;":"⩾̸","&NotGreaterTilde;":"≵","&NotHumpDownHump;":"≎̸","&NotHumpEqual;":"≏̸","&NotLeftTriangle;":"⋪","&NotLeftTriangleBar;":"⧏̸","&NotLeftTriangleEqual;":"⋬","&NotLess;":"≮","&NotLessEqual;":"≰","&NotLessGreater;":"≸","&NotLessLess;":"≪̸","&NotLessSlantEqual;":"⩽̸","&NotLessTilde;":"≴","&NotNestedGreaterGreater;":"⪢̸","&NotNestedLessLess;":"⪡̸","&NotPrecedes;":"⊀","&NotPrecedesEqual;":"⪯̸","&NotPrecedesSlantEqual;":"⋠","&NotReverseElement;":"∌","&NotRightTriangle;":"⋫","&NotRightTriangleBar;":"⧐̸","&NotRightTriangleEqual;":"⋭","&NotSquareSubset;":"⊏̸","&NotSquareSubsetEqual;":"⋢","&NotSquareSuperset;":"⊐̸","&NotSquareSupersetEqual;":"⋣","&NotSubset;":"⊂⃒","&NotSubsetEqual;":"⊈","&NotSucceeds;":"⊁","&NotSucceedsEqual;":"⪰̸","&NotSucceedsSlantEqual;":"⋡","&NotSucceedsTilde;":"≿̸","&NotSuperset;":"⊃⃒","&NotSupersetEqual;":"⊉","&NotTilde;":"≁","&NotTildeEqual;":"≄","&NotTildeFullEqual;":"≇","&NotTildeTilde;":"≉","&NotVerticalBar;":"∤","&Nscr;":"𝒩","&Ntilde":"Ñ","&Ntilde;":"Ñ","&Nu;":"Ν","&OElig;":"Œ","&Oacute":"Ó","&Oacute;":"Ó","&Ocirc":"Ô","&Ocirc;":"Ô","&Ocy;":"О","&Odblac;":"Ő","&Ofr;":"𝔒","&Ograve":"Ò","&Ograve;":"Ò","&Omacr;":"Ō","&Omega;":"Ω","&Omicron;":"Ο","&Oopf;":"𝕆","&OpenCurlyDoubleQuote;":"“","&OpenCurlyQuote;":"‘","&Or;":"⩔","&Oscr;":"𝒪","&Oslash":"Ø","&Oslash;":"Ø","&Otilde":"Õ","&Otilde;":"Õ","&Otimes;":"⨷","&Ouml":"Ö","&Ouml;":"Ö","&OverBar;":"‾","&OverBrace;":"⏞","&OverBracket;":"⎴","&OverParenthesis;":"⏜","&PartialD;":"∂","&Pcy;":"П","&Pfr;":"𝔓","&Phi;":"Φ","&Pi;":"Π","&PlusMinus;":"±","&Poincareplane;":"ℌ","&Popf;":"ℙ","&Pr;":"⪻","&Precedes;":"≺","&PrecedesEqual;":"⪯","&PrecedesSlantEqual;":"≼","&PrecedesTilde;":"≾","&Prime;":"″","&Product;":"∏","&Proportion;":"∷","&Proportional;":"∝","&Pscr;":"𝒫","&Psi;":"Ψ","&QUOT":'"',"&QUOT;":'"',"&Qfr;":"𝔔","&Qopf;":"ℚ","&Qscr;":"𝒬","&RBarr;":"⤐","&REG":"®","&REG;":"®","&Racute;":"Ŕ","&Rang;":"⟫","&Rarr;":"↠","&Rarrtl;":"⤖","&Rcaron;":"Ř","&Rcedil;":"Ŗ","&Rcy;":"Р","&Re;":"ℜ","&ReverseElement;":"∋","&ReverseEquilibrium;":"⇋","&ReverseUpEquilibrium;":"⥯","&Rfr;":"ℜ","&Rho;":"Ρ","&RightAngleBracket;":"⟩","&RightArrow;":"→","&RightArrowBar;":"⇥","&RightArrowLeftArrow;":"⇄","&RightCeiling;":"⌉","&RightDoubleBracket;":"⟧","&RightDownTeeVector;":"⥝","&RightDownVector;":"⇂","&RightDownVectorBar;":"⥕","&RightFloor;":"⌋","&RightTee;":"⊢","&RightTeeArrow;":"↦","&RightTeeVector;":"⥛","&RightTriangle;":"⊳","&RightTriangleBar;":"⧐","&RightTriangleEqual;":"⊵","&RightUpDownVector;":"⥏","&RightUpTeeVector;":"⥜","&RightUpVector;":"↾","&RightUpVectorBar;":"⥔","&RightVector;":"⇀","&RightVectorBar;":"⥓","&Rightarrow;":"⇒","&Ropf;":"ℝ","&RoundImplies;":"⥰","&Rrightarrow;":"⇛","&Rscr;":"ℛ","&Rsh;":"↱","&RuleDelayed;":"⧴","&SHCHcy;":"Щ","&SHcy;":"Ш","&SOFTcy;":"Ь","&Sacute;":"Ś","&Sc;":"⪼","&Scaron;":"Š","&Scedil;":"Ş","&Scirc;":"Ŝ","&Scy;":"С","&Sfr;":"𝔖","&ShortDownArrow;":"↓","&ShortLeftArrow;":"←","&ShortRightArrow;":"→","&ShortUpArrow;":"↑","&Sigma;":"Σ","&SmallCircle;":"∘","&Sopf;":"𝕊","&Sqrt;":"√","&Square;":"□","&SquareIntersection;":"⊓","&SquareSubset;":"⊏","&SquareSubsetEqual;":"⊑","&SquareSuperset;":"⊐","&SquareSupersetEqual;":"⊒","&SquareUnion;":"⊔","&Sscr;":"𝒮","&Star;":"⋆","&Sub;":"⋐","&Subset;":"⋐","&SubsetEqual;":"⊆","&Succeeds;":"≻","&SucceedsEqual;":"⪰","&SucceedsSlantEqual;":"≽","&SucceedsTilde;":"≿","&SuchThat;":"∋","&Sum;":"∑","&Sup;":"⋑","&Superset;":"⊃","&SupersetEqual;":"⊇","&Supset;":"⋑","&THORN":"Þ","&THORN;":"Þ","&TRADE;":"™","&TSHcy;":"Ћ","&TScy;":"Ц","&Tab;":" ","&Tau;":"Τ","&Tcaron;":"Ť","&Tcedil;":"Ţ","&Tcy;":"Т","&Tfr;":"𝔗","&Therefore;":"∴","&Theta;":"Θ","&ThickSpace;":"  ","&ThinSpace;":" ","&Tilde;":"∼","&TildeEqual;":"≃","&TildeFullEqual;":"≅","&TildeTilde;":"≈","&Topf;":"𝕋","&TripleDot;":"⃛","&Tscr;":"𝒯","&Tstrok;":"Ŧ","&Uacute":"Ú","&Uacute;":"Ú","&Uarr;":"↟","&Uarrocir;":"⥉","&Ubrcy;":"Ў","&Ubreve;":"Ŭ","&Ucirc":"Û","&Ucirc;":"Û","&Ucy;":"У","&Udblac;":"Ű","&Ufr;":"𝔘","&Ugrave":"Ù","&Ugrave;":"Ù","&Umacr;":"Ū","&UnderBar;":"_","&UnderBrace;":"⏟","&UnderBracket;":"⎵","&UnderParenthesis;":"⏝","&Union;":"⋃","&UnionPlus;":"⊎","&Uogon;":"Ų","&Uopf;":"𝕌","&UpArrow;":"↑","&UpArrowBar;":"⤒","&UpArrowDownArrow;":"⇅","&UpDownArrow;":"↕","&UpEquilibrium;":"⥮","&UpTee;":"⊥","&UpTeeArrow;":"↥","&Uparrow;":"⇑","&Updownarrow;":"⇕","&UpperLeftArrow;":"↖","&UpperRightArrow;":"↗","&Upsi;":"ϒ","&Upsilon;":"Υ","&Uring;":"Ů","&Uscr;":"𝒰","&Utilde;":"Ũ","&Uuml":"Ü","&Uuml;":"Ü","&VDash;":"⊫","&Vbar;":"⫫","&Vcy;":"В","&Vdash;":"⊩","&Vdashl;":"⫦","&Vee;":"⋁","&Verbar;":"‖","&Vert;":"‖","&VerticalBar;":"∣","&VerticalLine;":"|","&VerticalSeparator;":"❘","&VerticalTilde;":"≀","&VeryThinSpace;":" ","&Vfr;":"𝔙","&Vopf;":"𝕍","&Vscr;":"𝒱","&Vvdash;":"⊪","&Wcirc;":"Ŵ","&Wedge;":"⋀","&Wfr;":"𝔚","&Wopf;":"𝕎","&Wscr;":"𝒲","&Xfr;":"𝔛","&Xi;":"Ξ","&Xopf;":"𝕏","&Xscr;":"𝒳","&YAcy;":"Я","&YIcy;":"Ї","&YUcy;":"Ю","&Yacute":"Ý","&Yacute;":"Ý","&Ycirc;":"Ŷ","&Ycy;":"Ы","&Yfr;":"𝔜","&Yopf;":"𝕐","&Yscr;":"𝒴","&Yuml;":"Ÿ","&ZHcy;":"Ж","&Zacute;":"Ź","&Zcaron;":"Ž","&Zcy;":"З","&Zdot;":"Ż","&ZeroWidthSpace;":"​","&Zeta;":"Ζ","&Zfr;":"ℨ","&Zopf;":"ℤ","&Zscr;":"𝒵","&aacute":"á","&aacute;":"á","&abreve;":"ă","&ac;":"∾","&acE;":"∾̳","&acd;":"∿","&acirc":"â","&acirc;":"â","&acute":"´","&acute;":"´","&acy;":"а","&aelig":"æ","&aelig;":"æ","&af;":"⁡","&afr;":"𝔞","&agrave":"à","&agrave;":"à","&alefsym;":"ℵ","&aleph;":"ℵ","&alpha;":"α","&amacr;":"ā","&amalg;":"⨿","&amp":"&","&amp;":"&","&and;":"∧","&andand;":"⩕","&andd;":"⩜","&andslope;":"⩘","&andv;":"⩚","&ang;":"∠","&ange;":"⦤","&angle;":"∠","&angmsd;":"∡","&angmsdaa;":"⦨","&angmsdab;":"⦩","&angmsdac;":"⦪","&angmsdad;":"⦫","&angmsdae;":"⦬","&angmsdaf;":"⦭","&angmsdag;":"⦮","&angmsdah;":"⦯","&angrt;":"∟","&angrtvb;":"⊾","&angrtvbd;":"⦝","&angsph;":"∢","&angst;":"Å","&angzarr;":"⍼","&aogon;":"ą","&aopf;":"𝕒","&ap;":"≈","&apE;":"⩰","&apacir;":"⩯","&ape;":"≊","&apid;":"≋","&apos;":"'","&approx;":"≈","&approxeq;":"≊","&aring":"å","&aring;":"å","&ascr;":"𝒶","&ast;":"*","&asymp;":"≈","&asympeq;":"≍","&atilde":"ã","&atilde;":"ã","&auml":"ä","&auml;":"ä","&awconint;":"∳","&awint;":"⨑","&bNot;":"⫭","&backcong;":"≌","&backepsilon;":"϶","&backprime;":"‵","&backsim;":"∽","&backsimeq;":"⋍","&barvee;":"⊽","&barwed;":"⌅","&barwedge;":"⌅","&bbrk;":"⎵","&bbrktbrk;":"⎶","&bcong;":"≌","&bcy;":"б","&bdquo;":"„","&becaus;":"∵","&because;":"∵","&bemptyv;":"⦰","&bepsi;":"϶","&bernou;":"ℬ","&beta;":"β","&beth;":"ℶ","&between;":"≬","&bfr;":"𝔟","&bigcap;":"⋂","&bigcirc;":"◯","&bigcup;":"⋃","&bigodot;":"⨀","&bigoplus;":"⨁","&bigotimes;":"⨂","&bigsqcup;":"⨆","&bigstar;":"★","&bigtriangledown;":"▽","&bigtriangleup;":"△","&biguplus;":"⨄","&bigvee;":"⋁","&bigwedge;":"⋀","&bkarow;":"⤍","&blacklozenge;":"⧫","&blacksquare;":"▪","&blacktriangle;":"▴","&blacktriangledown;":"▾","&blacktriangleleft;":"◂","&blacktriangleright;":"▸","&blank;":"␣","&blk12;":"▒","&blk14;":"░","&blk34;":"▓","&block;":"█","&bne;":"=⃥","&bnequiv;":"≡⃥","&bnot;":"⌐","&bopf;":"𝕓","&bot;":"⊥","&bottom;":"⊥","&bowtie;":"⋈","&boxDL;":"╗","&boxDR;":"╔","&boxDl;":"╖","&boxDr;":"╓","&boxH;":"═","&boxHD;":"╦","&boxHU;":"╩","&boxHd;":"╤","&boxHu;":"╧","&boxUL;":"╝","&boxUR;":"╚","&boxUl;":"╜","&boxUr;":"╙","&boxV;":"║","&boxVH;":"╬","&boxVL;":"╣","&boxVR;":"╠","&boxVh;":"╫","&boxVl;":"╢","&boxVr;":"╟","&boxbox;":"⧉","&boxdL;":"╕","&boxdR;":"╒","&boxdl;":"┐","&boxdr;":"┌","&boxh;":"─","&boxhD;":"╥","&boxhU;":"╨","&boxhd;":"┬","&boxhu;":"┴","&boxminus;":"⊟","&boxplus;":"⊞","&boxtimes;":"⊠","&boxuL;":"╛","&boxuR;":"╘","&boxul;":"┘","&boxur;":"└","&boxv;":"│","&boxvH;":"╪","&boxvL;":"╡","&boxvR;":"╞","&boxvh;":"┼","&boxvl;":"┤","&boxvr;":"├","&bprime;":"‵","&breve;":"˘","&brvbar":"¦","&brvbar;":"¦","&bscr;":"𝒷","&bsemi;":"⁏","&bsim;":"∽","&bsime;":"⋍","&bsol;":"\\","&bsolb;":"⧅","&bsolhsub;":"⟈","&bull;":"•","&bullet;":"•","&bump;":"≎","&bumpE;":"⪮","&bumpe;":"≏","&bumpeq;":"≏","&cacute;":"ć","&cap;":"∩","&capand;":"⩄","&capbrcup;":"⩉","&capcap;":"⩋","&capcup;":"⩇","&capdot;":"⩀","&caps;":"∩︀","&caret;":"⁁","&caron;":"ˇ","&ccaps;":"⩍","&ccaron;":"č","&ccedil":"ç","&ccedil;":"ç","&ccirc;":"ĉ","&ccups;":"⩌","&ccupssm;":"⩐","&cdot;":"ċ","&cedil":"¸","&cedil;":"¸","&cemptyv;":"⦲","&cent":"¢","&cent;":"¢","&centerdot;":"·","&cfr;":"𝔠","&chcy;":"ч","&check;":"✓","&checkmark;":"✓","&chi;":"χ","&cir;":"○","&cirE;":"⧃","&circ;":"ˆ","&circeq;":"≗","&circlearrowleft;":"↺","&circlearrowright;":"↻","&circledR;":"®","&circledS;":"Ⓢ","&circledast;":"⊛","&circledcirc;":"⊚","&circleddash;":"⊝","&cire;":"≗","&cirfnint;":"⨐","&cirmid;":"⫯","&cirscir;":"⧂","&clubs;":"♣","&clubsuit;":"♣","&colon;":":","&colone;":"≔","&coloneq;":"≔","&comma;":",","&commat;":"@","&comp;":"∁","&compfn;":"∘","&complement;":"∁","&complexes;":"ℂ","&cong;":"≅","&congdot;":"⩭","&conint;":"∮","&copf;":"𝕔","&coprod;":"∐","&copy":"©","&copy;":"©","&copysr;":"℗","&crarr;":"↵","&cross;":"✗","&cscr;":"𝒸","&csub;":"⫏","&csube;":"⫑","&csup;":"⫐","&csupe;":"⫒","&ctdot;":"⋯","&cudarrl;":"⤸","&cudarrr;":"⤵","&cuepr;":"⋞","&cuesc;":"⋟","&cularr;":"↶","&cularrp;":"⤽","&cup;":"∪","&cupbrcap;":"⩈","&cupcap;":"⩆","&cupcup;":"⩊","&cupdot;":"⊍","&cupor;":"⩅","&cups;":"∪︀","&curarr;":"↷","&curarrm;":"⤼","&curlyeqprec;":"⋞","&curlyeqsucc;":"⋟","&curlyvee;":"⋎","&curlywedge;":"⋏","&curren":"¤","&curren;":"¤","&curvearrowleft;":"↶","&curvearrowright;":"↷","&cuvee;":"⋎","&cuwed;":"⋏","&cwconint;":"∲","&cwint;":"∱","&cylcty;":"⌭","&dArr;":"⇓","&dHar;":"⥥","&dagger;":"†","&daleth;":"ℸ","&darr;":"↓","&dash;":"‐","&dashv;":"⊣","&dbkarow;":"⤏","&dblac;":"˝","&dcaron;":"ď","&dcy;":"д","&dd;":"ⅆ","&ddagger;":"‡","&ddarr;":"⇊","&ddotseq;":"⩷","&deg":"°","&deg;":"°","&delta;":"δ","&demptyv;":"⦱","&dfisht;":"⥿","&dfr;":"𝔡","&dharl;":"⇃","&dharr;":"⇂","&diam;":"⋄","&diamond;":"⋄","&diamondsuit;":"♦","&diams;":"♦","&die;":"¨","&digamma;":"ϝ","&disin;":"⋲","&div;":"÷","&divide":"÷","&divide;":"÷","&divideontimes;":"⋇","&divonx;":"⋇","&djcy;":"ђ","&dlcorn;":"⌞","&dlcrop;":"⌍","&dollar;":"$","&dopf;":"𝕕","&dot;":"˙","&doteq;":"≐","&doteqdot;":"≑","&dotminus;":"∸","&dotplus;":"∔","&dotsquare;":"⊡","&doublebarwedge;":"⌆","&downarrow;":"↓","&downdownarrows;":"⇊","&downharpoonleft;":"⇃","&downharpoonright;":"⇂","&drbkarow;":"⤐","&drcorn;":"⌟","&drcrop;":"⌌","&dscr;":"𝒹","&dscy;":"ѕ","&dsol;":"⧶","&dstrok;":"đ","&dtdot;":"⋱","&dtri;":"▿","&dtrif;":"▾","&duarr;":"⇵","&duhar;":"⥯","&dwangle;":"⦦","&dzcy;":"џ","&dzigrarr;":"⟿","&eDDot;":"⩷","&eDot;":"≑","&eacute":"é","&eacute;":"é","&easter;":"⩮","&ecaron;":"ě","&ecir;":"≖","&ecirc":"ê","&ecirc;":"ê","&ecolon;":"≕","&ecy;":"э","&edot;":"ė","&ee;":"ⅇ","&efDot;":"≒","&efr;":"𝔢","&eg;":"⪚","&egrave":"è","&egrave;":"è","&egs;":"⪖","&egsdot;":"⪘","&el;":"⪙","&elinters;":"⏧","&ell;":"ℓ","&els;":"⪕","&elsdot;":"⪗","&emacr;":"ē","&empty;":"∅","&emptyset;":"∅","&emptyv;":"∅","&emsp13;":" ","&emsp14;":" ","&emsp;":" ","&eng;":"ŋ","&ensp;":" ","&eogon;":"ę","&eopf;":"𝕖","&epar;":"⋕","&eparsl;":"⧣","&eplus;":"⩱","&epsi;":"ε","&epsilon;":"ε","&epsiv;":"ϵ","&eqcirc;":"≖","&eqcolon;":"≕","&eqsim;":"≂","&eqslantgtr;":"⪖","&eqslantless;":"⪕","&equals;":"=","&equest;":"≟","&equiv;":"≡","&equivDD;":"⩸","&eqvparsl;":"⧥","&erDot;":"≓","&erarr;":"⥱","&escr;":"ℯ","&esdot;":"≐","&esim;":"≂","&eta;":"η","&eth":"ð","&eth;":"ð","&euml":"ë","&euml;":"ë","&euro;":"€","&excl;":"!","&exist;":"∃","&expectation;":"ℰ","&exponentiale;":"ⅇ","&fallingdotseq;":"≒","&fcy;":"ф","&female;":"♀","&ffilig;":"ffi","&fflig;":"ff","&ffllig;":"ffl","&ffr;":"𝔣","&filig;":"fi","&fjlig;":"fj","&flat;":"♭","&fllig;":"fl","&fltns;":"▱","&fnof;":"ƒ","&fopf;":"𝕗","&forall;":"∀","&fork;":"⋔","&forkv;":"⫙","&fpartint;":"⨍","&frac12":"½","&frac12;":"½","&frac13;":"⅓","&frac14":"¼","&frac14;":"¼","&frac15;":"⅕","&frac16;":"⅙","&frac18;":"⅛","&frac23;":"⅔","&frac25;":"⅖","&frac34":"¾","&frac34;":"¾","&frac35;":"⅗","&frac38;":"⅜","&frac45;":"⅘","&frac56;":"⅚","&frac58;":"⅝","&frac78;":"⅞","&frasl;":"⁄","&frown;":"⌢","&fscr;":"𝒻","&gE;":"≧","&gEl;":"⪌","&gacute;":"ǵ","&gamma;":"γ","&gammad;":"ϝ","&gap;":"⪆","&gbreve;":"ğ","&gcirc;":"ĝ","&gcy;":"г","&gdot;":"ġ","&ge;":"≥","&gel;":"⋛","&geq;":"≥","&geqq;":"≧","&geqslant;":"⩾","&ges;":"⩾","&gescc;":"⪩","&gesdot;":"⪀","&gesdoto;":"⪂","&gesdotol;":"⪄","&gesl;":"⋛︀","&gesles;":"⪔","&gfr;":"𝔤","&gg;":"≫","&ggg;":"⋙","&gimel;":"ℷ","&gjcy;":"ѓ","&gl;":"≷","&glE;":"⪒","&gla;":"⪥","&glj;":"⪤","&gnE;":"≩","&gnap;":"⪊","&gnapprox;":"⪊","&gne;":"⪈","&gneq;":"⪈","&gneqq;":"≩","&gnsim;":"⋧","&gopf;":"𝕘","&grave;":"`","&gscr;":"ℊ","&gsim;":"≳","&gsime;":"⪎","&gsiml;":"⪐","&gt":">","&gt;":">","&gtcc;":"⪧","&gtcir;":"⩺","&gtdot;":"⋗","&gtlPar;":"⦕","&gtquest;":"⩼","&gtrapprox;":"⪆","&gtrarr;":"⥸","&gtrdot;":"⋗","&gtreqless;":"⋛","&gtreqqless;":"⪌","&gtrless;":"≷","&gtrsim;":"≳","&gvertneqq;":"≩︀","&gvnE;":"≩︀","&hArr;":"⇔","&hairsp;":" ","&half;":"½","&hamilt;":"ℋ","&hardcy;":"ъ","&harr;":"↔","&harrcir;":"⥈","&harrw;":"↭","&hbar;":"ℏ","&hcirc;":"ĥ","&hearts;":"♥","&heartsuit;":"♥","&hellip;":"…","&hercon;":"⊹","&hfr;":"𝔥","&hksearow;":"⤥","&hkswarow;":"⤦","&hoarr;":"⇿","&homtht;":"∻","&hookleftarrow;":"↩","&hookrightarrow;":"↪","&hopf;":"𝕙","&horbar;":"―","&hscr;":"𝒽","&hslash;":"ℏ","&hstrok;":"ħ","&hybull;":"⁃","&hyphen;":"‐","&iacute":"í","&iacute;":"í","&ic;":"⁣","&icirc":"î","&icirc;":"î","&icy;":"и","&iecy;":"е","&iexcl":"¡","&iexcl;":"¡","&iff;":"⇔","&ifr;":"𝔦","&igrave":"ì","&igrave;":"ì","&ii;":"ⅈ","&iiiint;":"⨌","&iiint;":"∭","&iinfin;":"⧜","&iiota;":"℩","&ijlig;":"ij","&imacr;":"ī","&image;":"ℑ","&imagline;":"ℐ","&imagpart;":"ℑ","&imath;":"ı","&imof;":"⊷","&imped;":"Ƶ","&in;":"∈","&incare;":"℅","&infin;":"∞","&infintie;":"⧝","&inodot;":"ı","&int;":"∫","&intcal;":"⊺","&integers;":"ℤ","&intercal;":"⊺","&intlarhk;":"⨗","&intprod;":"⨼","&iocy;":"ё","&iogon;":"į","&iopf;":"𝕚","&iota;":"ι","&iprod;":"⨼","&iquest":"¿","&iquest;":"¿","&iscr;":"𝒾","&isin;":"∈","&isinE;":"⋹","&isindot;":"⋵","&isins;":"⋴","&isinsv;":"⋳","&isinv;":"∈","&it;":"⁢","&itilde;":"ĩ","&iukcy;":"і","&iuml":"ï","&iuml;":"ï","&jcirc;":"ĵ","&jcy;":"й","&jfr;":"𝔧","&jmath;":"ȷ","&jopf;":"𝕛","&jscr;":"𝒿","&jsercy;":"ј","&jukcy;":"є","&kappa;":"κ","&kappav;":"ϰ","&kcedil;":"ķ","&kcy;":"к","&kfr;":"𝔨","&kgreen;":"ĸ","&khcy;":"х","&kjcy;":"ќ","&kopf;":"𝕜","&kscr;":"𝓀","&lAarr;":"⇚","&lArr;":"⇐","&lAtail;":"⤛","&lBarr;":"⤎","&lE;":"≦","&lEg;":"⪋","&lHar;":"⥢","&lacute;":"ĺ","&laemptyv;":"⦴","&lagran;":"ℒ","&lambda;":"λ","&lang;":"⟨","&langd;":"⦑","&langle;":"⟨","&lap;":"⪅","&laquo":"«","&laquo;":"«","&larr;":"←","&larrb;":"⇤","&larrbfs;":"⤟","&larrfs;":"⤝","&larrhk;":"↩","&larrlp;":"↫","&larrpl;":"⤹","&larrsim;":"⥳","&larrtl;":"↢","&lat;":"⪫","&latail;":"⤙","&late;":"⪭","&lates;":"⪭︀","&lbarr;":"⤌","&lbbrk;":"❲","&lbrace;":"{","&lbrack;":"[","&lbrke;":"⦋","&lbrksld;":"⦏","&lbrkslu;":"⦍","&lcaron;":"ľ","&lcedil;":"ļ","&lceil;":"⌈","&lcub;":"{","&lcy;":"л","&ldca;":"⤶","&ldquo;":"“","&ldquor;":"„","&ldrdhar;":"⥧","&ldrushar;":"⥋","&ldsh;":"↲","&le;":"≤","&leftarrow;":"←","&leftarrowtail;":"↢","&leftharpoondown;":"↽","&leftharpoonup;":"↼","&leftleftarrows;":"⇇","&leftrightarrow;":"↔","&leftrightarrows;":"⇆","&leftrightharpoons;":"⇋","&leftrightsquigarrow;":"↭","&leftthreetimes;":"⋋","&leg;":"⋚","&leq;":"≤","&leqq;":"≦","&leqslant;":"⩽","&les;":"⩽","&lescc;":"⪨","&lesdot;":"⩿","&lesdoto;":"⪁","&lesdotor;":"⪃","&lesg;":"⋚︀","&lesges;":"⪓","&lessapprox;":"⪅","&lessdot;":"⋖","&lesseqgtr;":"⋚","&lesseqqgtr;":"⪋","&lessgtr;":"≶","&lesssim;":"≲","&lfisht;":"⥼","&lfloor;":"⌊","&lfr;":"𝔩","&lg;":"≶","&lgE;":"⪑","&lhard;":"↽","&lharu;":"↼","&lharul;":"⥪","&lhblk;":"▄","&ljcy;":"љ","&ll;":"≪","&llarr;":"⇇","&llcorner;":"⌞","&llhard;":"⥫","&lltri;":"◺","&lmidot;":"ŀ","&lmoust;":"⎰","&lmoustache;":"⎰","&lnE;":"≨","&lnap;":"⪉","&lnapprox;":"⪉","&lne;":"⪇","&lneq;":"⪇","&lneqq;":"≨","&lnsim;":"⋦","&loang;":"⟬","&loarr;":"⇽","&lobrk;":"⟦","&longleftarrow;":"⟵","&longleftrightarrow;":"⟷","&longmapsto;":"⟼","&longrightarrow;":"⟶","&looparrowleft;":"↫","&looparrowright;":"↬","&lopar;":"⦅","&lopf;":"𝕝","&loplus;":"⨭","&lotimes;":"⨴","&lowast;":"∗","&lowbar;":"_","&loz;":"◊","&lozenge;":"◊","&lozf;":"⧫","&lpar;":"(","&lparlt;":"⦓","&lrarr;":"⇆","&lrcorner;":"⌟","&lrhar;":"⇋","&lrhard;":"⥭","&lrm;":"‎","&lrtri;":"⊿","&lsaquo;":"‹","&lscr;":"𝓁","&lsh;":"↰","&lsim;":"≲","&lsime;":"⪍","&lsimg;":"⪏","&lsqb;":"[","&lsquo;":"‘","&lsquor;":"‚","&lstrok;":"ł","&lt":"<","&lt;":"<","&ltcc;":"⪦","&ltcir;":"⩹","&ltdot;":"⋖","&lthree;":"⋋","&ltimes;":"⋉","&ltlarr;":"⥶","&ltquest;":"⩻","&ltrPar;":"⦖","&ltri;":"◃","&ltrie;":"⊴","&ltrif;":"◂","&lurdshar;":"⥊","&luruhar;":"⥦","&lvertneqq;":"≨︀","&lvnE;":"≨︀","&mDDot;":"∺","&macr":"¯","&macr;":"¯","&male;":"♂","&malt;":"✠","&maltese;":"✠","&map;":"↦","&mapsto;":"↦","&mapstodown;":"↧","&mapstoleft;":"↤","&mapstoup;":"↥","&marker;":"▮","&mcomma;":"⨩","&mcy;":"м","&mdash;":"—","&measuredangle;":"∡","&mfr;":"𝔪","&mho;":"℧","&micro":"µ","&micro;":"µ","&mid;":"∣","&midast;":"*","&midcir;":"⫰","&middot":"·","&middot;":"·","&minus;":"−","&minusb;":"⊟","&minusd;":"∸","&minusdu;":"⨪","&mlcp;":"⫛","&mldr;":"…","&mnplus;":"∓","&models;":"⊧","&mopf;":"𝕞","&mp;":"∓","&mscr;":"𝓂","&mstpos;":"∾","&mu;":"μ","&multimap;":"⊸","&mumap;":"⊸","&nGg;":"⋙̸","&nGt;":"≫⃒","&nGtv;":"≫̸","&nLeftarrow;":"⇍","&nLeftrightarrow;":"⇎","&nLl;":"⋘̸","&nLt;":"≪⃒","&nLtv;":"≪̸","&nRightarrow;":"⇏","&nVDash;":"⊯","&nVdash;":"⊮","&nabla;":"∇","&nacute;":"ń","&nang;":"∠⃒","&nap;":"≉","&napE;":"⩰̸","&napid;":"≋̸","&napos;":"ʼn","&napprox;":"≉","&natur;":"♮","&natural;":"♮","&naturals;":"ℕ","&nbsp":" ","&nbsp;":" ","&nbump;":"≎̸","&nbumpe;":"≏̸","&ncap;":"⩃","&ncaron;":"ň","&ncedil;":"ņ","&ncong;":"≇","&ncongdot;":"⩭̸","&ncup;":"⩂","&ncy;":"н","&ndash;":"–","&ne;":"≠","&neArr;":"⇗","&nearhk;":"⤤","&nearr;":"↗","&nearrow;":"↗","&nedot;":"≐̸","&nequiv;":"≢","&nesear;":"⤨","&nesim;":"≂̸","&nexist;":"∄","&nexists;":"∄","&nfr;":"𝔫","&ngE;":"≧̸","&nge;":"≱","&ngeq;":"≱","&ngeqq;":"≧̸","&ngeqslant;":"⩾̸","&nges;":"⩾̸","&ngsim;":"≵","&ngt;":"≯","&ngtr;":"≯","&nhArr;":"⇎","&nharr;":"↮","&nhpar;":"⫲","&ni;":"∋","&nis;":"⋼","&nisd;":"⋺","&niv;":"∋","&njcy;":"њ","&nlArr;":"⇍","&nlE;":"≦̸","&nlarr;":"↚","&nldr;":"‥","&nle;":"≰","&nleftarrow;":"↚","&nleftrightarrow;":"↮","&nleq;":"≰","&nleqq;":"≦̸","&nleqslant;":"⩽̸","&nles;":"⩽̸","&nless;":"≮","&nlsim;":"≴","&nlt;":"≮","&nltri;":"⋪","&nltrie;":"⋬","&nmid;":"∤","&nopf;":"𝕟","&not":"¬","&not;":"¬","&notin;":"∉","&notinE;":"⋹̸","&notindot;":"⋵̸","&notinva;":"∉","&notinvb;":"⋷","&notinvc;":"⋶","&notni;":"∌","&notniva;":"∌","&notnivb;":"⋾","&notnivc;":"⋽","&npar;":"∦","&nparallel;":"∦","&nparsl;":"⫽⃥","&npart;":"∂̸","&npolint;":"⨔","&npr;":"⊀","&nprcue;":"⋠","&npre;":"⪯̸","&nprec;":"⊀","&npreceq;":"⪯̸","&nrArr;":"⇏","&nrarr;":"↛","&nrarrc;":"⤳̸","&nrarrw;":"↝̸","&nrightarrow;":"↛","&nrtri;":"⋫","&nrtrie;":"⋭","&nsc;":"⊁","&nsccue;":"⋡","&nsce;":"⪰̸","&nscr;":"𝓃","&nshortmid;":"∤","&nshortparallel;":"∦","&nsim;":"≁","&nsime;":"≄","&nsimeq;":"≄","&nsmid;":"∤","&nspar;":"∦","&nsqsube;":"⋢","&nsqsupe;":"⋣","&nsub;":"⊄","&nsubE;":"⫅̸","&nsube;":"⊈","&nsubset;":"⊂⃒","&nsubseteq;":"⊈","&nsubseteqq;":"⫅̸","&nsucc;":"⊁","&nsucceq;":"⪰̸","&nsup;":"⊅","&nsupE;":"⫆̸","&nsupe;":"⊉","&nsupset;":"⊃⃒","&nsupseteq;":"⊉","&nsupseteqq;":"⫆̸","&ntgl;":"≹","&ntilde":"ñ","&ntilde;":"ñ","&ntlg;":"≸","&ntriangleleft;":"⋪","&ntrianglelefteq;":"⋬","&ntriangleright;":"⋫","&ntrianglerighteq;":"⋭","&nu;":"ν","&num;":"#","&numero;":"№","&numsp;":" ","&nvDash;":"⊭","&nvHarr;":"⤄","&nvap;":"≍⃒","&nvdash;":"⊬","&nvge;":"≥⃒","&nvgt;":">⃒","&nvinfin;":"⧞","&nvlArr;":"⤂","&nvle;":"≤⃒","&nvlt;":"<⃒","&nvltrie;":"⊴⃒","&nvrArr;":"⤃","&nvrtrie;":"⊵⃒","&nvsim;":"∼⃒","&nwArr;":"⇖","&nwarhk;":"⤣","&nwarr;":"↖","&nwarrow;":"↖","&nwnear;":"⤧","&oS;":"Ⓢ","&oacute":"ó","&oacute;":"ó","&oast;":"⊛","&ocir;":"⊚","&ocirc":"ô","&ocirc;":"ô","&ocy;":"о","&odash;":"⊝","&odblac;":"ő","&odiv;":"⨸","&odot;":"⊙","&odsold;":"⦼","&oelig;":"œ","&ofcir;":"⦿","&ofr;":"𝔬","&ogon;":"˛","&ograve":"ò","&ograve;":"ò","&ogt;":"⧁","&ohbar;":"⦵","&ohm;":"Ω","&oint;":"∮","&olarr;":"↺","&olcir;":"⦾","&olcross;":"⦻","&oline;":"‾","&olt;":"⧀","&omacr;":"ō","&omega;":"ω","&omicron;":"ο","&omid;":"⦶","&ominus;":"⊖","&oopf;":"𝕠","&opar;":"⦷","&operp;":"⦹","&oplus;":"⊕","&or;":"∨","&orarr;":"↻","&ord;":"⩝","&order;":"ℴ","&orderof;":"ℴ","&ordf":"ª","&ordf;":"ª","&ordm":"º","&ordm;":"º","&origof;":"⊶","&oror;":"⩖","&orslope;":"⩗","&orv;":"⩛","&oscr;":"ℴ","&oslash":"ø","&oslash;":"ø","&osol;":"⊘","&otilde":"õ","&otilde;":"õ","&otimes;":"⊗","&otimesas;":"⨶","&ouml":"ö","&ouml;":"ö","&ovbar;":"⌽","&par;":"∥","&para":"¶","&para;":"¶","&parallel;":"∥","&parsim;":"⫳","&parsl;":"⫽","&part;":"∂","&pcy;":"п","&percnt;":"%","&period;":".","&permil;":"‰","&perp;":"⊥","&pertenk;":"‱","&pfr;":"𝔭","&phi;":"φ","&phiv;":"ϕ","&phmmat;":"ℳ","&phone;":"☎","&pi;":"π","&pitchfork;":"⋔","&piv;":"ϖ","&planck;":"ℏ","&planckh;":"ℎ","&plankv;":"ℏ","&plus;":"+","&plusacir;":"⨣","&plusb;":"⊞","&pluscir;":"⨢","&plusdo;":"∔","&plusdu;":"⨥","&pluse;":"⩲","&plusmn":"±","&plusmn;":"±","&plussim;":"⨦","&plustwo;":"⨧","&pm;":"±","&pointint;":"⨕","&popf;":"𝕡","&pound":"£","&pound;":"£","&pr;":"≺","&prE;":"⪳","&prap;":"⪷","&prcue;":"≼","&pre;":"⪯","&prec;":"≺","&precapprox;":"⪷","&preccurlyeq;":"≼","&preceq;":"⪯","&precnapprox;":"⪹","&precneqq;":"⪵","&precnsim;":"⋨","&precsim;":"≾","&prime;":"′","&primes;":"ℙ","&prnE;":"⪵","&prnap;":"⪹","&prnsim;":"⋨","&prod;":"∏","&profalar;":"⌮","&profline;":"⌒","&profsurf;":"⌓","&prop;":"∝","&propto;":"∝","&prsim;":"≾","&prurel;":"⊰","&pscr;":"𝓅","&psi;":"ψ","&puncsp;":" ","&qfr;":"𝔮","&qint;":"⨌","&qopf;":"𝕢","&qprime;":"⁗","&qscr;":"𝓆","&quaternions;":"ℍ","&quatint;":"⨖","&quest;":"?","&questeq;":"≟","&quot":'"',"&quot;":'"',"&rAarr;":"⇛","&rArr;":"⇒","&rAtail;":"⤜","&rBarr;":"⤏","&rHar;":"⥤","&race;":"∽̱","&racute;":"ŕ","&radic;":"√","&raemptyv;":"⦳","&rang;":"⟩","&rangd;":"⦒","&range;":"⦥","&rangle;":"⟩","&raquo":"»","&raquo;":"»","&rarr;":"→","&rarrap;":"⥵","&rarrb;":"⇥","&rarrbfs;":"⤠","&rarrc;":"⤳","&rarrfs;":"⤞","&rarrhk;":"↪","&rarrlp;":"↬","&rarrpl;":"⥅","&rarrsim;":"⥴","&rarrtl;":"↣","&rarrw;":"↝","&ratail;":"⤚","&ratio;":"∶","&rationals;":"ℚ","&rbarr;":"⤍","&rbbrk;":"❳","&rbrace;":"}","&rbrack;":"]","&rbrke;":"⦌","&rbrksld;":"⦎","&rbrkslu;":"⦐","&rcaron;":"ř","&rcedil;":"ŗ","&rceil;":"⌉","&rcub;":"}","&rcy;":"р","&rdca;":"⤷","&rdldhar;":"⥩","&rdquo;":"”","&rdquor;":"”","&rdsh;":"↳","&real;":"ℜ","&realine;":"ℛ","&realpart;":"ℜ","&reals;":"ℝ","&rect;":"▭","&reg":"®","&reg;":"®","&rfisht;":"⥽","&rfloor;":"⌋","&rfr;":"𝔯","&rhard;":"⇁","&rharu;":"⇀","&rharul;":"⥬","&rho;":"ρ","&rhov;":"ϱ","&rightarrow;":"→","&rightarrowtail;":"↣","&rightharpoondown;":"⇁","&rightharpoonup;":"⇀","&rightleftarrows;":"⇄","&rightleftharpoons;":"⇌","&rightrightarrows;":"⇉","&rightsquigarrow;":"↝","&rightthreetimes;":"⋌","&ring;":"˚","&risingdotseq;":"≓","&rlarr;":"⇄","&rlhar;":"⇌","&rlm;":"‏","&rmoust;":"⎱","&rmoustache;":"⎱","&rnmid;":"⫮","&roang;":"⟭","&roarr;":"⇾","&robrk;":"⟧","&ropar;":"⦆","&ropf;":"𝕣","&roplus;":"⨮","&rotimes;":"⨵","&rpar;":")","&rpargt;":"⦔","&rppolint;":"⨒","&rrarr;":"⇉","&rsaquo;":"›","&rscr;":"𝓇","&rsh;":"↱","&rsqb;":"]","&rsquo;":"’","&rsquor;":"’","&rthree;":"⋌","&rtimes;":"⋊","&rtri;":"▹","&rtrie;":"⊵","&rtrif;":"▸","&rtriltri;":"⧎","&ruluhar;":"⥨","&rx;":"℞","&sacute;":"ś","&sbquo;":"‚","&sc;":"≻","&scE;":"⪴","&scap;":"⪸","&scaron;":"š","&sccue;":"≽","&sce;":"⪰","&scedil;":"ş","&scirc;":"ŝ","&scnE;":"⪶","&scnap;":"⪺","&scnsim;":"⋩","&scpolint;":"⨓","&scsim;":"≿","&scy;":"с","&sdot;":"⋅","&sdotb;":"⊡","&sdote;":"⩦","&seArr;":"⇘","&searhk;":"⤥","&searr;":"↘","&searrow;":"↘","&sect":"§","&sect;":"§","&semi;":";","&seswar;":"⤩","&setminus;":"∖","&setmn;":"∖","&sext;":"✶","&sfr;":"𝔰","&sfrown;":"⌢","&sharp;":"♯","&shchcy;":"щ","&shcy;":"ш","&shortmid;":"∣","&shortparallel;":"∥","&shy":"­","&shy;":"­","&sigma;":"σ","&sigmaf;":"ς","&sigmav;":"ς","&sim;":"∼","&simdot;":"⩪","&sime;":"≃","&simeq;":"≃","&simg;":"⪞","&simgE;":"⪠","&siml;":"⪝","&simlE;":"⪟","&simne;":"≆","&simplus;":"⨤","&simrarr;":"⥲","&slarr;":"←","&smallsetminus;":"∖","&smashp;":"⨳","&smeparsl;":"⧤","&smid;":"∣","&smile;":"⌣","&smt;":"⪪","&smte;":"⪬","&smtes;":"⪬︀","&softcy;":"ь","&sol;":"/","&solb;":"⧄","&solbar;":"⌿","&sopf;":"𝕤","&spades;":"♠","&spadesuit;":"♠","&spar;":"∥","&sqcap;":"⊓","&sqcaps;":"⊓︀","&sqcup;":"⊔","&sqcups;":"⊔︀","&sqsub;":"⊏","&sqsube;":"⊑","&sqsubset;":"⊏","&sqsubseteq;":"⊑","&sqsup;":"⊐","&sqsupe;":"⊒","&sqsupset;":"⊐","&sqsupseteq;":"⊒","&squ;":"□","&square;":"□","&squarf;":"▪","&squf;":"▪","&srarr;":"→","&sscr;":"𝓈","&ssetmn;":"∖","&ssmile;":"⌣","&sstarf;":"⋆","&star;":"☆","&starf;":"★","&straightepsilon;":"ϵ","&straightphi;":"ϕ","&strns;":"¯","&sub;":"⊂","&subE;":"⫅","&subdot;":"⪽","&sube;":"⊆","&subedot;":"⫃","&submult;":"⫁","&subnE;":"⫋","&subne;":"⊊","&subplus;":"⪿","&subrarr;":"⥹","&subset;":"⊂","&subseteq;":"⊆","&subseteqq;":"⫅","&subsetneq;":"⊊","&subsetneqq;":"⫋","&subsim;":"⫇","&subsub;":"⫕","&subsup;":"⫓","&succ;":"≻","&succapprox;":"⪸","&succcurlyeq;":"≽","&succeq;":"⪰","&succnapprox;":"⪺","&succneqq;":"⪶","&succnsim;":"⋩","&succsim;":"≿","&sum;":"∑","&sung;":"♪","&sup1":"¹","&sup1;":"¹","&sup2":"²","&sup2;":"²","&sup3":"³","&sup3;":"³","&sup;":"⊃","&supE;":"⫆","&supdot;":"⪾","&supdsub;":"⫘","&supe;":"⊇","&supedot;":"⫄","&suphsol;":"⟉","&suphsub;":"⫗","&suplarr;":"⥻","&supmult;":"⫂","&supnE;":"⫌","&supne;":"⊋","&supplus;":"⫀","&supset;":"⊃","&supseteq;":"⊇","&supseteqq;":"⫆","&supsetneq;":"⊋","&supsetneqq;":"⫌","&supsim;":"⫈","&supsub;":"⫔","&supsup;":"⫖","&swArr;":"⇙","&swarhk;":"⤦","&swarr;":"↙","&swarrow;":"↙","&swnwar;":"⤪","&szlig":"ß","&szlig;":"ß","&target;":"⌖","&tau;":"τ","&tbrk;":"⎴","&tcaron;":"ť","&tcedil;":"ţ","&tcy;":"т","&tdot;":"⃛","&telrec;":"⌕","&tfr;":"𝔱","&there4;":"∴","&therefore;":"∴","&theta;":"θ","&thetasym;":"ϑ","&thetav;":"ϑ","&thickapprox;":"≈","&thicksim;":"∼","&thinsp;":" ","&thkap;":"≈","&thksim;":"∼","&thorn":"þ","&thorn;":"þ","&tilde;":"˜","&times":"×","&times;":"×","&timesb;":"⊠","&timesbar;":"⨱","&timesd;":"⨰","&tint;":"∭","&toea;":"⤨","&top;":"⊤","&topbot;":"⌶","&topcir;":"⫱","&topf;":"𝕥","&topfork;":"⫚","&tosa;":"⤩","&tprime;":"‴","&trade;":"™","&triangle;":"▵","&triangledown;":"▿","&triangleleft;":"◃","&trianglelefteq;":"⊴","&triangleq;":"≜","&triangleright;":"▹","&trianglerighteq;":"⊵","&tridot;":"◬","&trie;":"≜","&triminus;":"⨺","&triplus;":"⨹","&trisb;":"⧍","&tritime;":"⨻","&trpezium;":"⏢","&tscr;":"𝓉","&tscy;":"ц","&tshcy;":"ћ","&tstrok;":"ŧ","&twixt;":"≬","&twoheadleftarrow;":"↞","&twoheadrightarrow;":"↠","&uArr;":"⇑","&uHar;":"⥣","&uacute":"ú","&uacute;":"ú","&uarr;":"↑","&ubrcy;":"ў","&ubreve;":"ŭ","&ucirc":"û","&ucirc;":"û","&ucy;":"у","&udarr;":"⇅","&udblac;":"ű","&udhar;":"⥮","&ufisht;":"⥾","&ufr;":"𝔲","&ugrave":"ù","&ugrave;":"ù","&uharl;":"↿","&uharr;":"↾","&uhblk;":"▀","&ulcorn;":"⌜","&ulcorner;":"⌜","&ulcrop;":"⌏","&ultri;":"◸","&umacr;":"ū","&uml":"¨","&uml;":"¨","&uogon;":"ų","&uopf;":"𝕦","&uparrow;":"↑","&updownarrow;":"↕","&upharpoonleft;":"↿","&upharpoonright;":"↾","&uplus;":"⊎","&upsi;":"υ","&upsih;":"ϒ","&upsilon;":"υ","&upuparrows;":"⇈","&urcorn;":"⌝","&urcorner;":"⌝","&urcrop;":"⌎","&uring;":"ů","&urtri;":"◹","&uscr;":"𝓊","&utdot;":"⋰","&utilde;":"ũ","&utri;":"▵","&utrif;":"▴","&uuarr;":"⇈","&uuml":"ü","&uuml;":"ü","&uwangle;":"⦧","&vArr;":"⇕","&vBar;":"⫨","&vBarv;":"⫩","&vDash;":"⊨","&vangrt;":"⦜","&varepsilon;":"ϵ","&varkappa;":"ϰ","&varnothing;":"∅","&varphi;":"ϕ","&varpi;":"ϖ","&varpropto;":"∝","&varr;":"↕","&varrho;":"ϱ","&varsigma;":"ς","&varsubsetneq;":"⊊︀","&varsubsetneqq;":"⫋︀","&varsupsetneq;":"⊋︀","&varsupsetneqq;":"⫌︀","&vartheta;":"ϑ","&vartriangleleft;":"⊲","&vartriangleright;":"⊳","&vcy;":"в","&vdash;":"⊢","&vee;":"∨","&veebar;":"⊻","&veeeq;":"≚","&vellip;":"⋮","&verbar;":"|","&vert;":"|","&vfr;":"𝔳","&vltri;":"⊲","&vnsub;":"⊂⃒","&vnsup;":"⊃⃒","&vopf;":"𝕧","&vprop;":"∝","&vrtri;":"⊳","&vscr;":"𝓋","&vsubnE;":"⫋︀","&vsubne;":"⊊︀","&vsupnE;":"⫌︀","&vsupne;":"⊋︀","&vzigzag;":"⦚","&wcirc;":"ŵ","&wedbar;":"⩟","&wedge;":"∧","&wedgeq;":"≙","&weierp;":"℘","&wfr;":"𝔴","&wopf;":"𝕨","&wp;":"℘","&wr;":"≀","&wreath;":"≀","&wscr;":"𝓌","&xcap;":"⋂","&xcirc;":"◯","&xcup;":"⋃","&xdtri;":"▽","&xfr;":"𝔵","&xhArr;":"⟺","&xharr;":"⟷","&xi;":"ξ","&xlArr;":"⟸","&xlarr;":"⟵","&xmap;":"⟼","&xnis;":"⋻","&xodot;":"⨀","&xopf;":"𝕩","&xoplus;":"⨁","&xotime;":"⨂","&xrArr;":"⟹","&xrarr;":"⟶","&xscr;":"𝓍","&xsqcup;":"⨆","&xuplus;":"⨄","&xutri;":"△","&xvee;":"⋁","&xwedge;":"⋀","&yacute":"ý","&yacute;":"ý","&yacy;":"я","&ycirc;":"ŷ","&ycy;":"ы","&yen":"¥","&yen;":"¥","&yfr;":"𝔶","&yicy;":"ї","&yopf;":"𝕪","&yscr;":"𝓎","&yucy;":"ю","&yuml":"ÿ","&yuml;":"ÿ","&zacute;":"ź","&zcaron;":"ž","&zcy;":"з","&zdot;":"ż","&zeetrf;":"ℨ","&zeta;":"ζ","&zfr;":"𝔷","&zhcy;":"ж","&zigrarr;":"⇝","&zopf;":"𝕫","&zscr;":"𝓏","&zwj;":"‍","&zwnj;":"‌"};function zd(r){return r.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi,(e,t)=>{if(typeof va[e]=="string")return va[e];if(t.charAt(0)!=="#"||e.charAt(e.length-1)!==";")return e;let n;t.charAt(1)==="x"?n=parseInt(t.substr(2),16):n=parseInt(t.substr(1),10);var s="";return n>=55296&&n<=57343||n>1114111?"�":(n>65535&&(n-=65536,s+=String.fromCharCode(n>>>10&1023|55296),n=56320|n&1023),s+=String.fromCharCode(n),s)})}function Er(r){return r.trim().replace(/[<>"'?&]/g,e=>{let t=e.charCodeAt(0).toString(16);return t.length<2&&(t="0"+t),"&#x"+t.toUpperCase()+";"})}function $d(r){return"<div>"+Er(r).replace(/\n/g,"<br />")+"</div>"}function qd(r){return r=r.replace(/\r?\n/g,"").replace(/<\!\-\-.*?\-\->/gi," ").replace(/<br\b[^>]*>/gi,`
7
7
  `).replace(/<\/?(p|div|table|tr|td|th)\b[^>]*>/gi,`
8
8
 
9
9
  `).replace(/<script\b[^>]*>.*?<\/script\b[^>]*>/gi," ").replace(/^.*<body\b[^>]*>/i,"").replace(/^.*<\/head\b[^>]*>/i,"").replace(/^.*<\!doctype\b[^>]*>/i,"").replace(/<\/body\b[^>]*>.*$/i,"").replace(/<\/html\b[^>]*>.*$/i,"").replace(/<a\b[^>]*href\s*=\s*["']?([^\s"']+)[^>]*>/gi," ($1) ").replace(/<\/?(span|em|i|strong|b|u|a)\b[^>]*>/gi,"").replace(/<li\b[^>]*>[\n\u0001\s]*/gi,"* ").replace(/<hr\b[^>]*>/g,`
@@ -13,19 +13,19 @@
13
13
 
14
14
  `).replace(/^\n+/,`
15
15
  `).replace(/\n+$/,`
16
- `),r=_u(r),r}function bl(r){return[].concat(r.name||[]).concat(r.name?`<${r.address}>`:r.address).join(" ")}function Bs(r){let e=[],t=(n,s)=>{if(s&&e.push(", "),n.group){let i=`${n.name}:`,o=";";e.push(i),n.group.forEach(t),e.push(o)}else e.push(bl(n))};return r.forEach(t),e.join("")}function _l(r){return`<a href="mailto:${dr(r.address)}" class="postal-email-address">${dr(r.name||`<${r.address}>`)}</a>`}function Fs(r){let e=[],t=(n,s)=>{if(s&&e.push('<span class="postal-email-address-separator">, </span>'),n.group){let i=`<span class="postal-email-address-group">${dr(n.name)}:</span>`,o='<span class="postal-email-address-group">;</span>';e.push(i),n.group.forEach(t),e.push(o)}else e.push(_l(n))};return r.forEach(t),e.join(" ")}function wu(r,e,t){r=(r||"").toString(),e=e||76;let n=0,s=r.length,i="",o,a;for(;n<s;){if(o=r.substr(n,e),o.length<e){i+=o;break}if(a=o.match(/^[^\n\r]*(\r?\n|\r)/)){o=a[0],i+=o,n+=o.length;continue}else(a=o.match(/(\s+)[^\s]*$/))&&a[0].length-(a[1]||"").length<o.length?o=o.substr(0,o.length-(a[0].length-(a[1]||"").length)):(a=r.substr(n+o.length).match(/^[^\s]+(\s*)/))&&(o=o+a[0].substr(0,a[0].length-0));i+=o,n+=o.length,n<s&&(i+=`\r
17
- `)}return i}function ro(r){let e=[];if(r.from&&e.push({key:"From",val:bl(r.from)}),r.subject&&e.push({key:"Subject",val:r.subject}),r.date){let o={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},a=typeof Intl>"u"?r.date:new Intl.DateTimeFormat("default",o).format(new Date(r.date));e.push({key:"Date",val:a})}r.to&&r.to.length&&e.push({key:"To",val:Bs(r.to)}),r.cc&&r.cc.length&&e.push({key:"Cc",val:Bs(r.cc)}),r.bcc&&r.bcc.length&&e.push({key:"Bcc",val:Bs(r.bcc)});let t=e.map(o=>o.key.length).reduce((o,a)=>a>o?a:o,0);e=e.flatMap(o=>{let a=t-o.key.length,l=`${o.key}: ${" ".repeat(a)}`,u=`${" ".repeat(o.key.length+1)} ${" ".repeat(a)}`;return wu(o.val,80).split(/\r?\n/).map(d=>d.trim()).map((d,f)=>`${f?u:l}${d}`)});let n=e.map(o=>o.length).reduce((o,a)=>a>o?a:o,0),s="-".repeat(n);return`
16
+ `),r=zd(r),r}function ru(r){return[].concat(r.name||[]).concat(r.name?`<${r.address}>`:r.address).join(" ")}function ki(r){let e=[],t=(n,s)=>{if(s&&e.push(", "),n.group){let i=`${n.name}:`,o=";";e.push(i),n.group.forEach(t),e.push(o)}else e.push(ru(n))};return r.forEach(t),e.join("")}function nu(r){return`<a href="mailto:${Er(r.address)}" class="postal-email-address">${Er(r.name||`<${r.address}>`)}</a>`}function Di(r){let e=[],t=(n,s)=>{if(s&&e.push('<span class="postal-email-address-separator">, </span>'),n.group){let i=`<span class="postal-email-address-group">${Er(n.name)}:</span>`,o='<span class="postal-email-address-group">;</span>';e.push(i),n.group.forEach(t),e.push(o)}else e.push(nu(n))};return r.forEach(t),e.join(" ")}function Ud(r,e,t){r=(r||"").toString(),e=e||76;let n=0,s=r.length,i="",o,l;for(;n<s;){if(o=r.substr(n,e),o.length<e){i+=o;break}if(l=o.match(/^[^\n\r]*(\r?\n|\r)/)){o=l[0],i+=o,n+=o.length;continue}else(l=o.match(/(\s+)[^\s]*$/))&&l[0].length-(l[1]||"").length<o.length?o=o.substr(0,o.length-(l[0].length-(l[1]||"").length)):(l=r.substr(n+o.length).match(/^[^\s]+(\s*)/))&&(o=o+l[0].substr(0,l[0].length-0));i+=o,n+=o.length,n<s&&(i+=`\r
17
+ `)}return i}function wa(r){let e=[];if(r.from&&e.push({key:"From",val:ru(r.from)}),r.subject&&e.push({key:"Subject",val:r.subject}),r.date){let o={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},l=typeof Intl>"u"?r.date:new Intl.DateTimeFormat("default",o).format(new Date(r.date));e.push({key:"Date",val:l})}r.to&&r.to.length&&e.push({key:"To",val:ki(r.to)}),r.cc&&r.cc.length&&e.push({key:"Cc",val:ki(r.cc)}),r.bcc&&r.bcc.length&&e.push({key:"Bcc",val:ki(r.bcc)});let t=e.map(o=>o.key.length).reduce((o,l)=>l>o?l:o,0);e=e.flatMap(o=>{let l=t-o.key.length,a=`${o.key}: ${" ".repeat(l)}`,u=`${" ".repeat(o.key.length+1)} ${" ".repeat(l)}`;return Ud(o.val,80).split(/\r?\n/).map(d=>d.trim()).map((d,f)=>`${f?u:a}${d}`)});let n=e.map(o=>o.length).reduce((o,l)=>l>o?l:o,0),s="-".repeat(n);return`
18
18
  ${s}
19
19
  ${e.join(`
20
20
  `)}
21
21
  ${s}
22
- `}function no(r){let e=[];if(r.from&&e.push(`<div class="postal-email-header-key">From</div><div class="postal-email-header-value">${_l(r.from)}</div>`),r.subject&&e.push(`<div class="postal-email-header-key">Subject</div><div class="postal-email-header-value postal-email-header-subject">${dr(r.subject)}</div>`),r.date){let n={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},s=typeof Intl>"u"?r.date:new Intl.DateTimeFormat("default",n).format(new Date(r.date));e.push(`<div class="postal-email-header-key">Date</div><div class="postal-email-header-value postal-email-header-date" data-date="${dr(r.date)}">${dr(s)}</div>`)}return r.to&&r.to.length&&e.push(`<div class="postal-email-header-key">To</div><div class="postal-email-header-value">${Fs(r.to)}</div>`),r.cc&&r.cc.length&&e.push(`<div class="postal-email-header-key">Cc</div><div class="postal-email-header-value">${Fs(r.cc)}</div>`),r.bcc&&r.bcc.length&&e.push(`<div class="postal-email-header-key">Bcc</div><div class="postal-email-header-value">${Fs(r.bcc)}</div>`),`<div class="postal-email-header">${e.length?'<div class="postal-email-header-row">':""}${e.join(`</div>
23
- <div class="postal-email-header-row">`)}${e.length?"</div>":""}</div>`}function Du(r,e){let t=!1,n="text",s,i=[],o={address:[],comment:[],group:[],text:[],textWasQuoted:[]},a,l,u=!1;for(a=0,l=r.length;a<l;a++){let c=r[a],d=a?r[a-1]:null;if(c.type==="operator")switch(c.value){case"<":n="address",u=!1;break;case"(":n="comment",u=!1;break;case":":n="group",t=!0,u=!1;break;case'"':u=!u,n="text";break;default:n="text",u=!1;break}else c.value&&(n==="address"&&(c.value=c.value.replace(/^[^<]*<\s*/,"")),d&&d.noBreak&&o[n].length?(o[n][o[n].length-1]+=c.value,n==="text"&&u&&(o.textWasQuoted[o.textWasQuoted.length-1]=!0)):(o[n].push(c.value),n==="text"&&o.textWasQuoted.push(u)))}if(!o.text.length&&o.comment.length&&(o.text=o.comment,o.comment=[]),t){o.text=o.text.join(" ");let c=[];o.group.length&&nn(o.group.join(","),{_depth:e+1}).forEach(f=>{f.group?c=c.concat(f.group):c.push(f)}),i.push({name:rn(o.text||s&&s.name),group:c})}else{if(!o.address.length&&o.text.length){for(a=o.text.length-1;a>=0;a--)if(!o.textWasQuoted[a]&&o.text[a].match(/^[^@\s]+@[^@\s]+$/)){o.address=o.text.splice(a,1),o.textWasQuoted.splice(a,1);break}let c=function(d){return o.address.length?d:(o.address=[d.trim()]," ")};if(!o.address.length)for(a=o.text.length-1;a>=0&&!(!o.textWasQuoted[a]&&(o.text[a]=o.text[a].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/,c).trim(),o.address.length));a--);}if(!o.text.length&&o.comment.length&&(o.text=o.comment,o.comment=[]),o.address.length>1&&(o.text=o.text.concat(o.address.splice(1))),o.text=o.text.join(" "),o.address=o.address.join(" "),!o.address&&/^=\?[^=]+?=$/.test(o.text.trim())){const c=nn(rn(o.text));if(c&&c.length)return c}if(!o.address&&t)return[];s={address:o.address||o.text||"",name:rn(o.text||o.address||"")},s.address===s.name&&((s.address||"").match(/@/)?s.name="":s.address=""),i.push(s)}return i}class Eu{constructor(e){this.str=(e||"").toString(),this.operatorCurrent="",this.operatorExpecting="",this.node=null,this.escaped=!1,this.list=[],this.operators={'"':'"',"(":")","<":">",",":"",":":";",";":""}}tokenize(){let e=[];for(let t=0,n=this.str.length;t<n;t++){let s=this.str.charAt(t),i=t<n-1?this.str.charAt(t+1):null;this.checkChar(s,i)}return this.list.forEach(t=>{t.value=(t.value||"").toString().trim(),t.value&&e.push(t)}),e}checkChar(e,t){if(!this.escaped){if(e===this.operatorExpecting){this.node={type:"operator",value:e},t&&![" "," ","\r",`
22
+ `}function Ca(r){let e=[];if(r.from&&e.push(`<div class="postal-email-header-key">From</div><div class="postal-email-header-value">${nu(r.from)}</div>`),r.subject&&e.push(`<div class="postal-email-header-key">Subject</div><div class="postal-email-header-value postal-email-header-subject">${Er(r.subject)}</div>`),r.date){let n={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},s=typeof Intl>"u"?r.date:new Intl.DateTimeFormat("default",n).format(new Date(r.date));e.push(`<div class="postal-email-header-key">Date</div><div class="postal-email-header-value postal-email-header-date" data-date="${Er(r.date)}">${Er(s)}</div>`)}return r.to&&r.to.length&&e.push(`<div class="postal-email-header-key">To</div><div class="postal-email-header-value">${Di(r.to)}</div>`),r.cc&&r.cc.length&&e.push(`<div class="postal-email-header-key">Cc</div><div class="postal-email-header-value">${Di(r.cc)}</div>`),r.bcc&&r.bcc.length&&e.push(`<div class="postal-email-header-key">Bcc</div><div class="postal-email-header-value">${Di(r.bcc)}</div>`),`<div class="postal-email-header">${e.length?'<div class="postal-email-header-row">':""}${e.join(`</div>
23
+ <div class="postal-email-header-row">`)}${e.length?"</div>":""}</div>`}function Wd(r,e){let t=!1,n="text",s,i=[],o={address:[],comment:[],group:[],text:[],textWasQuoted:[]},l,a,u=!1;for(l=0,a=r.length;l<a;l++){let c=r[l],d=l?r[l-1]:null;if(c.type==="operator")switch(c.value){case"<":n="address",u=!1;break;case"(":n="comment",u=!1;break;case":":n="group",t=!0,u=!1;break;case'"':u=!u,n="text";break;default:n="text",u=!1;break}else c.value&&(n==="address"&&(c.value=c.value.replace(/^[^<]*<\s*/,"")),d&&d.noBreak&&o[n].length?(o[n][o[n].length-1]+=c.value,n==="text"&&u&&(o.textWasQuoted[o.textWasQuoted.length-1]=!0)):(o[n].push(c.value),n==="text"&&o.textWasQuoted.push(u)))}if(!o.text.length&&o.comment.length&&(o.text=o.comment,o.comment=[]),t){o.text=o.text.join(" ");let c=[];o.group.length&&Dn(o.group.join(","),{_depth:e+1}).forEach(f=>{f.group?c=c.concat(f.group):c.push(f)}),i.push({name:kn(o.text||s&&s.name),group:c})}else{if(!o.address.length&&o.text.length){for(l=o.text.length-1;l>=0;l--)if(!o.textWasQuoted[l]&&o.text[l].match(/^[^@\s]+@[^@\s]+$/)){o.address=o.text.splice(l,1),o.textWasQuoted.splice(l,1);break}let c=function(d){return o.address.length?d:(o.address=[d.trim()]," ")};if(!o.address.length)for(l=o.text.length-1;l>=0&&!(!o.textWasQuoted[l]&&(o.text[l]=o.text[l].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/,c).trim(),o.address.length));l--);}if(!o.text.length&&o.comment.length&&(o.text=o.comment,o.comment=[]),o.address.length>1&&(o.text=o.text.concat(o.address.splice(1))),o.text=o.text.join(" "),o.address=o.address.join(" "),!o.address&&/^=\?[^=]+?=$/.test(o.text.trim())){const c=Dn(kn(o.text));if(c&&c.length)return c}if(!o.address&&t)return[];s={address:o.address||o.text||"",name:kn(o.text||o.address||"")},s.address===s.name&&((s.address||"").match(/@/)?s.name="":s.address=""),i.push(s)}return i}class Vd{constructor(e){this.str=(e||"").toString(),this.operatorCurrent="",this.operatorExpecting="",this.node=null,this.escaped=!1,this.list=[],this.operators={'"':'"',"(":")","<":">",",":"",":":";",";":""}}tokenize(){let e=[];for(let t=0,n=this.str.length;t<n;t++){let s=this.str.charAt(t),i=t<n-1?this.str.charAt(t+1):null;this.checkChar(s,i)}return this.list.forEach(t=>{t.value=(t.value||"").toString().trim(),t.value&&e.push(t)}),e}checkChar(e,t){if(!this.escaped){if(e===this.operatorExpecting){this.node={type:"operator",value:e},t&&![" "," ","\r",`
24
24
  `,",",";"].includes(t)&&(this.node.noBreak=!0),this.list.push(this.node),this.node=null,this.operatorExpecting="",this.escaped=!1;return}else if(!this.operatorExpecting&&e in this.operators){this.node={type:"operator",value:e},this.list.push(this.node),this.node=null,this.operatorExpecting=this.operators[e],this.escaped=!1;return}else if(['"',"'"].includes(this.operatorExpecting)&&e==="\\"){this.escaped=!0;return}}this.node||(this.node={type:"text",value:""},this.list.push(this.node)),e===`
25
- `&&(e=" "),(e.charCodeAt(0)>=33||[" "," "].includes(e))&&(this.node.value+=e),this.escaped=!1}}const Su=50;function nn(r,e){e=e||{};let t=e._depth||0;if(t>Su)return[];let s=new Eu(r).tokenize(),i=[],o=[],a=[];if(s.forEach(l=>{l.type==="operator"&&(l.value===","||l.value===";")?(o.length&&i.push(o),o=[]):o.push(l)}),o.length&&i.push(o),i.forEach(l=>{l=Du(l,t),l.length&&(a=a.concat(l))}),e.flatten){let l=[],u=c=>{c.forEach(d=>{if(d.group)return u(d.group);l.push(d)})};return u(a),l}return a}function Au(r){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(r),s=n.byteLength,i=s%3,o=s-i,a,l,u,c,d,f=0;f<o;f=f+3)d=n[f]<<16|n[f+1]<<8|n[f+2],a=(d&16515072)>>18,l=(d&258048)>>12,u=(d&4032)>>6,c=d&63,e+=t[a]+t[l]+t[u]+t[c];return i==1?(d=n[o],a=(d&252)>>2,l=(d&3)<<4,e+=t[a]+t[l]+"=="):i==2&&(d=n[o]<<8|n[o+1],a=(d&64512)>>10,l=(d&1008)>>4,u=(d&15)<<2,e+=t[a]+t[l]+t[u]+"="),e}const ku=256,Tu=2*1024*1024;class Un{static parse(e,t){return new Un(t).parse(e)}constructor(e){this.options=e||{},this.mimeOptions={maxNestingDepth:this.options.maxNestingDepth||ku,maxHeadersSize:this.options.maxHeadersSize||Tu},this.root=this.currentNode=new eo({postalMime:this,...this.mimeOptions}),this.boundaries=[],this.textContent={},this.attachments=[],this.attachmentEncoding=(this.options.attachmentEncoding||"").toString().replace(/[-_\s]/g,"").trim().toLowerCase()||"arraybuffer",this.started=!1}async finalize(){await this.root.finalize()}async processLine(e,t){let n=this.boundaries;if(n.length&&e.length>2&&e[0]===45&&e[1]===45)for(let s=n.length-1;s>=0;s--){let i=n[s];if(e.length!==i.value.length+2&&e.length!==i.value.length+4)continue;let o=e.length===i.value.length+4;if(o&&(e[e.length-2]!==45||e[e.length-1]!==45))continue;let a=!0;for(let l=0;l<i.value.length;l++)if(e[l+2]!==i.value[l]){a=!1;break}if(a)return o?(await i.node.finalize(),this.currentNode=i.node.parentNode||this.root):(await i.node.finalizeChildNodes(),this.currentNode=new eo({postalMime:this,parentNode:i.node,...this.mimeOptions})),t?this.finalize():void 0}if(this.currentNode.feed(e),t)return this.finalize()}readLine(){let e=this.readPos,t=this.readPos,n=()=>({bytes:new Uint8Array(this.buf,e,t-e),done:this.readPos>=this.av.length});for(;this.readPos<this.av.length;){const s=this.av[this.readPos++];if(s!==13&&s!==10&&(t=this.readPos),s===10)return n()}return n()}async processNodeTree(){let e={},t=new Set,n=this.textMap=new Map,s=this.forceRfc822Attachments(),i=async(o,a,l)=>{if(a=a||!1,l=l||!1,o.contentType.multipart)o.contentType.multipart==="alternative"?a=o:o.contentType.multipart==="related"&&(l=o);else if(this.isInlineMessageRfc822(o)&&!s){const u=new Un;o.subMessage=await u.parse(o.content),n.has(o)||n.set(o,{});let c=n.get(o);(o.subMessage.text||!o.subMessage.html)&&(c.plain=c.plain||[],c.plain.push({type:"subMessage",value:o.subMessage}),t.add("plain")),o.subMessage.html&&(c.html=c.html||[],c.html.push({type:"subMessage",value:o.subMessage}),t.add("html")),u.textMap&&u.textMap.forEach((d,f)=>{n.set(f,d)});for(let d of o.subMessage.attachments||[])this.attachments.push(d)}else if(this.isInlineTextNode(o)){let u=o.contentType.parsed.value.substr(o.contentType.parsed.value.indexOf("/")+1),c=a||o;n.has(c)||n.set(c,{});let d=n.get(c);d[u]=d[u]||[],d[u].push({type:"text",value:o.getTextContent()}),t.add(u)}else if(o.content){const u=o.contentDisposition.parsed.params.filename||o.contentType.parsed.params.name||null,c={filename:u?rn(u):null,mimeType:o.contentType.parsed.value,disposition:o.contentDisposition.parsed.value||null};switch(l&&o.contentId&&(c.related=!0),o.contentDescription&&(c.description=o.contentDescription),o.contentId&&(c.contentId=o.contentId),o.contentType.parsed.value){case"text/calendar":case"application/ics":{o.contentType.parsed.params.method&&(c.method=o.contentType.parsed.params.method.toString().toUpperCase().trim());const d=o.getTextContent().replace(/\r?\n/g,`
25
+ `&&(e=" "),(e.charCodeAt(0)>=33||[" "," "].includes(e))&&(this.node.value+=e),this.escaped=!1}}const Hd=50;function Dn(r,e){e=e||{};let t=e._depth||0;if(t>Hd)return[];let s=new Vd(r).tokenize(),i=[],o=[],l=[];if(s.forEach(a=>{a.type==="operator"&&(a.value===","||a.value===";")?(o.length&&i.push(o),o=[]):o.push(a)}),o.length&&i.push(o),i.forEach(a=>{a=Wd(a,t),a.length&&(l=l.concat(a))}),e.flatten){let a=[],u=c=>{c.forEach(d=>{if(d.group)return u(d.group);a.push(d)})};return u(l),a}return l}function Gd(r){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(r),s=n.byteLength,i=s%3,o=s-i,l,a,u,c,d,f=0;f<o;f=f+3)d=n[f]<<16|n[f+1]<<8|n[f+2],l=(d&16515072)>>18,a=(d&258048)>>12,u=(d&4032)>>6,c=d&63,e+=t[l]+t[a]+t[u]+t[c];return i==1?(d=n[o],l=(d&252)>>2,a=(d&3)<<4,e+=t[l]+t[a]+"=="):i==2&&(d=n[o]<<8|n[o+1],l=(d&64512)>>10,a=(d&1008)>>4,u=(d&15)<<2,e+=t[l]+t[a]+t[u]+"="),e}const Kd=256,Yd=2*1024*1024;class Ds{static parse(e,t){return new Ds(t).parse(e)}constructor(e){this.options=e||{},this.mimeOptions={maxNestingDepth:this.options.maxNestingDepth||Kd,maxHeadersSize:this.options.maxHeadersSize||Yd},this.root=this.currentNode=new _a({postalMime:this,...this.mimeOptions}),this.boundaries=[],this.textContent={},this.attachments=[],this.attachmentEncoding=(this.options.attachmentEncoding||"").toString().replace(/[-_\s]/g,"").trim().toLowerCase()||"arraybuffer",this.started=!1}async finalize(){await this.root.finalize()}async processLine(e,t){let n=this.boundaries;if(n.length&&e.length>2&&e[0]===45&&e[1]===45)for(let s=n.length-1;s>=0;s--){let i=n[s];if(e.length!==i.value.length+2&&e.length!==i.value.length+4)continue;let o=e.length===i.value.length+4;if(o&&(e[e.length-2]!==45||e[e.length-1]!==45))continue;let l=!0;for(let a=0;a<i.value.length;a++)if(e[a+2]!==i.value[a]){l=!1;break}if(l)return o?(await i.node.finalize(),this.currentNode=i.node.parentNode||this.root):(await i.node.finalizeChildNodes(),this.currentNode=new _a({postalMime:this,parentNode:i.node,...this.mimeOptions})),t?this.finalize():void 0}if(this.currentNode.feed(e),t)return this.finalize()}readLine(){let e=this.readPos,t=this.readPos,n=()=>({bytes:new Uint8Array(this.buf,e,t-e),done:this.readPos>=this.av.length});for(;this.readPos<this.av.length;){const s=this.av[this.readPos++];if(s!==13&&s!==10&&(t=this.readPos),s===10)return n()}return n()}async processNodeTree(){let e={},t=new Set,n=this.textMap=new Map,s=this.forceRfc822Attachments(),i=async(o,l,a)=>{if(l=l||!1,a=a||!1,o.contentType.multipart)o.contentType.multipart==="alternative"?l=o:o.contentType.multipart==="related"&&(a=o);else if(this.isInlineMessageRfc822(o)&&!s){const u=new Ds;o.subMessage=await u.parse(o.content),n.has(o)||n.set(o,{});let c=n.get(o);(o.subMessage.text||!o.subMessage.html)&&(c.plain=c.plain||[],c.plain.push({type:"subMessage",value:o.subMessage}),t.add("plain")),o.subMessage.html&&(c.html=c.html||[],c.html.push({type:"subMessage",value:o.subMessage}),t.add("html")),u.textMap&&u.textMap.forEach((d,f)=>{n.set(f,d)});for(let d of o.subMessage.attachments||[])this.attachments.push(d)}else if(this.isInlineTextNode(o)){let u=o.contentType.parsed.value.substr(o.contentType.parsed.value.indexOf("/")+1),c=l||o;n.has(c)||n.set(c,{});let d=n.get(c);d[u]=d[u]||[],d[u].push({type:"text",value:o.getTextContent()}),t.add(u)}else if(o.content){const u=o.contentDisposition.parsed.params.filename||o.contentType.parsed.params.name||null,c={filename:u?kn(u):null,mimeType:o.contentType.parsed.value,disposition:o.contentDisposition.parsed.value||null};switch(a&&o.contentId&&(c.related=!0),o.contentDescription&&(c.description=o.contentDescription),o.contentId&&(c.contentId=o.contentId),o.contentType.parsed.value){case"text/calendar":case"application/ics":{o.contentType.parsed.params.method&&(c.method=o.contentType.parsed.params.method.toString().toUpperCase().trim());const d=o.getTextContent().replace(/\r?\n/g,`
26
26
  `).replace(/\n*$/,`
27
- `);c.content=Mr.encode(d);break}default:c.content=o.content}this.attachments.push(c)}for(let u of o.childNodes)await i(u,a,l)};await i(this.root,!1,[]),n.forEach(o=>{t.forEach(a=>{if(e[a]||(e[a]=[]),o[a])o[a].forEach(l=>{switch(l.type){case"text":e[a].push(l.value);break;case"subMessage":switch(a){case"html":e[a].push(no(l.value));break;case"plain":e[a].push(ro(l.value));break}break}});else{let l;switch(a){case"html":l="plain";break;case"plain":l="html";break}(o[l]||[]).forEach(u=>{switch(u.type){case"text":switch(a){case"html":e[a].push(vu(u.value));break;case"plain":e[a].push(Cu(u.value));break}break;case"subMessage":switch(a){case"html":e[a].push(no(u.value));break;case"plain":e[a].push(ro(u.value));break}break}})}})}),Object.keys(e).forEach(o=>{e[o]=e[o].join(`
28
- `)}),this.textContent=e}isInlineTextNode(e){if(e.contentDisposition.parsed.value==="attachment")return!1;switch(e.contentType.parsed.value){case"text/html":case"text/plain":return!0;case"text/calendar":case"text/csv":default:return!1}}isInlineMessageRfc822(e){return e.contentType.parsed.value!=="message/rfc822"?!1:(e.contentDisposition.parsed.value||(this.options.rfc822Attachments?"attachment":"inline"))==="inline"}forceRfc822Attachments(){if(this.options.forceRfc822Attachments)return!0;let e=!1,t=n=>{n.contentType.multipart||["message/delivery-status","message/feedback-report"].includes(n.contentType.parsed.value)&&(e=!0);for(let s of n.childNodes)t(s)};return t(this.root),e}async resolveStream(e){let t=0,n=[];const s=e.getReader();for(;;){const{done:a,value:l}=await s.read();if(a)break;n.push(l),t+=l.length}const i=new Uint8Array(t);let o=0;for(let a of n)i.set(a,o),o+=a.length;return i}async parse(e){var s,i;if(this.started)throw new Error("Can not reuse parser, create a new PostalMime object");for(this.started=!0,e&&typeof e.getReader=="function"&&(e=await this.resolveStream(e)),e=e||new ArrayBuffer(0),typeof e=="string"&&(e=Mr.encode(e)),(e instanceof Blob||Object.prototype.toString.call(e)==="[object Blob]")&&(e=await ds(e)),e.buffer instanceof ArrayBuffer&&(e=new Uint8Array(e).buffer),this.buf=e,this.av=new Uint8Array(e),this.readPos=0;this.readPos<this.av.length;){const o=this.readLine();await this.processLine(o.bytes,o.done)}await this.processNodeTree();const t={headers:this.root.headers.map(o=>({key:o.key,value:o.value})).reverse()};for(const o of["from","sender"]){const a=this.root.headers.find(l=>l.key===o);if(a&&a.value){const l=nn(a.value);l&&l.length&&(t[o]=l[0])}}for(const o of["delivered-to","return-path"]){const a=this.root.headers.find(l=>l.key===o);if(a&&a.value){const l=nn(a.value);if(l&&l.length&&l[0].address){const u=o.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[u]=l[0].address}}}for(const o of["to","cc","bcc","reply-to"]){const a=this.root.headers.filter(u=>u.key===o);let l=[];if(a.filter(u=>u&&u.value).map(u=>nn(u.value)).forEach(u=>l=l.concat(u||[])),l&&l.length){const u=o.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[u]=l}}for(const o of["subject","message-id","in-reply-to","references"]){const a=this.root.headers.find(l=>l.key===o);if(a&&a.value){const l=o.replace(/\-(.)/g,(u,c)=>c.toUpperCase());t[l]=rn(a.value)}}let n=this.root.headers.find(o=>o.key==="date");if(n){let o=new Date(n.value);!o||o.toString()==="Invalid Date"?o=n.value:o=o.toISOString(),t.date=o}switch((s=this.textContent)!=null&&s.html&&(t.html=this.textContent.html),(i=this.textContent)!=null&&i.plain&&(t.text=this.textContent.plain),t.attachments=this.attachments,this.attachmentEncoding){case"arraybuffer":break;case"base64":for(let a of t.attachments||[])a!=null&&a.content&&(a.content=Au(a.content),a.encoding="base64");break;case"utf8":let o=new TextDecoder("utf8");for(let a of t.attachments||[])a!=null&&a.content&&(a.content=o.decode(a.content),a.encoding="utf8");break;default:throw new Error("Unknwon attachment encoding")}return t}}class vl{constructor(e){_t(this,"config");if(!e.system_id)throw new Error("MailClient: system_id is REQUIRED");this.config=e}async callCoprocessor(e,t,n={}){const s={coprocessor:e,method:t,system_id:this.config.system_id,params:{user_id:this.config.system_id,...n}};try{const i=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(s)});if(!i.ok){const a=await i.text();throw new Error(`API error (${i.status}): ${a}`)}const o=await i.json();if(!o.success&&o.error)throw new Error(o.error);return o.result}catch(i){throw console.error("API call failed:",i),i}}async callMail(e,t={}){return this.callCoprocessor("mail",e,t)}async callEmail(e,t={}){return this.callCoprocessor("email",e,t)}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getSettings(){try{return await this.callMail("get_email_settings")||{accounts:[]}}catch{return{accounts:[]}}}async saveSettings(e){await this.callMail("save_email_settings",{accounts:e})}async listEmails(e,t=150,n){return this.callMail("list_emails",{account_id:e,limit:t,folder:n})}async deleteEmails(e,t,n=!0){return this.callMail("delete_emails",{account_id:e,uids:t,expunge:n})}async imapExec(e,t){return this.callMail("imap_exec",{account_id:e,commands:t})}async trashEmails(e,t,n="INBOX"){const s=["[Gmail]/Trash","[Gmail]/Corbeille","[Gmail]/Bin","Trash"];for(const i of s){const o=[`SELECT "${n}"`,...t.map(u=>`UID MOVE ${u} "${i}"`)],l=(await this.imapExec(e,o)).responses.filter(u=>u.ok&&u.command==="UID MOVE").length;if(l>0)return{success:!0,moved:l}}return{success:!1,moved:0}}async archiveEmails(e,t,n="INBOX"){const s=[`SELECT "${n}"`,...t.map(a=>`UID STORE ${a} +FLAGS (\\Deleted)`),"EXPUNGE"],o=(await this.imapExec(e,s)).responses.filter(a=>a.ok&&a.command==="UID STORE").length;return{success:o>0,archived:o}}async listFolders(e){const n=(await this.imapExec(e,['LIST "" *'])).responses.find(s=>s.command==="LIST");return n!=null&&n.ok&&n.folders?{success:!0,folders:n.folders}:{success:!1,folders:[]}}async listEmailsSorted(e,t="INBOX",n=150){const s=await this.imapExec(e,[`SELECT ${t}`,"FETCH 1:* (UID INTERNALDATE)"]),i=s.responses.find(h=>h.command==="SELECT");if(!(i!=null&&i.ok))throw new Error(`Failed to select folder: ${(i==null?void 0:i.error)||"Unknown error"}`);const o=s.responses.find(h=>h.command==="FETCH");if(!(o!=null&&o.ok)||!o.messages)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:i.exists||0},messages:[]};const l=[...o.messages].sort((h,p)=>{const m=h.internalDate?new Date(h.internalDate).getTime():0;return(p.internalDate?new Date(p.internalDate).getTime():0)-m}).slice(0,n).map(h=>h.uid).filter(Boolean);if(l.length===0)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:i.exists||0},messages:[]};const c=(await this.imapExec(e,[`SELECT ${t}`,`UID FETCH ${l.join(",")} (UID FLAGS ENVELOPE)`])).responses.find(h=>h.command==="UID FETCH");if(!(c!=null&&c.ok)||!c.messages)throw new Error(`Failed to fetch details: ${(c==null?void 0:c.error)||"Unknown error"}`);const d=new Map;for(const h of c.messages)h.uid&&d.set(h.uid,h);const f=l.map(h=>{var E,_,A,b,v;const p=d.get(h);if(!p)return null;const m=((E=p.flags)==null?void 0:E.some(S=>S.includes("Seen")))||!1,y=((A=(_=p.envelope)==null?void 0:_.from)==null?void 0:A.email)||"Unknown",D=((b=p.envelope)==null?void 0:b.subject)||"(No subject)",x=((v=p.envelope)==null?void 0:v.date)||"";return{uid:h,from:y,subject:D,date:x,seen:m}}).filter(Boolean);return{account:{id:e,label:"",email:""},mailbox:{name:t,total:i.exists||0},messages:f}}async getEmail(e,t,n="INBOX"){return this.callMail("get_email",{account_id:e,uid:t,folder:n})}async getAttachment(e,t,n,s="INBOX"){return this.callMail("get_attachment",{account_id:e,uid:t,attachment_index:n,folder:s})}async searchContactEmails(e,t,n=50){return this.callMail("search_contact_emails",{account_id:e,contact_email:t,limit:n})}async getEmailParsed(e,t,n="INBOX"){var p,m,y,D,x,E;const i=(await this.imapExec(e,[`SELECT "${n}"`,`UID FETCH ${t} (FLAGS BODY[])`])).responses.find(_=>_.command==="UID FETCH");if(!(i!=null&&i.ok)||!((p=i.messages)!=null&&p[0]))return console.error("Failed to fetch raw email:",i==null?void 0:i.error),null;const o=i.messages[0],a=o.body||o.raw;if(!a)return console.error("No raw email content in response"),null;const u=await new Un().parse(a);console.log("[MailClient] Parsed email - attachments count:",((m=u.attachments)==null?void 0:m.length)||0),console.log("[MailClient] Parsed attachments:",(y=u.attachments)==null?void 0:y.map(_=>({filename:_.filename,mimeType:_.mimeType,contentId:_.contentId})));const c=new Map;for(const _ of u.attachments||[])if(_.contentId){const A=this.contentToBase64(_.content),b=`data:${_.mimeType};base64,${A}`,v=_.contentId.replace(/^<|>$/g,"");c.set(v,b),c.set(`<${v}>`,b)}let d=u.html||"";d&&c.size>0&&(d=d.replace(/src=["']cid:([^"']+)["']/gi,(_,A)=>{const b=c.get(A)||c.get(`<${A}>`);return b?`src="${b}"`:_}));const f=((D=o.flags)==null?void 0:D.some(_=>_.toLowerCase().includes("seen")))||!1,h=((x=u.from)==null?void 0:x.address)||((E=u.from)==null?void 0:E.name)||"Unknown";return{uid:t,from:h,subject:u.subject||"(No subject)",date:u.date||"",body:d||u.text||"",html:d,text:u.text||"",seen:f,attachments:(u.attachments||[]).map(_=>({filename:_.filename||"attachment",mimeType:_.mimeType||"application/octet-stream",size:this.getContentSize(_.content)}))}}contentToBase64(e){if(typeof e=="string")try{return btoa(e)}catch{return e}const t=e instanceof Uint8Array?e:new Uint8Array(e);let n="";for(let s=0;s<t.byteLength;s++)n+=String.fromCharCode(t[s]);return btoa(n)}getContentSize(e){return e?typeof e=="string"?e.length:(e instanceof Uint8Array,e.byteLength):0}async sendMail(e){const t={to:e.to,subject:e.subject,body:e.body};return e.html&&(t.html=e.html),e.from&&(t.from=e.from),e.smtpConfig&&(t.smtp_config=e.smtpConfig),this.callEmail("send",t)}async sendEmail(e,t){var n,s;try{const i=await this.getSettings(),o=((n=i.accounts)==null?void 0:n.find(u=>u.id===e))||((s=i.accounts)==null?void 0:s[0]);if(!(o!=null&&o.smtp))return{success:!1,error:"No SMTP configuration found for account"};const a={to:Array.isArray(t.to)?t.to:[t.to],subject:t.subject,body:t.text||"",html:t.html,from:o.email,smtp_config:{host:o.smtp.host,port:parseInt(o.smtp.port,10)||587,username:o.smtp.user,password:o.smtp.password}};t.in_reply_to&&(a.in_reply_to=t.in_reply_to),t.attachments&&t.attachments.length>0&&(a.attachments=t.attachments);const l=await this.callEmail("send",a);return{success:(l==null?void 0:l.sent)??!1,message_id:l==null?void 0:l.message_id,error:l==null?void 0:l.error}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}}const Rs="qwanyx_auth_token",Ls="qwanyx_refresh_token";class Cl{static setToken(e){typeof window<"u"&&localStorage.setItem(Rs,e)}static getToken(){return typeof window<"u"?localStorage.getItem(Rs):null}static clearToken(){typeof window<"u"&&(localStorage.removeItem(Rs),localStorage.removeItem(Ls))}static setRefreshToken(e){typeof window<"u"&&localStorage.setItem(Ls,e)}static getRefreshToken(){return typeof window<"u"?localStorage.getItem(Ls):null}static isAuthenticated(){return!!this.getToken()}static getAuthHeader(){const e=this.getToken();return e?{Authorization:`Bearer ${e}`}:{}}}class wl{constructor(e){_t(this,"config");this.config={timeout:3e4,headers:{"Content-Type":"application/json"},...e}}buildQueryString(e){if(!e||Object.keys(e).length===0)return"";const t=new URLSearchParams;Object.entries(e).forEach(([s,i])=>{i!=null&&t.append(s,String(i))});const n=t.toString();return n?`?${n}`:""}async request(e,t={}){const{method:n="GET",headers:s={},body:i,params:o}=t,a=`${this.config.baseUrl}/${e}${this.buildQueryString(o)}`,l={...this.config.headers,...Cl.getAuthHeader(),...s},u={method:n,headers:l};i&&n!=="GET"&&(u.body=JSON.stringify(i));try{const c=new AbortController,d=setTimeout(()=>c.abort(),this.config.timeout),f=await fetch(a,{...u,signal:c.signal});if(clearTimeout(d),!f.ok){const h=await f.json().catch(()=>({message:f.statusText}));throw new Error(h.message||`HTTP ${f.status}`)}return await f.json()}catch(c){throw c instanceof Error?c:new Error("An unexpected error occurred")}}async get(e,t){return this.request(e,{method:"GET",params:t})}async post(e,t,n){return this.request(e,{method:"POST",body:t,params:n})}async put(e,t,n){return this.request(e,{method:"PUT",body:t,params:n})}async patch(e,t,n){return this.request(e,{method:"PATCH",body:t,params:n})}async delete(e,t){return this.request(e,{method:"DELETE",params:t})}setBaseUrl(e){this.config.baseUrl=e}getBaseUrl(){return this.config.baseUrl}}let Wn=null;function Nu(r){return Wn=new wl(r),Wn}function xi(){if(!Wn)throw new Error("API client not initialized. Call initializeApiClient() first.");return Wn}function Dl(r,e,t={}){const{enabled:n=!0,refetchOnMount:s=!0,onSuccess:i,onError:o}=t,[a,l]=w.useState(null),[u,c]=w.useState(n),[d,f]=w.useState(null),h=w.useCallback(async()=>{if(n){c(!0),f(null);try{const m=await xi().get(r,e);l(m),i==null||i(m)}catch(p){const m=p instanceof Error?p:new Error("Unknown error");f(m),o==null||o(m)}finally{c(!1)}}},[r,JSON.stringify(e),n,i,o]);return w.useEffect(()=>{s&&h()},[h,s]),{data:a,loading:u,error:d,refetch:h}}function Bu(r,e="POST",t={}){const{onSuccess:n,onError:s}=t,[i,o]=w.useState(null),[a,l]=w.useState(!1),[u,c]=w.useState(null),d=w.useCallback(async h=>{l(!0),c(null);try{const p=xi();let m;switch(e){case"POST":m=await p.post(r,h);break;case"PUT":m=await p.put(r,h);break;case"PATCH":m=await p.patch(r,h);break;case"DELETE":m=await p.delete(r);break;default:throw new Error(`Unsupported method: ${e}`)}return o(m),n==null||n(m,h),m}catch(p){const m=p instanceof Error?p:new Error("Unknown error");return c(m),s==null||s(m,h),null}finally{l(!1)}},[r,e,n,s]),f=w.useCallback(()=>{o(null),c(null),l(!1)},[]);return{data:i,loading:a,error:u,mutate:d,reset:f}}var Ks={exports:{}},Wr={};/**
27
+ `);c.content=Jr.encode(d);break}default:c.content=o.content}this.attachments.push(c)}for(let u of o.childNodes)await i(u,l,a)};await i(this.root,!1,[]),n.forEach(o=>{t.forEach(l=>{if(e[l]||(e[l]=[]),o[l])o[l].forEach(a=>{switch(a.type){case"text":e[l].push(a.value);break;case"subMessage":switch(l){case"html":e[l].push(Ca(a.value));break;case"plain":e[l].push(wa(a.value));break}break}});else{let a;switch(l){case"html":a="plain";break;case"plain":a="html";break}(o[a]||[]).forEach(u=>{switch(u.type){case"text":switch(l){case"html":e[l].push($d(u.value));break;case"plain":e[l].push(qd(u.value));break}break;case"subMessage":switch(l){case"html":e[l].push(Ca(u.value));break;case"plain":e[l].push(wa(u.value));break}break}})}})}),Object.keys(e).forEach(o=>{e[o]=e[o].join(`
28
+ `)}),this.textContent=e}isInlineTextNode(e){if(e.contentDisposition.parsed.value==="attachment")return!1;switch(e.contentType.parsed.value){case"text/html":case"text/plain":return!0;case"text/calendar":case"text/csv":default:return!1}}isInlineMessageRfc822(e){return e.contentType.parsed.value!=="message/rfc822"?!1:(e.contentDisposition.parsed.value||(this.options.rfc822Attachments?"attachment":"inline"))==="inline"}forceRfc822Attachments(){if(this.options.forceRfc822Attachments)return!0;let e=!1,t=n=>{n.contentType.multipart||["message/delivery-status","message/feedback-report"].includes(n.contentType.parsed.value)&&(e=!0);for(let s of n.childNodes)t(s)};return t(this.root),e}async resolveStream(e){let t=0,n=[];const s=e.getReader();for(;;){const{done:l,value:a}=await s.read();if(l)break;n.push(a),t+=a.length}const i=new Uint8Array(t);let o=0;for(let l of n)i.set(l,o),o+=l.length;return i}async parse(e){var s,i;if(this.started)throw new Error("Can not reuse parser, create a new PostalMime object");for(this.started=!0,e&&typeof e.getReader=="function"&&(e=await this.resolveStream(e)),e=e||new ArrayBuffer(0),typeof e=="string"&&(e=Jr.encode(e)),(e instanceof Blob||Object.prototype.toString.call(e)==="[object Blob]")&&(e=await ni(e)),e.buffer instanceof ArrayBuffer&&(e=new Uint8Array(e).buffer),this.buf=e,this.av=new Uint8Array(e),this.readPos=0;this.readPos<this.av.length;){const o=this.readLine();await this.processLine(o.bytes,o.done)}await this.processNodeTree();const t={headers:this.root.headers.map(o=>({key:o.key,value:o.value})).reverse()};for(const o of["from","sender"]){const l=this.root.headers.find(a=>a.key===o);if(l&&l.value){const a=Dn(l.value);a&&a.length&&(t[o]=a[0])}}for(const o of["delivered-to","return-path"]){const l=this.root.headers.find(a=>a.key===o);if(l&&l.value){const a=Dn(l.value);if(a&&a.length&&a[0].address){const u=o.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[u]=a[0].address}}}for(const o of["to","cc","bcc","reply-to"]){const l=this.root.headers.filter(u=>u.key===o);let a=[];if(l.filter(u=>u&&u.value).map(u=>Dn(u.value)).forEach(u=>a=a.concat(u||[])),a&&a.length){const u=o.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[u]=a}}for(const o of["subject","message-id","in-reply-to","references"]){const l=this.root.headers.find(a=>a.key===o);if(l&&l.value){const a=o.replace(/\-(.)/g,(u,c)=>c.toUpperCase());t[a]=kn(l.value)}}let n=this.root.headers.find(o=>o.key==="date");if(n){let o=new Date(n.value);!o||o.toString()==="Invalid Date"?o=n.value:o=o.toISOString(),t.date=o}switch((s=this.textContent)!=null&&s.html&&(t.html=this.textContent.html),(i=this.textContent)!=null&&i.plain&&(t.text=this.textContent.plain),t.attachments=this.attachments,this.attachmentEncoding){case"arraybuffer":break;case"base64":for(let l of t.attachments||[])l!=null&&l.content&&(l.content=Gd(l.content),l.encoding="base64");break;case"utf8":let o=new TextDecoder("utf8");for(let l of t.attachments||[])l!=null&&l.content&&(l.content=o.decode(l.content),l.encoding="utf8");break;default:throw new Error("Unknwon attachment encoding")}return t}}class su{constructor(e){St(this,"config");if(!e.system_id)throw new Error("MailClient: system_id is REQUIRED");this.config=e}async callCoprocessor(e,t,n={}){const s={coprocessor:e,method:t,system_id:this.config.system_id,params:{user_id:this.config.system_id,...n}};try{const i=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(s)});if(!i.ok){const l=await i.text();throw new Error(`API error (${i.status}): ${l}`)}const o=await i.json();if(!o.success&&o.error)throw new Error(o.error);return o.result}catch(i){throw console.error("API call failed:",i),i}}async callMail(e,t={}){return this.callCoprocessor("mail",e,t)}async callEmail(e,t={}){return this.callCoprocessor("email",e,t)}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getSettings(){try{return await this.callMail("get_email_settings")||{accounts:[]}}catch{return{accounts:[]}}}async saveSettings(e){await this.callMail("save_email_settings",{accounts:e})}async listEmails(e,t=150,n){return this.callMail("list_emails",{account_id:e,limit:t,folder:n})}async deleteEmails(e,t,n=!0){return this.callMail("delete_emails",{account_id:e,uids:t,expunge:n})}async imapExec(e,t){return this.callMail("imap_exec",{account_id:e,commands:t})}async trashEmails(e,t,n="INBOX"){const s=["[Gmail]/Trash","[Gmail]/Corbeille","[Gmail]/Bin","Trash"];for(const i of s){const o=[`SELECT "${n}"`,...t.map(u=>`UID MOVE ${u} "${i}"`)],a=(await this.imapExec(e,o)).responses.filter(u=>u.ok&&u.command==="UID MOVE").length;if(a>0)return{success:!0,moved:a}}return{success:!1,moved:0}}async archiveEmails(e,t,n="INBOX"){const s=[`SELECT "${n}"`,...t.map(l=>`UID STORE ${l} +FLAGS (\\Deleted)`),"EXPUNGE"],o=(await this.imapExec(e,s)).responses.filter(l=>l.ok&&l.command==="UID STORE").length;return{success:o>0,archived:o}}async listFolders(e){const n=(await this.imapExec(e,['LIST "" *'])).responses.find(s=>s.command==="LIST");return n!=null&&n.ok&&n.folders?{success:!0,folders:n.folders}:{success:!1,folders:[]}}async listEmailsSorted(e,t="INBOX",n=150){const s=await this.imapExec(e,[`SELECT ${t}`,"FETCH 1:* (UID INTERNALDATE)"]),i=s.responses.find(h=>h.command==="SELECT");if(!(i!=null&&i.ok))throw new Error(`Failed to select folder: ${(i==null?void 0:i.error)||"Unknown error"}`);const o=s.responses.find(h=>h.command==="FETCH");if(!(o!=null&&o.ok)||!o.messages)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:i.exists||0},messages:[]};const a=[...o.messages].sort((h,g)=>{const m=h.internalDate?new Date(h.internalDate).getTime():0;return(g.internalDate?new Date(g.internalDate).getTime():0)-m}).slice(0,n).map(h=>h.uid).filter(Boolean);if(a.length===0)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:i.exists||0},messages:[]};const c=(await this.imapExec(e,[`SELECT ${t}`,`UID FETCH ${a.join(",")} (UID FLAGS ENVELOPE)`])).responses.find(h=>h.command==="UID FETCH");if(!(c!=null&&c.ok)||!c.messages)throw new Error(`Failed to fetch details: ${(c==null?void 0:c.error)||"Unknown error"}`);const d=new Map;for(const h of c.messages)h.uid&&d.set(h.uid,h);const f=a.map(h=>{var C,S,D,w,y;const g=d.get(h);if(!g)return null;const m=((C=g.flags)==null?void 0:C.some(k=>k.includes("Seen")))||!1,x=((D=(S=g.envelope)==null?void 0:S.from)==null?void 0:D.email)||"Unknown",v=((w=g.envelope)==null?void 0:w.subject)||"(No subject)",_=((y=g.envelope)==null?void 0:y.date)||"";return{uid:h,from:x,subject:v,date:_,seen:m}}).filter(Boolean);return{account:{id:e,label:"",email:""},mailbox:{name:t,total:i.exists||0},messages:f}}async getEmail(e,t,n="INBOX"){return this.callMail("get_email",{account_id:e,uid:t,folder:n})}async getAttachment(e,t,n,s="INBOX"){return this.callMail("get_attachment",{account_id:e,uid:t,attachment_index:n,folder:s})}async searchContactEmails(e,t,n=50){return this.callMail("search_contact_emails",{account_id:e,contact_email:t,limit:n})}async getEmailParsed(e,t,n="INBOX"){var g,m,x,v,_,C;const i=(await this.imapExec(e,[`SELECT "${n}"`,`UID FETCH ${t} (FLAGS BODY[])`])).responses.find(S=>S.command==="UID FETCH");if(!(i!=null&&i.ok)||!((g=i.messages)!=null&&g[0]))return console.error("Failed to fetch raw email:",i==null?void 0:i.error),null;const o=i.messages[0],l=o.body||o.raw;if(!l)return console.error("No raw email content in response"),null;const u=await new Ds().parse(l);console.log("[MailClient] Parsed email - attachments count:",((m=u.attachments)==null?void 0:m.length)||0),console.log("[MailClient] Parsed attachments:",(x=u.attachments)==null?void 0:x.map(S=>({filename:S.filename,mimeType:S.mimeType,contentId:S.contentId})));const c=new Map;for(const S of u.attachments||[])if(S.contentId){const D=this.contentToBase64(S.content),w=`data:${S.mimeType};base64,${D}`,y=S.contentId.replace(/^<|>$/g,"");c.set(y,w),c.set(`<${y}>`,w)}let d=u.html||"";d&&c.size>0&&(d=d.replace(/src=["']cid:([^"']+)["']/gi,(S,D)=>{const w=c.get(D)||c.get(`<${D}>`);return w?`src="${w}"`:S}));const f=((v=o.flags)==null?void 0:v.some(S=>S.toLowerCase().includes("seen")))||!1,h=((_=u.from)==null?void 0:_.address)||((C=u.from)==null?void 0:C.name)||"Unknown";return{uid:t,from:h,subject:u.subject||"(No subject)",date:u.date||"",body:d||u.text||"",html:d,text:u.text||"",seen:f,attachments:(u.attachments||[]).map(S=>({filename:S.filename||"attachment",mimeType:S.mimeType||"application/octet-stream",size:this.getContentSize(S.content)}))}}contentToBase64(e){if(typeof e=="string")try{return btoa(e)}catch{return e}const t=e instanceof Uint8Array?e:new Uint8Array(e);let n="";for(let s=0;s<t.byteLength;s++)n+=String.fromCharCode(t[s]);return btoa(n)}getContentSize(e){return e?typeof e=="string"?e.length:(e instanceof Uint8Array,e.byteLength):0}async sendMail(e){const t={to:e.to,subject:e.subject,body:e.body};return e.html&&(t.html=e.html),e.from&&(t.from=e.from),e.smtpConfig&&(t.smtp_config=e.smtpConfig),this.callEmail("send",t)}async sendEmail(e,t){var n,s;try{const i=await this.getSettings(),o=((n=i.accounts)==null?void 0:n.find(u=>u.id===e))||((s=i.accounts)==null?void 0:s[0]);if(!(o!=null&&o.smtp))return{success:!1,error:"No SMTP configuration found for account"};const l={to:Array.isArray(t.to)?t.to:[t.to],subject:t.subject,body:t.text||"",html:t.html,from:o.email,smtp_config:{host:o.smtp.host,port:parseInt(o.smtp.port,10)||587,username:o.smtp.user,password:o.smtp.password}};t.in_reply_to&&(l.in_reply_to=t.in_reply_to),t.attachments&&t.attachments.length>0&&(l.attachments=t.attachments);const a=await this.callEmail("send",l);return{success:(a==null?void 0:a.sent)??!1,message_id:a==null?void 0:a.message_id,error:a==null?void 0:a.error}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}}const Ai="qwanyx_auth_token",Ti="qwanyx_refresh_token",Bi="qwanyx_auth_user";class ht{static setToken(e){typeof window<"u"&&localStorage.setItem(Ai,e)}static getToken(){return typeof window<"u"?localStorage.getItem(Ai):null}static clearToken(){typeof window<"u"&&(localStorage.removeItem(Ai),localStorage.removeItem(Ti))}static setRefreshToken(e){typeof window<"u"&&localStorage.setItem(Ti,e)}static getRefreshToken(){return typeof window<"u"?localStorage.getItem(Ti):null}static isAuthenticated(){return!!this.getToken()}static getAuthHeader(){const e=this.getToken();return e?{Authorization:`Bearer ${e}`}:{}}static setUser(e){typeof window<"u"&&localStorage.setItem(Bi,JSON.stringify(e))}static getUser(){if(typeof window<"u"){const e=localStorage.getItem(Bi);if(e)try{return JSON.parse(e)}catch{return null}}return null}static clearUser(){typeof window<"u"&&localStorage.removeItem(Bi)}static clearAll(){this.clearToken(),this.clearUser()}}class To{constructor(e){St(this,"config");this.config=e}async register(e,t,n){var s,i;try{const l=await(await fetch(`${this.config.apiUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({system_id:"system",coprocessor:"auth",method:"register",params:{email:e,password:t,...n}})})).json();return l.success&&((s=l.result)!=null&&s.success)?{success:!0,userId:l.result.user_id,email:l.result.email,requiresVerification:l.result.requiresVerification}:{success:!1,error:((i=l.result)==null?void 0:i.message)||l.error||"Registration failed"}}catch(o){return{success:!1,error:o instanceof Error?o.message:"Network error"}}}async verifyEmail(e,t){var n,s,i,o;try{const a=await(await fetch(`${this.config.apiUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({system_id:"system",coprocessor:"auth",method:"verify_email",params:{email:e,code:t}})})).json();if(a.success&&((n=a.result)!=null&&n.token)){const{token:u,user:c}=a.result;return ht.setToken(u),ht.setUser(c),(i=(s=this.config).onLogin)==null||i.call(s,c),{success:!0,user:c,token:u}}else return{success:!1,error:((o=a.result)==null?void 0:o.error)||a.error||"Verification failed"}}catch(l){return{success:!1,error:l instanceof Error?l.message:"Network error"}}}async requestPasswordReset(e){var t,n;try{const i=await(await fetch(`${this.config.apiUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({system_id:"system",coprocessor:"auth",method:"request_password_reset",params:{email:e}})})).json();return i.success&&((t=i.result)!=null&&t.success)?{success:!0,message:i.result.message}:{success:!1,error:((n=i.result)==null?void 0:n.message)||i.error||"Request failed"}}catch(s){return{success:!1,error:s instanceof Error?s.message:"Network error"}}}async setPasswordWithCode(e,t,n){var s,i,o,l;try{const u=await(await fetch(`${this.config.apiUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({system_id:"system",coprocessor:"auth",method:"set_password_with_code",params:{email:e,code:t,password:n}})})).json();if(u.success&&((s=u.result)!=null&&s.token)){const{token:c,user:d}=u.result;return ht.setToken(c),ht.setUser(d),(o=(i=this.config).onLogin)==null||o.call(i,d),{success:!0,user:d,token:c}}else return{success:!1,error:((l=u.result)==null?void 0:l.message)||u.error||"Password reset failed"}}catch(a){return{success:!1,error:a instanceof Error?a.message:"Network error"}}}async login(e,t){var n,s,i,o,l,a;try{const c=await(await fetch(`${this.config.apiUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({system_id:"system",coprocessor:"auth",method:"login",params:{email:e,password:t}})})).json();if((n=c.result)!=null&&n.requiresVerification||c.requiresVerification)return{success:!1,error:((s=c.result)==null?void 0:s.error)||c.error||"Please verify your email first",requiresVerification:!0};if(c.success&&((i=c.result)!=null&&i.token)){const{token:d,user:f}=c.result;return ht.setToken(d),ht.setUser(f),(l=(o=this.config).onLogin)==null||l.call(o,f),{success:!0,user:f,token:d}}else return{success:!1,error:((a=c.result)==null?void 0:a.error)||c.error||"Login failed"}}catch(u){return{success:!1,error:u instanceof Error?u.message:"Network error"}}}async resendVerificationCode(e){return this.requestPasswordReset(e)}logout(){var e,t;ht.clearAll(),(t=(e=this.config).onLogout)==null||t.call(e)}async checkRole(e,t){var n;try{const i=await(await fetch(`${this.config.apiUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",...ht.getAuthHeader()},body:JSON.stringify({system_id:this.config.systemId||"system",coprocessor:"graph",method:"get_user_role",params:{group_id:e,target_user_id:t}})})).json();return i.success&&((n=i.result)!=null&&n.role)?i.result.role:null}catch{return null}}async isAdmin(e){return this.config.systemId?await this.checkRole(`${this.config.systemId}__admins`,e)==="admin":!1}getCurrentUser(){return ht.getUser()}isAuthenticated(){return ht.isAuthenticated()}}let As=null;function Qd(r){return As=new To(r),As}function Xd(){if(!As)throw new Error("Auth service not initialized. Call initializeAuthService() first.");return As}class iu{constructor(e){St(this,"config");this.config={timeout:3e4,headers:{"Content-Type":"application/json"},...e}}buildQueryString(e){if(!e||Object.keys(e).length===0)return"";const t=new URLSearchParams;Object.entries(e).forEach(([s,i])=>{i!=null&&t.append(s,String(i))});const n=t.toString();return n?`?${n}`:""}async request(e,t={}){const{method:n="GET",headers:s={},body:i,params:o}=t,l=`${this.config.baseUrl}/${e}${this.buildQueryString(o)}`,a={...this.config.headers,...ht.getAuthHeader(),...s},u={method:n,headers:a};i&&n!=="GET"&&(u.body=JSON.stringify(i));try{const c=new AbortController,d=setTimeout(()=>c.abort(),this.config.timeout),f=await fetch(l,{...u,signal:c.signal});if(clearTimeout(d),!f.ok){const h=await f.json().catch(()=>({message:f.statusText}));throw new Error(h.message||`HTTP ${f.status}`)}return await f.json()}catch(c){throw c instanceof Error?c:new Error("An unexpected error occurred")}}async get(e,t){return this.request(e,{method:"GET",params:t})}async post(e,t,n){return this.request(e,{method:"POST",body:t,params:n})}async put(e,t,n){return this.request(e,{method:"PUT",body:t,params:n})}async patch(e,t,n){return this.request(e,{method:"PATCH",body:t,params:n})}async delete(e,t){return this.request(e,{method:"DELETE",params:t})}setBaseUrl(e){this.config.baseUrl=e}getBaseUrl(){return this.config.baseUrl}}let Ts=null;function Jd(r){return Ts=new iu(r),Ts}function Bo(){if(!Ts)throw new Error("API client not initialized. Call initializeApiClient() first.");return Ts}var Hi={exports:{}},cn={};/**
29
29
  * @license React
30
30
  * react-jsx-runtime.production.min.js
31
31
  *
@@ -33,7 +33,7 @@ ${s}
33
33
  *
34
34
  * This source code is licensed under the MIT license found in the
35
35
  * LICENSE file in the root directory of this source tree.
36
- */var so;function Fu(){if(so)return Wr;so=1;var r=w,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,u){var c,d={},f=null,h=null;u!==void 0&&(f=""+u),l.key!==void 0&&(f=""+l.key),l.ref!==void 0&&(h=l.ref);for(c in l)n.call(l,c)&&!i.hasOwnProperty(c)&&(d[c]=l[c]);if(a&&a.defaultProps)for(c in l=a.defaultProps,l)d[c]===void 0&&(d[c]=l[c]);return{$$typeof:e,type:a,key:f,ref:h,props:d,_owner:s.current}}return Wr.Fragment=t,Wr.jsx=o,Wr.jsxs=o,Wr}var Gr={};/**
36
+ */var Sa;function Zd(){if(Sa)return cn;Sa=1;var r=b,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(l,a,u){var c,d={},f=null,h=null;u!==void 0&&(f=""+u),a.key!==void 0&&(f=""+a.key),a.ref!==void 0&&(h=a.ref);for(c in a)n.call(a,c)&&!i.hasOwnProperty(c)&&(d[c]=a[c]);if(l&&l.defaultProps)for(c in a=l.defaultProps,a)d[c]===void 0&&(d[c]=a[c]);return{$$typeof:e,type:l,key:f,ref:h,props:d,_owner:s.current}}return cn.Fragment=t,cn.jsx=o,cn.jsxs=o,cn}var dn={};/**
37
37
  * @license React
38
38
  * react-jsx-runtime.development.js
39
39
  *
@@ -41,49 +41,71 @@ ${s}
41
41
  *
42
42
  * This source code is licensed under the MIT license found in the
43
43
  * LICENSE file in the root directory of this source tree.
44
- */var io;function Ru(){return io||(io=1,process.env.NODE_ENV!=="production"&&function(){var r=w,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),p=Symbol.iterator,m="@@iterator";function y(C){if(C===null||typeof C!="object")return null;var M=p&&C[p]||C[m];return typeof M=="function"?M:null}var D=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(C){{for(var M=arguments.length,U=new Array(M>1?M-1:0),X=1;X<M;X++)U[X-1]=arguments[X];E("error",C,U)}}function E(C,M,U){{var X=D.ReactDebugCurrentFrame,ue=X.getStackAddendum();ue!==""&&(M+="%s",U=U.concat([ue]));var _e=U.map(function(le){return String(le)});_e.unshift("Warning: "+M),Function.prototype.apply.call(console[C],console,_e)}}var _=!1,A=!1,b=!1,v=!1,S=!1,k;k=Symbol.for("react.module.reference");function j(C){return!!(typeof C=="string"||typeof C=="function"||C===n||C===i||S||C===s||C===u||C===c||v||C===h||_||A||b||typeof C=="object"&&C!==null&&(C.$$typeof===f||C.$$typeof===d||C.$$typeof===o||C.$$typeof===a||C.$$typeof===l||C.$$typeof===k||C.getModuleId!==void 0))}function T(C,M,U){var X=C.displayName;if(X)return X;var ue=M.displayName||M.name||"";return ue!==""?U+"("+ue+")":U}function B(C){return C.displayName||"Context"}function L(C){if(C==null)return null;if(typeof C.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof C=="function")return C.displayName||C.name||null;if(typeof C=="string")return C;switch(C){case n:return"Fragment";case t:return"Portal";case i:return"Profiler";case s:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof C=="object")switch(C.$$typeof){case a:var M=C;return B(M)+".Consumer";case o:var U=C;return B(U._context)+".Provider";case l:return T(C,C.render,"ForwardRef");case d:var X=C.displayName||null;return X!==null?X:L(C.type)||"Memo";case f:{var ue=C,_e=ue._payload,le=ue._init;try{return L(le(_e))}catch{return null}}}return null}var R=Object.assign,P=0,Q,se,xe,oe,Se,he,fe;function pe(){}pe.__reactDisabledLog=!0;function ge(){{if(P===0){Q=console.log,se=console.info,xe=console.warn,oe=console.error,Se=console.group,he=console.groupCollapsed,fe=console.groupEnd;var C={configurable:!0,enumerable:!0,value:pe,writable:!0};Object.defineProperties(console,{info:C,log:C,warn:C,error:C,group:C,groupCollapsed:C,groupEnd:C})}P++}}function Ae(){{if(P--,P===0){var C={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},C,{value:Q}),info:R({},C,{value:se}),warn:R({},C,{value:xe}),error:R({},C,{value:oe}),group:R({},C,{value:Se}),groupCollapsed:R({},C,{value:he}),groupEnd:R({},C,{value:fe})})}P<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var be=D.ReactCurrentDispatcher,we;function Re(C,M,U){{if(we===void 0)try{throw Error()}catch(ue){var X=ue.stack.trim().match(/\n( *(at )?)/);we=X&&X[1]||""}return`
45
- `+we+C}}var ce=!1,je;{var at=typeof WeakMap=="function"?WeakMap:Map;je=new at}function kt(C,M){if(!C||ce)return"";{var U=je.get(C);if(U!==void 0)return U}var X;ce=!0;var ue=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var _e;_e=be.current,be.current=null,ge();try{if(M){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(st){X=st}Reflect.construct(C,[],le)}else{try{le.call()}catch(st){X=st}C.call(le.prototype)}}else{try{throw Error()}catch(st){X=st}C()}}catch(st){if(st&&X&&typeof st.stack=="string"){for(var ae=st.stack.split(`
46
- `),Ze=X.stack.split(`
47
- `),$e=ae.length-1,qe=Ze.length-1;$e>=1&&qe>=0&&ae[$e]!==Ze[qe];)qe--;for(;$e>=1&&qe>=0;$e--,qe--)if(ae[$e]!==Ze[qe]){if($e!==1||qe!==1)do if($e--,qe--,qe<0||ae[$e]!==Ze[qe]){var pt=`
48
- `+ae[$e].replace(" at new "," at ");return C.displayName&&pt.includes("<anonymous>")&&(pt=pt.replace("<anonymous>",C.displayName)),typeof C=="function"&&je.set(C,pt),pt}while($e>=1&&qe>=0);break}}}finally{ce=!1,be.current=_e,Ae(),Error.prepareStackTrace=ue}var Dr=C?C.displayName||C.name:"",ar=Dr?Re(Dr):"";return typeof C=="function"&&je.set(C,ar),ar}function zt(C,M,U){return kt(C,!1)}function nt(C){var M=C.prototype;return!!(M&&M.isReactComponent)}function mt(C,M,U){if(C==null)return"";if(typeof C=="function")return kt(C,nt(C));if(typeof C=="string")return Re(C);switch(C){case u:return Re("Suspense");case c:return Re("SuspenseList")}if(typeof C=="object")switch(C.$$typeof){case l:return zt(C.render);case d:return mt(C.type,M,U);case f:{var X=C,ue=X._payload,_e=X._init;try{return mt(_e(ue),M,U)}catch{}}}return""}var ft=Object.prototype.hasOwnProperty,Yt={},qt=D.ReactDebugCurrentFrame;function Tt(C){if(C){var M=C._owner,U=mt(C.type,C._source,M?M.type:null);qt.setExtraStackFrame(U)}else qt.setExtraStackFrame(null)}function Nt(C,M,U,X,ue){{var _e=Function.call.bind(ft);for(var le in C)if(_e(C,le)){var ae=void 0;try{if(typeof C[le]!="function"){var Ze=Error((X||"React class")+": "+U+" type `"+le+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof C[le]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ze.name="Invariant Violation",Ze}ae=C[le](M,le,X,U,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch($e){ae=$e}ae&&!(ae instanceof Error)&&(Tt(ue),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",X||"React class",U,le,typeof ae),Tt(null)),ae instanceof Error&&!(ae.message in Yt)&&(Yt[ae.message]=!0,Tt(ue),x("Failed %s type: %s",U,ae.message),Tt(null))}}}var ut=Array.isArray;function yt(C){return ut(C)}function W(C){{var M=typeof Symbol=="function"&&Symbol.toStringTag,U=M&&C[Symbol.toStringTag]||C.constructor.name||"Object";return U}}function De(C){try{return Te(C),!1}catch{return!0}}function Te(C){return""+C}function ke(C){if(De(C))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",W(C)),Te(C)}var Bt=D.ReactCurrentOwner,Ft={key:!0,ref:!0,__self:!0,__source:!0},Ut,V;function J(C){if(ft.call(C,"ref")){var M=Object.getOwnPropertyDescriptor(C,"ref").get;if(M&&M.isReactWarning)return!1}return C.ref!==void 0}function Ne(C){if(ft.call(C,"key")){var M=Object.getOwnPropertyDescriptor(C,"key").get;if(M&&M.isReactWarning)return!1}return C.key!==void 0}function Oe(C,M){typeof C.ref=="string"&&Bt.current}function Ie(C,M){{var U=function(){Ut||(Ut=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",M))};U.isReactWarning=!0,Object.defineProperty(C,"key",{get:U,configurable:!0})}}function xt(C,M){{var U=function(){V||(V=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",M))};U.isReactWarning=!0,Object.defineProperty(C,"ref",{get:U,configurable:!0})}}var q=function(C,M,U,X,ue,_e,le){var ae={$$typeof:e,type:C,key:M,ref:U,props:le,_owner:_e};return ae._store={},Object.defineProperty(ae._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ae,"_self",{configurable:!1,enumerable:!1,writable:!1,value:X}),Object.defineProperty(ae,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ue}),Object.freeze&&(Object.freeze(ae.props),Object.freeze(ae)),ae};function N(C,M,U,X,ue){{var _e,le={},ae=null,Ze=null;U!==void 0&&(ke(U),ae=""+U),Ne(M)&&(ke(M.key),ae=""+M.key),J(M)&&(Ze=M.ref,Oe(M,ue));for(_e in M)ft.call(M,_e)&&!Ft.hasOwnProperty(_e)&&(le[_e]=M[_e]);if(C&&C.defaultProps){var $e=C.defaultProps;for(_e in $e)le[_e]===void 0&&(le[_e]=$e[_e])}if(ae||Ze){var qe=typeof C=="function"?C.displayName||C.name||"Unknown":C;ae&&Ie(le,qe),Ze&&xt(le,qe)}return q(C,ae,Ze,ue,X,Bt.current,le)}}var H=D.ReactCurrentOwner,Y=D.ReactDebugCurrentFrame;function I(C){if(C){var M=C._owner,U=mt(C.type,C._source,M?M.type:null);Y.setExtraStackFrame(U)}else Y.setExtraStackFrame(null)}var re;re=!1;function Z(C){return typeof C=="object"&&C!==null&&C.$$typeof===e}function ee(){{if(H.current){var C=L(H.current.type);if(C)return`
44
+ */var Ea;function ef(){return Ea||(Ea=1,process.env.NODE_ENV!=="production"&&function(){var r=b,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator,m="@@iterator";function x(A){if(A===null||typeof A!="object")return null;var I=g&&A[g]||A[m];return typeof I=="function"?I:null}var v=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function _(A){{for(var I=arguments.length,Q=new Array(I>1?I-1:0),oe=1;oe<I;oe++)Q[oe-1]=arguments[oe];C("error",A,Q)}}function C(A,I,Q){{var oe=v.ReactDebugCurrentFrame,we=oe.getStackAddendum();we!==""&&(I+="%s",Q=Q.concat([we]));var ke=Q.map(function(xe){return String(xe)});ke.unshift("Warning: "+I),Function.prototype.apply.call(console[A],console,ke)}}var S=!1,D=!1,w=!1,y=!1,k=!1,B;B=Symbol.for("react.module.reference");function F(A){return!!(typeof A=="string"||typeof A=="function"||A===n||A===i||k||A===s||A===u||A===c||y||A===h||S||D||w||typeof A=="object"&&A!==null&&(A.$$typeof===f||A.$$typeof===d||A.$$typeof===o||A.$$typeof===l||A.$$typeof===a||A.$$typeof===B||A.getModuleId!==void 0))}function T(A,I,Q){var oe=A.displayName;if(oe)return oe;var we=I.displayName||I.name||"";return we!==""?Q+"("+we+")":Q}function M(A){return A.displayName||"Context"}function L(A){if(A==null)return null;if(typeof A.tag=="number"&&_("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof A=="function")return A.displayName||A.name||null;if(typeof A=="string")return A;switch(A){case n:return"Fragment";case t:return"Portal";case i:return"Profiler";case s:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof A=="object")switch(A.$$typeof){case l:var I=A;return M(I)+".Consumer";case o:var Q=A;return M(Q._context)+".Provider";case a:return T(A,A.render,"ForwardRef");case d:var oe=A.displayName||null;return oe!==null?oe:L(A.type)||"Memo";case f:{var we=A,ke=we._payload,xe=we._init;try{return L(xe(ke))}catch{return null}}}return null}var E=Object.assign,N=0,R,O,H,U,Z,q,K;function $(){}$.__reactDisabledLog=!0;function re(){{if(N===0){R=console.log,O=console.info,H=console.warn,U=console.error,Z=console.group,q=console.groupCollapsed,K=console.groupEnd;var A={configurable:!0,enumerable:!0,value:$,writable:!0};Object.defineProperties(console,{info:A,log:A,warn:A,error:A,group:A,groupCollapsed:A,groupEnd:A})}N++}}function ae(){{if(N--,N===0){var A={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:E({},A,{value:R}),info:E({},A,{value:O}),warn:E({},A,{value:H}),error:E({},A,{value:U}),group:E({},A,{value:Z}),groupCollapsed:E({},A,{value:q}),groupEnd:E({},A,{value:K})})}N<0&&_("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var le=v.ReactCurrentDispatcher,ce;function ve(A,I,Q){{if(ce===void 0)try{throw Error()}catch(we){var oe=we.stack.trim().match(/\n( *(at )?)/);ce=oe&&oe[1]||""}return`
45
+ `+ce+A}}var pe=!1,Fe;{var et=typeof WeakMap=="function"?WeakMap:Map;Fe=new et}function ct(A,I){if(!A||pe)return"";{var Q=Fe.get(A);if(Q!==void 0)return Q}var oe;pe=!0;var we=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ke;ke=le.current,le.current=null,re();try{if(I){var xe=function(){throw Error()};if(Object.defineProperty(xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(xe,[])}catch(ft){oe=ft}Reflect.construct(A,[],xe)}else{try{xe.call()}catch(ft){oe=ft}A.call(xe.prototype)}}else{try{throw Error()}catch(ft){oe=ft}A()}}catch(ft){if(ft&&oe&&typeof ft.stack=="string"){for(var be=ft.stack.split(`
46
+ `),ot=oe.stack.split(`
47
+ `),Ue=be.length-1,Ve=ot.length-1;Ue>=1&&Ve>=0&&be[Ue]!==ot[Ve];)Ve--;for(;Ue>=1&&Ve>=0;Ue--,Ve--)if(be[Ue]!==ot[Ve]){if(Ue!==1||Ve!==1)do if(Ue--,Ve--,Ve<0||be[Ue]!==ot[Ve]){var Ct=`
48
+ `+be[Ue].replace(" at new "," at ");return A.displayName&&Ct.includes("<anonymous>")&&(Ct=Ct.replace("<anonymous>",A.displayName)),typeof A=="function"&&Fe.set(A,Ct),Ct}while(Ue>=1&&Ve>=0);break}}}finally{pe=!1,le.current=ke,ae(),Error.prepareStackTrace=we}var zr=A?A.displayName||A.name:"",_r=zr?ve(zr):"";return typeof A=="function"&&Fe.set(A,_r),_r}function kt(A,I,Q){return ct(A,!1)}function tt(A){var I=A.prototype;return!!(I&&I.isReactComponent)}function xt(A,I,Q){if(A==null)return"";if(typeof A=="function")return ct(A,tt(A));if(typeof A=="string")return ve(A);switch(A){case u:return ve("Suspense");case c:return ve("SuspenseList")}if(typeof A=="object")switch(A.$$typeof){case a:return kt(A.render);case d:return xt(A.type,I,Q);case f:{var oe=A,we=oe._payload,ke=oe._init;try{return xt(ke(we),I,Q)}catch{}}}return""}var dt=Object.prototype.hasOwnProperty,It={},ue=v.ReactDebugCurrentFrame;function _e(A){if(A){var I=A._owner,Q=xt(A.type,A._source,I?I.type:null);ue.setExtraStackFrame(Q)}else ue.setExtraStackFrame(null)}function Te(A,I,Q,oe,we){{var ke=Function.call.bind(dt);for(var xe in A)if(ke(A,xe)){var be=void 0;try{if(typeof A[xe]!="function"){var ot=Error((oe||"React class")+": "+Q+" type `"+xe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof A[xe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ot.name="Invariant Violation",ot}be=A[xe](I,xe,oe,Q,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ue){be=Ue}be&&!(be instanceof Error)&&(_e(we),_("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",oe||"React class",Q,xe,typeof be),_e(null)),be instanceof Error&&!(be.message in It)&&(It[be.message]=!0,_e(we),_("Failed %s type: %s",Q,be.message),_e(null))}}}var it=Array.isArray;function Je(A){return it(A)}function X(A){{var I=typeof Symbol=="function"&&Symbol.toStringTag,Q=I&&A[Symbol.toStringTag]||A.constructor.name||"Object";return Q}}function Be(A){try{return Me(A),!1}catch{return!0}}function Me(A){return""+A}function Re(A){if(Be(A))return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",X(A)),Me(A)}var zt=v.ReactCurrentOwner,$t={key:!0,ref:!0,__self:!0,__source:!0},Jt,ee;function se(A){if(dt.call(A,"ref")){var I=Object.getOwnPropertyDescriptor(A,"ref").get;if(I&&I.isReactWarning)return!1}return A.ref!==void 0}function je(A){if(dt.call(A,"key")){var I=Object.getOwnPropertyDescriptor(A,"key").get;if(I&&I.isReactWarning)return!1}return A.key!==void 0}function $e(A,I){typeof A.ref=="string"&&zt.current}function qe(A,I){{var Q=function(){Jt||(Jt=!0,_("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",I))};Q.isReactWarning=!0,Object.defineProperty(A,"key",{get:Q,configurable:!0})}}function Dt(A,I){{var Q=function(){ee||(ee=!0,_("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",I))};Q.isReactWarning=!0,Object.defineProperty(A,"ref",{get:Q,configurable:!0})}}var Y=function(A,I,Q,oe,we,ke,xe){var be={$$typeof:e,type:A,key:I,ref:Q,props:xe,_owner:ke};return be._store={},Object.defineProperty(be._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(be,"_self",{configurable:!1,enumerable:!1,writable:!1,value:oe}),Object.defineProperty(be,"_source",{configurable:!1,enumerable:!1,writable:!1,value:we}),Object.freeze&&(Object.freeze(be.props),Object.freeze(be)),be};function j(A,I,Q,oe,we){{var ke,xe={},be=null,ot=null;Q!==void 0&&(Re(Q),be=""+Q),je(I)&&(Re(I.key),be=""+I.key),se(I)&&(ot=I.ref,$e(I,we));for(ke in I)dt.call(I,ke)&&!$t.hasOwnProperty(ke)&&(xe[ke]=I[ke]);if(A&&A.defaultProps){var Ue=A.defaultProps;for(ke in Ue)xe[ke]===void 0&&(xe[ke]=Ue[ke])}if(be||ot){var Ve=typeof A=="function"?A.displayName||A.name||"Unknown":A;be&&qe(xe,Ve),ot&&Dt(xe,Ve)}return Y(A,be,ot,we,oe,zt.current,xe)}}var ne=v.ReactCurrentOwner,ie=v.ReactDebugCurrentFrame;function W(A){if(A){var I=A._owner,Q=xt(A.type,A._source,I?I.type:null);ie.setExtraStackFrame(Q)}else ie.setExtraStackFrame(null)}var ge;ge=!1;function de(A){return typeof A=="object"&&A!==null&&A.$$typeof===e}function fe(){{if(ne.current){var A=L(ne.current.type);if(A)return`
49
49
 
50
- Check the render method of \``+C+"`."}return""}}function me(C){return""}var Ee={};function te(C){{var M=ee();if(!M){var U=typeof C=="string"?C:C.displayName||C.name;U&&(M=`
50
+ Check the render method of \``+A+"`."}return""}}function Se(A){return""}var Ne={};function he(A){{var I=fe();if(!I){var Q=typeof A=="string"?A:A.displayName||A.name;Q&&(I=`
51
51
 
52
- Check the top-level render call using <`+U+">.")}return M}}function ne(C,M){{if(!C._store||C._store.validated||C.key!=null)return;C._store.validated=!0;var U=te(M);if(Ee[U])return;Ee[U]=!0;var X="";C&&C._owner&&C._owner!==H.current&&(X=" It was passed a child from "+L(C._owner.type)+"."),I(C),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',U,X),I(null)}}function ze(C,M){{if(typeof C!="object")return;if(yt(C))for(var U=0;U<C.length;U++){var X=C[U];Z(X)&&ne(X,M)}else if(Z(C))C._store&&(C._store.validated=!0);else if(C){var ue=y(C);if(typeof ue=="function"&&ue!==C.entries)for(var _e=ue.call(C),le;!(le=_e.next()).done;)Z(le.value)&&ne(le.value,M)}}}function We(C){{var M=C.type;if(M==null||typeof M=="string")return;var U;if(typeof M=="function")U=M.propTypes;else if(typeof M=="object"&&(M.$$typeof===l||M.$$typeof===d))U=M.propTypes;else return;if(U){var X=L(M);Nt(U,C.props,"prop",X,C)}else if(M.PropTypes!==void 0&&!re){re=!0;var ue=L(M);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ue||"Unknown")}typeof M.getDefaultProps=="function"&&!M.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Be(C){{for(var M=Object.keys(C.props),U=0;U<M.length;U++){var X=M[U];if(X!=="children"&&X!=="key"){I(C),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",X),I(null);break}}C.ref!==null&&(I(C),x("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}var ve={};function Je(C,M,U,X,ue,_e){{var le=j(C);if(!le){var ae="";(C===void 0||typeof C=="object"&&C!==null&&Object.keys(C).length===0)&&(ae+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ze=me();Ze?ae+=Ze:ae+=ee();var $e;C===null?$e="null":yt(C)?$e="array":C!==void 0&&C.$$typeof===e?($e="<"+(L(C.type)||"Unknown")+" />",ae=" Did you accidentally export a JSX literal instead of a component?"):$e=typeof C,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",$e,ae)}var qe=N(C,M,U,ue,_e);if(qe==null)return qe;if(le){var pt=M.children;if(pt!==void 0)if(X)if(yt(pt)){for(var Dr=0;Dr<pt.length;Dr++)ze(pt[Dr],C);Object.freeze&&Object.freeze(pt)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ze(pt,C)}if(ft.call(M,"key")){var ar=L(C),st=Object.keys(M).filter(function(ou){return ou!=="key"}),Ts=st.length>0?"{key: someKey, "+st.join(": ..., ")+": ...}":"{key: someKey}";if(!ve[ar+Ts]){var iu=st.length>0?"{"+st.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
52
+ Check the top-level render call using <`+Q+">.")}return I}}function me(A,I){{if(!A._store||A._store.validated||A.key!=null)return;A._store.validated=!0;var Q=he(I);if(Ne[Q])return;Ne[Q]=!0;var oe="";A&&A._owner&&A._owner!==ne.current&&(oe=" It was passed a child from "+L(A._owner.type)+"."),W(A),_('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Q,oe),W(null)}}function We(A,I){{if(typeof A!="object")return;if(Je(A))for(var Q=0;Q<A.length;Q++){var oe=A[Q];de(oe)&&me(oe,I)}else if(de(A))A._store&&(A._store.validated=!0);else if(A){var we=x(A);if(typeof we=="function"&&we!==A.entries)for(var ke=we.call(A),xe;!(xe=ke.next()).done;)de(xe.value)&&me(xe.value,I)}}}function Ge(A){{var I=A.type;if(I==null||typeof I=="string")return;var Q;if(typeof I=="function")Q=I.propTypes;else if(typeof I=="object"&&(I.$$typeof===a||I.$$typeof===d))Q=I.propTypes;else return;if(Q){var oe=L(I);Te(Q,A.props,"prop",oe,A)}else if(I.PropTypes!==void 0&&!ge){ge=!0;var we=L(I);_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",we||"Unknown")}typeof I.getDefaultProps=="function"&&!I.getDefaultProps.isReactClassApproved&&_("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Le(A){{for(var I=Object.keys(A.props),Q=0;Q<I.length;Q++){var oe=I[Q];if(oe!=="children"&&oe!=="key"){W(A),_("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",oe),W(null);break}}A.ref!==null&&(W(A),_("Invalid attribute `ref` supplied to `React.Fragment`."),W(null))}}var De={};function rt(A,I,Q,oe,we,ke){{var xe=F(A);if(!xe){var be="";(A===void 0||typeof A=="object"&&A!==null&&Object.keys(A).length===0)&&(be+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ot=Se();ot?be+=ot:be+=fe();var Ue;A===null?Ue="null":Je(A)?Ue="array":A!==void 0&&A.$$typeof===e?(Ue="<"+(L(A.type)||"Unknown")+" />",be=" Did you accidentally export a JSX literal instead of a component?"):Ue=typeof A,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ue,be)}var Ve=j(A,I,Q,we,ke);if(Ve==null)return Ve;if(xe){var Ct=I.children;if(Ct!==void 0)if(oe)if(Je(Ct)){for(var zr=0;zr<Ct.length;zr++)We(Ct[zr],A);Object.freeze&&Object.freeze(Ct)}else _("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else We(Ct,A)}if(dt.call(I,"key")){var _r=L(A),ft=Object.keys(I).filter(function(kd){return kd!=="key"}),Si=ft.length>0?"{key: someKey, "+ft.join(": ..., ")+": ...}":"{key: someKey}";if(!De[_r+Si]){var Ed=ft.length>0?"{"+ft.join(": ..., ")+": ...}":"{}";_(`A props object containing a "key" prop is being spread into JSX:
53
53
  let props = %s;
54
54
  <%s {...props} />
55
55
  React keys must be passed directly to JSX without using spread:
56
56
  let props = %s;
57
- <%s key={someKey} {...props} />`,Ts,ar,iu,ar),ve[ar+Ts]=!0}}return C===n?Be(qe):We(qe),qe}}function Ye(C,M,U){return Je(C,M,U,!0)}function ht(C,M,U){return Je(C,M,U,!1)}var Wt=ht,bt=Ye;Gr.Fragment=n,Gr.jsx=Wt,Gr.jsxs=bt}()),Gr}process.env.NODE_ENV==="production"?Ks.exports=Fu():Ks.exports=Ru();var g=Ks.exports;class $n{static filter(e,t){return e.filter(t)}static filterBy(e,t,n){return e.filter(s=>s[t]===n)}static filterByFields(e,t){return e.filter(n=>Object.entries(t).every(([s,i])=>n[s]===i))}static sort(e,t,n="asc"){return[...e].sort((s,i)=>{const o=s[t],a=i[t];if(o===a)return 0;let l=0;return o>a&&(l=1),o<a&&(l=-1),n==="asc"?l:-l})}static search(e,t,n){if(!t.trim())return e;const s=t.toLowerCase();return e.filter(i=>n.some(o=>{const a=i[o];return a==null?!1:String(a).toLowerCase().includes(s)}))}static paginate(e,t,n){const s=(t-1)*n,i=s+n;return{data:e.slice(s,i),total:e.length,page:t,totalPages:Math.ceil(e.length/n)}}static groupBy(e,t){return e.reduce((n,s)=>{const i=String(s[t]);return n[i]||(n[i]=[]),n[i].push(s),n},{})}static unique(e,t){const n=e.map(s=>s[t]);return[...new Set(n)]}static countBy(e,t){return e.reduce((n,s)=>{const i=String(s[t]);return n[i]=(n[i]||0)+1,n},{})}static pipe(e,t){return t.reduce((n,s)=>s(n),e)}}function Lu({endpoint:r,params:e,layout:t="list",title:n,emptyMessage:s="No items found",renderItem:i,keyExtractor:o=(m,y)=>m.id||m._id||String(y),searchable:a=!1,searchFields:l=[],searchPlaceholder:u="Search...",filters:c=[],pageSize:d=20,onItemClick:f,onRefresh:h,theme:p={}}){const{data:m,loading:y,error:D,refetch:x}=Dl(r,e),[E,_]=w.useState(""),[A,b]=w.useState({}),[v,S]=w.useState(1),k=w.useMemo(()=>{if(!m)return{data:[],total:0,totalPages:0};let R=m;return a&&E&&l.length>0&&(R=$n.search(R,E,l)),Object.keys(A).length>0&&(R=$n.filterByFields(R,A)),$n.paginate(R,v,d)},[m,E,A,v,d,a,l]);w.useEffect(()=>{S(1)},[E,A]);const j=()=>{_(""),b({}),S(1),x(),h==null||h()},T={background:p.background||"#ffffff",cardBackground:p.cardBackground||"#f9fafb",text:p.text||"#111827",textSecondary:p.textSecondary||"#6b7280",border:p.border||"#e5e7eb",primary:p.primary||"#3b82f6"},L=i||(R=>g.jsxs("div",{style:{padding:"16px",cursor:f?"pointer":"default"},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:T.text},children:R.title||R.name||R.label||"Untitled"}),R.description&&g.jsx("div",{style:{fontSize:"13px",color:T.textSecondary,marginTop:"4px"},children:R.description})]}));return y&&!m?g.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px",color:T.textSecondary},children:"Loading..."}):D?g.jsxs("div",{style:{padding:"24px",textAlign:"center",color:"#ef4444"},children:[g.jsx("div",{style:{fontWeight:500,marginBottom:"8px"},children:"Error"}),g.jsx("div",{style:{fontSize:"14px"},children:D.message}),g.jsx("button",{onClick:j,style:{marginTop:"16px",padding:"8px 16px",background:T.primary,color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Retry"})]}):g.jsxs("div",{style:{background:T.background,borderRadius:"12px",overflow:"hidden"},children:[(n||a||c.length>0)&&g.jsxs("div",{style:{padding:"16px",borderBottom:`1px solid ${T.border}`},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:a||c.length>0?"12px":"0"},children:[n&&g.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:T.text},children:n}),g.jsx("button",{onClick:j,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${T.border}`,borderRadius:"6px",color:T.textSecondary,cursor:"pointer",fontSize:"13px"},children:"Refresh"})]}),a&&g.jsx("input",{type:"text",placeholder:u,value:E,onChange:R=>_(R.target.value),style:{width:"100%",padding:"8px 12px",border:`1px solid ${T.border}`,borderRadius:"8px",fontSize:"14px",outline:"none"}})]}),g.jsx("div",{style:{display:t==="grid"?"grid":"flex",flexDirection:t==="list"?"column":void 0,gridTemplateColumns:t==="grid"?"repeat(auto-fill, minmax(250px, 1fr))":void 0,gap:t==="list"?"0":"16px",padding:t==="list"?"0":"16px"},children:k.data.length===0?g.jsx("div",{style:{padding:"48px",textAlign:"center",color:T.textSecondary},children:s}):k.data.map((R,P)=>g.jsx("div",{onClick:()=>f==null?void 0:f(R),style:{background:T.cardBackground,borderRadius:t==="list"?"0":"8px",borderBottom:t==="list"?`1px solid ${T.border}`:"none",transition:"all 0.15s ease"},onMouseEnter:Q=>{f&&(Q.currentTarget.style.background=T.border)},onMouseLeave:Q=>{Q.currentTarget.style.background=T.cardBackground},children:L(R,P)},o(R,P)))}),k.totalPages>1&&g.jsxs("div",{style:{padding:"16px",borderTop:`1px solid ${T.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[g.jsxs("div",{style:{fontSize:"13px",color:T.textSecondary},children:["Page ",v," of ",k.totalPages]}),g.jsxs("div",{style:{display:"flex",gap:"8px"},children:[g.jsx("button",{onClick:()=>S(R=>Math.max(1,R-1)),disabled:v===1,style:{padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:"6px",background:"white",cursor:v===1?"not-allowed":"pointer",opacity:v===1?.5:1},children:"Previous"}),g.jsx("button",{onClick:()=>S(R=>Math.min(k.totalPages,R+1)),disabled:v===k.totalPages,style:{padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:"6px",background:"white",cursor:v===k.totalPages?"not-allowed":"pointer",opacity:v===k.totalPages?.5:1},children:"Next"})]})]})]})}function Mu({item:r,onClick:e,title:t=o=>o.title||o.name||o.label||"Untitled",subtitle:n=o=>o.description||o.subtitle||"",image:s=o=>o.image||o.thumbnail||o.photo,badge:i=o=>o.badge||o.tag||o.type}){const o=t(r),a=n(r),l=s(r),u=i(r);return g.jsxs("div",{onClick:e,className:`
57
+ <%s key={someKey} {...props} />`,Si,_r,Ed,_r),De[_r+Si]=!0}}return A===n?Le(Ve):Ge(Ve),Ve}}function nt(A,I,Q){return rt(A,I,Q,!0)}function wt(A,I,Q){return rt(A,I,Q,!1)}var Zt=wt,At=nt;dn.Fragment=n,dn.jsx=Zt,dn.jsxs=At}()),dn}process.env.NODE_ENV==="production"?Hi.exports=Zd():Hi.exports=ef();var p=Hi.exports;const ou=b.createContext(void 0);function tf({apiUrl:r,systemId:e,children:t}){const[n,s]=b.useState(null),[i,o]=b.useState(null),[l,a]=b.useState(!1),[u,c]=b.useState(!0),[d]=b.useState(()=>new To({apiUrl:r,systemId:e})),f=b.useCallback(async D=>{const w=await d.isAdmin(D);a(w)},[d]),h=b.useCallback(()=>{const D=ht.getToken(),w=ht.getUser();D&&w?(o(D),s(w),f(w._id).finally(()=>c(!1))):c(!1)},[f]);b.useEffect(()=>{h()},[h]);const g=b.useCallback(async(D,w)=>{const y=await d.login(D,w);return y.success&&y.user&&y.token&&(o(y.token),s(y.user),await f(y.user._id)),y},[d,f]),m=b.useCallback(async(D,w,y)=>d.register(D,w,y),[d]),x=b.useCallback(async(D,w)=>{const y=await d.verifyEmail(D,w);return y.success&&y.user&&y.token&&(o(y.token),s(y.user),await f(y.user._id)),y},[d,f]),v=b.useCallback(async D=>d.requestPasswordReset(D),[d]),_=b.useCallback(async(D,w,y)=>{const k=await d.setPasswordWithCode(D,w,y);return k.success&&k.user&&k.token&&(o(k.token),s(k.user),await f(k.user._id)),k},[d,f]),C=b.useCallback(async D=>d.resendVerificationCode(D),[d]),S=b.useCallback(()=>{d.logout(),s(null),o(null),a(!1)},[d]);return p.jsx(ou.Provider,{value:{user:n,token:i,isAdmin:l,loading:u,login:g,register:m,verifyEmail:x,requestPasswordReset:v,setPasswordWithCode:_,resendVerificationCode:C,logout:S,refreshUser:h},children:t})}function rf(){const r=b.useContext(ou);if(r===void 0)throw new Error("useAuth must be used within an AuthProvider");return r}const nf={primaryColor:"#1877F2",primaryHoverColor:"#166FE5",backgroundColor:"#ffffff",textColor:"#111827",textMutedColor:"#6B7280",borderColor:"#D1D5DB",errorColor:"#DC2626",errorBackgroundColor:"#FEF2F2",inputBackground:"#ffffff",borderRadius:"0.5rem"};function No({onLogin:r,onSuccess:e,logo:t,title:n="Connexion",submitText:s="Se connecter",loadingText:i="Connexion...",emailLabel:o="Email",passwordLabel:l="Mot de passe",theme:a,className:u="",isModal:c=!1}){const[d,f]=b.useState(""),[h,g]=b.useState(""),[m,x]=b.useState(""),[v,_]=b.useState(!1),C={...nf,...a};async function S(F){F.preventDefault(),_(!0),x("");const T=await r(d,h);T.success?e==null||e():x(T.error||"Connexion impossible"),_(!1)}const D={backgroundColor:C.backgroundColor,borderRadius:C.borderRadius,padding:"1.5rem",width:"100%",maxWidth:"24rem",...c&&{boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)"}},w={width:"100%",padding:"0.5rem 1rem",border:`1px solid ${C.borderColor}`,borderRadius:C.borderRadius,backgroundColor:C.inputBackground,color:C.textColor,fontSize:"1rem",outline:"none"},y={display:"block",fontSize:"0.875rem",fontWeight:500,color:C.textMutedColor,marginBottom:"0.25rem"},k={width:"100%",padding:"0.75rem",backgroundColor:v?C.textMutedColor:C.primaryColor,color:"#ffffff",border:"none",borderRadius:C.borderRadius,fontSize:"1rem",fontWeight:500,cursor:v?"not-allowed":"pointer",transition:"background-color 0.2s"},B={padding:"0.75rem",backgroundColor:C.errorBackgroundColor,border:`1px solid ${C.errorColor}20`,borderRadius:C.borderRadius,marginBottom:"1rem"};return p.jsxs("div",{style:D,className:u,children:[t&&p.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"1.5rem"},children:t}),p.jsx("h2",{style:{fontSize:"1.25rem",fontWeight:700,color:C.textColor,marginBottom:"1rem",textAlign:t?"center":"left"},children:n}),p.jsxs("form",{onSubmit:S,children:[m&&p.jsx("div",{style:B,children:p.jsx("p",{style:{fontSize:"0.875rem",color:C.errorColor,margin:0},children:m})}),p.jsxs("div",{style:{marginBottom:"1rem"},children:[p.jsx("label",{style:y,children:o}),p.jsx("input",{type:"email",value:d,onChange:F=>f(F.target.value),required:!0,style:w,onFocus:F=>{F.target.style.borderColor=C.primaryColor,F.target.style.boxShadow=`0 0 0 2px ${C.primaryColor}20`},onBlur:F=>{F.target.style.borderColor=C.borderColor,F.target.style.boxShadow="none"}})]}),p.jsxs("div",{style:{marginBottom:"1.5rem"},children:[p.jsx("label",{style:y,children:l}),p.jsx("input",{type:"password",value:h,onChange:F=>g(F.target.value),required:!0,style:w,onFocus:F=>{F.target.style.borderColor=C.primaryColor,F.target.style.boxShadow=`0 0 0 2px ${C.primaryColor}20`},onBlur:F=>{F.target.style.borderColor=C.borderColor,F.target.style.boxShadow="none"}})]}),p.jsx("button",{type:"submit",disabled:v,style:k,onMouseEnter:F=>{v||(F.target.style.backgroundColor=C.primaryHoverColor)},onMouseLeave:F=>{v||(F.target.style.backgroundColor=C.primaryColor)},children:v?i:s})]})]})}function sf({isOpen:r,onClose:e,backdropBlur:t=!0,...n}){if(!r)return null;const s={position:"fixed",inset:0,zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem"},i={position:"absolute",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",...t&&{backdropFilter:"blur(4px)"}},o={position:"relative",animation:"slideUp 0.2s ease-out"};return p.jsxs("div",{style:s,children:[p.jsx("div",{style:i,onClick:e}),p.jsxs("div",{style:o,children:[p.jsx("button",{onClick:e,style:{position:"absolute",top:"0.75rem",right:"0.75rem",zIndex:10,background:"none",border:"none",padding:"0.25rem",cursor:"pointer",color:"#9CA3AF"},onMouseEnter:l=>{l.target.style.color="#4B5563"},onMouseLeave:l=>{l.target.style.color="#9CA3AF"},children:p.jsx("svg",{width:"24",height:"24",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),p.jsx(No,{...n,isModal:!0})]}),p.jsx("style",{children:`
58
+ @keyframes slideUp {
59
+ from {
60
+ opacity: 0;
61
+ transform: translateY(10px);
62
+ }
63
+ to {
64
+ opacity: 1;
65
+ transform: translateY(0);
66
+ }
67
+ }
68
+ `})]})}const of={primaryColor:"#1877F2",primaryHoverColor:"#166FE5",backgroundColor:"#ffffff",textColor:"#111827",textMutedColor:"#6B7280",borderColor:"#D1D5DB",errorColor:"#DC2626",errorBackgroundColor:"#FEF2F2",successColor:"#059669",successBackgroundColor:"#ECFDF5",inputBackground:"#ffffff",borderRadius:"0.5rem"};function au({onRegister:r,onSuccess:e,onLoginClick:t,logo:n,title:s="Créer un compte",submitText:i="S'inscrire",loadingText:o="Inscription...",emailLabel:l="Email",passwordLabel:a="Mot de passe",confirmPasswordLabel:u="Confirmer le mot de passe",firstNameLabel:c="Prénom",lastNameLabel:d="Nom",loginLinkText:f="Déjà un compte ? Se connecter",showNameFields:h=!1,theme:g,className:m="",isModal:x=!1}){const[v,_]=b.useState(""),[C,S]=b.useState(""),[D,w]=b.useState(""),[y,k]=b.useState(""),[B,F]=b.useState(""),[T,M]=b.useState(""),[L,E]=b.useState(!1),N={...of,...g};async function R($){if($.preventDefault(),M(""),C!==D){M("Les mots de passe ne correspondent pas");return}if(C.length<8){M("Le mot de passe doit contenir au moins 8 caractères");return}E(!0);const ae=await r(v,C,h?{firstName:y,lastName:B}:void 0);ae.success?e==null||e(v):M(ae.error||"Erreur lors de l'inscription"),E(!1)}const O={backgroundColor:N.backgroundColor,borderRadius:N.borderRadius,padding:"1.5rem",width:"100%",maxWidth:"24rem",...x&&{boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)"}},H={width:"100%",padding:"0.5rem 1rem",border:`1px solid ${N.borderColor}`,borderRadius:N.borderRadius,backgroundColor:N.inputBackground,color:N.textColor,fontSize:"1rem",outline:"none",boxSizing:"border-box"},U={display:"block",fontSize:"0.875rem",fontWeight:500,color:N.textMutedColor,marginBottom:"0.25rem"},Z={width:"100%",padding:"0.75rem",backgroundColor:L?N.textMutedColor:N.primaryColor,color:"#ffffff",border:"none",borderRadius:N.borderRadius,fontSize:"1rem",fontWeight:500,cursor:L?"not-allowed":"pointer",transition:"background-color 0.2s"},q={padding:"0.75rem",backgroundColor:N.errorBackgroundColor,border:`1px solid ${N.errorColor}20`,borderRadius:N.borderRadius,marginBottom:"1rem"},K={color:N.primaryColor,textDecoration:"none",fontSize:"0.875rem",cursor:"pointer"};return p.jsxs("div",{style:O,className:m,children:[n&&p.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"1.5rem"},children:n}),p.jsx("h2",{style:{fontSize:"1.25rem",fontWeight:700,color:N.textColor,marginBottom:"1rem",textAlign:n?"center":"left"},children:s}),p.jsxs("form",{onSubmit:R,children:[T&&p.jsx("div",{style:q,children:p.jsx("p",{style:{fontSize:"0.875rem",color:N.errorColor,margin:0},children:T})}),h&&p.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginBottom:"1rem"},children:[p.jsxs("div",{style:{flex:1},children:[p.jsx("label",{style:U,children:c}),p.jsx("input",{type:"text",value:y,onChange:$=>k($.target.value),style:H})]}),p.jsxs("div",{style:{flex:1},children:[p.jsx("label",{style:U,children:d}),p.jsx("input",{type:"text",value:B,onChange:$=>F($.target.value),style:H})]})]}),p.jsxs("div",{style:{marginBottom:"1rem"},children:[p.jsx("label",{style:U,children:l}),p.jsx("input",{type:"email",value:v,onChange:$=>_($.target.value),required:!0,style:H})]}),p.jsxs("div",{style:{marginBottom:"1rem"},children:[p.jsx("label",{style:U,children:a}),p.jsx("input",{type:"password",value:C,onChange:$=>S($.target.value),required:!0,minLength:8,style:H})]}),p.jsxs("div",{style:{marginBottom:"1.5rem"},children:[p.jsx("label",{style:U,children:u}),p.jsx("input",{type:"password",value:D,onChange:$=>w($.target.value),required:!0,style:H})]}),p.jsx("button",{type:"submit",disabled:L,style:Z,onMouseEnter:$=>{L||($.target.style.backgroundColor=N.primaryHoverColor)},onMouseLeave:$=>{L||($.target.style.backgroundColor=N.primaryColor)},children:L?o:i}),t&&p.jsx("p",{style:{textAlign:"center",marginTop:"1rem",marginBottom:0},children:p.jsx("span",{style:K,onClick:t,children:f})})]})]})}const af={primaryColor:"#1877F2",primaryHoverColor:"#166FE5",backgroundColor:"#ffffff",textColor:"#111827",textMutedColor:"#6B7280",borderColor:"#D1D5DB",errorColor:"#DC2626",errorBackgroundColor:"#FEF2F2",successColor:"#059669",inputBackground:"#ffffff",borderRadius:"0.5rem"};function Gi({email:r,onVerify:e,onSuccess:t,onResendCode:n,onBackClick:s,title:i="Vérification",subtitle:o,submitText:l="Vérifier",loadingText:a="Vérification...",resendText:u="Renvoyer le code",resendingText:c="Envoi...",backText:d="← Retour",codeLength:f=6,theme:h,className:g="",isModal:m=!1}){const[x,v]=b.useState(Array(f).fill("")),[_,C]=b.useState(""),[S,D]=b.useState(!1),[w,y]=b.useState(!1),[k,B]=b.useState(!1),F=b.useRef([]),T={...af,...h};b.useEffect(()=>{var q;(q=F.current[0])==null||q.focus()},[]);const M=(q,K)=>{var ae;const $=K.replace(/\D/g,"").slice(-1),re=[...x];if(re[q]=$,v(re),C(""),$&&q<f-1&&((ae=F.current[q+1])==null||ae.focus()),$&&q===f-1){const le=re.join("");le.length===f&&N(le)}},L=(q,K)=>{var $;K.key==="Backspace"&&!x[q]&&q>0&&(($=F.current[q-1])==null||$.focus())},E=q=>{var ae;q.preventDefault();const K=q.clipboardData.getData("text").replace(/\D/g,"").slice(0,f),$=[...x];K.split("").forEach((le,ce)=>{ce<f&&($[ce]=le)}),v($);const re=Math.min(K.length,f)-1;re>=0&&((ae=F.current[re])==null||ae.focus()),K.length===f&&N(K)};async function N(q){var re;const K=q||x.join("");if(K.length!==f){C("Veuillez entrer le code complet");return}D(!0),C("");const $=await e(r,K);$.success?t==null||t():(C($.error||"Code invalide"),v(Array(f).fill("")),(re=F.current[0])==null||re.focus()),D(!1)}async function R(){if(!n)return;y(!0),B(!1),C("");const q=await n(r);q.success?(B(!0),setTimeout(()=>B(!1),3e3)):C(q.error||"Erreur lors de l'envoi"),y(!1)}const O={backgroundColor:T.backgroundColor,borderRadius:T.borderRadius,padding:"1.5rem",width:"100%",maxWidth:"24rem",...m&&{boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)"}},H={width:"3rem",height:"3.5rem",textAlign:"center",fontSize:"1.5rem",fontWeight:600,border:`2px solid ${T.borderColor}`,borderRadius:T.borderRadius,backgroundColor:T.inputBackground,color:T.textColor,outline:"none",transition:"border-color 0.2s, box-shadow 0.2s"},U={width:"100%",padding:"0.75rem",backgroundColor:S?T.textMutedColor:T.primaryColor,color:"#ffffff",border:"none",borderRadius:T.borderRadius,fontSize:"1rem",fontWeight:500,cursor:S?"not-allowed":"pointer",transition:"background-color 0.2s"},Z={color:T.primaryColor,textDecoration:"none",fontSize:"0.875rem",cursor:"pointer",background:"none",border:"none",padding:0};return p.jsxs("div",{style:O,className:g,children:[p.jsx("h2",{style:{fontSize:"1.25rem",fontWeight:700,color:T.textColor,marginBottom:"0.5rem",textAlign:"center"},children:i}),p.jsx("p",{style:{fontSize:"0.875rem",color:T.textMutedColor,textAlign:"center",marginBottom:"1.5rem"},children:o||`Un code a été envoyé à ${r}`}),_&&p.jsx("div",{style:{padding:"0.75rem",backgroundColor:T.errorBackgroundColor,border:`1px solid ${T.errorColor}20`,borderRadius:T.borderRadius,marginBottom:"1rem"},children:p.jsx("p",{style:{fontSize:"0.875rem",color:T.errorColor,margin:0,textAlign:"center"},children:_})}),k&&p.jsx("div",{style:{padding:"0.75rem",backgroundColor:"#ECFDF5",border:`1px solid ${T.successColor}20`,borderRadius:T.borderRadius,marginBottom:"1rem"},children:p.jsx("p",{style:{fontSize:"0.875rem",color:T.successColor,margin:0,textAlign:"center"},children:"Code renvoyé !"})}),p.jsx("div",{style:{display:"flex",justifyContent:"center",gap:"0.5rem",marginBottom:"1.5rem"},children:x.map((q,K)=>p.jsx("input",{ref:$=>{F.current[K]=$},type:"text",inputMode:"numeric",maxLength:1,value:q,onChange:$=>M(K,$.target.value),onKeyDown:$=>L(K,$),onPaste:E,disabled:S,style:{...H,borderColor:q?T.primaryColor:T.borderColor},onFocus:$=>{$.target.style.borderColor=T.primaryColor,$.target.style.boxShadow=`0 0 0 3px ${T.primaryColor}20`},onBlur:$=>{$.target.style.borderColor=q?T.primaryColor:T.borderColor,$.target.style.boxShadow="none"}},K))}),p.jsx("button",{type:"button",onClick:()=>N(),disabled:S||x.join("").length!==f,style:{...U,opacity:x.join("").length!==f?.5:1},children:S?a:l}),n&&p.jsx("p",{style:{textAlign:"center",marginTop:"1rem",marginBottom:0},children:p.jsx("button",{type:"button",onClick:R,disabled:w,style:{...Z,opacity:w?.5:1},children:w?c:u})}),s&&p.jsx("p",{style:{textAlign:"center",marginTop:"0.75rem",marginBottom:0},children:p.jsx("button",{type:"button",onClick:s,style:Z,children:d})})]})}const lf={primaryColor:"#1877F2",primaryHoverColor:"#166FE5",backgroundColor:"#ffffff",textColor:"#111827",textMutedColor:"#6B7280",borderColor:"#D1D5DB",errorColor:"#DC2626",errorBackgroundColor:"#FEF2F2",successColor:"#059669",successBackgroundColor:"#ECFDF5",inputBackground:"#ffffff",borderRadius:"0.5rem"};function lu({onRequestReset:r,onSuccess:e,onBackClick:t,title:n="Mot de passe oublié",subtitle:s="Entrez votre email pour recevoir un code de réinitialisation",submitText:i="Envoyer le code",loadingText:o="Envoi...",emailLabel:l="Email",backText:a="← Retour à la connexion",theme:u,className:c="",isModal:d=!1}){const[f,h]=b.useState(""),[g,m]=b.useState(""),[x,v]=b.useState(!1),_={...lf,...u};async function C(B){B.preventDefault(),v(!0),m("");const F=await r(f);F.success?e==null||e(f):m(F.error||"Erreur lors de l'envoi"),v(!1)}const S={backgroundColor:_.backgroundColor,borderRadius:_.borderRadius,padding:"1.5rem",width:"100%",maxWidth:"24rem",...d&&{boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)"}},D={width:"100%",padding:"0.5rem 1rem",border:`1px solid ${_.borderColor}`,borderRadius:_.borderRadius,backgroundColor:_.inputBackground,color:_.textColor,fontSize:"1rem",outline:"none",boxSizing:"border-box"},w={display:"block",fontSize:"0.875rem",fontWeight:500,color:_.textMutedColor,marginBottom:"0.25rem"},y={width:"100%",padding:"0.75rem",backgroundColor:x?_.textMutedColor:_.primaryColor,color:"#ffffff",border:"none",borderRadius:_.borderRadius,fontSize:"1rem",fontWeight:500,cursor:x?"not-allowed":"pointer",transition:"background-color 0.2s"},k={color:_.primaryColor,textDecoration:"none",fontSize:"0.875rem",cursor:"pointer",background:"none",border:"none",padding:0};return p.jsxs("div",{style:S,className:c,children:[p.jsx("h2",{style:{fontSize:"1.25rem",fontWeight:700,color:_.textColor,marginBottom:"0.5rem",textAlign:"center"},children:n}),p.jsx("p",{style:{fontSize:"0.875rem",color:_.textMutedColor,textAlign:"center",marginBottom:"1.5rem"},children:s}),p.jsxs("form",{onSubmit:C,children:[g&&p.jsx("div",{style:{padding:"0.75rem",backgroundColor:_.errorBackgroundColor,border:`1px solid ${_.errorColor}20`,borderRadius:_.borderRadius,marginBottom:"1rem"},children:p.jsx("p",{style:{fontSize:"0.875rem",color:_.errorColor,margin:0},children:g})}),p.jsxs("div",{style:{marginBottom:"1.5rem"},children:[p.jsx("label",{style:w,children:l}),p.jsx("input",{type:"email",value:f,onChange:B=>h(B.target.value),required:!0,style:D})]}),p.jsx("button",{type:"submit",disabled:x,style:y,onMouseEnter:B=>{x||(B.target.style.backgroundColor=_.primaryHoverColor)},onMouseLeave:B=>{x||(B.target.style.backgroundColor=_.primaryColor)},children:x?o:i}),t&&p.jsx("p",{style:{textAlign:"center",marginTop:"1rem",marginBottom:0},children:p.jsx("button",{type:"button",onClick:t,style:k,children:a})})]})]})}const uf={primaryColor:"#1877F2",primaryHoverColor:"#166FE5",backgroundColor:"#ffffff",textColor:"#111827",textMutedColor:"#6B7280",borderColor:"#D1D5DB",errorColor:"#DC2626",errorBackgroundColor:"#FEF2F2",inputBackground:"#ffffff",borderRadius:"0.5rem"};function uu({email:r,code:e,onResetPassword:t,onSuccess:n,onBackClick:s,title:i="Nouveau mot de passe",subtitle:o,submitText:l="Réinitialiser",loadingText:a="Réinitialisation...",passwordLabel:u="Nouveau mot de passe",confirmPasswordLabel:c="Confirmer le mot de passe",backText:d="← Retour",theme:f,className:h="",isModal:g=!1}){const[m,x]=b.useState(""),[v,_]=b.useState(""),[C,S]=b.useState(""),[D,w]=b.useState(!1),y={...uf,...f};async function k(E){if(E.preventDefault(),S(""),m!==v){S("Les mots de passe ne correspondent pas");return}if(m.length<8){S("Le mot de passe doit contenir au moins 8 caractères");return}w(!0);const N=await t(r,e,m);N.success?n==null||n():S(N.error||"Erreur lors de la réinitialisation"),w(!1)}const B={backgroundColor:y.backgroundColor,borderRadius:y.borderRadius,padding:"1.5rem",width:"100%",maxWidth:"24rem",...g&&{boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)"}},F={width:"100%",padding:"0.5rem 1rem",border:`1px solid ${y.borderColor}`,borderRadius:y.borderRadius,backgroundColor:y.inputBackground,color:y.textColor,fontSize:"1rem",outline:"none",boxSizing:"border-box"},T={display:"block",fontSize:"0.875rem",fontWeight:500,color:y.textMutedColor,marginBottom:"0.25rem"},M={width:"100%",padding:"0.75rem",backgroundColor:D?y.textMutedColor:y.primaryColor,color:"#ffffff",border:"none",borderRadius:y.borderRadius,fontSize:"1rem",fontWeight:500,cursor:D?"not-allowed":"pointer",transition:"background-color 0.2s"},L={color:y.primaryColor,textDecoration:"none",fontSize:"0.875rem",cursor:"pointer",background:"none",border:"none",padding:0};return p.jsxs("div",{style:B,className:h,children:[p.jsx("h2",{style:{fontSize:"1.25rem",fontWeight:700,color:y.textColor,marginBottom:"0.5rem",textAlign:"center"},children:i}),o&&p.jsx("p",{style:{fontSize:"0.875rem",color:y.textMutedColor,textAlign:"center",marginBottom:"1.5rem"},children:o}),p.jsxs("form",{onSubmit:k,children:[C&&p.jsx("div",{style:{padding:"0.75rem",backgroundColor:y.errorBackgroundColor,border:`1px solid ${y.errorColor}20`,borderRadius:y.borderRadius,marginBottom:"1rem"},children:p.jsx("p",{style:{fontSize:"0.875rem",color:y.errorColor,margin:0},children:C})}),p.jsxs("div",{style:{marginBottom:"1rem"},children:[p.jsx("label",{style:T,children:u}),p.jsx("input",{type:"password",value:m,onChange:E=>x(E.target.value),required:!0,minLength:8,style:F})]}),p.jsxs("div",{style:{marginBottom:"1.5rem"},children:[p.jsx("label",{style:T,children:c}),p.jsx("input",{type:"password",value:v,onChange:E=>_(E.target.value),required:!0,style:F})]}),p.jsx("button",{type:"submit",disabled:D,style:M,onMouseEnter:E=>{D||(E.target.style.backgroundColor=y.primaryHoverColor)},onMouseLeave:E=>{D||(E.target.style.backgroundColor=y.primaryColor)},children:D?a:l}),s&&p.jsx("p",{style:{textAlign:"center",marginTop:"1rem",marginBottom:0},children:p.jsx("button",{type:"button",onClick:s,style:L,children:d})})]})]})}function cu({onLogin:r,onRegister:e,onVerifyEmail:t,onRequestPasswordReset:n,onResetPassword:s,onResendCode:i,onSuccess:o,initialState:l="login",logo:a,theme:u,showNameFields:c=!1,className:d="",isModal:f=!1,labels:h={}}){const[g,m]=b.useState(l),[x,v]=b.useState(""),[_,C]=b.useState("");async function S(F,T){const M=await r(F,T);return M.requiresVerification?(v(F),m("verify-email"),{success:!1,error:"Veuillez vérifier votre email"}):M}async function D(F,T,M){const L=await e(F,T,M);return L.success&&L.requiresVerification&&(v(F),m("verify-email")),L}async function w(F){const T=await n(F);return T.success&&(v(F),m("verify-reset-code")),T}async function y(F,T){return C(T),m("reset-password"),{success:!0}}const k=()=>{switch(g){case"login":return p.jsx(No,{onLogin:S,onSuccess:o,logo:a,theme:u,title:h.loginTitle,className:d,isModal:f});case"register":return p.jsx(au,{onRegister:D,onSuccess:()=>{},onLoginClick:()=>m("login"),logo:a,theme:u,title:h.registerTitle,showNameFields:c,className:d,isModal:f});case"verify-email":return p.jsx(Gi,{email:x,onVerify:t,onSuccess:o,onResendCode:i,onBackClick:()=>m("login"),title:h.verifyTitle||"Vérification email",theme:u,className:d,isModal:f});case"forgot-password":return p.jsx(lu,{onRequestReset:w,onBackClick:()=>m("login"),title:h.forgotPasswordTitle,theme:u,className:d,isModal:f});case"verify-reset-code":return p.jsx(Gi,{email:x,onVerify:y,onResendCode:i,onBackClick:()=>m("forgot-password"),title:"Code de réinitialisation",theme:u,className:d,isModal:f});case"reset-password":return p.jsx(uu,{email:x,code:_,onResetPassword:s,onSuccess:o,onBackClick:()=>m("login"),title:h.resetPasswordTitle,theme:u,className:d,isModal:f})}},B=()=>{const F={color:(u==null?void 0:u.primaryColor)||"#1877F2",textDecoration:"none",fontSize:"0.875rem",cursor:"pointer",background:"none",border:"none",padding:0};return g==="login"?p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"1rem",padding:"0 1.5rem",maxWidth:"24rem",width:"100%"},children:[p.jsx("button",{type:"button",onClick:()=>m("forgot-password"),style:F,children:"Mot de passe oublié ?"}),p.jsx("button",{type:"button",onClick:()=>m("register"),style:F,children:"Créer un compte"})]}):null};return p.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",width:"100%"},children:[k(),B()]})}function cf({isOpen:r,onClose:e,backdropBlur:t=!0,...n}){return r?p.jsxs("div",{style:{position:"fixed",inset:0,zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem"},children:[p.jsx("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",...t&&{backdropFilter:"blur(4px)"}},onClick:e}),p.jsxs("div",{style:{position:"relative",animation:"authFlowSlideUp 0.2s ease-out"},children:[p.jsx("button",{onClick:e,style:{position:"absolute",top:"0.75rem",right:"0.75rem",zIndex:10,background:"none",border:"none",padding:"0.25rem",cursor:"pointer",color:"#9CA3AF"},children:p.jsx("svg",{width:"24",height:"24",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),p.jsx(cu,{...n,isModal:!0})]}),p.jsx("style",{children:`
69
+ @keyframes authFlowSlideUp {
70
+ from {
71
+ opacity: 0;
72
+ transform: translateY(10px);
73
+ }
74
+ to {
75
+ opacity: 1;
76
+ transform: translateY(0);
77
+ }
78
+ }
79
+ `})]}):null}function du(r,e,t={}){const{enabled:n=!0,refetchOnMount:s=!0,onSuccess:i,onError:o}=t,[l,a]=b.useState(null),[u,c]=b.useState(n),[d,f]=b.useState(null),h=b.useCallback(async()=>{if(n){c(!0),f(null);try{const m=await Bo().get(r,e);a(m),i==null||i(m)}catch(g){const m=g instanceof Error?g:new Error("Unknown error");f(m),o==null||o(m)}finally{c(!1)}}},[r,JSON.stringify(e),n,i,o]);return b.useEffect(()=>{s&&h()},[h,s]),{data:l,loading:u,error:d,refetch:h}}function df(r,e="POST",t={}){const{onSuccess:n,onError:s}=t,[i,o]=b.useState(null),[l,a]=b.useState(!1),[u,c]=b.useState(null),d=b.useCallback(async h=>{a(!0),c(null);try{const g=Bo();let m;switch(e){case"POST":m=await g.post(r,h);break;case"PUT":m=await g.put(r,h);break;case"PATCH":m=await g.patch(r,h);break;case"DELETE":m=await g.delete(r);break;default:throw new Error(`Unsupported method: ${e}`)}return o(m),n==null||n(m,h),m}catch(g){const m=g instanceof Error?g:new Error("Unknown error");return c(m),s==null||s(m,h),null}finally{a(!1)}},[r,e,n,s]),f=b.useCallback(()=>{o(null),c(null),a(!1)},[]);return{data:i,loading:l,error:u,mutate:d,reset:f}}class _s{static filter(e,t){return e.filter(t)}static filterBy(e,t,n){return e.filter(s=>s[t]===n)}static filterByFields(e,t){return e.filter(n=>Object.entries(t).every(([s,i])=>n[s]===i))}static sort(e,t,n="asc"){return[...e].sort((s,i)=>{const o=s[t],l=i[t];if(o===l)return 0;let a=0;return o>l&&(a=1),o<l&&(a=-1),n==="asc"?a:-a})}static search(e,t,n){if(!t.trim())return e;const s=t.toLowerCase();return e.filter(i=>n.some(o=>{const l=i[o];return l==null?!1:String(l).toLowerCase().includes(s)}))}static paginate(e,t,n){const s=(t-1)*n,i=s+n;return{data:e.slice(s,i),total:e.length,page:t,totalPages:Math.ceil(e.length/n)}}static groupBy(e,t){return e.reduce((n,s)=>{const i=String(s[t]);return n[i]||(n[i]=[]),n[i].push(s),n},{})}static unique(e,t){const n=e.map(s=>s[t]);return[...new Set(n)]}static countBy(e,t){return e.reduce((n,s)=>{const i=String(s[t]);return n[i]=(n[i]||0)+1,n},{})}static pipe(e,t){return t.reduce((n,s)=>s(n),e)}}function ff({endpoint:r,params:e,layout:t="list",title:n,emptyMessage:s="No items found",renderItem:i,keyExtractor:o=(m,x)=>m.id||m._id||String(x),searchable:l=!1,searchFields:a=[],searchPlaceholder:u="Search...",filters:c=[],pageSize:d=20,onItemClick:f,onRefresh:h,theme:g={}}){const{data:m,loading:x,error:v,refetch:_}=du(r,e),[C,S]=b.useState(""),[D,w]=b.useState({}),[y,k]=b.useState(1),B=b.useMemo(()=>{if(!m)return{data:[],total:0,totalPages:0};let E=m;return l&&C&&a.length>0&&(E=_s.search(E,C,a)),Object.keys(D).length>0&&(E=_s.filterByFields(E,D)),_s.paginate(E,y,d)},[m,C,D,y,d,l,a]);b.useEffect(()=>{k(1)},[C,D]);const F=()=>{S(""),w({}),k(1),_(),h==null||h()},T={background:g.background||"#ffffff",cardBackground:g.cardBackground||"#f9fafb",text:g.text||"#111827",textSecondary:g.textSecondary||"#6b7280",border:g.border||"#e5e7eb",primary:g.primary||"#3b82f6"},L=i||(E=>p.jsxs("div",{style:{padding:"16px",cursor:f?"pointer":"default"},children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:T.text},children:E.title||E.name||E.label||"Untitled"}),E.description&&p.jsx("div",{style:{fontSize:"13px",color:T.textSecondary,marginTop:"4px"},children:E.description})]}));return x&&!m?p.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px",color:T.textSecondary},children:"Loading..."}):v?p.jsxs("div",{style:{padding:"24px",textAlign:"center",color:"#ef4444"},children:[p.jsx("div",{style:{fontWeight:500,marginBottom:"8px"},children:"Error"}),p.jsx("div",{style:{fontSize:"14px"},children:v.message}),p.jsx("button",{onClick:F,style:{marginTop:"16px",padding:"8px 16px",background:T.primary,color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Retry"})]}):p.jsxs("div",{style:{background:T.background,borderRadius:"12px",overflow:"hidden"},children:[(n||l||c.length>0)&&p.jsxs("div",{style:{padding:"16px",borderBottom:`1px solid ${T.border}`},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:l||c.length>0?"12px":"0"},children:[n&&p.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:T.text},children:n}),p.jsx("button",{onClick:F,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${T.border}`,borderRadius:"6px",color:T.textSecondary,cursor:"pointer",fontSize:"13px"},children:"Refresh"})]}),l&&p.jsx("input",{type:"text",placeholder:u,value:C,onChange:E=>S(E.target.value),style:{width:"100%",padding:"8px 12px",border:`1px solid ${T.border}`,borderRadius:"8px",fontSize:"14px",outline:"none"}})]}),p.jsx("div",{style:{display:t==="grid"?"grid":"flex",flexDirection:t==="list"?"column":void 0,gridTemplateColumns:t==="grid"?"repeat(auto-fill, minmax(250px, 1fr))":void 0,gap:t==="list"?"0":"16px",padding:t==="list"?"0":"16px"},children:B.data.length===0?p.jsx("div",{style:{padding:"48px",textAlign:"center",color:T.textSecondary},children:s}):B.data.map((E,N)=>p.jsx("div",{onClick:()=>f==null?void 0:f(E),style:{background:T.cardBackground,borderRadius:t==="list"?"0":"8px",borderBottom:t==="list"?`1px solid ${T.border}`:"none",transition:"all 0.15s ease"},onMouseEnter:R=>{f&&(R.currentTarget.style.background=T.border)},onMouseLeave:R=>{R.currentTarget.style.background=T.cardBackground},children:L(E,N)},o(E,N)))}),B.totalPages>1&&p.jsxs("div",{style:{padding:"16px",borderTop:`1px solid ${T.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[p.jsxs("div",{style:{fontSize:"13px",color:T.textSecondary},children:["Page ",y," of ",B.totalPages]}),p.jsxs("div",{style:{display:"flex",gap:"8px"},children:[p.jsx("button",{onClick:()=>k(E=>Math.max(1,E-1)),disabled:y===1,style:{padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:"6px",background:"white",cursor:y===1?"not-allowed":"pointer",opacity:y===1?.5:1},children:"Previous"}),p.jsx("button",{onClick:()=>k(E=>Math.min(B.totalPages,E+1)),disabled:y===B.totalPages,style:{padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:"6px",background:"white",cursor:y===B.totalPages?"not-allowed":"pointer",opacity:y===B.totalPages?.5:1},children:"Next"})]})]})]})}function hf({item:r,onClick:e,title:t=o=>o.title||o.name||o.label||"Untitled",subtitle:n=o=>o.description||o.subtitle||"",image:s=o=>o.image||o.thumbnail||o.photo,badge:i=o=>o.badge||o.tag||o.type}){const o=t(r),l=n(r),a=s(r),u=i(r);return p.jsxs("div",{onClick:e,className:`
58
80
  flex items-center gap-4 p-4 border-b border-gray-200
59
81
  hover:bg-gray-50 transition-colors
60
82
  ${e?"cursor-pointer":""}
61
- `,children:[l&&g.jsx("div",{className:"flex-shrink-0",children:g.jsx("img",{src:l,alt:o,className:"w-16 h-16 object-cover rounded-lg"})}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("h3",{className:"font-medium text-gray-900 truncate",children:o}),u&&g.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:u})]}),a&&g.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:a})]}),e&&g.jsx("div",{className:"flex-shrink-0 text-gray-400",children:g.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function Pu({item:r,onClose:e,title:t=i=>i.title||i.name||i.label||"Detail",image:n=i=>i.image||i.thumbnail||i.photo,fields:s=[]}){if(!r)return null;const i=t(r),o=n(r);return g.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:g.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[g.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[g.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:i}),e&&g.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:g.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g.jsxs("div",{className:"p-6",children:[o&&g.jsx("div",{className:"mb-6",children:g.jsx("img",{src:o,alt:i,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&g.jsx("div",{className:"space-y-4",children:s.map((a,l)=>{const u=a.value(r);return u==null||u===""?null:g.jsxs("div",{children:[g.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:a.label}),g.jsx("div",{className:"text-base text-gray-900",children:typeof u=="object"?JSON.stringify(u,null,2):String(u)})]},l)})}),s.length===0&&g.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(r,null,2)})]}),e&&g.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:g.jsx("button",{onClick:e,className:"w-full px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors font-medium",children:"Close"})})]})})}const ju={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function Ou({nodes:r,cardCount:e=2,minInterval:t=1e3,maxInterval:n=3e3,onCardClick:s,cardSize:i="medium",className:o=""}){const a=Math.min(Math.max(e,1),5),[l,u]=w.useState([]),[c,d]=w.useState([]),[f,h]=w.useState(Array(a).fill(!1)),[p,m]=w.useState(Array(a).fill(!1)),y=w.useRef([]),D=w.useCallback(b=>{const v=r.filter(k=>!b.includes(k._id));if(v.length===0)return null;const S=Math.floor(Math.random()*v.length);return v[S]},[r]),x=w.useCallback(()=>Math.random()*(n-t)+t,[t,n]);w.useEffect(()=>{if(r.length===0){u([]),d([]);return}const b=[],v=[],S=[];for(let k=0;k<a&&k<r.length;k++){const j=D(S);j&&(b.push(j),S.push(j._id))}for(let k=0;k<b.length;k++){const j=[b[k]._id,...b.filter((B,L)=>L!==k).map(B=>B._id)],T=D(j);T?v.push(T):v.push(b[k])}u(b),d(v)},[r,a,D]);const E=w.useCallback(b=>{const v=x(),S=setTimeout(()=>{h(k=>{const j=[...k];return j[b]=!j[b],j}),setTimeout(()=>{m(k=>{const j=[...k];return j[b]=!j[b],j}),setTimeout(()=>{const k=!p[b];k&&u(j=>{const T=[...j];return T[b]=c[b],T}),d(j=>{const T=[...j],L=[(k?c[b]:l[b])._id,...l.filter((P,Q)=>Q!==b).map(P=>P._id),...j.filter((P,Q)=>Q!==b).map(P=>P._id)],R=D(L);return R&&(T[b]=R),T}),setTimeout(()=>{E(b)},150)},200)},150)},v);y.current[b]=S},[x,D,l,c,p]),_=w.useRef(!1);w.useEffect(()=>{if(!(l.length===0||r.length<=1)&&!_.current){_.current=!0;for(let b=0;b<l.length;b++)E(b);return()=>{y.current.forEach(b=>clearTimeout(b)),y.current=[],_.current=!1}}},[l.length,r.length]);const A=b=>{s&&s(b)};return r.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${o}`,children:g.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):l.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${o}`,children:g.jsx("p",{className:"text-gray-500",children:"Loading..."})}):g.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${o}`,children:l.map((b,v)=>{const S=c[v],k=p[v];return g.jsx("div",{className:`relative ${ju[i]}`,style:{perspective:"1000px"},onClick:()=>A(k?S:b),children:g.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${f[v]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[g.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:k?0:1},children:g.jsxs("div",{style:{transform:f[v]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:b.data.image,alt:b.title,className:"w-full h-full object-cover"}),g.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:g.jsx("p",{className:"text-white text-sm font-medium truncate",children:b.title})})]})}),S&&g.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:k?1:0},children:g.jsxs("div",{style:{transform:f[v]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:S.data.image,alt:S.title,className:"w-full h-full object-cover"}),g.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:g.jsx("p",{className:"text-white text-sm font-medium truncate",children:S.title})})]})})]})},`slot-${v}`)})})}function Er(r){if(!r)return"";const e=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return r.replace(e,(t,n,s,i)=>{try{if(s.toUpperCase()==="B"){const o=atob(i);return decodeURIComponent(escape(o))}else if(s.toUpperCase()==="Q"){const o=i.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(a,l)=>String.fromCharCode(parseInt(l,16)));return decodeURIComponent(escape(o))}}catch(o){console.warn("MIME decode error:",o)}return t}).replace(/\s+/g," ").trim()}const Iu={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function $u({baseUrl:r,systemId:e,accountId:t,limit:n=30,folder:s,selectable:i=!0,showDetail:o=!1,showSearch:a=!0,searchQuery:l,onSearchChange:u,emptyMessage:c="No emails",autoLoad:d=!0,onSelect:f,onSelectionChange:h,onDelete:p,onError:m,onLoad:y,renderItem:D,renderDetail:x,renderActions:E,renderEmpty:_,renderLoading:A,theme:b={}}){const v={...Iu,...b},[S,k]=w.useState([]),[j,T]=w.useState(!1),[B,L]=w.useState(null),[R,P]=w.useState(new Set),[Q,se]=w.useState(null),[xe,oe]=w.useState(null),[Se,he]=w.useState(null),[fe,pe]=w.useState(!1),[ge,Ae]=w.useState(""),be=l!==void 0?l:ge,we=V=>{u?u(V):Ae(V)},Re=w.useMemo(()=>{if(!be.trim())return S;const V=be.toLowerCase();return S.filter(J=>Er(J.from).toLowerCase().includes(V)||Er(J.subject).toLowerCase().includes(V))},[S,be]),ce=w.useMemo(()=>e?new vl({baseUrl:r,system_id:e}):null,[r,e]),je=w.useCallback(async()=>{if(ce){T(!0),L(null);try{const V=await ce.listEmails(t,n,s);V!=null&&V.messages&&(k(V.messages),y==null||y(V.messages))}catch(V){const J=V instanceof Error?V:new Error("Failed to fetch emails");L(J.message),m==null||m(J)}T(!1)}},[ce,t,n,s,m,y]);w.useEffect(()=>{k([]),P(new Set),oe(null),L(null),l===void 0&&Ae(""),d&&je()},[s,d]);const at=w.useCallback(async V=>{if(ce){oe(V),he(null),pe(!0);try{const J=await ce.getEmailParsed(t,V.uid,s||"INBOX");J!=null&&J.body&&he(J.body)}catch(J){console.error("Failed to fetch email body:",J)}pe(!1)}},[ce,t,s]),kt=w.useCallback(V=>{f==null||f(V),o&&at(V)},[f,o,at]),zt=w.useCallback((V,J,Ne)=>{if(!i){f==null||f(V),o&&at(V);return}const Oe=V.uid;if(Ne.shiftKey&&Q!==null){const Ie=Math.min(Q,J),xt=Math.max(Q,J),q=S.slice(Ie,xt+1).map(H=>H.uid),N=new Set(q);P(N),h==null||h(Array.from(N))}else if(Ne.ctrlKey||Ne.metaKey)P(Ie=>{const xt=new Set(Ie);return xt.has(Oe)?xt.delete(Oe):xt.add(Oe),h==null||h(Array.from(xt)),xt}),se(J);else{const Ie=new Set([Oe]);P(Ie),se(J),h==null||h(Array.from(Ie))}},[i,Q,S,R,f,h,o]),nt=w.useCallback(async()=>{if(!ce||R.size===0)return;const V=s||"INBOX";try{const J=await ce.trashEmails(t,Array.from(R),V);if(console.log("Trash result:",J),J.success&&J.moved>0){k(Oe=>Oe.filter(Ie=>!R.has(Ie.uid)));const Ne=Array.from(R);P(new Set),p==null||p(Ne)}else L("Failed to move emails to trash")}catch(J){const Ne=J instanceof Error?J:new Error("Trash failed");console.error("Trash error:",Ne),L(Ne.message),m==null||m(Ne)}},[ce,t,R,s,p,m]),mt=w.useCallback(async()=>{if(!ce||R.size===0)return;const V=s||"INBOX";try{const J=await ce.archiveEmails(t,Array.from(R),V);if(console.log("Archive result:",J),J.success&&J.archived>0){k(Oe=>Oe.filter(Ie=>!R.has(Ie.uid)));const Ne=Array.from(R);P(new Set),p==null||p(Ne)}else L("Failed to archive emails")}catch(J){const Ne=J instanceof Error?J:new Error("Archive failed");console.error("Archive error:",Ne),L(Ne.message),m==null||m(Ne)}},[ce,t,R,s,p,m]),ft=w.useCallback(()=>{if(R.size===S.length)P(new Set),h==null||h([]);else{const V=new Set(S.map(J=>J.uid));P(V),h==null||h(Array.from(V))}},[S,R.size,h]),Yt=w.useCallback(()=>{P(new Set),h==null||h([])},[h]),qt={delete:nt,archive:mt,refresh:je,selectAll:ft,clearSelection:Yt},Tt=V=>{if(!V)return"";const J=new Date(V),Ne=new Date;return J.toDateString()===Ne.toDateString()?J.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):J.toLocaleDateString([],{month:"short",day:"numeric"})},Nt=(V,J)=>g.jsx("div",{style:{padding:"12px 16px",background:J?v.selectedBackground:V.seen?v.cardBackground:v.unreadBackground,borderBottom:`1px solid ${v.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:g.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:V.seen?400:600,color:v.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Er(V.from).split("@")[0]}),g.jsx("div",{style:{fontSize:"14px",fontWeight:V.seen?400:500,color:V.seen?v.textSecondary:v.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Er(V.subject)||"(No subject)"})]}),g.jsx("div",{style:{fontSize:"12px",color:v.textSecondary,flexShrink:0},children:Tt(V.date)})]})}),ut=V=>g.jsxs("div",{style:{padding:"24px"},children:[g.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:v.text},children:Er(V.subject)||"(No subject)"}),g.jsxs("div",{style:{fontSize:"14px",color:v.textSecondary,marginBottom:"16px"},children:["From: ",Er(V.from)," • ",new Date(V.date).toLocaleString()]}),fe?g.jsx("div",{style:{fontSize:"14px",color:v.textSecondary},children:"Loading..."}):Se?g.jsx("div",{style:{fontSize:"14px",color:v.text},dangerouslySetInnerHTML:{__html:Se}}):g.jsx("div",{style:{fontSize:"14px",color:v.textSecondary},children:"No content available"})]}),yt=(V,J)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:v.cardBackground,borderBottom:`1px solid ${v.border}`},children:[g.jsx("button",{onClick:J.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:v.text},children:V.length===S.length?"Deselect All":"Select All"}),V.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("span",{style:{fontSize:"13px",color:v.textSecondary},children:[V.length," selected"]}),g.jsx("button",{onClick:J.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",cursor:"pointer",color:v.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),g.jsx("button",{onClick:J.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",cursor:"pointer",color:v.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),g.jsx("div",{style:{flex:1}}),g.jsx("button",{onClick:J.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",cursor:"pointer",color:v.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),W=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:v.textSecondary},children:c}),De=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:v.textSecondary},children:"Loading..."}),Te=D||Nt,ke=x||ut,Bt=E||yt,Ft=_||W,Ut=A||De;return j&&S.length===0?g.jsx("div",{style:{background:v.background,width:"100%",height:"100%"},children:Ut()}):g.jsxs("div",{style:{display:"flex",background:v.background,width:"100%",height:"100%"},children:[g.jsxs("div",{style:{flex:o&&xe?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:o&&xe?`1px solid ${v.border}`:"none",overflow:"hidden"},children:[i&&Bt(Array.from(R),qt),a&&g.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${v.border}`,background:v.background},children:g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",background:"#f5f5f5",borderRadius:"6px"},children:[g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:v.textSecondary,strokeWidth:"2",children:[g.jsx("circle",{cx:"11",cy:"11",r:"8"}),g.jsx("path",{d:"M21 21l-4.35-4.35"})]}),g.jsx("input",{type:"text",placeholder:"Search by email or subject...",value:be,onChange:V=>we(V.target.value),style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:"13px",color:v.text}}),be&&g.jsx("button",{onClick:()=>we(""),style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center"},children:g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:v.textSecondary,strokeWidth:"2",children:g.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})}),B&&g.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:v.danger,fontSize:"14px",borderBottom:`1px solid ${v.border}`},children:B}),g.jsx("div",{style:{flex:1,overflowY:"auto"},children:Re.length===0?Ft():Re.map((V,J)=>g.jsx("div",{onClick:Ne=>zt(V,J,Ne),onDoubleClick:()=>kt(V),children:Te(V,R.has(V.uid))},V.uid))})]}),o&&xe&&g.jsx("div",{style:{flex:1,overflowY:"auto"},children:ke(xe)})]})}function zu({items:r,renderItem:e,onSelectionChange:t,onCurrentChange:n,onAction:s,actions:i=[],emptyMessage:o="No items",showSelectAll:a=!0,className:l=""}){const[u,c]=w.useState(new Set),[d,f]=w.useState(-1),h=r.filter(_=>u.has(_.id)),p=d>=0&&d<h.length?h[d]:null,m=w.useCallback(_=>{c(A=>{const b=new Set(A);return b.has(_)?b.delete(_):b.add(_),t==null||t(Array.from(b)),b})},[t]),y=w.useCallback(()=>{if(u.size===r.length)c(new Set),f(-1),t==null||t([]);else{const _=new Set(r.map(A=>A.id));c(_),r.length>0&&(f(0),n==null||n(r[0],0)),t==null||t(r.map(A=>A.id))}},[r,u.size,t,n]),D=w.useCallback(()=>{if(h.length===0)return;const _=d<=0?h.length-1:d-1;f(_),n==null||n(h[_],_)},[h,d,n]),x=w.useCallback(()=>{if(h.length===0)return;const _=d>=h.length-1?0:d+1;f(_),n==null||n(h[_],_)},[h,d,n]),E=w.useCallback(_=>{s==null||s(_,h,p)},[s,h,p]);return w.useEffect(()=>{h.length===0?f(-1):d>=h.length?f(h.length-1):d<0&&h.length>0&&(f(0),n==null||n(h[0],0))},[h.length,d,n]),r.length===0?g.jsx("div",{className:`text-sm text-neutral-400 text-center py-4 ${l}`,children:o}):g.jsxs("div",{className:`space-y-2 ${l}`,children:[g.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[a&&g.jsxs("button",{onClick:y,className:"flex items-center gap-1 hover:text-neutral-700 transition-colors",children:[g.jsx("span",{className:"material-icons text-sm",children:u.size===r.length?"check_box":u.size>0?"indeterminate_check_box":"check_box_outline_blank"}),g.jsx("span",{children:u.size===r.length?"Deselect all":"Select all"})]}),u.size>0&&g.jsxs("span",{className:"text-neutral-400",children:["(",u.size," selected)"]})]}),h.length>1&&g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("button",{onClick:D,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Previous",children:g.jsx("span",{className:"material-icons text-sm",children:"chevron_left"})}),g.jsxs("span",{className:"text-xs min-w-[3rem] text-center",children:[d+1," / ",h.length]}),g.jsx("button",{onClick:x,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Next",children:g.jsx("span",{className:"material-icons text-sm",children:"chevron_right"})})]})]}),g.jsx("div",{className:"space-y-1",children:r.map(_=>{const A=u.has(_.id),b=(p==null?void 0:p.id)===_.id;return g.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${b?"bg-blue-50 ring-1 ring-blue-200":A?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>m(_.id),children:[g.jsx("span",{className:`material-icons text-lg ${A?"text-blue-500":"text-neutral-300"}`,children:A?"check_box":"check_box_outline_blank"}),g.jsx("div",{className:"flex-1 min-w-0",children:e(_,A,b)})]},_.id)})}),i.length>0&&u.size>0&&g.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:i.map(_=>{var b;const A=((b=_.disabled)==null?void 0:b.call(_,h))??!1;return g.jsxs("button",{onClick:()=>E(_.id),disabled:A,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${A?"bg-neutral-100 text-neutral-400 cursor-not-allowed":"bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,children:[_.icon&&g.jsx("span",{className:"material-icons text-sm",children:_.icon}),_.label]},_.id)})})]})}function qu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Uu=qu(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const El=w.createContext(null);function Wu(r,e){return{getTheme:function(){return e??null}}}function St(){const r=w.useContext(El);return r==null&&Uu(8),r}function xn(r){return{}}const bi={},Gu={},Sl={},fr={},Fr={},dn={},Rr={},fs={},Hs={},fn={},hn={},Dt={},_i={},vi={},Vu={},Al={},Ku={},kl={},Hu={},Tl={},Nl={},Gn={},Qu={},Bl={},Fl={},Rl={},Ju={},Yu={},Xu={},oo={},Ll={},Zu={},Ml={},Pl={},ec={},hs={},Ci={},Qs={},tc={},rc={},Fn={},Rn={},nc={},sc={},ic={},At=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,oc=At&&"documentMode"in document?document.documentMode:null,vt=At&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),sr=At&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Vn=!(!At||!("InputEvent"in window)||oc)&&"getTargetRanges"in new window.InputEvent("input"),ps=At&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),bn=At&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,lc=At&&/Android/.test(navigator.userAgent),jl=At&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ac=At&&lc&&jl,wi=At&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!jl,_n=1,or=3,gr=0,Ol=1,Pr=2,uc=0,cc=1,dc=2,Kn=4,Hn=8,Di=128,fc=112|(3|Kn|Hn)|Di,Ei=1,Si=2,Ai=3,ki=4,Ti=5,Ni=6,gs=ps||bn||wi?" ":"​",Kt=`
83
+ `,children:[a&&p.jsx("div",{className:"flex-shrink-0",children:p.jsx("img",{src:a,alt:o,className:"w-16 h-16 object-cover rounded-lg"})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h3",{className:"font-medium text-gray-900 truncate",children:o}),u&&p.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:u})]}),l&&p.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:l})]}),e&&p.jsx("div",{className:"flex-shrink-0 text-gray-400",children:p.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function pf({item:r,onClose:e,title:t=i=>i.title||i.name||i.label||"Detail",image:n=i=>i.image||i.thumbnail||i.photo,fields:s=[]}){if(!r)return null;const i=t(r),o=n(r);return p.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:p.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[p.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[p.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:i}),e&&p.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:p.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),p.jsxs("div",{className:"p-6",children:[o&&p.jsx("div",{className:"mb-6",children:p.jsx("img",{src:o,alt:i,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&p.jsx("div",{className:"space-y-4",children:s.map((l,a)=>{const u=l.value(r);return u==null||u===""?null:p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:l.label}),p.jsx("div",{className:"text-base text-gray-900",children:typeof u=="object"?JSON.stringify(u,null,2):String(u)})]},a)})}),s.length===0&&p.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(r,null,2)})]}),e&&p.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:p.jsx("button",{onClick:e,className:"w-full px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors font-medium",children:"Close"})})]})})}const gf={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function mf({nodes:r,cardCount:e=2,minInterval:t=1e3,maxInterval:n=3e3,onCardClick:s,cardSize:i="medium",className:o=""}){const l=Math.min(Math.max(e,1),5),[a,u]=b.useState([]),[c,d]=b.useState([]),[f,h]=b.useState(Array(l).fill(!1)),[g,m]=b.useState(Array(l).fill(!1)),x=b.useRef([]),v=b.useCallback(w=>{const y=r.filter(B=>!w.includes(B._id));if(y.length===0)return null;const k=Math.floor(Math.random()*y.length);return y[k]},[r]),_=b.useCallback(()=>Math.random()*(n-t)+t,[t,n]);b.useEffect(()=>{if(r.length===0){u([]),d([]);return}const w=[],y=[],k=[];for(let B=0;B<l&&B<r.length;B++){const F=v(k);F&&(w.push(F),k.push(F._id))}for(let B=0;B<w.length;B++){const F=[w[B]._id,...w.filter((M,L)=>L!==B).map(M=>M._id)],T=v(F);T?y.push(T):y.push(w[B])}u(w),d(y)},[r,l,v]);const C=b.useCallback(w=>{const y=_(),k=setTimeout(()=>{h(B=>{const F=[...B];return F[w]=!F[w],F}),setTimeout(()=>{m(B=>{const F=[...B];return F[w]=!F[w],F}),setTimeout(()=>{const B=!g[w];B&&u(F=>{const T=[...F];return T[w]=c[w],T}),d(F=>{const T=[...F],L=[(B?c[w]:a[w])._id,...a.filter((N,R)=>R!==w).map(N=>N._id),...F.filter((N,R)=>R!==w).map(N=>N._id)],E=v(L);return E&&(T[w]=E),T}),setTimeout(()=>{C(w)},150)},200)},150)},y);x.current[w]=k},[_,v,a,c,g]),S=b.useRef(!1);b.useEffect(()=>{if(!(a.length===0||r.length<=1)&&!S.current){S.current=!0;for(let w=0;w<a.length;w++)C(w);return()=>{x.current.forEach(w=>clearTimeout(w)),x.current=[],S.current=!1}}},[a.length,r.length]);const D=w=>{s&&s(w)};return r.length===0?p.jsx("div",{className:`flex items-center justify-center p-8 ${o}`,children:p.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):a.length===0?p.jsx("div",{className:`flex items-center justify-center p-8 ${o}`,children:p.jsx("p",{className:"text-gray-500",children:"Loading..."})}):p.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${o}`,children:a.map((w,y)=>{const k=c[y],B=g[y];return p.jsx("div",{className:`relative ${gf[i]}`,style:{perspective:"1000px"},onClick:()=>D(B?k:w),children:p.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${f[y]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[p.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:B?0:1},children:p.jsxs("div",{style:{transform:f[y]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[p.jsx("img",{src:w.data.image,alt:w.title,className:"w-full h-full object-cover"}),p.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:p.jsx("p",{className:"text-white text-sm font-medium truncate",children:w.title})})]})}),k&&p.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:B?1:0},children:p.jsxs("div",{style:{transform:f[y]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[p.jsx("img",{src:k.data.image,alt:k.title,className:"w-full h-full object-cover"}),p.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:p.jsx("p",{className:"text-white text-sm font-medium truncate",children:k.title})})]})})]})},`slot-${y}`)})})}function $r(r){if(!r)return"";const e=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return r.replace(e,(t,n,s,i)=>{try{if(s.toUpperCase()==="B"){const o=atob(i);return decodeURIComponent(escape(o))}else if(s.toUpperCase()==="Q"){const o=i.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(l,a)=>String.fromCharCode(parseInt(a,16)));return decodeURIComponent(escape(o))}}catch(o){console.warn("MIME decode error:",o)}return t}).replace(/\s+/g," ").trim()}const yf={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function xf({baseUrl:r,systemId:e,accountId:t,limit:n=30,folder:s,selectable:i=!0,showDetail:o=!1,showSearch:l=!0,searchQuery:a,onSearchChange:u,emptyMessage:c="No emails",autoLoad:d=!0,onSelect:f,onSelectionChange:h,onDelete:g,onError:m,onLoad:x,renderItem:v,renderDetail:_,renderActions:C,renderEmpty:S,renderLoading:D,theme:w={}}){const y={...yf,...w},[k,B]=b.useState([]),[F,T]=b.useState(!1),[M,L]=b.useState(null),[E,N]=b.useState(new Set),[R,O]=b.useState(null),[H,U]=b.useState(null),[Z,q]=b.useState(null),[K,$]=b.useState(!1),[re,ae]=b.useState(""),le=a!==void 0?a:re,ce=ee=>{u?u(ee):ae(ee)},ve=b.useMemo(()=>{if(!le.trim())return k;const ee=le.toLowerCase();return k.filter(se=>$r(se.from).toLowerCase().includes(ee)||$r(se.subject).toLowerCase().includes(ee))},[k,le]),pe=b.useMemo(()=>e?new su({baseUrl:r,system_id:e}):null,[r,e]),Fe=b.useCallback(async()=>{if(pe){T(!0),L(null);try{const ee=await pe.listEmails(t,n,s);ee!=null&&ee.messages&&(B(ee.messages),x==null||x(ee.messages))}catch(ee){const se=ee instanceof Error?ee:new Error("Failed to fetch emails");L(se.message),m==null||m(se)}T(!1)}},[pe,t,n,s,m,x]);b.useEffect(()=>{B([]),N(new Set),U(null),L(null),a===void 0&&ae(""),d&&Fe()},[s,d]);const et=b.useCallback(async ee=>{if(pe){U(ee),q(null),$(!0);try{const se=await pe.getEmailParsed(t,ee.uid,s||"INBOX");se!=null&&se.body&&q(se.body)}catch(se){console.error("Failed to fetch email body:",se)}$(!1)}},[pe,t,s]),ct=b.useCallback(ee=>{f==null||f(ee),o&&et(ee)},[f,o,et]),kt=b.useCallback((ee,se,je)=>{if(!i){f==null||f(ee),o&&et(ee);return}const $e=ee.uid;if(je.shiftKey&&R!==null){const qe=Math.min(R,se),Dt=Math.max(R,se),Y=k.slice(qe,Dt+1).map(ne=>ne.uid),j=new Set(Y);N(j),h==null||h(Array.from(j))}else if(je.ctrlKey||je.metaKey)N(qe=>{const Dt=new Set(qe);return Dt.has($e)?Dt.delete($e):Dt.add($e),h==null||h(Array.from(Dt)),Dt}),O(se);else{const qe=new Set([$e]);N(qe),O(se),h==null||h(Array.from(qe))}},[i,R,k,E,f,h,o]),tt=b.useCallback(async()=>{if(!pe||E.size===0)return;const ee=s||"INBOX";try{const se=await pe.trashEmails(t,Array.from(E),ee);if(console.log("Trash result:",se),se.success&&se.moved>0){B($e=>$e.filter(qe=>!E.has(qe.uid)));const je=Array.from(E);N(new Set),g==null||g(je)}else L("Failed to move emails to trash")}catch(se){const je=se instanceof Error?se:new Error("Trash failed");console.error("Trash error:",je),L(je.message),m==null||m(je)}},[pe,t,E,s,g,m]),xt=b.useCallback(async()=>{if(!pe||E.size===0)return;const ee=s||"INBOX";try{const se=await pe.archiveEmails(t,Array.from(E),ee);if(console.log("Archive result:",se),se.success&&se.archived>0){B($e=>$e.filter(qe=>!E.has(qe.uid)));const je=Array.from(E);N(new Set),g==null||g(je)}else L("Failed to archive emails")}catch(se){const je=se instanceof Error?se:new Error("Archive failed");console.error("Archive error:",je),L(je.message),m==null||m(je)}},[pe,t,E,s,g,m]),dt=b.useCallback(()=>{if(E.size===k.length)N(new Set),h==null||h([]);else{const ee=new Set(k.map(se=>se.uid));N(ee),h==null||h(Array.from(ee))}},[k,E.size,h]),It=b.useCallback(()=>{N(new Set),h==null||h([])},[h]),ue={delete:tt,archive:xt,refresh:Fe,selectAll:dt,clearSelection:It},_e=ee=>{if(!ee)return"";const se=new Date(ee),je=new Date;return se.toDateString()===je.toDateString()?se.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):se.toLocaleDateString([],{month:"short",day:"numeric"})},Te=(ee,se)=>p.jsx("div",{style:{padding:"12px 16px",background:se?y.selectedBackground:ee.seen?y.cardBackground:y.unreadBackground,borderBottom:`1px solid ${y.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:ee.seen?400:600,color:y.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:$r(ee.from).split("@")[0]}),p.jsx("div",{style:{fontSize:"14px",fontWeight:ee.seen?400:500,color:ee.seen?y.textSecondary:y.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:$r(ee.subject)||"(No subject)"})]}),p.jsx("div",{style:{fontSize:"12px",color:y.textSecondary,flexShrink:0},children:_e(ee.date)})]})}),it=ee=>p.jsxs("div",{style:{padding:"24px"},children:[p.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:y.text},children:$r(ee.subject)||"(No subject)"}),p.jsxs("div",{style:{fontSize:"14px",color:y.textSecondary,marginBottom:"16px"},children:["From: ",$r(ee.from)," • ",new Date(ee.date).toLocaleString()]}),K?p.jsx("div",{style:{fontSize:"14px",color:y.textSecondary},children:"Loading..."}):Z?p.jsx("div",{style:{fontSize:"14px",color:y.text},dangerouslySetInnerHTML:{__html:Z}}):p.jsx("div",{style:{fontSize:"14px",color:y.textSecondary},children:"No content available"})]}),Je=(ee,se)=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:y.cardBackground,borderBottom:`1px solid ${y.border}`},children:[p.jsx("button",{onClick:se.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${y.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:y.text},children:ee.length===k.length?"Deselect All":"Select All"}),ee.length>0&&p.jsxs(p.Fragment,{children:[p.jsxs("span",{style:{fontSize:"13px",color:y.textSecondary},children:[ee.length," selected"]}),p.jsx("button",{onClick:se.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${y.border}`,borderRadius:"6px",cursor:"pointer",color:y.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),p.jsx("button",{onClick:se.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${y.border}`,borderRadius:"6px",cursor:"pointer",color:y.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),p.jsx("div",{style:{flex:1}}),p.jsx("button",{onClick:se.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${y.border}`,borderRadius:"6px",cursor:"pointer",color:y.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),X=()=>p.jsx("div",{style:{padding:"48px",textAlign:"center",color:y.textSecondary},children:c}),Be=()=>p.jsx("div",{style:{padding:"48px",textAlign:"center",color:y.textSecondary},children:"Loading..."}),Me=v||Te,Re=_||it,zt=C||Je,$t=S||X,Jt=D||Be;return F&&k.length===0?p.jsx("div",{style:{background:y.background,width:"100%",height:"100%"},children:Jt()}):p.jsxs("div",{style:{display:"flex",background:y.background,width:"100%",height:"100%"},children:[p.jsxs("div",{style:{flex:o&&H?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:o&&H?`1px solid ${y.border}`:"none",overflow:"hidden"},children:[i&&zt(Array.from(E),ue),l&&p.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${y.border}`,background:y.background},children:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",background:"#f5f5f5",borderRadius:"6px"},children:[p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:y.textSecondary,strokeWidth:"2",children:[p.jsx("circle",{cx:"11",cy:"11",r:"8"}),p.jsx("path",{d:"M21 21l-4.35-4.35"})]}),p.jsx("input",{type:"text",placeholder:"Search by email or subject...",value:le,onChange:ee=>ce(ee.target.value),style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:"13px",color:y.text}}),le&&p.jsx("button",{onClick:()=>ce(""),style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center"},children:p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:y.textSecondary,strokeWidth:"2",children:p.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})}),M&&p.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:y.danger,fontSize:"14px",borderBottom:`1px solid ${y.border}`},children:M}),p.jsx("div",{style:{flex:1,overflowY:"auto"},children:ve.length===0?$t():ve.map((ee,se)=>p.jsx("div",{onClick:je=>kt(ee,se,je),onDoubleClick:()=>ct(ee),children:Me(ee,E.has(ee.uid))},ee.uid))})]}),o&&H&&p.jsx("div",{style:{flex:1,overflowY:"auto"},children:Re(H)})]})}function bf({items:r,renderItem:e,onSelectionChange:t,onCurrentChange:n,onAction:s,actions:i=[],emptyMessage:o="No items",showSelectAll:l=!0,className:a=""}){const[u,c]=b.useState(new Set),[d,f]=b.useState(-1),h=r.filter(S=>u.has(S.id)),g=d>=0&&d<h.length?h[d]:null,m=b.useCallback(S=>{c(D=>{const w=new Set(D);return w.has(S)?w.delete(S):w.add(S),t==null||t(Array.from(w)),w})},[t]),x=b.useCallback(()=>{if(u.size===r.length)c(new Set),f(-1),t==null||t([]);else{const S=new Set(r.map(D=>D.id));c(S),r.length>0&&(f(0),n==null||n(r[0],0)),t==null||t(r.map(D=>D.id))}},[r,u.size,t,n]),v=b.useCallback(()=>{if(h.length===0)return;const S=d<=0?h.length-1:d-1;f(S),n==null||n(h[S],S)},[h,d,n]),_=b.useCallback(()=>{if(h.length===0)return;const S=d>=h.length-1?0:d+1;f(S),n==null||n(h[S],S)},[h,d,n]),C=b.useCallback(S=>{s==null||s(S,h,g)},[s,h,g]);return b.useEffect(()=>{h.length===0?f(-1):d>=h.length?f(h.length-1):d<0&&h.length>0&&(f(0),n==null||n(h[0],0))},[h.length,d,n]),r.length===0?p.jsx("div",{className:`text-sm text-neutral-400 text-center py-4 ${a}`,children:o}):p.jsxs("div",{className:`space-y-2 ${a}`,children:[p.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[l&&p.jsxs("button",{onClick:x,className:"flex items-center gap-1 hover:text-neutral-700 transition-colors",children:[p.jsx("span",{className:"material-icons text-sm",children:u.size===r.length?"check_box":u.size>0?"indeterminate_check_box":"check_box_outline_blank"}),p.jsx("span",{children:u.size===r.length?"Deselect all":"Select all"})]}),u.size>0&&p.jsxs("span",{className:"text-neutral-400",children:["(",u.size," selected)"]})]}),h.length>1&&p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("button",{onClick:v,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Previous",children:p.jsx("span",{className:"material-icons text-sm",children:"chevron_left"})}),p.jsxs("span",{className:"text-xs min-w-[3rem] text-center",children:[d+1," / ",h.length]}),p.jsx("button",{onClick:_,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Next",children:p.jsx("span",{className:"material-icons text-sm",children:"chevron_right"})})]})]}),p.jsx("div",{className:"space-y-1",children:r.map(S=>{const D=u.has(S.id),w=(g==null?void 0:g.id)===S.id;return p.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${w?"bg-blue-50 ring-1 ring-blue-200":D?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>m(S.id),children:[p.jsx("span",{className:`material-icons text-lg ${D?"text-blue-500":"text-neutral-300"}`,children:D?"check_box":"check_box_outline_blank"}),p.jsx("div",{className:"flex-1 min-w-0",children:e(S,D,w)})]},S.id)})}),i.length>0&&u.size>0&&p.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:i.map(S=>{var w;const D=((w=S.disabled)==null?void 0:w.call(S,h))??!1;return p.jsxs("button",{onClick:()=>C(S.id),disabled:D,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${D?"bg-neutral-100 text-neutral-400 cursor-not-allowed":"bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,children:[S.icon&&p.jsx("span",{className:"material-icons text-sm",children:S.icon}),S.label]},S.id)})})]})}function _f(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var vf=_f(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const fu=b.createContext(null);function wf(r,e){return{getTheme:function(){return e??null}}}function Lt(){const r=b.useContext(fu);return r==null&&vf(8),r}function Hn(r){return{}}const Fo={},Cf={},hu={},kr={},Kr={},Mn={},Yr={},si={},Ki={},jn={},Ln={},Mt={},Ro={},Mo={},Sf={},pu={},Ef={},gu={},kf={},mu={},yu={},Bs={},Df={},xu={},bu={},_u={},Af={},Tf={},Bf={},ka={},vu={},Nf={},wu={},Cu={},Ff={},ii={},jo={},Yi={},Rf={},Mf={},ls={},us={},jf={},Lf={},Pf={},Pt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Of=Pt&&"documentMode"in document?document.documentMode:null,Tt=Pt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),mr=Pt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Ns=!(!Pt||!("InputEvent"in window)||Of)&&"getTargetRanges"in new window.InputEvent("input"),oi=Pt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Gn=Pt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,If=Pt&&/Android/.test(navigator.userAgent),Su=Pt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),zf=Pt&&If&&Su,Lo=Pt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Su,Kn=1,xr=3,Br=0,Eu=1,Zr=2,$f=0,qf=1,Uf=2,Fs=4,Rs=8,Po=128,Wf=112|(3|Fs|Rs)|Po,Oo=1,Io=2,zo=3,$o=4,qo=5,Uo=6,ai=oi||Gn||Lo?" ":"​",sr=`
62
84
 
63
- `,hc=sr?" ":gs,Il="֑-߿יִ-﷽ﹰ-ﻼ",$l="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",pc=new RegExp("^[^"+$l+"]*["+Il+"]"),gc=new RegExp("^[^"+Il+"]*["+$l+"]"),mr={bold:1,code:16,highlight:Di,italic:2,strikethrough:Kn,subscript:32,superscript:64,underline:Hn},mc={directionless:1,unmergeable:2},lo={center:Si,end:Ni,justify:ki,left:Ei,right:Ai,start:Ti},yc={[Si]:"center",[Ni]:"end",[ki]:"justify",[Ei]:"left",[Ai]:"right",[Ti]:"start"},xc={normal:0,segmented:2,token:1},bc={[uc]:"normal",[dc]:"segmented",[cc]:"token"};function _c(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var $=_c(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Qn(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}const vc=100;let Js=!1,Bi=0;function Cc(r){Bi=r.timeStamp}function Ms(r,e,t){const n=r.nodeName==="BR",s=e.__lexicalLineBreak;return s&&(r===s||n&&r.previousSibling===s)||n&&ys(r,t)!==void 0}function wc(r,e,t){const n=gt(t._window);let s=null,i=null;n!==null&&n.anchorNode===r&&(s=n.anchorOffset,i=n.focusOffset);const o=r.nodeValue;o!==null&&Pi(e,o,s,i,!1)}function Dc(r,e,t){if(O(r)){const n=r.anchor.getNode();if(n.is(t)&&r.format!==n.getFormat())return!1}return e.nodeType===or&&t.isAttached()}function Ec(r,e,t,n){for(let s=r;s&&!Oc(s);s=Cn(s)){const i=ys(s,e);if(i!==void 0){const o=Xe(i,t);if(o)return Ce(o)?void 0:[s,o]}else if(s===n)return[n,Ql(t)]}}function zl(r,e,t){Js=!0;const n=performance.now()-Bi>vc;try{ct(r,()=>{const s=K()||function(f){return f.getEditorState().read(()=>{const h=K();return h!==null?h.clone():null})}(r),i=new Map,o=r.getRootElement(),a=r._editorState,l=r._blockCursorElement;let u=!1,c="";for(let f=0;f<e.length;f++){const h=e[f],p=h.type,m=h.target,y=Ec(m,r,a,o);if(!y)continue;const[D,x]=y;if(p==="characterData")n&&z(x)&&Dc(s,m,x)&&wc(m,x,r);else if(p==="childList"){u=!0;const E=h.addedNodes;for(let b=0;b<E.length;b++){const v=E[b],S=Kl(v),k=v.parentNode;if(k!=null&&v!==l&&S===null&&!Ms(v,k,r)){if(sr){const j=v.innerText||v.nodeValue;j&&(c+=j)}k.removeChild(v)}}const _=h.removedNodes,A=_.length;if(A>0){let b=0;for(let v=0;v<A;v++){const S=_[v];(Ms(S,m,r)||l===S)&&(m.appendChild(S),b++)}A!==b&&i.set(D,x)}}}if(i.size>0)for(const[f,h]of i)h.reconcileObservedMutation(f,r);const d=t.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){const h=d[f],p=h.addedNodes,m=h.target;for(let y=0;y<p.length;y++){const D=p[y],x=D.parentNode;x==null||D.nodeName!=="BR"||Ms(D,m,r)||x.removeChild(D)}}t.takeRecords()}s!==null&&(u&&(s.dirty=!0,jt(s)),sr&&Zl(r)&&s.insertRawText(c))})}finally{Js=!1}}function ql(r){const e=r._observer;e!==null&&zl(r,e.takeRecords(),e)}function Ul(r){(function(e){Bi===0&&bs(e).addEventListener("textInput",Cc,!0)})(r),r._observer=new MutationObserver((e,t)=>{zl(r,e,t)})}function ao(r,e){const t=r.__mode,n=r.__format,s=r.__style,i=e.__mode,o=e.__format,a=e.__style;return!(t!==null&&t!==i||n!==null&&n!==o||s!==null&&s!==a)}function uo(r,e){const t=r.mergeWithSibling(e),n=Pe()._normalizedNodes;return n.add(r.__key),n.add(e.__key),t}function co(r){let e,t,n=r;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&z(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(ao(e,n)){n=uo(e,n);break}break}e.remove()}for(;(t=n.getNextSibling())!==null&&z(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(ao(n,t)){n=uo(n,t);break}break}t.remove()}}else n.remove()}function Wl(r){return fo(r.anchor),fo(r.focus),r}function fo(r){for(;r.type==="element";){const e=r.getNode(),t=r.offset;let n,s;if(t===e.getChildrenSize()?(n=e.getChildAtIndex(t-1),s=!0):(n=e.getChildAtIndex(t),s=!1),z(n)){r.set(n.__key,s?n.getTextContentSize():0,"text");break}if(!F(n))break;r.set(n.__key,s?n.getChildrenSize():0,"element")}}let Sc=1;const Ac=typeof queueMicrotask=="function"?queueMicrotask:r=>{Promise.resolve().then(r)};function Fi(r){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return Ce(jr(r))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&ms(e)==null)}function vn(r,e,t){const n=r.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!Fi(e)&&Gl(e)===r}catch{return!1}}function Ri(r){return r instanceof Ds}function Gl(r){let e=r;for(;e!=null;){const t=ms(e);if(Ri(t))return t;e=Cn(e)}return null}function ms(r){return r?r.__lexicalEditor:null}function cr(r){return r.isToken()||r.isSegmented()}function kc(r){return r.nodeType===or}function Jn(r){let e=r;for(;e!=null;){if(kc(e))return e;e=e.firstChild}return null}function Yn(r,e,t){const n=mr[e];if(t!==null&&(r&n)==(t&n))return r;let s=r^n;return e==="subscript"?s&=-65:e==="superscript"&&(s&=-33),s}function Vl(r){return z(r)||pr(r)||Ce(r)}function Tc(r,e){if(e!=null)return void(r.__key=e);it(),_a();const t=Pe(),n=Qt(),s=""+Sc++;n._nodeMap.set(s,r),F(r)?t._dirtyElements.set(s,!0):t._dirtyLeaves.add(s),t._cloneNotNeeded.add(s),t._dirtyType=Ol,r.__key=s}function hr(r){const e=r.getParent();if(e!==null){const t=r.getWritable(),n=e.getWritable(),s=r.getPreviousSibling(),i=r.getNextSibling();if(s===null)if(i!==null){const o=i.getWritable();n.__first=i.__key,o.__prev=null}else n.__first=null;else{const o=s.getWritable();if(i!==null){const a=i.getWritable();a.__prev=o.__key,o.__next=a.__key}else o.__next=null;t.__prev=null}if(i===null)if(s!==null){const o=s.getWritable();n.__last=s.__key,o.__next=null}else n.__last=null;else{const o=i.getWritable();if(s!==null){const a=s.getWritable();a.__next=o.__key,o.__prev=a.__key}else o.__prev=null;t.__next=null}n.__size--,t.__parent=null}}function Xn(r){_a();const e=r.getLatest(),t=e.__parent,n=Qt(),s=Pe(),i=n._nodeMap,o=s._dirtyElements;t!==null&&function(l,u,c){let d=l;for(;d!==null;){if(c.has(d))return;const f=u.get(d);if(f===void 0)break;c.set(d,!1),d=f.__parent}}(t,i,o);const a=e.__key;s._dirtyType=Ol,F(r)?o.set(a,!0):s._dirtyLeaves.add(a)}function Qe(r){it();const e=Pe(),t=e._compositionKey;if(r!==t){if(e._compositionKey=r,t!==null){const n=Xe(t);n!==null&&n.getWritable()}if(r!==null){const n=Xe(r);n!==null&&n.getWritable()}}}function tr(){return An()?null:Pe()._compositionKey}function Xe(r,e){const t=(e||Qt())._nodeMap.get(r);return t===void 0?null:t}function Kl(r,e){const t=ys(r,Pe());return t!==void 0?Xe(t,e):null}function ys(r,e){return r[`__lexicalKey_${e._key}`]}function jr(r,e){let t=r;for(;t!=null;){const n=Kl(t,e);if(n!==null)return n;t=Cn(t)}return null}function Hl(r){const e=r._decorators,t=Object.assign({},e);return r._pendingDecorators=t,t}function ho(r){return r.read(()=>Fe().getTextContent())}function Fe(){return Ql(Qt())}function Ql(r){return r._nodeMap.get("root")}function jt(r){it();const e=Qt();r!==null&&(r.dirty=!0,r.setCachedNodes(null)),e._selection=r}function Tr(r){const e=Pe(),t=function(n,s){let i=n;for(;i!=null;){const o=ys(i,s);if(o!==void 0)return o;i=Cn(i)}return null}(r,e);return t===null?r===e.getRootElement()?Xe("root"):null:Xe(t)}function po(r,e){return e?r.getTextContentSize():0}function Jl(r){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(r)}function Li(r){const e=[];let t=r;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Yl(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Xl(r){return r.nodeType===or?r.nodeValue:null}function Mi(r,e,t){const n=gt(e._window);if(n===null)return;const s=n.anchorNode;let{anchorOffset:i,focusOffset:o}=n;if(s!==null){let a=Xl(s);const l=jr(s);if(a!==null&&z(l)){if(a===gs&&t){const u=t.length;a=t,i=u,o=u}a!==null&&Pi(l,a,i,o,r)}}}function Pi(r,e,t,n,s){let i=r;if(i.isAttached()&&(s||!i.isDirty())){const o=i.isComposing();let a=e;(o||s)&&e[e.length-1]===gs&&(a=e.slice(0,-1));const l=i.getTextContent();if(s||a!==l){if(a===""){if(Qe(null),ps||bn||wi)i.remove();else{const m=Pe();setTimeout(()=>{m.update(()=>{i.isAttached()&&i.remove()})},20)}return}const u=i.getParent(),c=Sn(),d=i.getTextContentSize(),f=tr(),h=i.getKey();if(i.isToken()||f!==null&&h===f&&!o||O(c)&&(u!==null&&!u.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===r.__key&&c.anchor.offset===0&&!i.canInsertTextBefore()&&!o||c.focus.key===r.__key&&c.focus.offset===d&&!i.canInsertTextAfter()&&!o))return void i.markDirty();const p=K();if(!O(p)||t===null||n===null)return void i.setTextContent(a);if(p.setTextNodeRange(i,t,i,n),i.isSegmented()){const m=Ge(i.getTextContent());i.replace(m),i=m}i.setTextContent(a)}}}function Nc(r,e){if(e.isSegmented())return!0;if(!r.isCollapsed())return!1;const t=r.anchor.offset,n=e.getParentOrThrow(),s=e.isToken();return t===0?!e.canInsertTextBefore()||!n.canInsertTextBefore()&&!e.isComposing()||s||function(i){const o=i.getPreviousSibling();return(z(o)||F(o)&&o.isInline())&&!o.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||s)}function go(r){return r==="ArrowLeft"}function mo(r){return r==="ArrowRight"}function Xr(r,e){return vt?r:e}function yo(r){return r==="Enter"}function Vr(r){return r==="Backspace"}function Kr(r){return r==="Delete"}function xo(r,e,t){return r.toLowerCase()==="a"&&Xr(e,t)}function Bc(){const r=Fe();jt(Wl(r.select(0,r.getChildrenSize())))}function sn(r,e){r.__lexicalClassNameCache===void 0&&(r.__lexicalClassNameCache={});const t=r.__lexicalClassNameCache,n=t[e];if(n!==void 0)return n;const s=r[e];if(typeof s=="string"){const i=Qn(s);return t[e]=i,i}return s}function ji(r,e,t,n,s){if(t.size===0)return;const i=n.__type,o=n.__key,a=e.get(i);a===void 0&&$(33,i);const l=a.klass;let u=r.get(l);u===void 0&&(u=new Map,r.set(l,u));const c=u.get(o),d=c==="destroyed"&&s==="created";(c===void 0||d)&&u.set(o,d?"updated":s)}function bo(r,e,t){const n=r.getParent();let s=t,i=r;return n!==null&&(e&&t===0?(s=i.getIndexWithinParent(),i=n):e||t!==i.getChildrenSize()||(s=i.getIndexWithinParent()+1,i=n)),i.getChildAtIndex(e?s-1:s)}function pn(r,e){const t=r.offset;if(r.type==="element")return bo(r.getNode(),e,t);{const n=r.getNode();if(e&&t===0||!e&&t===n.getTextContentSize()){const s=e?n.getPreviousSibling():n.getNextSibling();return s===null?bo(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):s}}return null}function Zl(r){const e=bs(r).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function G(r,e,t){return wa(r,e,t)}function xs(r){return!tt(r)&&!r.isLastChild()&&!r.isInline()}function Zn(r,e){const t=r._keyToDOMMap.get(e);return t===void 0&&$(75,e),t}function Cn(r){const e=r.assignedSlot||r.parentElement;return e!==null&&e.nodeType===11?e.host:e}function on(r,e){let t=r.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function bs(r){const e=r._window;return e===null&&$(78),e}function Fc(r){let e=r.getParentOrThrow();for(;e!==null;){if(Ot(e))return e;e=e.getParentOrThrow()}return e}function Ot(r){return tt(r)||F(r)&&r.isShadowRoot()}function $t(r){const e=Pe(),t=r.constructor.getType(),n=e._nodes.get(t);n===void 0&&$(200,r.constructor.name,t);const{replace:s,replaceWithKlass:i}=n;if(s!==null){const o=s(r),a=o.constructor;return i!==null?o instanceof i||$(201,i.name,i.getType(),a.name,a.getType(),r.constructor.name,t):o instanceof r.constructor&&a!==r.constructor||$(202,a.name,a.getType(),r.constructor.name,t),o.__key===r.__key&&$(203,r.constructor.name,t,a.name,a.getType()),o}return r}function Ps(r,e){!tt(r.getParent())||F(e)||Ce(e)||$(99)}function js(r){return(Ce(r)||F(r)&&!r.canBeEmpty())&&!r.isInline()}function Oi(r,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const n=r.parentElement;n!==null&&n.removeChild(r)}function Rc(r,e,t){let n=r._blockCursorElement;if(O(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const s=t.anchor,i=s.getNode(),o=s.offset;let a=!1,l=null;if(o===i.getChildrenSize())js(i.getChildAtIndex(o-1))&&(a=!0);else{const u=i.getChildAtIndex(o);if(u!==null&&js(u)){const c=u.getPreviousSibling();(c===null||js(c))&&(a=!0,l=r.getElementByKey(u.__key))}}if(a){const u=r.getElementByKey(i.__key);return n===null&&(r._blockCursorElement=n=function(c){const d=c.theme,f=document.createElement("div");f.contentEditable="false",f.setAttribute("data-lexical-cursor","true");let h=d.blockCursor;if(h!==void 0){if(typeof h=="string"){const p=Qn(h);h=d.blockCursor=p}h!==void 0&&f.classList.add(...h)}return f}(r._config)),e.style.caretColor="transparent",void(l===null?u.appendChild(n):u.insertBefore(n,l))}}n!==null&&Oi(n,r,e)}function gt(r){return At?(r||window).getSelection():null}function Lc(r){return Ht(r)&&r.tagName==="A"}function Ht(r){return r.nodeType===1}function _o(r){return r.nodeType===11}function Ys(r){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return r.nodeName.match(e)!==null}function es(r){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return r.nodeName.match(e)!==null}function Zt(r){if(Ce(r)&&!r.isInline())return!0;if(!F(r)||Ot(r))return!1;const e=r.getFirstChild(),t=e===null||pr(e)||z(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Hr(r,e){let t=r;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function Mc(){return Pe()}const vo=new WeakMap,Pc=new Map;function jc(r){if(!r._readOnly&&r.isEmpty())return Pc;r._readOnly||$(192);let e=vo.get(r);if(!e){e=new Map,vo.set(r,e);for(const[t,n]of r._nodeMap){const s=n.__type;let i=e.get(s);i||(i=new Map,e.set(s,i)),i.set(t,n)}}return e}function Ii(r){const e=r.constructor.clone(r);return e.afterCloneFrom(r),e}function $i(r,e){const t=(parseInt(r.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function Oc(r){return r.__lexicalUnmanaged===!0}function ea(r,e,t,n,s,i){let o=r.getFirstChild();for(;o!==null;){const a=o.__key;o.__parent===e&&(F(o)&&ea(o,a,t,n,s,i),t.has(a)||i.delete(a),s.push(a)),o=o.getNextSibling()}}let ir,rt,gn,_s,Xs,Zs,yr,Et,ei,mn,Ve="",et="",Rt=null,Ct="",Vt="",ta=!1,yn=!1,zn=null;function ts(r,e){const t=yr.get(r);if(e!==null){const n=ni(r);n.parentNode===e&&e.removeChild(n)}if(Et.has(r)||rt._keyToDOMMap.delete(r),F(t)){const n=ns(t,yr);ti(n,0,n.length-1,null)}t!==void 0&&ji(mn,gn,_s,t,"destroyed")}function ti(r,e,t,n){let s=e;for(;s<=t;++s){const i=r[s];i!==void 0&&ts(i,n)}}function ur(r,e){r.setProperty("text-align",e)}const Ic="40px";function ra(r,e){const t=ir.theme.indent;if(typeof t=="string"){const s=r.classList.contains(t);e>0&&!s?r.classList.add(t):e<1&&s&&r.classList.remove(t)}const n=getComputedStyle(r).getPropertyValue("--lexical-indent-base-value")||Ic;r.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function na(r,e){const t=r.style;e===0?ur(t,""):e===Ei?ur(t,"left"):e===Si?ur(t,"center"):e===Ai?ur(t,"right"):e===ki?ur(t,"justify"):e===Ti?ur(t,"start"):e===Ni&&ur(t,"end")}function rs(r,e){const t=Et.get(r);t===void 0&&$(60);const n=t.createDOM(ir,rt);if(function(s,i,o){const a=o._keyToDOMMap;(function(l,u,c){l[`__lexicalKey_${u._key}`]=c})(i,o,s),a.set(s,i)}(r,n,rt),z(t)?n.setAttribute("data-lexical-text","true"):Ce(t)&&n.setAttribute("data-lexical-decorator","true"),F(t)){const s=t.__indent,i=t.__size;if(s!==0&&ra(n,s),i!==0){const a=i-1;(function(l,u,c,d){const f=et;et="",ri(l,c,0,u,c.getDOMSlot(d)),ia(c,d),et=f})(ns(t,Et),a,t,n)}const o=t.__format;o!==0&&na(n,o),t.isInline()||sa(null,t,n),xs(t)&&(Ve+=Kt,Vt+=Kt)}else{const s=t.getTextContent();if(Ce(t)){const i=t.decorate(rt,ir);i!==null&&oa(r,i),n.contentEditable="false"}else z(t)&&(t.isDirectionless()||(et+=s));Ve+=s,Vt+=s}return e!==null&&e.insertChild(n),ji(mn,gn,_s,t,"created"),n}function ri(r,e,t,n,s){const i=Ve;Ve="";let o=t;for(;o<=n;++o){rs(r[o],s);const a=Et.get(r[o]);a!==null&&z(a)&&(Rt===null&&(Rt=a.getFormat()),Ct===""&&(Ct=a.getStyle()))}xs(e)&&(Ve+=Kt),s.element.__lexicalTextContent=Ve,Ve=i+Ve}function Co(r,e){if(r){const t=r.__last;if(t){const n=e.get(t);if(n)return pr(n)?"line-break":Ce(n)&&n.isInline()?"decorator":null}return"empty"}return null}function sa(r,e,t){const n=Co(r,yr),s=Co(e,Et);n!==s&&e.getDOMSlot(t).setManagedLineBreak(s)}function ia(r,e){const t=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(t!==et||n!==zn){const i=et==="",o=i?zn:(s=et,pc.test(s)?"rtl":gc.test(s)?"ltr":null);if(o!==n){const a=e.classList,l=ir.theme;let u=n!==null?l[n]:void 0,c=o!==null?l[o]:void 0;if(u!==void 0){if(typeof u=="string"){const d=Qn(u);u=l[n]=d}a.remove(...u)}if(o===null||i&&o==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){const d=Qn(c);c=l[o]=d}c!==void 0&&a.add(...c)}e.dir=o}yn||(r.getWritable().__dir=o)}zn=o,e.__lexicalDirTextContent=et,e.__lexicalDir=o}var s}function $c(r,e,t){const n=et;var s;et="",Rt=null,Ct="",function(i,o,a){const l=Ve,u=i.__size,c=o.__size;Ve="";const d=a.element;if(u===1&&c===1){const f=i.__first,h=o.__first;if(f===h)Zr(f,d);else{const m=ni(f),y=rs(h,null);try{d.replaceChild(y,m)}catch(D){if(typeof D=="object"&&D!=null){const x=`${D.toString()} Parent: ${d.tagName}, new child: {tag: ${y.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${f}}.`;throw new Error(x)}throw D}ts(f,null)}const p=Et.get(h);z(p)&&(Rt===null&&(Rt=p.getFormat()),Ct===""&&(Ct=p.getStyle()))}else{const f=ns(i,yr),h=ns(o,Et);if(f.length!==u&&$(227),h.length!==c&&$(228),u===0)c!==0&&ri(h,o,0,c-1,a);else if(c===0){if(u!==0){const p=a.after==null&&a.before==null&&a.element.__lexicalLineBreak==null;ti(f,0,u-1,p?null:d),p&&(d.textContent="")}}else(function(p,m,y,D,x,E){const _=D-1,A=x-1;let b,v,S=E.getFirstChild(),k=0,j=0;for(;k<=_&&j<=A;){const L=m[k],R=y[j];if(L===R)S=Os(Zr(R,E.element)),k++,j++;else{b===void 0&&(b=new Set(m)),v===void 0&&(v=new Set(y));const Q=v.has(L),se=b.has(R);if(Q)if(se){const xe=Zn(rt,R);xe===S?S=Os(Zr(R,E.element)):(E.withBefore(S).insertChild(xe),Zr(R,E.element)),k++,j++}else rs(R,E.withBefore(S)),j++;else S=Os(ni(L)),ts(L,E.element),k++}const P=Et.get(R);P!==null&&z(P)&&(Rt===null&&(Rt=P.getFormat()),Ct===""&&(Ct=P.getStyle()))}const T=k>_,B=j>A;if(T&&!B){const L=y[A+1],R=L===void 0?null:rt.getElementByKey(L);ri(y,p,j,A,E.withBefore(R))}else B&&!T&&ti(m,k,_,E.element)})(o,f,h,u,c,a)}xs(o)&&(Ve+=Kt),d.__lexicalTextContent=Ve,Ve=l+Ve}(r,e,e.getDOMSlot(t)),ia(e,t),Or(s=e)&&Rt!=null&&Rt!==s.__textFormat&&!yn&&(s.setTextFormat(Rt),s.setTextStyle(Ct)),function(i){Or(i)&&Ct!==""&&Ct!==i.__textStyle&&!yn&&i.setTextStyle(Ct)}(e),et=n}function ns(r,e){const t=[];let n=r.__first;for(;n!==null;){const s=e.get(n);s===void 0&&$(101),t.push(n),n=s.__next}return t}function Zr(r,e){const t=yr.get(r);let n=Et.get(r);t!==void 0&&n!==void 0||$(61);const s=ta||Zs.has(r)||Xs.has(r),i=Zn(rt,r);if(t===n&&!s){if(F(t)){const o=i.__lexicalTextContent;o!==void 0&&(Ve+=o,Vt+=o);const a=i.__lexicalDirTextContent;a!==void 0&&(et+=a)}else{const o=t.getTextContent();z(t)&&!t.isDirectionless()&&(et+=o),Vt+=o,Ve+=o}return i}if(t!==n&&s&&ji(mn,gn,_s,n,"updated"),n.updateDOM(t,i,ir)){const o=rs(r,null);return e===null&&$(62),e.replaceChild(o,i),ts(r,null),o}if(F(t)&&F(n)){const o=n.__indent;o!==t.__indent&&ra(i,o);const a=n.__format;a!==t.__format&&na(i,a),s&&($c(t,n,i),tt(n)||n.isInline()||sa(t,n,i)),xs(n)&&(Ve+=Kt,Vt+=Kt)}else{const o=n.getTextContent();if(Ce(n)){const a=n.decorate(rt,ir);a!==null&&oa(r,a)}else z(n)&&!n.isDirectionless()&&(et+=o);Ve+=o,Vt+=o}if(!yn&&tt(n)&&n.__cachedText!==Vt){const o=n.getWritable();o.__cachedText=Vt,n=o}return i}function oa(r,e){let t=rt._pendingDecorators;const n=rt._decorators;if(t===null){if(n[r]===e)return;t=Hl(rt)}t[r]=e}function Os(r){let e=r.nextSibling;return e!==null&&e===rt._blockCursorElement&&(e=e.nextSibling),e}function zc(r,e,t,n,s,i){Ve="",Vt="",et="",ta=n===Pr,zn=null,rt=t,ir=t._config,gn=t._nodes,_s=rt._listeners.mutation,Xs=s,Zs=i,yr=r._nodeMap,Et=e._nodeMap,yn=e._readOnly,ei=new Map(t._keyToDOMMap);const o=new Map;return mn=o,Zr("root",null),rt=void 0,gn=void 0,Xs=void 0,Zs=void 0,yr=void 0,Et=void 0,ir=void 0,ei=void 0,mn=void 0,o}function ni(r){const e=ei.get(r);return e===void 0&&$(75,r),e}const Gt=Object.freeze({}),si=30,ii=[["keydown",function(r,e){if(ln=r.timeStamp,la=r.key,e.isComposing())return;const{key:t,shiftKey:n,ctrlKey:s,metaKey:i,altKey:o}=r;if(!G(e,Vu,r)&&t!=null){if(function(a,l,u,c){return mo(a)&&!l&&!c&&!u}(t,s,o,i))G(e,Al,r);else if(function(a,l,u,c,d){return mo(a)&&!c&&!u&&(l||d)}(t,s,n,o,i))G(e,Ku,r);else if(function(a,l,u,c){return go(a)&&!l&&!c&&!u}(t,s,o,i))G(e,kl,r);else if(function(a,l,u,c,d){return go(a)&&!c&&!u&&(l||d)}(t,s,n,o,i))G(e,Hu,r);else if(function(a,l,u){return function(c){return c==="ArrowUp"}(a)&&!l&&!u}(t,s,i))G(e,Tl,r);else if(function(a,l,u){return function(c){return c==="ArrowDown"}(a)&&!l&&!u}(t,s,i))G(e,Nl,r);else if(function(a,l){return yo(a)&&l}(t,n))an=!0,G(e,Gn,r);else if(function(a){return a===" "}(t))G(e,Qu,r);else if(function(a,l){return vt&&l&&a.toLowerCase()==="o"}(t,s))r.preventDefault(),an=!0,G(e,Fr,!0);else if(function(a,l){return yo(a)&&!l}(t,n))an=!1,G(e,Gn,r);else if(function(a,l,u,c){return vt?!l&&!u&&(Vr(a)||a.toLowerCase()==="h"&&c):!(c||l||u)&&Vr(a)}(t,o,i,s))Vr(t)?G(e,Bl,r):(r.preventDefault(),G(e,fr,!0));else if(function(a){return a==="Escape"}(t))G(e,Fl,r);else if(function(a,l,u,c,d){return vt?!(u||c||d)&&(Kr(a)||a.toLowerCase()==="d"&&l):!(l||c||d)&&Kr(a)}(t,s,n,o,i))Kr(t)?G(e,Rl,r):(r.preventDefault(),G(e,fr,!1));else if(function(a,l,u){return Vr(a)&&(vt?l:u)}(t,o,s))r.preventDefault(),G(e,fn,!0);else if(function(a,l,u){return Kr(a)&&(vt?l:u)}(t,o,s))r.preventDefault(),G(e,fn,!1);else if(function(a,l){return vt&&l&&Vr(a)}(t,i))r.preventDefault(),G(e,hn,!0);else if(function(a,l){return vt&&l&&Kr(a)}(t,i))r.preventDefault(),G(e,hn,!1);else if(function(a,l,u,c){return a.toLowerCase()==="b"&&!l&&Xr(u,c)}(t,o,i,s))r.preventDefault(),G(e,Dt,"bold");else if(function(a,l,u,c){return a.toLowerCase()==="u"&&!l&&Xr(u,c)}(t,o,i,s))r.preventDefault(),G(e,Dt,"underline");else if(function(a,l,u,c){return a.toLowerCase()==="i"&&!l&&Xr(u,c)}(t,o,i,s))r.preventDefault(),G(e,Dt,"italic");else if(function(a,l,u,c){return a==="Tab"&&!l&&!u&&!c}(t,o,s,i))G(e,Ju,r);else if(function(a,l,u,c){return a.toLowerCase()==="z"&&!l&&Xr(u,c)}(t,n,i,s))r.preventDefault(),G(e,_i,void 0);else if(function(a,l,u,c){return vt?a.toLowerCase()==="z"&&u&&l:a.toLowerCase()==="y"&&c||a.toLowerCase()==="z"&&c&&l}(t,n,i,s))r.preventDefault(),G(e,vi,void 0);else{const a=e._editorState._selection;a===null||O(a)?!sr&&xo(t,i,s)&&(r.preventDefault(),G(e,Qs,r)):function(l,u,c,d){return!u&&l.toLowerCase()==="c"&&(vt?c:d)}(t,n,i,s)?(r.preventDefault(),G(e,hs,r)):function(l,u,c,d){return!u&&l.toLowerCase()==="x"&&(vt?c:d)}(t,n,i,s)?(r.preventDefault(),G(e,Ci,r)):xo(t,i,s)&&(r.preventDefault(),G(e,Qs,r))}(function(a,l,u,c){return a||l||u||c})(s,n,o,i)&&G(e,ic,r)}}],["pointerdown",function(r,e){const t=r.target,n=r.pointerType;t instanceof Node&&n!=="touch"&&ct(e,()=>{Ce(jr(t))||(li=!0)})}],["compositionstart",function(r,e){ct(e,()=>{const t=K();if(O(t)&&!e.isComposing()){const n=t.anchor,s=t.anchor.getNode();Qe(n.key),(r.timeStamp<ln+si||n.type==="element"||!t.isCollapsed()||s.getFormat()!==t.format||z(s)&&s.getStyle()!==t.style)&&G(e,Rr,hc)}})}],["compositionend",function(r,e){sr?Qr=!0:ct(e,()=>{Is(e,r.data)})}],["input",function(r,e){r.stopPropagation(),ct(e,()=>{const t=K(),n=r.data,s=da(r);if(n!=null&&O(t)&&ca(t,s,n,r.timeStamp,!1)){Qr&&(Is(e,n),Qr=!1);const i=t.anchor.getNode(),o=gt(e._window);if(o===null)return;const a=t.isBackward(),l=a?t.anchor.offset:t.focus.offset,u=a?t.focus.offset:t.anchor.offset;Vn&&!t.isCollapsed()&&z(i)&&o.anchorNode!==null&&i.getTextContent().slice(0,l)+n+i.getTextContent().slice(l+u)===Xl(o.anchorNode)||G(e,Rr,n);const c=n.length;sr&&c>1&&r.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=c),ps||bn||wi||!e.isComposing()||(ln=0,Qe(null))}else Mi(!1,e,n!==null?n:void 0),Qr&&(Is(e,n||void 0),Qr=!1);it(),ql(Pe())}),kr=null}],["click",function(r,e){ct(e,()=>{const t=K(),n=gt(e._window),s=Sn();if(n){if(O(t)){const i=t.anchor,o=i.getNode();i.type==="element"&&i.offset===0&&t.isCollapsed()&&!tt(o)&&Fe().getChildrenSize()===1&&o.getTopLevelElementOrThrow().isEmpty()&&s!==null&&t.is(s)?(n.removeAllRanges(),t.dirty=!0):r.detail===3&&!t.isCollapsed()&&o!==t.focus.getNode()&&(F(o)?o.select(0):o.getParentOrThrow().select(0))}else if(r.pointerType==="touch"){const i=n.anchorNode;if(i!==null){const o=i.nodeType;(o===_n||o===or)&&jt(qi(s,n,e,r))}}}G(e,Sl,r)})}],["cut",Gt],["copy",Gt],["dragstart",Gt],["dragover",Gt],["dragend",Gt],["paste",Gt],["focus",Gt],["blur",Gt],["drop",Gt]];Vn&&ii.push(["beforeinput",(r,e)=>function(t,n){const s=t.inputType,i=da(t);s==="deleteCompositionText"||sr&&Zl(n)||s!=="insertCompositionText"&&ct(n,()=>{const o=K();if(s==="deleteContentBackward"){if(o===null){const h=Sn();if(!O(h))return;jt(h.clone())}if(O(o)){const h=o.anchor.key===o.focus.key;if(a=t.timeStamp,la==="MediaLast"&&a<ln+si&&n.isComposing()&&h){if(Qe(null),ln=0,setTimeout(()=>{ct(n,()=>{Qe(null)})},si),O(o)){const p=o.anchor.getNode();p.markDirty(),o.format=p.getFormat(),z(p)||$(142),o.style=p.getStyle()}}else{Qe(null),t.preventDefault();const p=o.anchor.getNode(),m=p.getTextContent(),y=p.canInsertTextAfter(),D=o.anchor.offset===0&&o.focus.offset===m.length;ac&&h&&!D&&y||G(n,fr,!0)}return}}var a;if(!O(o))return;const l=t.data;kr!==null&&Mi(!1,n,kr),o.dirty&&kr===null||!o.isCollapsed()||tt(o.anchor.getNode())||i===null||o.applyDOMRange(i),kr=null;const u=o.anchor,c=o.focus,d=u.getNode(),f=c.getNode();if(s!=="insertText"&&s!=="insertTranspose")switch(t.preventDefault(),s){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":G(n,Rr,t);break;case"insertFromComposition":Qe(null),G(n,Rr,t);break;case"insertLineBreak":Qe(null),G(n,Fr,!1);break;case"insertParagraph":Qe(null),an&&!bn?(an=!1,G(n,Fr,!1)):G(n,dn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":G(n,fs,t);break;case"deleteByComposition":(function(h,p){return h!==p||F(h)||F(p)||!h.isToken()||!p.isToken()})(d,f)&&G(n,Hs,t);break;case"deleteByDrag":case"deleteByCut":G(n,Hs,t);break;case"deleteContent":G(n,fr,!1);break;case"deleteWordBackward":G(n,fn,!0);break;case"deleteWordForward":G(n,fn,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":G(n,hn,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":G(n,hn,!1);break;case"formatStrikeThrough":G(n,Dt,"strikethrough");break;case"formatBold":G(n,Dt,"bold");break;case"formatItalic":G(n,Dt,"italic");break;case"formatUnderline":G(n,Dt,"underline");break;case"historyUndo":G(n,_i,void 0);break;case"historyRedo":G(n,vi,void 0)}else{if(l===`
64
- `)t.preventDefault(),G(n,Fr,!1);else if(l===Kt)t.preventDefault(),G(n,dn,void 0);else if(l==null&&t.dataTransfer){const h=t.dataTransfer.getData("text/plain");t.preventDefault(),o.insertRawText(h)}else l!=null&&ca(o,i,l,t.timeStamp,!0)?(t.preventDefault(),G(n,Rr,l)):kr=l;aa=t.timeStamp}})}(r,e)]);let ln=0,la=null,aa=0,kr=null;const ss=new WeakMap;let oi=!1,li=!1,an=!1,Qr=!1,ua=[0,"",0,"root",0];function ca(r,e,t,n,s){const i=r.anchor,o=r.focus,a=i.getNode(),l=Pe(),u=gt(l._window),c=u!==null?u.anchorNode:null,d=i.key,f=l.getElementByKey(d),h=t.length;return d!==o.key||!z(a)||(!s&&(!Vn||aa<n+50)||a.isDirty()&&h<2||Jl(t))&&i.offset!==o.offset&&!a.isComposing()||cr(a)||a.isDirty()&&h>1||(s||!Vn)&&f!==null&&!a.isComposing()&&c!==Jn(f)||u!==null&&e!==null&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||a.getFormat()!==r.format||a.getStyle()!==r.style||Nc(r,a)}function wo(r,e){return r!==null&&r.nodeValue!==null&&r.nodeType===or&&e!==0&&e!==r.nodeValue.length}function Do(r,e,t){const{anchorNode:n,anchorOffset:s,focusNode:i,focusOffset:o}=r;oi&&(oi=!1,wo(n,s)&&wo(i,o))||ct(e,()=>{if(!t)return void jt(null);if(!vn(e,n,i))return;const a=K();if(O(a)){const l=a.anchor,u=l.getNode();if(a.isCollapsed()){r.type==="Range"&&r.anchorNode===r.focusNode&&(a.dirty=!0);const c=bs(e).event,d=c?c.timeStamp:performance.now(),[f,h,p,m,y]=ua,D=Fe(),x=e.isComposing()===!1&&D.getTextContent()==="";if(d<y+200&&l.offset===p&&l.key===m)a.format=f,a.style=h;else if(l.type==="text")z(u)||$(141),a.format=u.getFormat(),a.style=u.getStyle();else if(l.type==="element"&&!x){const E=l.getNode();a.style="",E instanceof $r&&E.getChildrenSize()===0?(a.format=E.getTextFormat(),a.style=E.getTextStyle()):a.format=0}}else{const c=l.key,d=a.focus.key,f=a.getNodes(),h=f.length,p=a.isBackward(),m=p?o:s,y=p?s:o,D=p?d:c,x=p?c:d;let E=fc,_=!1;for(let A=0;A<h;A++){const b=f[A],v=b.getTextContentSize();if(z(b)&&v!==0&&!(A===0&&b.__key===D&&m===v||A===h-1&&b.__key===x&&y===0)&&(_=!0,E&=b.getFormat(),E===0))break}a.format=_?E:0}}G(e,bi,void 0)})}function da(r){if(!r.getTargetRanges)return null;const e=r.getTargetRanges();return e.length===0?null:e[0]}function Is(r,e){const t=r._compositionKey;if(Qe(null),t!==null&&e!=null){if(e===""){const n=Xe(t),s=Jn(r.getElementByKey(t));return void(s!==null&&s.nodeValue!==null&&z(n)&&Pi(n,s.nodeValue,null,null,!0))}if(e[e.length-1]===`
65
- `){const n=K();if(O(n)){const s=n.focus;return n.anchor.set(s.key,s.offset,s.type),void G(r,Gn,null)}}}Mi(!0,r,e)}function fa(r){let e=r.__lexicalEventHandles;return e===void 0&&(e=[],r.__lexicalEventHandles=e),e}const Lr=new Map;function ha(r){const e=r.target,t=gt(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const n=Gl(t.anchorNode);if(n===null)return;li&&(li=!1,ct(n,()=>{const u=Sn(),c=t.anchorNode;if(c===null)return;const d=c.nodeType;d!==_n&&d!==or||jt(qi(u,t,n,r))}));const s=Li(n),i=s[s.length-1],o=i._key,a=Lr.get(o),l=a||i;l!==n&&Do(t,l,!1),Do(t,n,!0),n!==i?Lr.set(o,n):a&&Lr.delete(o)}function Eo(r){r._lexicalHandled=!0}function So(r){return r._lexicalHandled===!0}function qc(r){const e=r.ownerDocument,t=ss.get(e);t===void 0&&$(162);const n=t-1;n>=0||$(164),ss.set(e,n),n===0&&e.removeEventListener("selectionchange",ha);const s=ms(r);Ri(s)?(function(o){if(o._parentEditor!==null){const a=Li(o),l=a[a.length-1]._key;Lr.get(l)===o&&Lr.delete(l)}else Lr.delete(o._key)}(s),r.__lexicalEditor=null):s&&$(198);const i=fa(r);for(let o=0;o<i.length;o++)i[o]();r.__lexicalEventHandles=[]}function ai(r,e,t){it();const n=r.__key,s=r.getParent();if(s===null)return;const i=function(a){const l=K();if(!O(l)||!F(a))return l;const{anchor:u,focus:c}=l,d=u.getNode(),f=c.getNode();return on(d,a)&&u.set(a.__key,0,"element"),on(f,a)&&c.set(a.__key,0,"element"),l}(r);let o=!1;if(O(i)&&e){const a=i.anchor,l=i.focus;a.key===n&&(os(a,r,s,r.getPreviousSibling(),r.getNextSibling()),o=!0),l.key===n&&(os(l,r,s,r.getPreviousSibling(),r.getNextSibling()),o=!0)}else Lt(i)&&e&&r.isSelected()&&r.selectPrevious();if(O(i)&&e&&!o){const a=r.getIndexWithinParent();hr(r),is(i,s,a,-1)}else hr(r);t||Ot(s)||s.canBeEmpty()||!s.isEmpty()||ai(s,e),e&&tt(s)&&s.isEmpty()&&s.selectEnd()}class vs{static getType(){$(64,this.name)}static clone(e){$(65,this.name)}afterCloneFrom(e){this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Tc(this,e)}getType(){return this.__type}isInline(){$(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=Xe(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||K();if(t==null)return!1;const n=t.getNodes().some(s=>s.__key===this.__key);if(z(this))return n;if(O(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const s=this.getParent();if(Ce(this)&&this.isInline()&&s){const i=t.isBackward()?t.focus:t.anchor,o=i.getNode();if(i.offset===o.getChildrenSize()&&o.is(s)&&o.getLastChildOrThrow().is(this))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:Xe(e)}getParentOrThrow(){const e=this.getParent();return e===null&&$(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(Ot(t))return F(e)||e===this&&Ce(e)||$(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&$(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:Xe(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return e===null?null:Xe(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=this.getParents(),n=e.getParents();F(this)&&t.unshift(this),F(e)&&n.unshift(e);const s=t.length,i=n.length;if(s===0||i===0||t[s-1]!==n[i-1])return null;const o=new Set(n);for(let a=0;a<s;a++){const l=t[a];if(o.has(l))return l}return null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;const t=this.getCommonAncestor(e);let n=0,s=0,i=this;for(;;){const o=i.getParentOrThrow();if(o===t){n=i.getIndexWithinParent();break}i=o}for(i=e;;){const o=i.getParentOrThrow();if(o===t){s=i.getIndexWithinParent();break}i=o}return n<s}isParentOf(e){const t=this.__key;if(t===e.__key)return!1;let n=e;for(;n!==null;){if(n.__key===t)return!0;n=n.getParent()}return!1}getNodesBetween(e){const t=this.isBefore(e),n=[],s=new Set;let i=this;for(;i!==null;){const o=i.__key;if(s.has(o)||(s.add(o),n.push(i)),i===e)break;const a=F(i)?t?i.getFirstChild():i.getLastChild():null;if(a!==null){i=a;continue}const l=t?i.getNextSibling():i.getPreviousSibling();if(l!==null){i=l;continue}const u=i.getParentOrThrow();if(s.has(u.__key)||n.push(u),u===e)break;let c=null,d=u;do{if(d===null&&$(68),c=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d===null)break;c!==null||s.has(d.__key)||n.push(d)}while(c===null);i=c}return t||n.reverse(),n}isDirty(){const e=Pe()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=Xe(this.__key);return e===null&&$(113),e}getWritable(){it();const e=Qt(),t=Pe(),n=e._nodeMap,s=this.__key,i=this.getLatest(),o=t._cloneNotNeeded,a=K();if(a!==null&&a.setCachedNodes(null),o.has(s))return Xn(i),i;const l=Ii(i);return o.add(s),Xn(l),n.set(s,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){$(70)}updateDOM(e,t,n){$(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){$(72)}static importJSON(e){$(18,this.name)}static transform(){return null}remove(e){ai(this,!0,e)}replace(e,t){it();let n=K();n!==null&&(n=n.clone()),Ps(this,e);const s=this.getLatest(),i=this.__key,o=e.__key,a=e.getWritable(),l=this.getParentOrThrow().getWritable(),u=l.__size;hr(a);const c=s.getPreviousSibling(),d=s.getNextSibling(),f=s.__prev,h=s.__next,p=s.__parent;if(ai(s,!1,!0),c===null?l.__first=o:c.getWritable().__next=o,a.__prev=f,d===null?l.__last=o:d.getWritable().__prev=o,a.__next=h,a.__parent=p,l.__size=u,t&&(F(this)&&F(a)||$(139),this.getChildren().forEach(m=>{a.append(m)})),O(n)){jt(n);const m=n.anchor,y=n.focus;m.key===i&&No(m,a),y.key===i&&No(y,a)}return tr()===i&&Qe(o),a}insertAfter(e,t=!0){it(),Ps(this,e);const n=this.getWritable(),s=e.getWritable(),i=s.getParent(),o=K();let a=!1,l=!1;if(i!==null){const h=e.getIndexWithinParent();if(hr(s),O(o)){const p=i.__key,m=o.anchor,y=o.focus;a=m.type==="element"&&m.key===p&&m.offset===h+1,l=y.type==="element"&&y.key===p&&y.offset===h+1}}const u=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),d=s.__key,f=n.__next;if(u===null?c.__last=d:u.getWritable().__prev=d,c.__size++,n.__next=d,s.__next=f,s.__prev=n.__key,s.__parent=n.__parent,t&&O(o)){const h=this.getIndexWithinParent();is(o,c,h+1);const p=c.__key;a&&o.anchor.set(p,h+2,"element"),l&&o.focus.set(p,h+2,"element")}return e}insertBefore(e,t=!0){it(),Ps(this,e);const n=this.getWritable(),s=e.getWritable(),i=s.__key;hr(s);const o=this.getPreviousSibling(),a=this.getParentOrThrow().getWritable(),l=n.__prev,u=this.getIndexWithinParent();o===null?a.__first=i:o.getWritable().__next=i,a.__size++,n.__prev=i,s.__prev=l,s.__next=n.__key,s.__parent=n.__parent;const c=K();return t&&O(c)&&is(c,this.getParentOrThrow(),u),e}isParentRequired(){return!1}createParentElementNode(){return Ue()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){it();const n=this.getPreviousSibling(),s=this.getParentOrThrow();if(n===null)return s.select(0,0);if(F(n))return n.select();if(!z(n)){const i=n.getIndexWithinParent()+1;return s.select(i,i)}return n.select(e,t)}selectNext(e,t){it();const n=this.getNextSibling(),s=this.getParentOrThrow();if(n===null)return s.select();if(F(n))return n.select(0,0);if(!z(n)){const i=n.getIndexWithinParent();return s.select(i,i)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class wn extends vs{static getType(){return"linebreak"}static clone(e){return new wn(e.__key)}constructor(e){super(e)}getTextContent(){return`
66
- `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const n=t.parentElement;if(n!==null&&es(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&Ln(s)){const i=n.lastChild;if(i===t||i.previousSibling===t&&Ln(i))return!0}}return!1}(e)||function(t){const n=t.parentElement;if(n!==null&&es(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&Ln(s))return!1;const i=n.lastChild;if(i===t||i.previousSibling===t&&Ln(i))return!0}return!1}(e)?null:{conversion:Uc,priority:0}}}static importJSON(e){return xr()}exportJSON(){return{type:"linebreak",version:1}}}function Uc(r){return{node:xr()}}function xr(){return $t(new wn)}function pr(r){return r instanceof wn}function Ln(r){return r.nodeType===or&&/^( |\t|\r?\n)+$/.test(r.textContent||"")}function $s(r,e){return 16&e?"code":e&Di?"mark":32&e?"sub":64&e?"sup":null}function zs(r,e){return 1&e?"strong":2&e?"em":"span"}function pa(r,e,t,n,s){const i=n.classList;let o=sn(s,"base");o!==void 0&&i.add(...o),o=sn(s,"underlineStrikethrough");let a=!1;const l=e&Hn&&e&Kn;o!==void 0&&(t&Hn&&t&Kn?(a=!0,l||i.add(...o)):l&&i.remove(...o));for(const u in mr){const c=mr[u];if(o=sn(s,u),o!==void 0)if(t&c){if(a&&(u==="underline"||u==="strikethrough")){e&c&&i.remove(...o);continue}e&c&&(!l||u!=="underline")&&u!=="strikethrough"||i.add(...o)}else e&c&&i.remove(...o)}}function ga(r,e,t){const n=e.firstChild,s=t.isComposing(),i=r+(s?gs:"");if(n==null)e.textContent=i;else{const o=n.nodeValue;if(o!==i)if(s||sr){const[a,l,u]=function(c,d){const f=c.length,h=d.length;let p=0,m=0;for(;p<f&&p<h&&c[p]===d[p];)p++;for(;m+p<f&&m+p<h&&c[f-m-1]===d[h-m-1];)m++;return[p,f-p-m,d.slice(p,h-m)]}(o,i);l!==0&&n.deleteData(a,l),n.insertData(a,u)}else n.nodeValue=i}}function Ao(r,e,t,n,s,i){ga(s,r,e);const o=i.theme.text;o!==void 0&&pa(0,0,n,r,o)}function Mn(r,e){const t=document.createElement(e);return t.appendChild(r),t}class Ir extends vs{static getType(){return"text"}static clone(e){return new Ir(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return bc[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===tr()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=mr[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Yn(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const n=this.__format,s=$s(0,n),i=zs(0,n),o=s===null?i:s,a=document.createElement(o);let l=a;this.hasFormat("code")&&a.setAttribute("spellcheck","false"),s!==null&&(l=document.createElement(i),a.appendChild(l)),Ao(l,this,0,n,this.__text,e);const u=this.__style;return u!==""&&(a.style.cssText=u),a}updateDOM(e,t,n){const s=this.__text,i=e.__format,o=this.__format,a=$s(0,i),l=$s(0,o),u=zs(0,i),c=zs(0,o);if((a===null?u:a)!==(l===null?c:l))return!0;if(a===l&&u!==c){const m=t.firstChild;m==null&&$(48);const y=document.createElement(c);return Ao(y,this,0,o,s,n),t.replaceChild(y,m),!1}let d=t;l!==null&&a!==null&&(d=t.firstChild,d==null&&$(49)),ga(s,d,this);const f=n.theme.text;f!==void 0&&i!==o&&pa(0,i,o,d,f);const h=e.__style,p=this.__style;return h!==p&&(t.style.cssText=p),!1}static importDOM(){return{"#text":()=>({conversion:Kc,priority:0}),b:()=>({conversion:Gc,priority:0}),code:()=>({conversion:Xt,priority:0}),em:()=>({conversion:Xt,priority:0}),i:()=>({conversion:Xt,priority:0}),s:()=>({conversion:Xt,priority:0}),span:()=>({conversion:Wc,priority:0}),strong:()=>({conversion:Xt,priority:0}),sub:()=>({conversion:Xt,priority:0}),sup:()=>({conversion:Xt,priority:0}),u:()=>({conversion:Xt,priority:0})}}static importJSON(e){const t=Ge(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);return t!==null&&Ht(t)||$(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=Mn(t,"b")),this.hasFormat("italic")&&(t=Mn(t,"i")),this.hasFormat("strikethrough")&&(t=Mn(t,"s")),this.hasFormat("underline")&&(t=Mn(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format=typeof e=="string"?mr[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?mc[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Yn(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=xc[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){it();let n=e,s=t;const i=K(),o=this.getTextContent(),a=this.__key;if(typeof o=="string"){const l=o.length;n===void 0&&(n=l),s===void 0&&(s=l)}else n=0,s=0;if(!O(i))return xa(a,n,a,s,"text","text");{const l=tr();l!==i.anchor.key&&l!==i.focus.key||Qe(a),i.setTextNodeRange(this,n,this,s)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,s){const i=this.getWritable(),o=i.__text,a=n.length;let l=e;l<0&&(l=a+l,l<0&&(l=0));const u=K();if(s&&O(u)){const d=e+a;u.setTextNodeRange(i,d,i,d)}const c=o.slice(0,l)+n+o.slice(l+t);return i.__text=c,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){it();const t=this.getLatest(),n=t.getTextContent(),s=t.__key,i=tr(),o=new Set(e),a=[],l=n.length;let u="";for(let A=0;A<l;A++)u!==""&&o.has(A)&&(a.push(u),u=""),u+=n[A];u!==""&&a.push(u);const c=a.length;if(c===0)return[];if(a[0]===n)return[t];const d=a[0],f=t.getParent();let h;const p=t.getFormat(),m=t.getStyle(),y=t.__detail;let D=!1;t.isSegmented()?(h=Ge(d),h.__format=p,h.__style=m,h.__detail=y,D=!0):(h=t.getWritable(),h.__text=d);const x=K(),E=[h];let _=d.length;for(let A=1;A<c;A++){const b=a[A],v=b.length,S=Ge(b).getWritable();S.__format=p,S.__style=m,S.__detail=y;const k=S.__key,j=_+v;if(O(x)){const T=x.anchor,B=x.focus;T.key===s&&T.type==="text"&&T.offset>_&&T.offset<=j&&(T.key=k,T.offset-=_,x.dirty=!0),B.key===s&&B.type==="text"&&B.offset>_&&B.offset<=j&&(B.key=k,B.offset-=_,x.dirty=!0)}i===s&&Qe(k),_=j,E.push(S)}if(f!==null){(function(v){const S=v.getPreviousSibling(),k=v.getNextSibling();S!==null&&Xn(S),k!==null&&Xn(k)})(this);const A=f.getWritable(),b=this.getIndexWithinParent();D?(A.splice(b,0,E),this.remove()):A.splice(b,1,E),O(x)&&is(x,f,b,c-1)}return E}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||$(50);const n=this.__key,s=e.__key,i=this.__text,o=i.length;tr()===s&&Qe(n);const a=K();if(O(a)){const d=a.anchor,f=a.focus;d!==null&&d.key===s&&(jo(d,t,n,e,o),a.dirty=!0),f!==null&&f.key===s&&(jo(f,t,n,e,o),a.dirty=!0)}const l=e.__text,u=t?l+i:i+l;this.setTextContent(u);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function Wc(r){return{forChild:zi(r.style),node:null}}function Gc(r){const e=r,t=e.style.fontWeight==="normal";return{forChild:zi(e.style,t?void 0:"bold"),node:null}}const ko=new WeakMap;function Vc(r){return r.nodeName==="PRE"||r.nodeType===_n&&r.style!==void 0&&r.style.whiteSpace!==void 0&&r.style.whiteSpace.startsWith("pre")}function Kc(r){const e=r;r.parentElement===null&&$(129);let t=e.textContent||"";if(function(n){let s,i=n.parentNode;const o=[n];for(;i!==null&&(s=ko.get(i))===void 0&&!Vc(i);)o.push(i),i=i.parentNode;const a=s===void 0?i:s;for(let l=0;l<o.length;l++)ko.set(o[l],a);return a}(e)!==null){const n=t.split(/(\r?\n|\t)/),s=[],i=n.length;for(let o=0;o<i;o++){const a=n[o];a===`
67
- `||a===`\r
68
- `?s.push(xr()):a===" "?s.push(En()):a!==""&&s.push(Ge(a))}return{node:s}}if(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," "),t==="")return{node:null};if(t[0]===" "){let n=e,s=!0;for(;n!==null&&(n=To(n,!1))!==null;){const i=n.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(t=t.slice(1)),s=!1;break}}s&&(t=t.slice(1))}if(t[t.length-1]===" "){let n=e,s=!0;for(;n!==null&&(n=To(n,!0))!==null;)if((n.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){s=!1;break}s&&(t=t.slice(0,t.length-1))}return t===""?{node:null}:{node:Ge(t)}}function To(r,e){let t=r;for(;;){let n;for(;(n=e?t.nextSibling:t.previousSibling)===null;){const i=t.parentElement;if(i===null)return null;t=i}if(t=n,t.nodeType===_n){const i=t.style.display;if(i===""&&!Ys(t)||i!==""&&!i.startsWith("inline"))return null}let s=t;for(;(s=e?t.firstChild:t.lastChild)!==null;)t=s;if(t.nodeType===or)return t;if(t.nodeName==="BR")return null}}const Hc={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Xt(r){const e=Hc[r.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:zi(r.style,e),node:null}}function Ge(r=""){return $t(new Ir(r))}function z(r){return r instanceof Ir}function zi(r,e){const t=r.fontWeight,n=r.textDecoration.split(" "),s=t==="700"||t==="bold",i=n.includes("line-through"),o=r.fontStyle==="italic",a=n.includes("underline"),l=r.verticalAlign;return u=>(z(u)&&(s&&!u.hasFormat("bold")&&u.toggleFormat("bold"),i&&!u.hasFormat("strikethrough")&&u.toggleFormat("strikethrough"),o&&!u.hasFormat("italic")&&u.toggleFormat("italic"),a&&!u.hasFormat("underline")&&u.toggleFormat("underline"),l!=="sub"||u.hasFormat("subscript")||u.toggleFormat("subscript"),l!=="super"||u.hasFormat("superscript")||u.toggleFormat("superscript"),e&&!u.hasFormat(e)&&u.toggleFormat(e)),u)}class Dn extends Ir{static getType(){return"tab"}static clone(e){return new Dn(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}static importJSON(e){const t=En();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){$(126)}setDetail(e){$(127)}setMode(e){$(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function En(){return $t(new Dn)}function Qc(r){return r instanceof Dn}class Jc{constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode(),n=e.getNode();const s=this.offset,i=e.offset;if(F(t)){const o=t.getDescendantByIndex(s);t=o??t}if(F(n)){const o=n.getDescendantByIndex(i);n=o??n}return t===n?s<i:t.isBefore(n)}getNode(){const e=Xe(this.key);return e===null&&$(20),e}set(e,t,n){const s=this._selection,i=this.key;this.key=e,this.offset=t,this.type=n,An()||(tr()===i&&Qe(e),s!==null&&(s.setCachedNodes(null),s.dirty=!0))}}function It(r,e,t){return new Jc(r,e,t)}function qs(r,e){let t=e.__key,n=r.offset,s="element";if(z(e)){s="text";const i=e.getTextContentSize();n>i&&(n=i)}else if(!F(e)){const i=e.getNextSibling();if(z(i))t=i.__key,n=0,s="text";else{const o=e.getParent();o&&(t=o.__key,n=e.getIndexWithinParent()+1)}}r.set(t,n,s)}function No(r,e){if(F(e)){const t=e.getLastDescendant();F(t)||z(t)?qs(r,t):qs(r,e)}else qs(r,e)}function er(r,e,t,n){r.key=e,r.offset=t,r.type=n}class Cs{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Lt(e))return!1;const t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(s=>n.has(s))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new Cs(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),n=t.length,s=t[n-1];let i;if(z(s))i=s.select();else{const o=s.getIndexWithinParent()+1;i=s.getParentOrThrow().select(o,o)}i.insertNodes(e);for(let o=0;o<n;o++)t[o].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,n=[];for(const s of t){const i=Xe(s);i!==null&&n.push(i)}return An()||(this._cachedNodes=n),n}getTextContent(){const e=this.getNodes();let t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}}function O(r){return r instanceof lr}class lr{constructor(e,t,n,s){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=s,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!O(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor,n=this.focus,s=t.isBefore(n),i=s?t:n,o=s?n:t;let a=i.getNode(),l=o.getNode();const u=i.offset,c=o.offset;if(F(a)){const f=a.getDescendantByIndex(u);a=f??a}if(F(l)){let f=l.getDescendantByIndex(c);f!==null&&f!==a&&l.getChildAtIndex(c)===f&&(f=f.getPreviousSibling()),l=f??l}let d;return d=a.is(l)?F(a)&&a.getChildrenSize()>0?[]:[a]:a.getNodesBetween(l),An()||(this._cachedNodes=d),d}setTextNodeRange(e,t,n,s){er(this.anchor,e.__key,t,"text"),er(this.focus,n.__key,s,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const t=e[0],n=e[e.length-1],s=this.anchor,i=this.focus,o=s.isBefore(i),[a,l]=ui(this);let u="",c=!0;for(let d=0;d<e.length;d++){const f=e[d];if(F(f)&&!f.isInline())c||(u+=`
69
- `),c=!f.isEmpty();else if(c=!1,z(f)){let h=f.getTextContent();f===t?f===n?s.type==="element"&&i.type==="element"&&i.offset!==s.offset||(h=a<l?h.slice(a,l):h.slice(l,a)):h=o?h.slice(a):h.slice(l):f===n&&(h=o?h.slice(0,l):h.slice(0,a)),u+=h}else!Ce(f)&&!pr(f)||f===n&&this.isCollapsed()||(u+=f.getTextContent())}return u}applyDOMRange(e){const t=Pe(),n=t.getEditorState()._selection,s=ya(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(s===null)return;const[i,o]=s;er(this.anchor,i.key,i.offset,i.type),er(this.focus,o.key,o.offset,o.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new lr(It(e.key,e.offset,e.type),It(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Yn(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=mr[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],s=t.length;for(let i=0;i<s;i++){const o=t[i];o===`
85
+ `,Vf=mr?" ":ai,ku="֑-߿יִ-﷽ﹰ-ﻼ",Du="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Hf=new RegExp("^[^"+Du+"]*["+ku+"]"),Gf=new RegExp("^[^"+ku+"]*["+Du+"]"),Nr={bold:1,code:16,highlight:Po,italic:2,strikethrough:Fs,subscript:32,superscript:64,underline:Rs},Kf={directionless:1,unmergeable:2},Da={center:Io,end:Uo,justify:$o,left:Oo,right:zo,start:qo},Yf={[Io]:"center",[Uo]:"end",[$o]:"justify",[Oo]:"left",[zo]:"right",[qo]:"start"},Qf={normal:0,segmented:2,token:1},Xf={[$f]:"normal",[Uf]:"segmented",[qf]:"token"};function Jf(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var V=Jf(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Ms(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}const Zf=100;let Qi=!1,Wo=0;function eh(r){Wo=r.timeStamp}function Ni(r,e,t){const n=r.nodeName==="BR",s=e.__lexicalLineBreak;return s&&(r===s||n&&r.previousSibling===s)||n&&ui(r,t)!==void 0}function th(r,e,t){const n=Et(t._window);let s=null,i=null;n!==null&&n.anchorNode===r&&(s=n.anchorOffset,i=n.focusOffset);const o=r.nodeValue;o!==null&&Yo(e,o,s,i,!1)}function rh(r,e,t){if(z(r)){const n=r.anchor.getNode();if(n.is(t)&&r.format!==n.getFormat())return!1}return e.nodeType===xr&&t.isAttached()}function nh(r,e,t,n){for(let s=r;s&&!mh(s);s=Qn(s)){const i=ui(s,e);if(i!==void 0){const o=st(i,t);if(o)return Ae(o)?void 0:[s,o]}else if(s===n)return[n,Lu(t)]}}function Au(r,e,t){Qi=!0;const n=performance.now()-Wo>Zf;try{bt(r,()=>{const s=te()||function(f){return f.getEditorState().read(()=>{const h=te();return h!==null?h.clone():null})}(r),i=new Map,o=r.getRootElement(),l=r._editorState,a=r._blockCursorElement;let u=!1,c="";for(let f=0;f<e.length;f++){const h=e[f],g=h.type,m=h.target,x=nh(m,r,l,o);if(!x)continue;const[v,_]=x;if(g==="characterData")n&&G(_)&&rh(s,m,_)&&th(m,_,r);else if(g==="childList"){u=!0;const C=h.addedNodes;for(let w=0;w<C.length;w++){const y=C[w],k=Mu(y),B=y.parentNode;if(B!=null&&y!==a&&k===null&&!Ni(y,B,r)){if(mr){const F=y.innerText||y.nodeValue;F&&(c+=F)}B.removeChild(y)}}const S=h.removedNodes,D=S.length;if(D>0){let w=0;for(let y=0;y<D;y++){const k=S[y];(Ni(k,m,r)||a===k)&&(m.appendChild(k),w++)}D!==w&&i.set(v,_)}}}if(i.size>0)for(const[f,h]of i)h.reconcileObservedMutation(f,r);const d=t.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){const h=d[f],g=h.addedNodes,m=h.target;for(let x=0;x<g.length;x++){const v=g[x],_=v.parentNode;_==null||v.nodeName!=="BR"||Ni(v,m,r)||_.removeChild(v)}}t.takeRecords()}s!==null&&(u&&(s.dirty=!0,Gt(s)),mr&&zu(r)&&s.insertRawText(c))})}finally{Qi=!1}}function Tu(r){const e=r._observer;e!==null&&Au(r,e.takeRecords(),e)}function Bu(r){(function(e){Wo===0&&di(e).addEventListener("textInput",eh,!0)})(r),r._observer=new MutationObserver((e,t)=>{Au(r,e,t)})}function Aa(r,e){const t=r.__mode,n=r.__format,s=r.__style,i=e.__mode,o=e.__format,l=e.__style;return!(t!==null&&t!==i||n!==null&&n!==o||s!==null&&s!==l)}function Ta(r,e){const t=r.mergeWithSibling(e),n=ze()._normalizedNodes;return n.add(r.__key),n.add(e.__key),t}function Ba(r){let e,t,n=r;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&G(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Aa(e,n)){n=Ta(e,n);break}break}e.remove()}for(;(t=n.getNextSibling())!==null&&G(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Aa(n,t)){n=Ta(n,t);break}break}t.remove()}}else n.remove()}function Nu(r){return Na(r.anchor),Na(r.focus),r}function Na(r){for(;r.type==="element";){const e=r.getNode(),t=r.offset;let n,s;if(t===e.getChildrenSize()?(n=e.getChildAtIndex(t-1),s=!0):(n=e.getChildAtIndex(t),s=!1),G(n)){r.set(n.__key,s?n.getTextContentSize():0,"text");break}if(!P(n))break;r.set(n.__key,s?n.getChildrenSize():0,"element")}}let sh=1;const ih=typeof queueMicrotask=="function"?queueMicrotask:r=>{Promise.resolve().then(r)};function Vo(r){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return Ae(en(r))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&li(e)==null)}function Yn(r,e,t){const n=r.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!Vo(e)&&Fu(e)===r}catch{return!1}}function Ho(r){return r instanceof mi}function Fu(r){let e=r;for(;e!=null;){const t=li(e);if(Ho(t))return t;e=Qn(e)}return null}function li(r){return r?r.__lexicalEditor:null}function Cr(r){return r.isToken()||r.isSegmented()}function oh(r){return r.nodeType===xr}function js(r){let e=r;for(;e!=null;){if(oh(e))return e;e=e.firstChild}return null}function Ls(r,e,t){const n=Nr[e];if(t!==null&&(r&n)==(t&n))return r;let s=r^n;return e==="subscript"?s&=-65:e==="superscript"&&(s&=-33),s}function Ru(r){return G(r)||Ar(r)||Ae(r)}function ah(r,e){if(e!=null)return void(r.__key=e);pt(),ac();const t=ze(),n=ar(),s=""+sh++;n._nodeMap.set(s,r),P(r)?t._dirtyElements.set(s,!0):t._dirtyLeaves.add(s),t._cloneNotNeeded.add(s),t._dirtyType=Eu,r.__key=s}function Dr(r){const e=r.getParent();if(e!==null){const t=r.getWritable(),n=e.getWritable(),s=r.getPreviousSibling(),i=r.getNextSibling();if(s===null)if(i!==null){const o=i.getWritable();n.__first=i.__key,o.__prev=null}else n.__first=null;else{const o=s.getWritable();if(i!==null){const l=i.getWritable();l.__prev=o.__key,o.__next=l.__key}else o.__next=null;t.__prev=null}if(i===null)if(s!==null){const o=s.getWritable();n.__last=s.__key,o.__next=null}else n.__last=null;else{const o=i.getWritable();if(s!==null){const l=s.getWritable();l.__next=o.__key,o.__prev=l.__key}else o.__prev=null;t.__next=null}n.__size--,t.__parent=null}}function Ps(r){ac();const e=r.getLatest(),t=e.__parent,n=ar(),s=ze(),i=n._nodeMap,o=s._dirtyElements;t!==null&&function(a,u,c){let d=a;for(;d!==null;){if(c.has(d))return;const f=u.get(d);if(f===void 0)break;c.set(d,!1),d=f.__parent}}(t,i,o);const l=e.__key;s._dirtyType=Eu,P(r)?o.set(l,!0):s._dirtyLeaves.add(l)}function Ze(r){pt();const e=ze(),t=e._compositionKey;if(r!==t){if(e._compositionKey=r,t!==null){const n=st(t);n!==null&&n.getWritable()}if(r!==null){const n=st(r);n!==null&&n.getWritable()}}}function hr(){return ts()?null:ze()._compositionKey}function st(r,e){const t=(e||ar())._nodeMap.get(r);return t===void 0?null:t}function Mu(r,e){const t=ui(r,ze());return t!==void 0?st(t,e):null}function ui(r,e){return r[`__lexicalKey_${e._key}`]}function en(r,e){let t=r;for(;t!=null;){const n=Mu(t,e);if(n!==null)return n;t=Qn(t)}return null}function ju(r){const e=r._decorators,t=Object.assign({},e);return r._pendingDecorators=t,t}function Fa(r){return r.read(()=>Pe().getTextContent())}function Pe(){return Lu(ar())}function Lu(r){return r._nodeMap.get("root")}function Gt(r){pt();const e=ar();r!==null&&(r.dirty=!0,r.setCachedNodes(null)),e._selection=r}function Vr(r){const e=ze(),t=function(n,s){let i=n;for(;i!=null;){const o=ui(i,s);if(o!==void 0)return o;i=Qn(i)}return null}(r,e);return t===null?r===e.getRootElement()?st("root"):null:st(t)}function Ra(r,e){return e?r.getTextContentSize():0}function Pu(r){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(r)}function Go(r){const e=[];let t=r;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Ou(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Iu(r){return r.nodeType===xr?r.nodeValue:null}function Ko(r,e,t){const n=Et(e._window);if(n===null)return;const s=n.anchorNode;let{anchorOffset:i,focusOffset:o}=n;if(s!==null){let l=Iu(s);const a=en(s);if(l!==null&&G(a)){if(l===ai&&t){const u=t.length;l=t,i=u,o=u}l!==null&&Yo(a,l,i,o,r)}}}function Yo(r,e,t,n,s){let i=r;if(i.isAttached()&&(s||!i.isDirty())){const o=i.isComposing();let l=e;(o||s)&&e[e.length-1]===ai&&(l=e.slice(0,-1));const a=i.getTextContent();if(s||l!==a){if(l===""){if(Ze(null),oi||Gn||Lo)i.remove();else{const m=ze();setTimeout(()=>{m.update(()=>{i.isAttached()&&i.remove()})},20)}return}const u=i.getParent(),c=es(),d=i.getTextContentSize(),f=hr(),h=i.getKey();if(i.isToken()||f!==null&&h===f&&!o||z(c)&&(u!==null&&!u.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===r.__key&&c.anchor.offset===0&&!i.canInsertTextBefore()&&!o||c.focus.key===r.__key&&c.focus.offset===d&&!i.canInsertTextAfter()&&!o))return void i.markDirty();const g=te();if(!z(g)||t===null||n===null)return void i.setTextContent(l);if(g.setTextNodeRange(i,t,i,n),i.isSegmented()){const m=Ke(i.getTextContent());i.replace(m),i=m}i.setTextContent(l)}}}function lh(r,e){if(e.isSegmented())return!0;if(!r.isCollapsed())return!1;const t=r.anchor.offset,n=e.getParentOrThrow(),s=e.isToken();return t===0?!e.canInsertTextBefore()||!n.canInsertTextBefore()&&!e.isComposing()||s||function(i){const o=i.getPreviousSibling();return(G(o)||P(o)&&o.isInline())&&!o.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||s)}function Ma(r){return r==="ArrowLeft"}function ja(r){return r==="ArrowRight"}function _n(r,e){return Tt?r:e}function La(r){return r==="Enter"}function fn(r){return r==="Backspace"}function hn(r){return r==="Delete"}function Pa(r,e,t){return r.toLowerCase()==="a"&&_n(e,t)}function uh(){const r=Pe();Gt(Nu(r.select(0,r.getChildrenSize())))}function An(r,e){r.__lexicalClassNameCache===void 0&&(r.__lexicalClassNameCache={});const t=r.__lexicalClassNameCache,n=t[e];if(n!==void 0)return n;const s=r[e];if(typeof s=="string"){const i=Ms(s);return t[e]=i,i}return s}function Qo(r,e,t,n,s){if(t.size===0)return;const i=n.__type,o=n.__key,l=e.get(i);l===void 0&&V(33,i);const a=l.klass;let u=r.get(a);u===void 0&&(u=new Map,r.set(a,u));const c=u.get(o),d=c==="destroyed"&&s==="created";(c===void 0||d)&&u.set(o,d?"updated":s)}function Oa(r,e,t){const n=r.getParent();let s=t,i=r;return n!==null&&(e&&t===0?(s=i.getIndexWithinParent(),i=n):e||t!==i.getChildrenSize()||(s=i.getIndexWithinParent()+1,i=n)),i.getChildAtIndex(e?s-1:s)}function Pn(r,e){const t=r.offset;if(r.type==="element")return Oa(r.getNode(),e,t);{const n=r.getNode();if(e&&t===0||!e&&t===n.getTextContentSize()){const s=e?n.getPreviousSibling():n.getNextSibling();return s===null?Oa(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):s}}return null}function zu(r){const e=di(r).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function J(r,e,t){return cc(r,e,t)}function ci(r){return!lt(r)&&!r.isLastChild()&&!r.isInline()}function Os(r,e){const t=r._keyToDOMMap.get(e);return t===void 0&&V(75,e),t}function Qn(r){const e=r.assignedSlot||r.parentElement;return e!==null&&e.nodeType===11?e.host:e}function Tn(r,e){let t=r.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function di(r){const e=r._window;return e===null&&V(78),e}function ch(r){let e=r.getParentOrThrow();for(;e!==null;){if(Kt(e))return e;e=e.getParentOrThrow()}return e}function Kt(r){return lt(r)||P(r)&&r.isShadowRoot()}function Qt(r){const e=ze(),t=r.constructor.getType(),n=e._nodes.get(t);n===void 0&&V(200,r.constructor.name,t);const{replace:s,replaceWithKlass:i}=n;if(s!==null){const o=s(r),l=o.constructor;return i!==null?o instanceof i||V(201,i.name,i.getType(),l.name,l.getType(),r.constructor.name,t):o instanceof r.constructor&&l!==r.constructor||V(202,l.name,l.getType(),r.constructor.name,t),o.__key===r.__key&&V(203,r.constructor.name,t,l.name,l.getType()),o}return r}function Fi(r,e){!lt(r.getParent())||P(e)||Ae(e)||V(99)}function Ri(r){return(Ae(r)||P(r)&&!r.canBeEmpty())&&!r.isInline()}function Xo(r,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const n=r.parentElement;n!==null&&n.removeChild(r)}function dh(r,e,t){let n=r._blockCursorElement;if(z(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const s=t.anchor,i=s.getNode(),o=s.offset;let l=!1,a=null;if(o===i.getChildrenSize())Ri(i.getChildAtIndex(o-1))&&(l=!0);else{const u=i.getChildAtIndex(o);if(u!==null&&Ri(u)){const c=u.getPreviousSibling();(c===null||Ri(c))&&(l=!0,a=r.getElementByKey(u.__key))}}if(l){const u=r.getElementByKey(i.__key);return n===null&&(r._blockCursorElement=n=function(c){const d=c.theme,f=document.createElement("div");f.contentEditable="false",f.setAttribute("data-lexical-cursor","true");let h=d.blockCursor;if(h!==void 0){if(typeof h=="string"){const g=Ms(h);h=d.blockCursor=g}h!==void 0&&f.classList.add(...h)}return f}(r._config)),e.style.caretColor="transparent",void(a===null?u.appendChild(n):u.insertBefore(n,a))}}n!==null&&Xo(n,r,e)}function Et(r){return Pt?(r||window).getSelection():null}function fh(r){return or(r)&&r.tagName==="A"}function or(r){return r.nodeType===1}function Ia(r){return r.nodeType===11}function Xi(r){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return r.nodeName.match(e)!==null}function Is(r){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return r.nodeName.match(e)!==null}function cr(r){if(Ae(r)&&!r.isInline())return!0;if(!P(r)||Kt(r))return!1;const e=r.getFirstChild(),t=e===null||Ar(e)||G(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function pn(r,e){let t=r;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function hh(){return ze()}const za=new WeakMap,ph=new Map;function gh(r){if(!r._readOnly&&r.isEmpty())return ph;r._readOnly||V(192);let e=za.get(r);if(!e){e=new Map,za.set(r,e);for(const[t,n]of r._nodeMap){const s=n.__type;let i=e.get(s);i||(i=new Map,e.set(s,i)),i.set(t,n)}}return e}function Jo(r){const e=r.constructor.clone(r);return e.afterCloneFrom(r),e}function Zo(r,e){const t=(parseInt(r.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function mh(r){return r.__lexicalUnmanaged===!0}function $u(r,e,t,n,s,i){let o=r.getFirstChild();for(;o!==null;){const l=o.__key;o.__parent===e&&(P(o)&&$u(o,l,t,n,s,i),t.has(l)||i.delete(l),s.push(l)),o=o.getNextSibling()}}let yr,ut,On,fi,Ji,Zi,Fr,jt,eo,In,Ye="",at="",qt=null,Bt="",rr="",qu=!1,zn=!1,vs=null;function zs(r,e){const t=Fr.get(r);if(e!==null){const n=no(r);n.parentNode===e&&e.removeChild(n)}if(jt.has(r)||ut._keyToDOMMap.delete(r),P(t)){const n=qs(t,Fr);to(n,0,n.length-1,null)}t!==void 0&&Qo(In,On,fi,t,"destroyed")}function to(r,e,t,n){let s=e;for(;s<=t;++s){const i=r[s];i!==void 0&&zs(i,n)}}function vr(r,e){r.setProperty("text-align",e)}const yh="40px";function Uu(r,e){const t=yr.theme.indent;if(typeof t=="string"){const s=r.classList.contains(t);e>0&&!s?r.classList.add(t):e<1&&s&&r.classList.remove(t)}const n=getComputedStyle(r).getPropertyValue("--lexical-indent-base-value")||yh;r.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function Wu(r,e){const t=r.style;e===0?vr(t,""):e===Oo?vr(t,"left"):e===Io?vr(t,"center"):e===zo?vr(t,"right"):e===$o?vr(t,"justify"):e===qo?vr(t,"start"):e===Uo&&vr(t,"end")}function $s(r,e){const t=jt.get(r);t===void 0&&V(60);const n=t.createDOM(yr,ut);if(function(s,i,o){const l=o._keyToDOMMap;(function(a,u,c){a[`__lexicalKey_${u._key}`]=c})(i,o,s),l.set(s,i)}(r,n,ut),G(t)?n.setAttribute("data-lexical-text","true"):Ae(t)&&n.setAttribute("data-lexical-decorator","true"),P(t)){const s=t.__indent,i=t.__size;if(s!==0&&Uu(n,s),i!==0){const l=i-1;(function(a,u,c,d){const f=at;at="",ro(a,c,0,u,c.getDOMSlot(d)),Hu(c,d),at=f})(qs(t,jt),l,t,n)}const o=t.__format;o!==0&&Wu(n,o),t.isInline()||Vu(null,t,n),ci(t)&&(Ye+=sr,rr+=sr)}else{const s=t.getTextContent();if(Ae(t)){const i=t.decorate(ut,yr);i!==null&&Gu(r,i),n.contentEditable="false"}else G(t)&&(t.isDirectionless()||(at+=s));Ye+=s,rr+=s}return e!==null&&e.insertChild(n),Qo(In,On,fi,t,"created"),n}function ro(r,e,t,n,s){const i=Ye;Ye="";let o=t;for(;o<=n;++o){$s(r[o],s);const l=jt.get(r[o]);l!==null&&G(l)&&(qt===null&&(qt=l.getFormat()),Bt===""&&(Bt=l.getStyle()))}ci(e)&&(Ye+=sr),s.element.__lexicalTextContent=Ye,Ye=i+Ye}function $a(r,e){if(r){const t=r.__last;if(t){const n=e.get(t);if(n)return Ar(n)?"line-break":Ae(n)&&n.isInline()?"decorator":null}return"empty"}return null}function Vu(r,e,t){const n=$a(r,Fr),s=$a(e,jt);n!==s&&e.getDOMSlot(t).setManagedLineBreak(s)}function Hu(r,e){const t=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(t!==at||n!==vs){const i=at==="",o=i?vs:(s=at,Hf.test(s)?"rtl":Gf.test(s)?"ltr":null);if(o!==n){const l=e.classList,a=yr.theme;let u=n!==null?a[n]:void 0,c=o!==null?a[o]:void 0;if(u!==void 0){if(typeof u=="string"){const d=Ms(u);u=a[n]=d}l.remove(...u)}if(o===null||i&&o==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){const d=Ms(c);c=a[o]=d}c!==void 0&&l.add(...c)}e.dir=o}zn||(r.getWritable().__dir=o)}vs=o,e.__lexicalDirTextContent=at,e.__lexicalDir=o}var s}function xh(r,e,t){const n=at;var s;at="",qt=null,Bt="",function(i,o,l){const a=Ye,u=i.__size,c=o.__size;Ye="";const d=l.element;if(u===1&&c===1){const f=i.__first,h=o.__first;if(f===h)vn(f,d);else{const m=no(f),x=$s(h,null);try{d.replaceChild(x,m)}catch(v){if(typeof v=="object"&&v!=null){const _=`${v.toString()} Parent: ${d.tagName}, new child: {tag: ${x.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${f}}.`;throw new Error(_)}throw v}zs(f,null)}const g=jt.get(h);G(g)&&(qt===null&&(qt=g.getFormat()),Bt===""&&(Bt=g.getStyle()))}else{const f=qs(i,Fr),h=qs(o,jt);if(f.length!==u&&V(227),h.length!==c&&V(228),u===0)c!==0&&ro(h,o,0,c-1,l);else if(c===0){if(u!==0){const g=l.after==null&&l.before==null&&l.element.__lexicalLineBreak==null;to(f,0,u-1,g?null:d),g&&(d.textContent="")}}else(function(g,m,x,v,_,C){const S=v-1,D=_-1;let w,y,k=C.getFirstChild(),B=0,F=0;for(;B<=S&&F<=D;){const L=m[B],E=x[F];if(L===E)k=Mi(vn(E,C.element)),B++,F++;else{w===void 0&&(w=new Set(m)),y===void 0&&(y=new Set(x));const R=y.has(L),O=w.has(E);if(R)if(O){const H=Os(ut,E);H===k?k=Mi(vn(E,C.element)):(C.withBefore(k).insertChild(H),vn(E,C.element)),B++,F++}else $s(E,C.withBefore(k)),F++;else k=Mi(no(L)),zs(L,C.element),B++}const N=jt.get(E);N!==null&&G(N)&&(qt===null&&(qt=N.getFormat()),Bt===""&&(Bt=N.getStyle()))}const T=B>S,M=F>D;if(T&&!M){const L=x[D+1],E=L===void 0?null:ut.getElementByKey(L);ro(x,g,F,D,C.withBefore(E))}else M&&!T&&to(m,B,S,C.element)})(o,f,h,u,c,l)}ci(o)&&(Ye+=sr),d.__lexicalTextContent=Ye,Ye=a+Ye}(r,e,e.getDOMSlot(t)),Hu(e,t),tn(s=e)&&qt!=null&&qt!==s.__textFormat&&!zn&&(s.setTextFormat(qt),s.setTextStyle(Bt)),function(i){tn(i)&&Bt!==""&&Bt!==i.__textStyle&&!zn&&i.setTextStyle(Bt)}(e),at=n}function qs(r,e){const t=[];let n=r.__first;for(;n!==null;){const s=e.get(n);s===void 0&&V(101),t.push(n),n=s.__next}return t}function vn(r,e){const t=Fr.get(r);let n=jt.get(r);t!==void 0&&n!==void 0||V(61);const s=qu||Zi.has(r)||Ji.has(r),i=Os(ut,r);if(t===n&&!s){if(P(t)){const o=i.__lexicalTextContent;o!==void 0&&(Ye+=o,rr+=o);const l=i.__lexicalDirTextContent;l!==void 0&&(at+=l)}else{const o=t.getTextContent();G(t)&&!t.isDirectionless()&&(at+=o),rr+=o,Ye+=o}return i}if(t!==n&&s&&Qo(In,On,fi,n,"updated"),n.updateDOM(t,i,yr)){const o=$s(r,null);return e===null&&V(62),e.replaceChild(o,i),zs(r,null),o}if(P(t)&&P(n)){const o=n.__indent;o!==t.__indent&&Uu(i,o);const l=n.__format;l!==t.__format&&Wu(i,l),s&&(xh(t,n,i),lt(n)||n.isInline()||Vu(t,n,i)),ci(n)&&(Ye+=sr,rr+=sr)}else{const o=n.getTextContent();if(Ae(n)){const l=n.decorate(ut,yr);l!==null&&Gu(r,l)}else G(n)&&!n.isDirectionless()&&(at+=o);Ye+=o,rr+=o}if(!zn&&lt(n)&&n.__cachedText!==rr){const o=n.getWritable();o.__cachedText=rr,n=o}return i}function Gu(r,e){let t=ut._pendingDecorators;const n=ut._decorators;if(t===null){if(n[r]===e)return;t=ju(ut)}t[r]=e}function Mi(r){let e=r.nextSibling;return e!==null&&e===ut._blockCursorElement&&(e=e.nextSibling),e}function bh(r,e,t,n,s,i){Ye="",rr="",at="",qu=n===Zr,vs=null,ut=t,yr=t._config,On=t._nodes,fi=ut._listeners.mutation,Ji=s,Zi=i,Fr=r._nodeMap,jt=e._nodeMap,zn=e._readOnly,eo=new Map(t._keyToDOMMap);const o=new Map;return In=o,vn("root",null),ut=void 0,On=void 0,Ji=void 0,Zi=void 0,Fr=void 0,jt=void 0,yr=void 0,eo=void 0,In=void 0,o}function no(r){const e=eo.get(r);return e===void 0&&V(75,r),e}const er=Object.freeze({}),so=30,io=[["keydown",function(r,e){if(Bn=r.timeStamp,Ku=r.key,e.isComposing())return;const{key:t,shiftKey:n,ctrlKey:s,metaKey:i,altKey:o}=r;if(!J(e,Sf,r)&&t!=null){if(function(l,a,u,c){return ja(l)&&!a&&!c&&!u}(t,s,o,i))J(e,pu,r);else if(function(l,a,u,c,d){return ja(l)&&!c&&!u&&(a||d)}(t,s,n,o,i))J(e,Ef,r);else if(function(l,a,u,c){return Ma(l)&&!a&&!c&&!u}(t,s,o,i))J(e,gu,r);else if(function(l,a,u,c,d){return Ma(l)&&!c&&!u&&(a||d)}(t,s,n,o,i))J(e,kf,r);else if(function(l,a,u){return function(c){return c==="ArrowUp"}(l)&&!a&&!u}(t,s,i))J(e,mu,r);else if(function(l,a,u){return function(c){return c==="ArrowDown"}(l)&&!a&&!u}(t,s,i))J(e,yu,r);else if(function(l,a){return La(l)&&a}(t,n))Nn=!0,J(e,Bs,r);else if(function(l){return l===" "}(t))J(e,Df,r);else if(function(l,a){return Tt&&a&&l.toLowerCase()==="o"}(t,s))r.preventDefault(),Nn=!0,J(e,Kr,!0);else if(function(l,a){return La(l)&&!a}(t,n))Nn=!1,J(e,Bs,r);else if(function(l,a,u,c){return Tt?!a&&!u&&(fn(l)||l.toLowerCase()==="h"&&c):!(c||a||u)&&fn(l)}(t,o,i,s))fn(t)?J(e,xu,r):(r.preventDefault(),J(e,kr,!0));else if(function(l){return l==="Escape"}(t))J(e,bu,r);else if(function(l,a,u,c,d){return Tt?!(u||c||d)&&(hn(l)||l.toLowerCase()==="d"&&a):!(a||c||d)&&hn(l)}(t,s,n,o,i))hn(t)?J(e,_u,r):(r.preventDefault(),J(e,kr,!1));else if(function(l,a,u){return fn(l)&&(Tt?a:u)}(t,o,s))r.preventDefault(),J(e,jn,!0);else if(function(l,a,u){return hn(l)&&(Tt?a:u)}(t,o,s))r.preventDefault(),J(e,jn,!1);else if(function(l,a){return Tt&&a&&fn(l)}(t,i))r.preventDefault(),J(e,Ln,!0);else if(function(l,a){return Tt&&a&&hn(l)}(t,i))r.preventDefault(),J(e,Ln,!1);else if(function(l,a,u,c){return l.toLowerCase()==="b"&&!a&&_n(u,c)}(t,o,i,s))r.preventDefault(),J(e,Mt,"bold");else if(function(l,a,u,c){return l.toLowerCase()==="u"&&!a&&_n(u,c)}(t,o,i,s))r.preventDefault(),J(e,Mt,"underline");else if(function(l,a,u,c){return l.toLowerCase()==="i"&&!a&&_n(u,c)}(t,o,i,s))r.preventDefault(),J(e,Mt,"italic");else if(function(l,a,u,c){return l==="Tab"&&!a&&!u&&!c}(t,o,s,i))J(e,Af,r);else if(function(l,a,u,c){return l.toLowerCase()==="z"&&!a&&_n(u,c)}(t,n,i,s))r.preventDefault(),J(e,Ro,void 0);else if(function(l,a,u,c){return Tt?l.toLowerCase()==="z"&&u&&a:l.toLowerCase()==="y"&&c||l.toLowerCase()==="z"&&c&&a}(t,n,i,s))r.preventDefault(),J(e,Mo,void 0);else{const l=e._editorState._selection;l===null||z(l)?!mr&&Pa(t,i,s)&&(r.preventDefault(),J(e,Yi,r)):function(a,u,c,d){return!u&&a.toLowerCase()==="c"&&(Tt?c:d)}(t,n,i,s)?(r.preventDefault(),J(e,ii,r)):function(a,u,c,d){return!u&&a.toLowerCase()==="x"&&(Tt?c:d)}(t,n,i,s)?(r.preventDefault(),J(e,jo,r)):Pa(t,i,s)&&(r.preventDefault(),J(e,Yi,r))}(function(l,a,u,c){return l||a||u||c})(s,n,o,i)&&J(e,Pf,r)}}],["pointerdown",function(r,e){const t=r.target,n=r.pointerType;t instanceof Node&&n!=="touch"&&bt(e,()=>{Ae(en(t))||(ao=!0)})}],["compositionstart",function(r,e){bt(e,()=>{const t=te();if(z(t)&&!e.isComposing()){const n=t.anchor,s=t.anchor.getNode();Ze(n.key),(r.timeStamp<Bn+so||n.type==="element"||!t.isCollapsed()||s.getFormat()!==t.format||G(s)&&s.getStyle()!==t.style)&&J(e,Yr,Vf)}})}],["compositionend",function(r,e){mr?gn=!0:bt(e,()=>{ji(e,r.data)})}],["input",function(r,e){r.stopPropagation(),bt(e,()=>{const t=te(),n=r.data,s=Ju(r);if(n!=null&&z(t)&&Xu(t,s,n,r.timeStamp,!1)){gn&&(ji(e,n),gn=!1);const i=t.anchor.getNode(),o=Et(e._window);if(o===null)return;const l=t.isBackward(),a=l?t.anchor.offset:t.focus.offset,u=l?t.focus.offset:t.anchor.offset;Ns&&!t.isCollapsed()&&G(i)&&o.anchorNode!==null&&i.getTextContent().slice(0,a)+n+i.getTextContent().slice(a+u)===Iu(o.anchorNode)||J(e,Yr,n);const c=n.length;mr&&c>1&&r.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=c),oi||Gn||Lo||!e.isComposing()||(Bn=0,Ze(null))}else Ko(!1,e,n!==null?n:void 0),gn&&(ji(e,n||void 0),gn=!1);pt(),Tu(ze())}),Wr=null}],["click",function(r,e){bt(e,()=>{const t=te(),n=Et(e._window),s=es();if(n){if(z(t)){const i=t.anchor,o=i.getNode();i.type==="element"&&i.offset===0&&t.isCollapsed()&&!lt(o)&&Pe().getChildrenSize()===1&&o.getTopLevelElementOrThrow().isEmpty()&&s!==null&&t.is(s)?(n.removeAllRanges(),t.dirty=!0):r.detail===3&&!t.isCollapsed()&&o!==t.focus.getNode()&&(P(o)?o.select(0):o.getParentOrThrow().select(0))}else if(r.pointerType==="touch"){const i=n.anchorNode;if(i!==null){const o=i.nodeType;(o===Kn||o===xr)&&Gt(ta(s,n,e,r))}}}J(e,hu,r)})}],["cut",er],["copy",er],["dragstart",er],["dragover",er],["dragend",er],["paste",er],["focus",er],["blur",er],["drop",er]];Ns&&io.push(["beforeinput",(r,e)=>function(t,n){const s=t.inputType,i=Ju(t);s==="deleteCompositionText"||mr&&zu(n)||s!=="insertCompositionText"&&bt(n,()=>{const o=te();if(s==="deleteContentBackward"){if(o===null){const h=es();if(!z(h))return;Gt(h.clone())}if(z(o)){const h=o.anchor.key===o.focus.key;if(l=t.timeStamp,Ku==="MediaLast"&&l<Bn+so&&n.isComposing()&&h){if(Ze(null),Bn=0,setTimeout(()=>{bt(n,()=>{Ze(null)})},so),z(o)){const g=o.anchor.getNode();g.markDirty(),o.format=g.getFormat(),G(g)||V(142),o.style=g.getStyle()}}else{Ze(null),t.preventDefault();const g=o.anchor.getNode(),m=g.getTextContent(),x=g.canInsertTextAfter(),v=o.anchor.offset===0&&o.focus.offset===m.length;zf&&h&&!v&&x||J(n,kr,!0)}return}}var l;if(!z(o))return;const a=t.data;Wr!==null&&Ko(!1,n,Wr),o.dirty&&Wr===null||!o.isCollapsed()||lt(o.anchor.getNode())||i===null||o.applyDOMRange(i),Wr=null;const u=o.anchor,c=o.focus,d=u.getNode(),f=c.getNode();if(s!=="insertText"&&s!=="insertTranspose")switch(t.preventDefault(),s){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":J(n,Yr,t);break;case"insertFromComposition":Ze(null),J(n,Yr,t);break;case"insertLineBreak":Ze(null),J(n,Kr,!1);break;case"insertParagraph":Ze(null),Nn&&!Gn?(Nn=!1,J(n,Kr,!1)):J(n,Mn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":J(n,si,t);break;case"deleteByComposition":(function(h,g){return h!==g||P(h)||P(g)||!h.isToken()||!g.isToken()})(d,f)&&J(n,Ki,t);break;case"deleteByDrag":case"deleteByCut":J(n,Ki,t);break;case"deleteContent":J(n,kr,!1);break;case"deleteWordBackward":J(n,jn,!0);break;case"deleteWordForward":J(n,jn,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":J(n,Ln,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":J(n,Ln,!1);break;case"formatStrikeThrough":J(n,Mt,"strikethrough");break;case"formatBold":J(n,Mt,"bold");break;case"formatItalic":J(n,Mt,"italic");break;case"formatUnderline":J(n,Mt,"underline");break;case"historyUndo":J(n,Ro,void 0);break;case"historyRedo":J(n,Mo,void 0)}else{if(a===`
86
+ `)t.preventDefault(),J(n,Kr,!1);else if(a===sr)t.preventDefault(),J(n,Mn,void 0);else if(a==null&&t.dataTransfer){const h=t.dataTransfer.getData("text/plain");t.preventDefault(),o.insertRawText(h)}else a!=null&&Xu(o,i,a,t.timeStamp,!0)?(t.preventDefault(),J(n,Yr,a)):Wr=a;Yu=t.timeStamp}})}(r,e)]);let Bn=0,Ku=null,Yu=0,Wr=null;const Us=new WeakMap;let oo=!1,ao=!1,Nn=!1,gn=!1,Qu=[0,"",0,"root",0];function Xu(r,e,t,n,s){const i=r.anchor,o=r.focus,l=i.getNode(),a=ze(),u=Et(a._window),c=u!==null?u.anchorNode:null,d=i.key,f=a.getElementByKey(d),h=t.length;return d!==o.key||!G(l)||(!s&&(!Ns||Yu<n+50)||l.isDirty()&&h<2||Pu(t))&&i.offset!==o.offset&&!l.isComposing()||Cr(l)||l.isDirty()&&h>1||(s||!Ns)&&f!==null&&!l.isComposing()&&c!==js(f)||u!==null&&e!==null&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||l.getFormat()!==r.format||l.getStyle()!==r.style||lh(r,l)}function qa(r,e){return r!==null&&r.nodeValue!==null&&r.nodeType===xr&&e!==0&&e!==r.nodeValue.length}function Ua(r,e,t){const{anchorNode:n,anchorOffset:s,focusNode:i,focusOffset:o}=r;oo&&(oo=!1,qa(n,s)&&qa(i,o))||bt(e,()=>{if(!t)return void Gt(null);if(!Yn(e,n,i))return;const l=te();if(z(l)){const a=l.anchor,u=a.getNode();if(l.isCollapsed()){r.type==="Range"&&r.anchorNode===r.focusNode&&(l.dirty=!0);const c=di(e).event,d=c?c.timeStamp:performance.now(),[f,h,g,m,x]=Qu,v=Pe(),_=e.isComposing()===!1&&v.getTextContent()==="";if(d<x+200&&a.offset===g&&a.key===m)l.format=f,l.style=h;else if(a.type==="text")G(u)||V(141),l.format=u.getFormat(),l.style=u.getStyle();else if(a.type==="element"&&!_){const C=a.getNode();l.style="",C instanceof on&&C.getChildrenSize()===0?(l.format=C.getTextFormat(),l.style=C.getTextStyle()):l.format=0}}else{const c=a.key,d=l.focus.key,f=l.getNodes(),h=f.length,g=l.isBackward(),m=g?o:s,x=g?s:o,v=g?d:c,_=g?c:d;let C=Wf,S=!1;for(let D=0;D<h;D++){const w=f[D],y=w.getTextContentSize();if(G(w)&&y!==0&&!(D===0&&w.__key===v&&m===y||D===h-1&&w.__key===_&&x===0)&&(S=!0,C&=w.getFormat(),C===0))break}l.format=S?C:0}}J(e,Fo,void 0)})}function Ju(r){if(!r.getTargetRanges)return null;const e=r.getTargetRanges();return e.length===0?null:e[0]}function ji(r,e){const t=r._compositionKey;if(Ze(null),t!==null&&e!=null){if(e===""){const n=st(t),s=js(r.getElementByKey(t));return void(s!==null&&s.nodeValue!==null&&G(n)&&Yo(n,s.nodeValue,null,null,!0))}if(e[e.length-1]===`
87
+ `){const n=te();if(z(n)){const s=n.focus;return n.anchor.set(s.key,s.offset,s.type),void J(r,Bs,null)}}}Ko(!0,r,e)}function Zu(r){let e=r.__lexicalEventHandles;return e===void 0&&(e=[],r.__lexicalEventHandles=e),e}const Qr=new Map;function ec(r){const e=r.target,t=Et(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const n=Fu(t.anchorNode);if(n===null)return;ao&&(ao=!1,bt(n,()=>{const u=es(),c=t.anchorNode;if(c===null)return;const d=c.nodeType;d!==Kn&&d!==xr||Gt(ta(u,t,n,r))}));const s=Go(n),i=s[s.length-1],o=i._key,l=Qr.get(o),a=l||i;a!==n&&Ua(t,a,!1),Ua(t,n,!0),n!==i?Qr.set(o,n):l&&Qr.delete(o)}function Wa(r){r._lexicalHandled=!0}function Va(r){return r._lexicalHandled===!0}function _h(r){const e=r.ownerDocument,t=Us.get(e);t===void 0&&V(162);const n=t-1;n>=0||V(164),Us.set(e,n),n===0&&e.removeEventListener("selectionchange",ec);const s=li(r);Ho(s)?(function(o){if(o._parentEditor!==null){const l=Go(o),a=l[l.length-1]._key;Qr.get(a)===o&&Qr.delete(a)}else Qr.delete(o._key)}(s),r.__lexicalEditor=null):s&&V(198);const i=Zu(r);for(let o=0;o<i.length;o++)i[o]();r.__lexicalEventHandles=[]}function lo(r,e,t){pt();const n=r.__key,s=r.getParent();if(s===null)return;const i=function(l){const a=te();if(!z(a)||!P(l))return a;const{anchor:u,focus:c}=a,d=u.getNode(),f=c.getNode();return Tn(d,l)&&u.set(l.__key,0,"element"),Tn(f,l)&&c.set(l.__key,0,"element"),a}(r);let o=!1;if(z(i)&&e){const l=i.anchor,a=i.focus;l.key===n&&(Vs(l,r,s,r.getPreviousSibling(),r.getNextSibling()),o=!0),a.key===n&&(Vs(a,r,s,r.getPreviousSibling(),r.getNextSibling()),o=!0)}else Ut(i)&&e&&r.isSelected()&&r.selectPrevious();if(z(i)&&e&&!o){const l=r.getIndexWithinParent();Dr(r),Ws(i,s,l,-1)}else Dr(r);t||Kt(s)||s.canBeEmpty()||!s.isEmpty()||lo(s,e),e&&lt(s)&&s.isEmpty()&&s.selectEnd()}class hi{static getType(){V(64,this.name)}static clone(e){V(65,this.name)}afterCloneFrom(e){this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,ah(this,e)}getType(){return this.__type}isInline(){V(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=st(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||te();if(t==null)return!1;const n=t.getNodes().some(s=>s.__key===this.__key);if(G(this))return n;if(z(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const s=this.getParent();if(Ae(this)&&this.isInline()&&s){const i=t.isBackward()?t.focus:t.anchor,o=i.getNode();if(i.offset===o.getChildrenSize()&&o.is(s)&&o.getLastChildOrThrow().is(this))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:st(e)}getParentOrThrow(){const e=this.getParent();return e===null&&V(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(Kt(t))return P(e)||e===this&&Ae(e)||V(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&V(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:st(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return e===null?null:st(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=this.getParents(),n=e.getParents();P(this)&&t.unshift(this),P(e)&&n.unshift(e);const s=t.length,i=n.length;if(s===0||i===0||t[s-1]!==n[i-1])return null;const o=new Set(n);for(let l=0;l<s;l++){const a=t[l];if(o.has(a))return a}return null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;const t=this.getCommonAncestor(e);let n=0,s=0,i=this;for(;;){const o=i.getParentOrThrow();if(o===t){n=i.getIndexWithinParent();break}i=o}for(i=e;;){const o=i.getParentOrThrow();if(o===t){s=i.getIndexWithinParent();break}i=o}return n<s}isParentOf(e){const t=this.__key;if(t===e.__key)return!1;let n=e;for(;n!==null;){if(n.__key===t)return!0;n=n.getParent()}return!1}getNodesBetween(e){const t=this.isBefore(e),n=[],s=new Set;let i=this;for(;i!==null;){const o=i.__key;if(s.has(o)||(s.add(o),n.push(i)),i===e)break;const l=P(i)?t?i.getFirstChild():i.getLastChild():null;if(l!==null){i=l;continue}const a=t?i.getNextSibling():i.getPreviousSibling();if(a!==null){i=a;continue}const u=i.getParentOrThrow();if(s.has(u.__key)||n.push(u),u===e)break;let c=null,d=u;do{if(d===null&&V(68),c=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d===null)break;c!==null||s.has(d.__key)||n.push(d)}while(c===null);i=c}return t||n.reverse(),n}isDirty(){const e=ze()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=st(this.__key);return e===null&&V(113),e}getWritable(){pt();const e=ar(),t=ze(),n=e._nodeMap,s=this.__key,i=this.getLatest(),o=t._cloneNotNeeded,l=te();if(l!==null&&l.setCachedNodes(null),o.has(s))return Ps(i),i;const a=Jo(i);return o.add(s),Ps(a),n.set(s,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){V(70)}updateDOM(e,t,n){V(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){V(72)}static importJSON(e){V(18,this.name)}static transform(){return null}remove(e){lo(this,!0,e)}replace(e,t){pt();let n=te();n!==null&&(n=n.clone()),Fi(this,e);const s=this.getLatest(),i=this.__key,o=e.__key,l=e.getWritable(),a=this.getParentOrThrow().getWritable(),u=a.__size;Dr(l);const c=s.getPreviousSibling(),d=s.getNextSibling(),f=s.__prev,h=s.__next,g=s.__parent;if(lo(s,!1,!0),c===null?a.__first=o:c.getWritable().__next=o,l.__prev=f,d===null?a.__last=o:d.getWritable().__prev=o,l.__next=h,l.__parent=g,a.__size=u,t&&(P(this)&&P(l)||V(139),this.getChildren().forEach(m=>{l.append(m)})),z(n)){Gt(n);const m=n.anchor,x=n.focus;m.key===i&&Ya(m,l),x.key===i&&Ya(x,l)}return hr()===i&&Ze(o),l}insertAfter(e,t=!0){pt(),Fi(this,e);const n=this.getWritable(),s=e.getWritable(),i=s.getParent(),o=te();let l=!1,a=!1;if(i!==null){const h=e.getIndexWithinParent();if(Dr(s),z(o)){const g=i.__key,m=o.anchor,x=o.focus;l=m.type==="element"&&m.key===g&&m.offset===h+1,a=x.type==="element"&&x.key===g&&x.offset===h+1}}const u=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),d=s.__key,f=n.__next;if(u===null?c.__last=d:u.getWritable().__prev=d,c.__size++,n.__next=d,s.__next=f,s.__prev=n.__key,s.__parent=n.__parent,t&&z(o)){const h=this.getIndexWithinParent();Ws(o,c,h+1);const g=c.__key;l&&o.anchor.set(g,h+2,"element"),a&&o.focus.set(g,h+2,"element")}return e}insertBefore(e,t=!0){pt(),Fi(this,e);const n=this.getWritable(),s=e.getWritable(),i=s.__key;Dr(s);const o=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),a=n.__prev,u=this.getIndexWithinParent();o===null?l.__first=i:o.getWritable().__next=i,l.__size++,n.__prev=i,s.__prev=a,s.__next=n.__key,s.__parent=n.__parent;const c=te();return t&&z(c)&&Ws(c,this.getParentOrThrow(),u),e}isParentRequired(){return!1}createParentElementNode(){return He()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){pt();const n=this.getPreviousSibling(),s=this.getParentOrThrow();if(n===null)return s.select(0,0);if(P(n))return n.select();if(!G(n)){const i=n.getIndexWithinParent()+1;return s.select(i,i)}return n.select(e,t)}selectNext(e,t){pt();const n=this.getNextSibling(),s=this.getParentOrThrow();if(n===null)return s.select();if(P(n))return n.select(0,0);if(!G(n)){const i=n.getIndexWithinParent();return s.select(i,i)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class Xn extends hi{static getType(){return"linebreak"}static clone(e){return new Xn(e.__key)}constructor(e){super(e)}getTextContent(){return`
88
+ `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const n=t.parentElement;if(n!==null&&Is(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&cs(s)){const i=n.lastChild;if(i===t||i.previousSibling===t&&cs(i))return!0}}return!1}(e)||function(t){const n=t.parentElement;if(n!==null&&Is(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&cs(s))return!1;const i=n.lastChild;if(i===t||i.previousSibling===t&&cs(i))return!0}return!1}(e)?null:{conversion:vh,priority:0}}}static importJSON(e){return Rr()}exportJSON(){return{type:"linebreak",version:1}}}function vh(r){return{node:Rr()}}function Rr(){return Qt(new Xn)}function Ar(r){return r instanceof Xn}function cs(r){return r.nodeType===xr&&/^( |\t|\r?\n)+$/.test(r.textContent||"")}function Li(r,e){return 16&e?"code":e&Po?"mark":32&e?"sub":64&e?"sup":null}function Pi(r,e){return 1&e?"strong":2&e?"em":"span"}function tc(r,e,t,n,s){const i=n.classList;let o=An(s,"base");o!==void 0&&i.add(...o),o=An(s,"underlineStrikethrough");let l=!1;const a=e&Rs&&e&Fs;o!==void 0&&(t&Rs&&t&Fs?(l=!0,a||i.add(...o)):a&&i.remove(...o));for(const u in Nr){const c=Nr[u];if(o=An(s,u),o!==void 0)if(t&c){if(l&&(u==="underline"||u==="strikethrough")){e&c&&i.remove(...o);continue}e&c&&(!a||u!=="underline")&&u!=="strikethrough"||i.add(...o)}else e&c&&i.remove(...o)}}function rc(r,e,t){const n=e.firstChild,s=t.isComposing(),i=r+(s?ai:"");if(n==null)e.textContent=i;else{const o=n.nodeValue;if(o!==i)if(s||mr){const[l,a,u]=function(c,d){const f=c.length,h=d.length;let g=0,m=0;for(;g<f&&g<h&&c[g]===d[g];)g++;for(;m+g<f&&m+g<h&&c[f-m-1]===d[h-m-1];)m++;return[g,f-g-m,d.slice(g,h-m)]}(o,i);a!==0&&n.deleteData(l,a),n.insertData(l,u)}else n.nodeValue=i}}function Ha(r,e,t,n,s,i){rc(s,r,e);const o=i.theme.text;o!==void 0&&tc(0,0,n,r,o)}function ds(r,e){const t=document.createElement(e);return t.appendChild(r),t}class sn extends hi{static getType(){return"text"}static clone(e){return new sn(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return Xf[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===hr()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=Nr[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Ls(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const n=this.__format,s=Li(0,n),i=Pi(0,n),o=s===null?i:s,l=document.createElement(o);let a=l;this.hasFormat("code")&&l.setAttribute("spellcheck","false"),s!==null&&(a=document.createElement(i),l.appendChild(a)),Ha(a,this,0,n,this.__text,e);const u=this.__style;return u!==""&&(l.style.cssText=u),l}updateDOM(e,t,n){const s=this.__text,i=e.__format,o=this.__format,l=Li(0,i),a=Li(0,o),u=Pi(0,i),c=Pi(0,o);if((l===null?u:l)!==(a===null?c:a))return!0;if(l===a&&u!==c){const m=t.firstChild;m==null&&V(48);const x=document.createElement(c);return Ha(x,this,0,o,s,n),t.replaceChild(x,m),!1}let d=t;a!==null&&l!==null&&(d=t.firstChild,d==null&&V(49)),rc(s,d,this);const f=n.theme.text;f!==void 0&&i!==o&&tc(0,i,o,d,f);const h=e.__style,g=this.__style;return h!==g&&(t.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:Eh,priority:0}),b:()=>({conversion:Ch,priority:0}),code:()=>({conversion:ur,priority:0}),em:()=>({conversion:ur,priority:0}),i:()=>({conversion:ur,priority:0}),s:()=>({conversion:ur,priority:0}),span:()=>({conversion:wh,priority:0}),strong:()=>({conversion:ur,priority:0}),sub:()=>({conversion:ur,priority:0}),sup:()=>({conversion:ur,priority:0}),u:()=>({conversion:ur,priority:0})}}static importJSON(e){const t=Ke(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);return t!==null&&or(t)||V(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=ds(t,"b")),this.hasFormat("italic")&&(t=ds(t,"i")),this.hasFormat("strikethrough")&&(t=ds(t,"s")),this.hasFormat("underline")&&(t=ds(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format=typeof e=="string"?Nr[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?Kf[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Ls(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=Qf[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){pt();let n=e,s=t;const i=te(),o=this.getTextContent(),l=this.__key;if(typeof o=="string"){const a=o.length;n===void 0&&(n=a),s===void 0&&(s=a)}else n=0,s=0;if(!z(i))return ic(l,n,l,s,"text","text");{const a=hr();a!==i.anchor.key&&a!==i.focus.key||Ze(l),i.setTextNodeRange(this,n,this,s)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,s){const i=this.getWritable(),o=i.__text,l=n.length;let a=e;a<0&&(a=l+a,a<0&&(a=0));const u=te();if(s&&z(u)){const d=e+l;u.setTextNodeRange(i,d,i,d)}const c=o.slice(0,a)+n+o.slice(a+t);return i.__text=c,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){pt();const t=this.getLatest(),n=t.getTextContent(),s=t.__key,i=hr(),o=new Set(e),l=[],a=n.length;let u="";for(let D=0;D<a;D++)u!==""&&o.has(D)&&(l.push(u),u=""),u+=n[D];u!==""&&l.push(u);const c=l.length;if(c===0)return[];if(l[0]===n)return[t];const d=l[0],f=t.getParent();let h;const g=t.getFormat(),m=t.getStyle(),x=t.__detail;let v=!1;t.isSegmented()?(h=Ke(d),h.__format=g,h.__style=m,h.__detail=x,v=!0):(h=t.getWritable(),h.__text=d);const _=te(),C=[h];let S=d.length;for(let D=1;D<c;D++){const w=l[D],y=w.length,k=Ke(w).getWritable();k.__format=g,k.__style=m,k.__detail=x;const B=k.__key,F=S+y;if(z(_)){const T=_.anchor,M=_.focus;T.key===s&&T.type==="text"&&T.offset>S&&T.offset<=F&&(T.key=B,T.offset-=S,_.dirty=!0),M.key===s&&M.type==="text"&&M.offset>S&&M.offset<=F&&(M.key=B,M.offset-=S,_.dirty=!0)}i===s&&Ze(B),S=F,C.push(k)}if(f!==null){(function(y){const k=y.getPreviousSibling(),B=y.getNextSibling();k!==null&&Ps(k),B!==null&&Ps(B)})(this);const D=f.getWritable(),w=this.getIndexWithinParent();v?(D.splice(w,0,C),this.remove()):D.splice(w,1,C),z(_)&&Ws(_,f,w,c-1)}return C}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||V(50);const n=this.__key,s=e.__key,i=this.__text,o=i.length;hr()===s&&Ze(n);const l=te();if(z(l)){const d=l.anchor,f=l.focus;d!==null&&d.key===s&&(rl(d,t,n,e,o),l.dirty=!0),f!==null&&f.key===s&&(rl(f,t,n,e,o),l.dirty=!0)}const a=e.__text,u=t?a+i:i+a;this.setTextContent(u);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function wh(r){return{forChild:ea(r.style),node:null}}function Ch(r){const e=r,t=e.style.fontWeight==="normal";return{forChild:ea(e.style,t?void 0:"bold"),node:null}}const Ga=new WeakMap;function Sh(r){return r.nodeName==="PRE"||r.nodeType===Kn&&r.style!==void 0&&r.style.whiteSpace!==void 0&&r.style.whiteSpace.startsWith("pre")}function Eh(r){const e=r;r.parentElement===null&&V(129);let t=e.textContent||"";if(function(n){let s,i=n.parentNode;const o=[n];for(;i!==null&&(s=Ga.get(i))===void 0&&!Sh(i);)o.push(i),i=i.parentNode;const l=s===void 0?i:s;for(let a=0;a<o.length;a++)Ga.set(o[a],l);return l}(e)!==null){const n=t.split(/(\r?\n|\t)/),s=[],i=n.length;for(let o=0;o<i;o++){const l=n[o];l===`
89
+ `||l===`\r
90
+ `?s.push(Rr()):l===" "?s.push(Zn()):l!==""&&s.push(Ke(l))}return{node:s}}if(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," "),t==="")return{node:null};if(t[0]===" "){let n=e,s=!0;for(;n!==null&&(n=Ka(n,!1))!==null;){const i=n.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(t=t.slice(1)),s=!1;break}}s&&(t=t.slice(1))}if(t[t.length-1]===" "){let n=e,s=!0;for(;n!==null&&(n=Ka(n,!0))!==null;)if((n.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){s=!1;break}s&&(t=t.slice(0,t.length-1))}return t===""?{node:null}:{node:Ke(t)}}function Ka(r,e){let t=r;for(;;){let n;for(;(n=e?t.nextSibling:t.previousSibling)===null;){const i=t.parentElement;if(i===null)return null;t=i}if(t=n,t.nodeType===Kn){const i=t.style.display;if(i===""&&!Xi(t)||i!==""&&!i.startsWith("inline"))return null}let s=t;for(;(s=e?t.firstChild:t.lastChild)!==null;)t=s;if(t.nodeType===xr)return t;if(t.nodeName==="BR")return null}}const kh={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function ur(r){const e=kh[r.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:ea(r.style,e),node:null}}function Ke(r=""){return Qt(new sn(r))}function G(r){return r instanceof sn}function ea(r,e){const t=r.fontWeight,n=r.textDecoration.split(" "),s=t==="700"||t==="bold",i=n.includes("line-through"),o=r.fontStyle==="italic",l=n.includes("underline"),a=r.verticalAlign;return u=>(G(u)&&(s&&!u.hasFormat("bold")&&u.toggleFormat("bold"),i&&!u.hasFormat("strikethrough")&&u.toggleFormat("strikethrough"),o&&!u.hasFormat("italic")&&u.toggleFormat("italic"),l&&!u.hasFormat("underline")&&u.toggleFormat("underline"),a!=="sub"||u.hasFormat("subscript")||u.toggleFormat("subscript"),a!=="super"||u.hasFormat("superscript")||u.toggleFormat("superscript"),e&&!u.hasFormat(e)&&u.toggleFormat(e)),u)}class Jn extends sn{static getType(){return"tab"}static clone(e){return new Jn(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}static importJSON(e){const t=Zn();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){V(126)}setDetail(e){V(127)}setMode(e){V(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Zn(){return Qt(new Jn)}function Dh(r){return r instanceof Jn}class Ah{constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode(),n=e.getNode();const s=this.offset,i=e.offset;if(P(t)){const o=t.getDescendantByIndex(s);t=o??t}if(P(n)){const o=n.getDescendantByIndex(i);n=o??n}return t===n?s<i:t.isBefore(n)}getNode(){const e=st(this.key);return e===null&&V(20),e}set(e,t,n){const s=this._selection,i=this.key;this.key=e,this.offset=t,this.type=n,ts()||(hr()===i&&Ze(e),s!==null&&(s.setCachedNodes(null),s.dirty=!0))}}function Yt(r,e,t){return new Ah(r,e,t)}function Oi(r,e){let t=e.__key,n=r.offset,s="element";if(G(e)){s="text";const i=e.getTextContentSize();n>i&&(n=i)}else if(!P(e)){const i=e.getNextSibling();if(G(i))t=i.__key,n=0,s="text";else{const o=e.getParent();o&&(t=o.__key,n=e.getIndexWithinParent()+1)}}r.set(t,n,s)}function Ya(r,e){if(P(e)){const t=e.getLastDescendant();P(t)||G(t)?Oi(r,t):Oi(r,e)}else Oi(r,e)}function dr(r,e,t,n){r.key=e,r.offset=t,r.type=n}class pi{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Ut(e))return!1;const t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(s=>n.has(s))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new pi(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),n=t.length,s=t[n-1];let i;if(G(s))i=s.select();else{const o=s.getIndexWithinParent()+1;i=s.getParentOrThrow().select(o,o)}i.insertNodes(e);for(let o=0;o<n;o++)t[o].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,n=[];for(const s of t){const i=st(s);i!==null&&n.push(i)}return ts()||(this._cachedNodes=n),n}getTextContent(){const e=this.getNodes();let t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}}function z(r){return r instanceof br}class br{constructor(e,t,n,s){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=s,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!z(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor,n=this.focus,s=t.isBefore(n),i=s?t:n,o=s?n:t;let l=i.getNode(),a=o.getNode();const u=i.offset,c=o.offset;if(P(l)){const f=l.getDescendantByIndex(u);l=f??l}if(P(a)){let f=a.getDescendantByIndex(c);f!==null&&f!==l&&a.getChildAtIndex(c)===f&&(f=f.getPreviousSibling()),a=f??a}let d;return d=l.is(a)?P(l)&&l.getChildrenSize()>0?[]:[l]:l.getNodesBetween(a),ts()||(this._cachedNodes=d),d}setTextNodeRange(e,t,n,s){dr(this.anchor,e.__key,t,"text"),dr(this.focus,n.__key,s,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const t=e[0],n=e[e.length-1],s=this.anchor,i=this.focus,o=s.isBefore(i),[l,a]=uo(this);let u="",c=!0;for(let d=0;d<e.length;d++){const f=e[d];if(P(f)&&!f.isInline())c||(u+=`
91
+ `),c=!f.isEmpty();else if(c=!1,G(f)){let h=f.getTextContent();f===t?f===n?s.type==="element"&&i.type==="element"&&i.offset!==s.offset||(h=l<a?h.slice(l,a):h.slice(a,l)):h=o?h.slice(l):h.slice(a):f===n&&(h=o?h.slice(0,a):h.slice(0,l)),u+=h}else!Ae(f)&&!Ar(f)||f===n&&this.isCollapsed()||(u+=f.getTextContent())}return u}applyDOMRange(e){const t=ze(),n=t.getEditorState()._selection,s=sc(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(s===null)return;const[i,o]=s;dr(this.anchor,i.key,i.offset,i.type),dr(this.focus,o.key,o.offset,o.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new br(Yt(e.key,e.offset,e.type),Yt(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Ls(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=Nr[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],s=t.length;for(let i=0;i<s;i++){const o=t[i];o===`
70
92
  `||o===`\r
71
- `?n.push(xr()):o===" "?n.push(En()):n.push(Ge(o))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,s=this.format,i=this.style;let o=t,a=n;!this.isCollapsed()&&n.isBefore(t)&&(o=n,a=t),o.type==="element"&&function(y,D,x,E){const _=y.getNode(),A=_.getChildAtIndex(y.offset),b=Ge(),v=tt(_)?Ue().append(b):b;b.setFormat(x),b.setStyle(E),A===null?_.append(v):A.insertBefore(v),y.is(D)&&D.set(b.__key,0,"text"),y.set(b.__key,0,"text")}(o,a,s,i);const l=o.offset;let u=a.offset;const c=this.getNodes(),d=c.length;let f=c[0];z(f)||$(26);const h=f.getTextContent().length,p=f.getParentOrThrow();let m=c[d-1];if(d===1&&a.type==="element"&&(u=h,a.set(o.key,u,"text")),this.isCollapsed()&&l===h&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!p.canInsertTextAfter()&&f.getNextSibling()===null)){let y=f.getNextSibling();if(z(y)&&y.canInsertTextBefore()&&!cr(y)||(y=Ge(),y.setFormat(s),y.setStyle(i),p.canInsertTextAfter()?f.insertAfter(y):p.insertAfter(y)),y.select(0,0),f=y,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&l===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!p.canInsertTextBefore()&&f.getPreviousSibling()===null)){let y=f.getPreviousSibling();if(z(y)&&!cr(y)||(y=Ge(),y.setFormat(s),p.canInsertTextBefore()?f.insertBefore(y):p.insertBefore(y)),y.select(),f=y,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&l!==h){const y=Ge(f.getTextContent());y.setFormat(s),f.replace(y),f=y}else if(!this.isCollapsed()&&e!==""){const y=m.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||F(y)&&(!y.canInsertTextBefore()||!y.canInsertTextAfter()))return this.insertText(""),ma(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(f.isToken()){const E=Ge(e);return E.select(),void f.replace(E)}const y=f.getFormat(),D=f.getStyle();if(l!==u||y===s&&D===i){if(Qc(f)){const E=Ge(e);return E.setFormat(s),E.setStyle(i),E.select(),void f.replace(E)}}else{if(f.getTextContent()!==""){const E=Ge(e);if(E.setFormat(s),E.setStyle(i),E.select(),l===0)f.insertBefore(E,!1);else{const[_]=f.splitText(l);_.insertAfter(E,!1)}return void(E.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(s),f.setStyle(i)}const x=u-l;f=f.spliceText(l,x,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=y,this.style=D))}else{const y=new Set([...f.getParentKeys(),...m.getParentKeys()]),D=F(f)?f:f.getParentOrThrow();let x=F(m)?m:m.getParentOrThrow(),E=m;if(!D.is(x)&&x.isInline())do E=x,x=x.getParentOrThrow();while(x.isInline());if(a.type==="text"&&(u!==0||m.getTextContent()==="")||a.type==="element"&&m.getIndexWithinParent()<u)if(z(m)&&!m.isToken()&&u!==m.getTextContentSize()){if(m.isSegmented()){const S=Ge(m.getTextContent());m.replace(S),m=S}tt(a.getNode())||a.type!=="text"||(m=m.spliceText(0,u,"")),y.add(m.__key)}else{const S=m.getParentOrThrow();S.canBeEmpty()||S.getChildrenSize()!==1?m.remove():S.remove()}else y.add(m.__key);const _=x.getChildren(),A=new Set(c),b=D.is(x),v=D.isInline()&&f.getNextSibling()===null?D:f;for(let S=_.length-1;S>=0;S--){const k=_[S];if(k.is(f)||F(k)&&k.isParentOf(f))break;k.isAttached()&&(!A.has(k)||k.is(E)?b||v.insertAfter(k,!1):k.remove())}if(!b){let S=x,k=null;for(;S!==null;){const j=S.getChildren(),T=j.length;(T===0||j[T-1].is(k))&&(y.delete(S.__key),k=S),S=S.getParent()}}if(f.isToken())if(l===h)f.select();else{const S=Ge(e);S.select(),f.replace(S)}else f=f.spliceText(l,h-l,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let S=1;S<d;S++){const k=c[S],j=k.__key;y.has(j)||k.remove()}}}removeText(){if(this.isCollapsed())return;const{anchor:e,focus:t}=this,n=this.getNodes(),s=this.isBackward()?t:e,i=this.isBackward()?e:t;let o=s.getNode(),a=i.getNode();const l=Hr(o,Zt),u=Hr(a,Zt);z(o)&&o.isToken()&&s.offset<o.getTextContentSize()&&(s.offset=0),i.offset>0&&z(a)&&a.isToken()&&(i.offset=a.getTextContentSize()),n.forEach(d=>{on(o,d)||on(a,d)||d.getKey()===o.getKey()||d.getKey()===a.getKey()||d.remove()});const c=(d,f)=>{if(d.getTextContent()==="")d.remove();else if(f!==0&&cr(d)){const h=Ge(d.getTextContent());return h.setFormat(d.getFormat()),h.setStyle(d.getStyle()),d.replace(h)}};if(o===a&&z(o)){const d=Math.abs(t.offset-e.offset);return o.spliceText(s.offset,d,"",!0),void c(o,d)}if(z(o)){const d=o.getTextContentSize()-s.offset;o.spliceText(s.offset,d,""),o=c(o,d)||o}z(a)&&(a.spliceText(0,i.offset,""),a=c(a,i.offset)||a),o.isAttached()&&z(o)?o.selectEnd():a.isAttached()&&z(a)&&a.selectStart(),F(l)&&F(u)&&l!==u&&(l.append(...u.getChildren()),u.remove(),i.set(s.key,s.offset,s.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void Qe(null);const n=this.getNodes(),s=[];for(const _ of n)z(_)&&s.push(_);const i=_=>{n.forEach(A=>{if(Or(A)){const b=A.getFormatFlags(e,_);A.setTextFormat(b)}})},o=s.length;if(o===0)return this.toggleFormat(e),Qe(null),void i(t);const a=this.anchor,l=this.focus,u=this.isBackward(),c=u?l:a,d=u?a:l;let f=0,h=s[0],p=c.type==="element"?0:c.offset;if(c.type==="text"&&p===h.getTextContentSize()&&(f=1,h=s[1],p=0),h==null)return;const m=h.getFormatFlags(e,t);i(m);const y=o-1;let D=s[y];const x=d.type==="text"?d.offset:D.getTextContentSize();if(h.is(D)){if(p===x)return;if(cr(h)||p===0&&x===h.getTextContentSize())h.setFormat(m);else{const _=h.splitText(p,x),A=p===0?_[0]:_[1];A.setFormat(m),c.type==="text"&&c.set(A.__key,0,"text"),d.type==="text"&&d.set(A.__key,x-p,"text")}return void(this.format=m)}p===0||cr(h)||([,h]=h.splitText(p),p=0),h.setFormat(m);const E=D.getFormatFlags(e,m);x>0&&(x===D.getTextContentSize()||cr(D)||([D]=D.splitText(x)),D.setFormat(E));for(let _=f+1;_<y;_++){const A=s[_],b=A.getFormatFlags(e,E);A.setFormat(b)}c.type==="text"&&c.set(h.__key,p,"text"),d.type==="text"&&d.set(D.__key,x,"text"),this.format=m|E}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const p=K();return O(p)||$(134),p.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=Hr(t,Zt),s=e[e.length-1];if(F(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const p=Us(this);n.splice(p,0,e),s.selectEnd()}return}if(!e.some(p=>(F(p)||Ce(p))&&!p.isInline())){F(n)||$(211,t.constructor.name,t.getType());const p=Us(this);return n.splice(p,0,e),void s.selectEnd()}const i=function(p){const m=Ue();let y=null;for(let D=0;D<p.length;D++){const x=p[D],E=pr(x);if(E||Ce(x)&&x.isInline()||F(x)&&x.isInline()||z(x)||x.isParentRequired()){if(y===null&&(y=x.createParentElementNode(),m.append(y),E))continue;y!==null&&y.append(x)}else m.append(x),y=null}return m}(e),o=i.getLastDescendant(),a=i.getChildren(),l=!F(n)||!n.isEmpty()?this.insertParagraph():null,u=a[a.length-1];let c=a[0];var d;F(d=c)&&Zt(d)&&!d.isEmpty()&&F(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(F(n)||$(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=a[1]),c&&(n===null&&$(212,t.constructor.name,t.getType()),function(p,m,y){const D=m.getParentOrThrow().getLastChild();let x=m;const E=[m];for(;x!==D;)x.getNextSibling()||$(140),x=x.getNextSibling(),E.push(x);let _=p;for(const A of E)_=_.insertAfter(A)}(n,c));const f=Hr(o,Zt);l&&F(f)&&(l.canMergeWhenEmpty()||Zt(u))&&(f.append(...l.getChildren()),l.remove()),F(n)&&n.isEmpty()&&n.remove(),o.selectEnd();const h=F(n)?n.getLastChild():null;pr(h)&&f!==n&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const o=Ue();return Fe().splice(this.anchor.offset,0,[o]),o.select(),o}const e=Us(this),t=Hr(this.anchor.getNode(),Zt);F(t)||$(213);const n=t.getChildAtIndex(e),s=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...s),i.selectStart(),i):null}insertLineBreak(e){const t=xr();if(this.insertNodes([t]),e){const n=t.getParentOrThrow(),s=t.getIndexWithinParent();n.select(s,s)}}extract(){const e=this.getNodes(),t=e.length,n=t-1,s=this.anchor,i=this.focus;let o=e[0],a=e[n];const[l,u]=ui(this);if(t===0)return[];if(t===1){if(z(o)&&!this.isCollapsed()){const d=l>u?u:l,f=l>u?l:u,h=o.splitText(d,f),p=d===0?h[0]:h[1];return p!=null?[p]:[]}return[o]}const c=s.isBefore(i);if(z(o)){const d=c?l:u;d===o.getTextContentSize()?e.shift():d!==0&&([,o]=o.splitText(d),e[0]=o)}if(z(a)){const d=a.getTextContent().length,f=c?u:l;f===0?e.pop():f!==d&&([a]=a.splitText(f),e[n]=a)}return e}modify(e,t,n){const s=this.focus,i=this.anchor,o=e==="move",a=pn(s,t);if(Ce(a)&&!a.isIsolated()){if(o&&a.isKeyboardSelectable()){const h=Mo();return h.add(a.__key),void jt(h)}const f=t?a.getPreviousSibling():a.getNextSibling();if(z(f)){const h=f.__key,p=t?f.getTextContent().length:0;return s.set(h,p,"text"),void(o&&i.set(h,p,"text"))}{const h=a.getParentOrThrow();let p,m;return F(f)?(m=f.__key,p=t?f.getChildrenSize():0):(p=a.getIndexWithinParent(),m=h.__key,t||p++),s.set(m,p,"element"),void(o&&i.set(m,p,"element"))}}const l=Pe(),u=gt(l._window);if(!u)return;const c=l._blockCursorElement,d=l._rootElement;if(d===null||c===null||!F(a)||a.isInline()||a.canBeEmpty()||Oi(c,l,d),function(f,h,p,m){f.modify(h,p,m)}(u,e,t?"backward":"forward",n),u.rangeCount>0){const f=u.getRangeAt(0),h=this.anchor.getNode(),p=tt(h)?h:Fc(h);if(this.applyDOMRange(f),this.dirty=!0,!o){const m=this.getNodes(),y=[];let D=!1;for(let x=0;x<m.length;x++){const E=m[x];on(E,p)?y.push(E):D=!0}if(D&&y.length>0)if(t){const x=y[0];F(x)?x.selectStart():x.getParentOrThrow().selectStart()}else{const x=y[y.length-1];F(x)?x.selectEnd():x.getParentOrThrow().selectEnd()}u.anchorNode===f.startContainer&&u.anchorOffset===f.startOffset||function(x){const E=x.focus,_=x.anchor,A=_.key,b=_.offset,v=_.type;er(_,E.key,E.offset,E.type),er(E,A,b,v),x._cachedNodes=null}(this)}}}forwardDeletion(e,t,n){if(!n&&(e.type==="element"&&F(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const s=t.getParent(),i=t.getNextSibling()||(s===null?null:s.getNextSibling());if(F(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const n=this.anchor;let s=n.getNode();if(this.forwardDeletion(n,s,e))return;const i=this.focus,o=pn(i,e);if(Ce(o)&&!o.isIsolated()){if(o.isKeyboardSelectable()&&F(s)&&s.getChildrenSize()===0){s.remove();const a=Mo();a.add(o.__key),jt(a)}else o.remove(),Pe().dispatchCommand(bi,void 0);return}if(!e&&F(o)&&F(s)&&s.isEmpty())return s.remove(),void o.selectStart();if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&n.offset===0&&(n.type==="element"?n.getNode():n.getNode().getParentOrThrow()).collapseAtStart(this))return}else{const a=i.type==="text"?i.getNode():null;if(s=n.type==="text"?n.getNode():null,a!==null&&a.isSegmented()){const l=i.offset,u=a.getTextContentSize();if(a.is(s)||e&&l!==u||!e&&l!==0)return void Fo(a,e,l)}else if(s!==null&&s.isSegmented()){const l=n.offset,u=s.getTextContentSize();if(s.is(a)||e&&l!==0||!e&&l!==u)return void Fo(s,e,l)}(function(l,u){const c=l.anchor,d=l.focus,f=c.getNode(),h=d.getNode();if(f===h&&c.type==="text"&&d.type==="text"){const p=c.offset,m=d.offset,y=p<m,D=y?p:m,x=y?m:p,E=x-1;D!==E&&(Jl(f.getTextContent().slice(D,x))||(u?d.offset=E:c.offset=E))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const n=this.anchor.getNode();n.isEmpty()&&tt(n.getParent())&&n.getIndexWithinParent()===0&&n.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t=this.anchor.type==="element";if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),this.isCollapsed()&&this.anchor.offset===0&&this.modify("extend",e,"character"),t){const n=e?this.anchor:this.focus;n.set(n.key,n.offset+1,n.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Lt(r){return r instanceof Cs}function Bo(r){const e=r.offset;if(r.type==="text")return e;const t=r.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function ui(r){const e=r.getStartEndPoints();if(e===null)return[0,0];const[t,n]=e;return t.type==="element"&&n.type==="element"&&t.key===n.key&&t.offset===n.offset?[0,0]:[Bo(t),Bo(n)]}function Fo(r,e,t){const n=r,s=n.getTextContent().split(/(?=\s)/g),i=s.length;let o=0,a=0;for(let u=0;u<i;u++){const c=u===i-1;if(a=o,o+=s[u].length,e&&o===t||o>t||c){s.splice(u,1),c&&(a=void 0);break}}const l=s.join("").trim();l===""?n.remove():(n.setTextContent(l),n.select(a,a))}function Ro(r,e,t,n){let s,i=e;if(r.nodeType===_n){let o=!1;const a=r.childNodes,l=a.length,u=n._blockCursorElement;i===l&&(o=!0,i=l-1);let c=a[i],d=!1;if(c===u)c=a[i+1],d=!0;else if(u!==null){const f=u.parentNode;r===f&&e>Array.prototype.indexOf.call(f.children,u)&&i--}if(s=Tr(c),z(s))i=po(s,o);else{let f=Tr(r);if(f===null)return null;if(F(f)){const h=n.getElementByKey(f.getKey());h===null&&$(214),[f,i]=f.getDOMSlot(h).resolveChildIndex(f,h,r,e),F(f)||$(215),o&&i>=f.getChildrenSize()&&(i=Math.max(0,f.getChildrenSize()-1));let m=f.getChildAtIndex(i);if(F(m)&&function(y,D,x){const E=y.getParent();return x===null||E===null||!E.canBeEmpty()||E!==x.getNode()}(m,0,t)){const y=o?m.getLastDescendant():m.getFirstDescendant();y===null?f=m:(m=y,f=F(m)?m:m.getParentOrThrow()),i=0}z(m)?(s=m,f=null,i=po(m,o)):m!==f&&o&&!d&&(F(f)||$(216),i=Math.min(f.getChildrenSize(),i+1))}else{const h=f.getIndexWithinParent();i=e===0&&Ce(f)&&Tr(r)===f?h:h+1,f=f.getParentOrThrow()}if(F(f))return It(f.__key,i,"element")}}else s=Tr(r);return z(s)?It(s.__key,i,"text"):null}function Lo(r,e,t){const n=r.offset,s=r.getNode();if(n===0){const i=s.getPreviousSibling(),o=s.getParent();if(e){if((t||!e)&&i===null&&F(o)&&o.isInline()){const a=o.getPreviousSibling();z(a)&&(r.key=a.__key,r.offset=a.getTextContent().length)}}else F(i)&&!t&&i.isInline()?(r.key=i.__key,r.offset=i.getChildrenSize(),r.type="element"):z(i)&&(r.key=i.__key,r.offset=i.getTextContent().length)}else if(n===s.getTextContent().length){const i=s.getNextSibling(),o=s.getParent();if(e&&F(i)&&i.isInline())r.key=i.__key,r.offset=0,r.type="element";else if((t||e)&&i===null&&F(o)&&o.isInline()&&!o.canInsertTextAfter()){const a=o.getNextSibling();z(a)&&(r.key=a.__key,r.offset=0)}}}function ma(r,e,t){if(r.type==="text"&&e.type==="text"){const n=r.isBefore(e),s=r.is(e);Lo(r,n,s),Lo(e,!n,s),s&&(e.key=r.key,e.offset=r.offset,e.type=r.type);const i=Pe();if(i.isComposing()&&i._compositionKey!==r.key&&O(t)){const o=t.anchor,a=t.focus;er(r,o.key,o.offset,o.type),er(e,a.key,a.offset,a.type)}}}function ya(r,e,t,n,s,i){if(r===null||t===null||!vn(s,r,t))return null;const o=Ro(r,e,O(i)?i.anchor:null,s);if(o===null)return null;const a=Ro(t,n,O(i)?i.focus:null,s);if(a===null)return null;if(o.type==="element"&&a.type==="element"){const l=Tr(r),u=Tr(t);if(Ce(l)&&Ce(u))return null}return ma(o,a,i),[o,a]}function ci(r){return F(r)&&!r.isInline()}function xa(r,e,t,n,s,i){const o=Qt(),a=new lr(It(r,e,s),It(t,n,i),0,"");return a.dirty=!0,o._selection=a,a}function Yc(){const r=It("root",0,"element"),e=It("root",0,"element");return new lr(r,e,0,"")}function Mo(){return new Cs(new Set)}function qi(r,e,t,n){const s=t._window;if(s===null)return null;const i=n||s.event,o=i?i.type:void 0,a=o==="selectionchange",l=!Js&&(a||o==="beforeinput"||o==="compositionstart"||o==="compositionend"||o==="click"&&i&&i.detail===3||o==="drop"||o===void 0);let u,c,d,f;if(O(r)&&!l)return r.clone();if(e===null)return null;if(u=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,a&&O(r)&&!vn(t,u,c))return r.clone();const h=ya(u,d,c,f,t,r);if(h===null)return null;const[p,m]=h;return new lr(p,m,O(r)?r.format:0,O(r)?r.style:"")}function K(){return Qt()._selection}function Sn(){return Pe()._editorState._selection}function is(r,e,t,n=1){const s=r.anchor,i=r.focus,o=s.getNode(),a=i.getNode();if(!e.is(o)&&!e.is(a))return;const l=e.__key;if(r.isCollapsed()){const u=s.offset;if(t<=u&&n>0||t<u&&n<0){const c=Math.max(0,u+n);s.set(l,c,"element"),i.set(l,c,"element"),Po(r)}}else{const u=r.isBackward(),c=u?i:s,d=c.getNode(),f=u?s:i,h=f.getNode();if(e.is(d)){const p=c.offset;(t<=p&&n>0||t<p&&n<0)&&c.set(l,Math.max(0,p+n),"element")}if(e.is(h)){const p=f.offset;(t<=p&&n>0||t<p&&n<0)&&f.set(l,Math.max(0,p+n),"element")}}Po(r)}function Po(r){const e=r.anchor,t=e.offset,n=r.focus,s=n.offset,i=e.getNode(),o=n.getNode();if(r.isCollapsed()){if(!F(i))return;const a=i.getChildrenSize(),l=t>=a,u=l?i.getChildAtIndex(a-1):i.getChildAtIndex(t);if(z(u)){let c=0;l&&(c=u.getTextContentSize()),e.set(u.__key,c,"text"),n.set(u.__key,c,"text")}}else{if(F(i)){const a=i.getChildrenSize(),l=t>=a,u=l?i.getChildAtIndex(a-1):i.getChildAtIndex(t);if(z(u)){let c=0;l&&(c=u.getTextContentSize()),e.set(u.__key,c,"text")}}if(F(o)){const a=o.getChildrenSize(),l=s>=a,u=l?o.getChildAtIndex(a-1):o.getChildAtIndex(s);if(z(u)){let c=0;l&&(c=u.getTextContentSize()),n.set(u.__key,c,"text")}}}}function os(r,e,t,n,s){let i=null,o=0,a=null;n!==null?(i=n.__key,z(n)?(o=n.getTextContentSize(),a="text"):F(n)&&(o=n.getChildrenSize(),a="element")):s!==null&&(i=s.__key,z(s)?a="text":F(s)&&(a="element")),i!==null&&a!==null?r.set(i,o,a):(o=e.getIndexWithinParent(),o===-1&&(o=t.getChildrenSize()),r.set(t.__key,o,"element"))}function jo(r,e,t,n,s){r.type==="text"?(r.key=t,e||(r.offset+=s)):r.offset>n.getIndexWithinParent()&&(r.offset-=1)}function Xc(r,e,t,n,s,i,o){const a=n.anchorNode,l=n.focusNode,u=n.anchorOffset,c=n.focusOffset,d=document.activeElement;if(s.has("collaboration")&&d!==i||d!==null&&Fi(d))return;if(!O(e))return void(r!==null&&vn(t,a,l)&&n.removeAllRanges());const f=e.anchor,h=e.focus,p=f.key,m=h.key,y=Zn(t,p),D=Zn(t,m),x=f.offset,E=h.offset,_=e.format,A=e.style,b=e.isCollapsed();let v=y,S=D,k=!1;if(f.type==="text"){v=Jn(y);const P=f.getNode();k=P.getFormat()!==_||P.getStyle()!==A}else O(r)&&r.anchor.type==="text"&&(k=!0);var j,T,B,L,R;if(h.type==="text"&&(S=Jn(D)),v!==null&&S!==null&&(b&&(r===null||k||O(r)&&(r.format!==_||r.style!==A))&&(j=_,T=A,B=x,L=p,R=performance.now(),ua=[j,T,B,L,R]),u!==x||c!==E||a!==v||l!==S||n.type==="Range"&&b||(d!==null&&i.contains(d)||i.focus({preventScroll:!0}),f.type==="element"))){try{n.setBaseAndExtent(v,x,S,E)}catch{}if(!s.has("skip-scroll-into-view")&&e.isCollapsed()&&i!==null&&i===document.activeElement){const P=e instanceof lr&&e.anchor.type==="element"?v.childNodes[x]||null:n.rangeCount>0?n.getRangeAt(0):null;if(P!==null){let Q;if(P instanceof Text){const se=document.createRange();se.selectNode(P),Q=se.getBoundingClientRect()}else Q=P.getBoundingClientRect();(function(se,xe,oe){const Se=oe.ownerDocument,he=Se.defaultView;if(he===null)return;let{top:fe,bottom:pe}=xe,ge=0,Ae=0,be=oe;for(;be!==null;){const we=be===Se.body;if(we)ge=0,Ae=bs(se).innerHeight;else{const ce=be.getBoundingClientRect();ge=ce.top,Ae=ce.bottom}let Re=0;if(fe<ge?Re=-(ge-fe):pe>Ae&&(Re=pe-Ae),Re!==0)if(we)he.scrollBy(0,Re);else{const ce=be.scrollTop;be.scrollTop+=Re;const je=be.scrollTop-ce;fe-=je,pe-=je}if(we)break;be=Cn(be)}})(t,Q,i)}}oi=!0}}function ba(r){let e=K()||Sn();e===null&&(e=Fe().selectEnd()),e.insertNodes(r)}function Us(r){let e=r;r.isCollapsed()||e.removeText();const t=K();O(t)&&(e=t),O(e)||$(161);const n=e.anchor;let s=n.getNode(),i=n.offset;for(;!Zt(s);)[s,i]=Zc(s,i);return i}function Zc(r,e){const t=r.getParent();if(!t){const s=Ue();return Fe().append(s),s.select(),[Fe(),0]}if(z(r)){const s=r.splitText(e);if(s.length===0)return[t,r.getIndexWithinParent()];const i=e===0?0:1;return[t,s[0].getIndexWithinParent()+i]}if(!F(r)||e===0)return[t,r.getIndexWithinParent()];const n=r.getChildAtIndex(e);if(n){const s=new lr(It(r.__key,e,"element"),It(r.__key,e,"element"),0,""),i=r.insertNewAfter(s);i&&i.append(n,...n.getNextSiblings())}return[t,r.getIndexWithinParent()+1]}let Ke=null,He=null,ot=!1,Ws=!1,qn=0;const Oo={characterData:!0,childList:!0,subtree:!0};function An(){return ot||Ke!==null&&Ke._readOnly}function it(){ot&&$(13)}function _a(){qn>99&&$(14)}function Qt(){return Ke===null&&$(195,va()),Ke}function Pe(){return He===null&&$(196,va()),He}function va(){let r=0;const e=new Set,t=Ds.version;if(typeof window<"u")for(const s of document.querySelectorAll("[contenteditable]")){const i=ms(s);if(Ri(i))r++;else if(i){let o=String(i.constructor.version||"<0.17.1");o===t&&(o+=" (separately built, likely a bundler configuration issue)"),e.add(o)}}let n=` Detected on the page: ${r} compatible editor(s) with version ${t}`;return e.size&&(n+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),n}function ed(){return He}function Io(r,e,t){const n=e.__type,s=function(a,l){const u=a._nodes.get(l);return u===void 0&&$(30,l),u}(r,n);let i=t.get(n);i===void 0&&(i=Array.from(s.transforms),t.set(n,i));const o=i.length;for(let a=0;a<o&&(i[a](e),e.isAttached());a++);}function $o(r,e){return r!==void 0&&r.__key!==e&&r.isAttached()}function Ca(r,e){if(!e)return;const t=r._updateTags;let n=e;Array.isArray(e)||(n=[e]);for(const s of n)t.add(s)}function td(r){return Ui(r,Pe()._nodes)}function Ui(r,e){const t=r.type,n=e.get(t);n===void 0&&$(17,t);const s=n.klass;r.type!==s.getType()&&$(18,s.name);const i=s.importJSON(r),o=r.children;if(F(i)&&Array.isArray(o))for(let a=0;a<o.length;a++){const l=Ui(o[a],e);i.append(l)}return i}function zo(r,e,t){const n=Ke,s=ot,i=He;Ke=e,ot=!0,He=r;try{return t()}finally{Ke=n,ot=s,He=i}}function rr(r,e){const t=r._pendingEditorState,n=r._rootElement,s=r._headless||n===null;if(t===null)return;const i=r._editorState,o=i._selection,a=t._selection,l=r._dirtyType!==gr,u=Ke,c=ot,d=He,f=r._updating,h=r._observer;let p=null;if(r._pendingEditorState=null,r._editorState=t,!s&&l&&h!==null){He=r,Ke=t,ot=!1,r._updating=!0;try{const b=r._dirtyType,v=r._dirtyElements,S=r._dirtyLeaves;h.disconnect(),p=zc(i,t,r,b,v,S)}catch(b){if(b instanceof Error&&r._onError(b),Ws)throw b;return Aa(r,null,n,t),Ul(r),r._dirtyType=Pr,Ws=!0,rr(r,i),void(Ws=!1)}finally{h.observe(n,Oo),r._updating=f,Ke=u,ot=c,He=d}}t._readOnly||(t._readOnly=!0);const m=r._dirtyLeaves,y=r._dirtyElements,D=r._normalizedNodes,x=r._updateTags,E=r._deferred;l&&(r._dirtyType=gr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set,r._updateTags=new Set),function(b,v){const S=b._decorators;let k=b._pendingDecorators||S;const j=v._nodeMap;let T;for(T in k)j.has(T)||(k===S&&(k=Hl(b)),delete k[T])}(r,t);const _=s?null:gt(r._window);if(r._editable&&_!==null&&(l||a===null||a.dirty)){He=r,Ke=t;try{if(h!==null&&h.disconnect(),l||a===null||a.dirty){const b=r._blockCursorElement;b!==null&&Oi(b,r,n),Xc(o,a,r,_,x,n)}Rc(r,n,a),h!==null&&h.observe(n,Oo)}finally{He=d,Ke=u}}p!==null&&function(b,v,S,k,j){const T=Array.from(b._listeners.mutation),B=T.length;for(let L=0;L<B;L++){const[R,P]=T[L],Q=v.get(P);Q!==void 0&&R(Q,{dirtyLeaves:k,prevEditorState:j,updateTags:S})}}(r,p,x,m,i),O(a)||a===null||o!==null&&o.is(a)||r.dispatchCommand(bi,void 0);const A=r._pendingDecorators;A!==null&&(r._decorators=A,r._pendingDecorators=null,un("decorator",r,!0,A)),function(b,v,S){const k=ho(v),j=ho(S);k!==j&&un("textcontent",b,!0,j)}(r,e||i,t),un("update",r,!0,{dirtyElements:y,dirtyLeaves:m,editorState:t,normalizedNodes:D,prevEditorState:e||i,tags:x}),function(b,v){if(b._deferred=[],v.length!==0){const S=b._updating;b._updating=!0;try{for(let k=0;k<v.length;k++)v[k]()}finally{b._updating=S}}}(r,E),function(b){const v=b._updates;if(v.length!==0){const S=v.shift();if(S){const[k,j]=S;Da(b,k,j)}}}(r)}function un(r,e,t,...n){const s=e._updating;e._updating=t;try{const i=Array.from(e._listeners[r]);for(let o=0;o<i.length;o++)i[o].apply(null,n)}finally{e._updating=s}}function wa(r,e,t){if(r._updating===!1||He!==r){let s=!1;return r.update(()=>{s=wa(r,e,t)}),s}const n=Li(r);for(let s=4;s>=0;s--)for(let i=0;i<n.length;i++){const o=n[i]._commands.get(e);if(o!==void 0){const a=o[s];if(a!==void 0){const l=Array.from(a),u=l.length;for(let c=0;c<u;c++)if(l[c](t,r)===!0)return!0}}}return!1}function qo(r,e){const t=r._updates;let n=e||!1;for(;t.length!==0;){const s=t.shift();if(s){const[i,o]=s;let a;if(o!==void 0){if(a=o.onUpdate,o.skipTransforms&&(n=!0),o.discrete){const l=r._pendingEditorState;l===null&&$(191),l._flushSync=!0}a&&r._deferred.push(a),Ca(r,o.tag)}i()}}return n}function Da(r,e,t){const n=r._updateTags;let s,i=!1,o=!1;t!==void 0&&(s=t.onUpdate,Ca(r,t.tag),i=t.skipTransforms||!1,o=t.discrete||!1),s&&r._deferred.push(s);const a=r._editorState;let l=r._pendingEditorState,u=!1;(l===null||l._readOnly)&&(l=r._pendingEditorState=Ea(l||a),u=!0),l._flushSync=o;const c=Ke,d=ot,f=He,h=r._updating;Ke=l,ot=!1,r._updating=!0,He=r;try{u&&(r._headless?a._selection!==null&&(l._selection=a._selection.clone()):l._selection=function(D){const x=D.getEditorState()._selection,E=gt(D._window);return O(x)||x==null?qi(x,E,D,null):x.clone()}(r));const m=r._compositionKey;e(),i=qo(r,i),function(D,x){const E=x.getEditorState()._selection,_=D._selection;if(O(_)){const A=_.anchor,b=_.focus;let v;if(A.type==="text"&&(v=A.getNode(),v.selectionTransform(E,_)),b.type==="text"){const S=b.getNode();v!==S&&S.selectionTransform(E,_)}}}(l,r),r._dirtyType!==gr&&(i?function(D,x){const E=x._dirtyLeaves,_=D._nodeMap;for(const A of E){const b=_.get(A);z(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&co(b)}}(l,r):function(D,x){const E=x._dirtyLeaves,_=x._dirtyElements,A=D._nodeMap,b=tr(),v=new Map;let S=E,k=S.size,j=_,T=j.size;for(;k>0||T>0;){if(k>0){x._dirtyLeaves=new Set;for(const B of S){const L=A.get(B);z(L)&&L.isAttached()&&L.isSimpleText()&&!L.isUnmergeable()&&co(L),L!==void 0&&$o(L,b)&&Io(x,L,v),E.add(B)}if(S=x._dirtyLeaves,k=S.size,k>0){qn++;continue}}x._dirtyLeaves=new Set,x._dirtyElements=new Map;for(const B of j){const L=B[0],R=B[1];if(L!=="root"&&!R)continue;const P=A.get(L);P!==void 0&&$o(P,b)&&Io(x,P,v),_.set(L,R)}S=x._dirtyLeaves,k=S.size,j=x._dirtyElements,T=j.size,qn++}x._dirtyLeaves=E,x._dirtyElements=_}(l,r),qo(r),function(D,x,E,_){const A=D._nodeMap,b=x._nodeMap,v=[];for(const[S]of _){const k=b.get(S);k!==void 0&&(k.isAttached()||(F(k)&&ea(k,S,A,b,v,_),A.has(S)||_.delete(S),v.push(S)))}for(const S of v)b.delete(S);for(const S of E){const k=b.get(S);k===void 0||k.isAttached()||(A.has(S)||E.delete(S),b.delete(S))}}(a,l,r._dirtyLeaves,r._dirtyElements)),m!==r._compositionKey&&(l._flushSync=!0);const y=l._selection;if(O(y)){const D=l._nodeMap,x=y.anchor.key,E=y.focus.key;D.get(x)!==void 0&&D.get(E)!==void 0||$(19)}else Lt(y)&&y._nodes.size===0&&(l._selection=null)}catch(m){return m instanceof Error&&r._onError(m),r._pendingEditorState=a,r._dirtyType=Pr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),void rr(r)}finally{Ke=c,ot=d,He=f,r._updating=h,qn=0}r._dirtyType!==gr||function(m,y){const D=y.getEditorState()._selection,x=m._selection;if(x!==null){if(x.dirty||!x.is(D))return!0}else if(D!==null)return!0;return!1}(l,r)?l._flushSync?(l._flushSync=!1,rr(r)):u&&Ac(()=>{rr(r)}):(l._flushSync=!1,u&&(n.clear(),r._deferred=[],r._pendingEditorState=null))}function ct(r,e,t){r._updating?r._updates.push([e,t]):Da(r,e,t)}class cn{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new cn(this.element,e,this.after)}withAfter(e){return new cn(this.element,this.before,e)}withElement(e){return new cn(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&$(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&$(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&$(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(bn||ps);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n=e.nodeName==="IMG"?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const n=this.element,s=this.before,i=document.createElement("br");if(n.insertBefore(i,s),e){const o=document.createElement("img");o.setAttribute("data-lexical-linebreak","true"),o.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",o.alt="",n.insertBefore(o,i),n.__lexicalLineBreak=o}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;t!==null;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,s){if(n===this.element){const l=this.getFirstChildOffset();return[e,Math.min(l+e.getChildrenSize(),Math.max(l,s))]}const i=Uo(t,n);i.push(s);const o=Uo(t,this.element);let a=e.getIndexWithinParent();for(let l=0;l<o.length;l++){const u=i[l],c=o[l];if(u===void 0||u<c)break;if(u>c){a+=1;break}}return[e.getParentOrThrow(),a]}}function Uo(r,e){const t=[];let n=e;for(;n!==r&&n!==null;n=e.parentNode){let s=0;for(let i=n.previousSibling;i!==null;i=n.previousSibling)s++;t.push(s)}return n!==r&&$(225),t.reverse()}class Jt extends vs{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return yc[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=Pe()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(z(t)&&e.push(t),F(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;F(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;F(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const i=t[n-1];return F(i)&&i.getLastDescendant()||i||null}const s=t[e];return F(s)&&s.getFirstDescendant()||s||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:Xe(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&$(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:Xe(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&$(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,s;if(e<t/2){for(n=this.getFirstChild(),s=0;n!==null&&s<=e;){if(s===e)return n;n=n.getNextSibling(),s++}return null}for(n=this.getLastChild(),s=t-1;n!==null&&s>=e;){if(s===e)return n;n=n.getPreviousSibling(),s--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const i=t[s];e+=i.getTextContent(),F(i)&&s!==n-1&&!i.isInline()&&(e+=Kt)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const i=t[s];e+=i.getTextContentSize(),F(i)&&s!==n-1&&!i.isInline()&&(e+=Kt.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=lo[e];return!!(this.getFormat()&t)}return!1}select(e,t){it();const n=K();let s=e,i=t;const o=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const l=this.getFirstChild();if(z(l)||F(l))return l.select(0,0)}else if(!(e!==void 0&&e!==o||t!==void 0&&t!==o)){const l=this.getLastChild();if(z(l)||F(l))return l.select()}}s===void 0&&(s=o),i===void 0&&(i=o);const a=this.__key;return O(n)?(n.anchor.set(a,s,"element"),n.focus.set(a,i,"element"),n.dirty=!0,n):xa(a,s,a,i,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(t=>t.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==""?lo[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){const s=n.length,i=this.getChildrenSize(),o=this.getWritable();e+t<=i||$(226,String(e),String(t),String(i));const a=o.__key,l=[],u=[],c=this.getChildAtIndex(e+t);let d=null,f=i-t+s;if(e!==0)if(e===i)d=this.getLastChild();else{const p=this.getChildAtIndex(e);p!==null&&(d=p.getPreviousSibling())}if(t>0){let p=d===null?this.getFirstChild():d.getNextSibling();for(let m=0;m<t;m++){p===null&&$(100);const y=p.getNextSibling(),D=p.__key;hr(p.getWritable()),u.push(D),p=y}}let h=d;for(let p=0;p<s;p++){const m=n[p];h!==null&&m.is(h)&&(d=h=h.getPreviousSibling());const y=m.getWritable();y.__parent===a&&f--,hr(y);const D=m.__key;if(h===null)o.__first=D,y.__prev=null;else{const x=h.getWritable();x.__next=D,y.__prev=x.__key}m.__key===a&&$(76),y.__parent=a,l.push(D),h=m}if(e+t===i)h!==null&&(h.getWritable().__next=null,o.__last=h.__key);else if(c!==null){const p=c.getWritable();if(h!==null){const m=h.getWritable();p.__prev=h.__key,m.__next=c.__key}else p.__prev=null}if(o.__size=f,u.length){const p=K();if(O(p)){const m=new Set(u),y=new Set(l),{anchor:D,focus:x}=p;Wo(D,m,y)&&os(D,D.getNode(),this,d,c),Wo(x,m,y)&&os(x,x.getNode(),this,d,c),f!==0||this.canBeEmpty()||Ot(this)||this.remove()}}return o}getDOMSlot(e){return new cn(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(t)){const n=this.getIndent();n>0&&(t.style.paddingInlineStart=40*n+"px")}return{element:t}}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let s=n.getFirstChild();for(let i=this.getFirstChild();i;i=i.getNextSibling()){const o=t.getElementByKey(i.getKey());o!==null&&(s==null?(n.insertChild(o),s=o):s!==o&&n.replaceChild(o,s),s=s.nextSibling)}}}function F(r){return r instanceof Jt}function Wo(r,e,t){let n=r.getNode();for(;n;){const s=n.__key;if(e.has(s)&&!t.has(s))return!0;n=n.getParent()}return!1}class Wi extends vs{constructor(e){super(e)}decorate(e,t){$(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Ce(r){return r instanceof Wi}class kn extends Jt{static getType(){return"root"}static clone(){return new kn}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){$(51)}getTextContent(){const e=this.__cachedText;return!An()&&Pe()._dirtyType!==gr||e===null?super.getTextContent():e}remove(){$(52)}replace(e){$(53)}insertBefore(e){$(54)}insertAfter(e){$(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];F(n)||Ce(n)||$(56)}return super.append(...e)}static importJSON(e){const t=Fe();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function tt(r){return r instanceof kn}function Ea(r){return new ws(new Map(r._nodeMap))}function Gi(){return new ws(new Map([["root",new kn]]))}function Sa(r){const e=r.exportJSON(),t=r.constructor;if(e.type!==t.getType()&&$(130,t.name),F(r)){const n=e.children;Array.isArray(n)||$(59,t.name);const s=r.getChildren();for(let i=0;i<s.length;i++){const o=Sa(s[i]);n.push(o)}}return e}class ws{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return zo(t&&t.editor||null,this,e)}clone(e){const t=new ws(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return zo(null,this,()=>({root:Sa(Fe())}))}}class Vi extends Jt{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class $r extends Jt{constructor(e){super(e),this.__textFormat=0,this.__textStyle=""}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=mr[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return Yn(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}static clone(e){return new $r(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=sn(e.theme,"paragraph");return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:rd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=Ue();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){const n=Ue();n.setTextFormat(e.format),n.setTextStyle(e.style);const s=this.getDirection();return n.setDirection(s),n.setFormat(this.getFormatType()),n.setStyle(this.getTextStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(e.length===0||z(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function rd(r){const e=Ue();return r.style&&(e.setFormat(r.style.textAlign),$i(r,e)),{node:e}}function Ue(){return $t(new $r)}function Or(r){return r instanceof $r}const ye=0,Nr=1,nd=4;function Aa(r,e,t,n){const s=r._keyToDOMMap;s.clear(),r._editorState=Gi(),r._pendingEditorState=n,r._compositionKey=null,r._dirtyType=gr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),r._normalizedNodes=new Set,r._updateTags=new Set,r._updates=[],r._blockCursorElement=null;const i=r._observer;i!==null&&(i.disconnect(),r._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",s.set("root",t))}function sd(r){const e=r||{},t=ed(),n=e.theme||{},s=r===void 0?t:e.parentEditor||null,i=e.disableEvents||!1,o=Gi(),a=e.namespace||(s!==null?s._config.namespace:Yl()),l=e.editorState,u=[kn,Ir,wn,Dn,$r,Vi,...e.nodes||[]],{onError:c,html:d}=e,f=e.editable===void 0||e.editable;let h;if(r===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let m=0;m<u.length;m++){let y=u[m],D=null,x=null;if(typeof y!="function"){const b=y;y=b.replace,D=b.with,x=b.withKlass||null}const E=y.getType(),_=y.transform(),A=new Set;_!==null&&A.add(_),h.set(E,{exportDOM:d&&d.export?d.export.get(y):void 0,klass:y,replace:D,replaceWithKlass:x,transforms:A})}}const p=new Ds(o,s,h,{disableEvents:i,namespace:a,theme:n},c||console.error,function(m,y){const D=new Map,x=new Set,E=_=>{Object.keys(_).forEach(A=>{let b=D.get(A);b===void 0&&(b=[],D.set(A,b)),b.push(_[A])})};return m.forEach(_=>{const A=_.klass.importDOM;if(A==null||x.has(A))return;x.add(A);const b=A.call(_.klass);b!==null&&E(b)}),y&&E(y),D}(h,d?d.import:void 0),f);return l!==void 0&&(p._pendingEditorState=l,p._dirtyType=Pr),p}class Ds{constructor(e,t,n,s,i,o,a){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=s,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=gr,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Yl(),this._onError=i,this._htmlConversions=o,this._editable=a,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,n){n===void 0&&$(35);const s=this._commands;s.has(e)||s.set(e,[new Set,new Set,new Set,new Set,new Set]);const i=s.get(e);i===void 0&&$(36,String(e));const o=i[n];return o.add(t),()=>{o.delete(t),i.every(a=>a.size===0)&&s.delete(e)}}registerMutationListener(e,t,n){const s=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;i.set(t,s);const o=n&&n.skipInitialization;return o!==void 0&&o||this.initializeMutationListener(t,s),()=>{i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&$(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,s=jc(n).get(t.getType());if(!s)return;const i=new Map;for(const o of s.keys())i.set(o,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),s=[n],i=n.replaceWithKlass;if(i!=null){const l=this.registerNodeTransformToKlass(i,t);s.push(l)}var o,a;return o=this,a=e.getType(),ct(o,()=>{const l=Qt();if(l.isEmpty())return;if(a==="root")return void Fe().markDirty();const u=l._nodeMap;for(const[,c]of u)c.markDirty()},o._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{s.forEach(l=>l.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return G(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=sn(this._config.theme,"root"),s=this._pendingEditorState||this._editorState;if(this._rootElement=e,Aa(this,t,e,s),t!==null&&(this._config.disableEvents||qc(t),n!=null&&t.classList.remove(...n)),e!==null){const i=function(a){const l=a.ownerDocument;return l&&l.defaultView||null}(e),o=e.style;o.userSelect="text",o.whiteSpace="pre-wrap",o.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=Pr,Ul(this),this._updateTags.add("history-merge"),rr(this),this._config.disableEvents||function(a,l){const u=a.ownerDocument,c=ss.get(u);(c===void 0||c<1)&&u.addEventListener("selectionchange",ha),ss.set(u,(c||0)+1),a.__lexicalEditor=l;const d=fa(a);for(let f=0;f<ii.length;f++){const[h,p]=ii[f],m=typeof p=="function"?y=>{So(y)||(Eo(y),(l.isEditable()||h==="click")&&p(y,l))}:y=>{if(So(y))return;Eo(y);const D=l.isEditable();switch(h){case"cut":return D&&G(l,Ci,y);case"copy":return G(l,hs,y);case"paste":return D&&G(l,fs,y);case"dragstart":return D&&G(l,Ml,y);case"dragover":return D&&G(l,Pl,y);case"dragend":return D&&G(l,ec,y);case"focus":return D&&G(l,nc,y);case"blur":return D&&G(l,sc,y);case"drop":return D&&G(l,Ll,y)}};a.addEventListener(h,m),d.push(()=>{a.removeEventListener(h,m)})}}(e,this),n!=null&&e.classList.add(...n)}else this._editorState=s,this._pendingEditorState=null,this._window=null;un("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&$(38);let n=e;n._readOnly&&(n=Ea(e),n._selection=e._selection?e._selection.clone():null),ql(this);const s=this._pendingEditorState,i=this._updateTags,o=t!==void 0?t.tag:null;s===null||s.isEmpty()||(o!=null&&i.add(o),rr(this)),this._pendingEditorState=n,this._dirtyType=Pr,this._dirtyElements.set("root",!1),this._compositionKey=null,o!=null&&i.add(o),this._updating||rr(this)}parseEditorState(e,t){return function(n,s,i){const o=Gi(),a=Ke,l=ot,u=He,c=s._dirtyElements,d=s._dirtyLeaves,f=s._cloneNotNeeded,h=s._dirtyType;s._dirtyElements=new Map,s._dirtyLeaves=new Set,s._cloneNotNeeded=new Set,s._dirtyType=0,Ke=o,ot=!1,He=s;try{const p=s._nodes;Ui(n.root,p),i&&i(),o._readOnly=!0}catch(p){p instanceof Error&&s._onError(p)}finally{s._dirtyElements=c,s._dirtyLeaves=d,s._cloneNotNeeded=f,s._dirtyType=h,Ke=a,ot=l,He=u}return o}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return rr(this),this.getEditorState().read(e,{editor:this})}update(e,t){ct(this,e,t)}focus(e,t={}){const n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),ct(this,()=>{const s=K(),i=Fe();s!==null?s.dirty=!0:i.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?i.selectStart():i.selectEnd())},{onUpdate:()=>{n.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=gt(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,un("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Ds.version="0.21.0+prod.esm";const ka=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,id=ka?w.useLayoutEffect:w.useEffect,Pn={tag:"history-merge"};function od({initialConfig:r,children:e}){const t=w.useMemo(()=>{const{theme:n,namespace:s,nodes:i,onError:o,editorState:a,html:l}=r,u=Wu(null,n),c=sd({editable:r.editable,html:l,namespace:s,nodes:i,onError:d=>o(d,c),theme:n});return function(d,f){if(f!==null){if(f===void 0)d.update(()=>{const h=Fe();if(h.isEmpty()){const p=Ue();h.append(p);const m=ka?document.activeElement:null;(K()!==null||m!==null&&m===d.getRootElement())&&p.select()}},Pn);else if(f!==null)switch(typeof f){case"string":{const h=d.parseEditorState(f);d.setEditorState(h,Pn);break}case"object":d.setEditorState(f,Pn);break;case"function":d.update(()=>{Fe().isEmpty()&&f(d)},Pn)}}}(c,a),[c,u]},[]);return id(()=>{const n=r.editable,[s]=t;s.setEditable(n===void 0||n)},[]),g.jsx(El.Provider,{value:t,children:e})}const ld=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function ad(r){return{initialValueFn:()=>r.isEditable(),subscribe:e=>r.registerEditableListener(e)}}function ud(){return function(r){const[e]=St(),t=w.useMemo(()=>r(e),[e,r]),[n,s]=w.useState(()=>t.initialValueFn()),i=w.useRef(n);return ld(()=>{const{initialValueFn:o,subscribe:a}=t,l=o();return i.current!==l&&(i.current=l,s(l)),a(u=>{i.current=u,s(u)})},[t,r]),n}(ad)}function cd(){return Fe().getTextContent()}function dd(r,e=!0){if(r)return!1;let t=cd();return e&&(t=t.trim()),t===""}function fd(r){if(!dd(r,!1))return!1;const e=Fe().getChildren(),t=e.length;if(t>1)return!1;for(let n=0;n<t;n++){const s=e[n];if(Ce(s))return!1;if(F(s)){if(!Or(s)||s.__indent!==0)return!1;const i=s.getChildren(),o=i.length;for(let a=0;a<o;a++){const l=i[n];if(!z(l))return!1}}}return!0}function Ta(r){return()=>fd(r)}function hd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}hd(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function pd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var gd=pd(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const md=new Map;function yd(r){const e={};if(!r)return e;const t=r.split(";");for(const n of t)if(n!==""){const[s,i]=n.split(/:([^]+)/);s&&i&&(e[s.trim()]=i.trim())}return e}function Na(r,e){const t=r.getStartEndPoints();if(e.isSelected(r)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[n,s]=t,i=r.isBackward(),o=n.getNode(),a=s.getNode(),l=e.is(o),u=e.is(a);if(l||u){const[c,d]=ui(r),f=o.is(a),h=e.is(i?a:o),p=e.is(i?o:a);let m,y=0;return f?(y=c>d?d:c,m=c>d?c:d):h?(y=i?d:c,m=void 0):p&&(y=0,m=i?c:d),e.__text=e.__text.slice(y,m),e}}return e}function xd(r){const e=r.getStyle(),t=yd(e);md.set(e,t)}function bd(r,e){if(r===null)return;const t=r.getStartEndPoints(),n=t?t[0]:null;if(n!==null&&n.key==="root"){const o=e(),a=Fe(),l=a.getFirstChild();return void(l?l.replace(o,!0):a.append(o))}const s=r.getNodes(),i=n!==null&&function(o,a){let l=o;for(;l!==null&&l.getParent()!==null&&!a(l);)l=l.getParentOrThrow();return a(l)?l:null}(n.getNode(),Ko);i&&s.indexOf(i)===-1&&s.push(i);for(let o=0;o<s.length;o++){const a=s[o];if(!Ko(a))continue;F(a)||gd(178);const l=e();l.setFormat(a.getFormatType()),l.setIndent(a.getIndent()),a.replace(l,!0)}}function Go(r,e){const t=pn(r.focus,e);return Ce(t)&&!t.isIsolated()||F(t)&&!t.isInline()&&!t.canBeEmpty()}function _d(r,e,t,n){r.modify(e?"extend":"move",t,n)}function vd(r){const e=r.anchor.getNode();return(tt(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Vo(r,e,t){const n=vd(r);_d(r,e,t?!n:n,"character")}function Ko(r){if(Ce(r)||!F(r)||Ot(r))return!1;const e=r.getFirstChild(),t=e===null||pr(e)||z(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Cd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var wd=Cd(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const Ba=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Dd=Ba&&"documentMode"in document?document.documentMode:null;!(!Ba||!("InputEvent"in window)||Dd)&&"getTargetRanges"in new window.InputEvent("input");function Fa(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}function vr(...r){return()=>{for(let e=r.length-1;e>=0;e--)r[e]();r.length=0}}function Tn(r,...e){const t=Fa(...e);t.length>0&&r.classList.add(...t)}function Ra(r,...e){const t=Fa(...e);t.length>0&&r.classList.remove(...t)}function Ed(r,e){let t=r;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function Sd(r){const e=Es(r,t=>F(t)&&!t.isInline());return F(e)||wd(4,r.__key),e}const Es=(r,e)=>{let t=r;for(;t!==Fe()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function nr(r,e){return r!==null&&Object.getPrototypeOf(r).constructor.name===e.name}function Ad(r){const e=window.location.origin,t=n=>{if(n.origin!==e)return;const s=r.getRootElement();if(document.activeElement!==s)return;const i=n.data;if(typeof i=="string"){let o;try{o=JSON.parse(i)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"){const a=o.payload;if(a&&a.functionId==="makeChanges"){const l=a.args;if(l){const[u,c,d,f,h,p]=l;r.update(()=>{const m=K();if(O(m)){const y=m.anchor;let D=y.getNode(),x=0,E=0;if(z(D)&&u>=0&&c>=0&&(x=u,E=u+c,m.setTextNodeRange(D,x,D,E)),x===E&&d===""||(m.insertRawText(d),D=y.getNode()),z(D)){x=f,E=f+h;const _=D.getTextContentSize();x=x>_?_:x,E=E>_?_:E,m.setTextNodeRange(D,x,D,E)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function La(r,e){const t=e.body?e.body.childNodes:[];let n=[];const s=[];for(let i=0;i<t.length;i++){const o=t[i];if(!ja.has(o.nodeName)){const a=Oa(o,r,s,!1);a!==null&&(n=n.concat(a))}}return function(i){for(const o of i)o.getNextSibling()instanceof Vi&&o.insertAfter(xr());for(const o of i){const a=o.getChildren();for(const l of a)o.insertBefore(l);o.remove()}}(s),n}function Ma(r,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),n=Fe().getChildren();for(let s=0;s<n.length;s++)Pa(r,n[s],t,e);return t.innerHTML}function Pa(r,e,t,n=null){let s=n===null||e.isSelected(n);const i=F(e)&&e.excludeFromCopy("html");let o=e;if(n!==null){let h=Ii(e);h=z(h)&&n!==null?Na(n,h):h,o=h}const a=F(o)?o.getChildren():[],l=r._nodes.get(o.getType());let u;u=l&&l.exportDOM!==void 0?l.exportDOM(r,o):o.exportDOM(r);const{element:c,after:d}=u;if(!c)return!1;const f=document.createDocumentFragment();for(let h=0;h<a.length;h++){const p=a[h],m=Pa(r,p,f,n);!s&&F(e)&&m&&e.extractWithChild(p,n,"html")&&(s=!0)}if(s&&!i){if((Ht(c)||_o(c))&&c.append(f),t.append(c),d){const h=d.call(o,c);h&&(_o(c)?c.replaceChildren(h):c.replaceWith(h))}}else t.append(f);return s}const ja=new Set(["STYLE","SCRIPT"]);function Oa(r,e,t,n,s=new Map,i){let o=[];if(ja.has(r.nodeName))return o;let a=null;const l=function(p,m){const{nodeName:y}=p,D=m._htmlConversions.get(y.toLowerCase());let x=null;if(D!==void 0)for(const E of D){const _=E(p);_!==null&&(x===null||(x.priority||0)<=(_.priority||0))&&(x=_)}return x!==null?x.conversion:null}(r,e),u=l?l(r):null;let c=null;if(u!==null){c=u.after;const p=u.node;if(a=Array.isArray(p)?p[p.length-1]:p,a!==null){for(const[,m]of s)if(a=m(a,i),!a)break;a&&o.push(...Array.isArray(p)?p:[a])}u.forChild!=null&&s.set(r.nodeName,u.forChild)}const d=r.childNodes;let f=[];const h=(a==null||!Ot(a))&&(a!=null&&ci(a)||n);for(let p=0;p<d.length;p++)f.push(...Oa(d[p],e,t,h,new Map(s),a));return c!=null&&(f=c(f)),es(r)&&(f=kd(r,f,h?()=>{const p=new Vi;return t.push(p),p}:Ue)),a==null?f.length>0?o=o.concat(f):es(r)&&function(p){return p.nextSibling==null||p.previousSibling==null?!1:Ys(p.nextSibling)&&Ys(p.previousSibling)}(r)&&(o=o.concat(xr())):F(a)&&a.append(...f),o}function kd(r,e,t){const n=r.style.textAlign,s=[];let i=[];for(let o=0;o<e.length;o++){const a=e[o];if(ci(a))n&&!a.getFormat()&&a.setFormat(n),s.push(a);else if(i.push(a),o===e.length-1||o<e.length-1&&ci(e[o+1])){const l=t();l.setFormat(n),l.append(...i),s.push(l),i=[]}}return s}function Td(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ls=Td(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Nd(r,e=K()){return e==null&&ls(166),O(e)&&e.isCollapsed()||e.getNodes().length===0?"":Ma(r,e)}function Bd(r,e=K()){return e==null&&ls(166),O(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(Fd(r,e))}function Ho(r,e,t){const n=r.getData("application/x-lexical-editor");if(n)try{const o=JSON.parse(n);if(o.namespace===t._config.namespace&&Array.isArray(o.nodes))return Qo(t,Rd(o.nodes),e)}catch{}const s=r.getData("text/html");if(s)try{const o=new DOMParser().parseFromString(function(a){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:l=>l}).createHTML(a):a}(s),"text/html");return Qo(t,La(t,o),e)}catch{}const i=r.getData("text/plain")||r.getData("text/uri-list");if(i!=null)if(O(e)){const o=i.split(/(\r?\n|\t)/);o[o.length-1]===""&&o.pop();for(let a=0;a<o.length;a++){const l=K();if(O(l)){const u=o[a];u===`
93
+ `?n.push(Rr()):o===" "?n.push(Zn()):n.push(Ke(o))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,s=this.format,i=this.style;let o=t,l=n;!this.isCollapsed()&&n.isBefore(t)&&(o=n,l=t),o.type==="element"&&function(x,v,_,C){const S=x.getNode(),D=S.getChildAtIndex(x.offset),w=Ke(),y=lt(S)?He().append(w):w;w.setFormat(_),w.setStyle(C),D===null?S.append(y):D.insertBefore(y),x.is(v)&&v.set(w.__key,0,"text"),x.set(w.__key,0,"text")}(o,l,s,i);const a=o.offset;let u=l.offset;const c=this.getNodes(),d=c.length;let f=c[0];G(f)||V(26);const h=f.getTextContent().length,g=f.getParentOrThrow();let m=c[d-1];if(d===1&&l.type==="element"&&(u=h,l.set(o.key,u,"text")),this.isCollapsed()&&a===h&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!g.canInsertTextAfter()&&f.getNextSibling()===null)){let x=f.getNextSibling();if(G(x)&&x.canInsertTextBefore()&&!Cr(x)||(x=Ke(),x.setFormat(s),x.setStyle(i),g.canInsertTextAfter()?f.insertAfter(x):g.insertAfter(x)),x.select(0,0),f=x,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&a===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!g.canInsertTextBefore()&&f.getPreviousSibling()===null)){let x=f.getPreviousSibling();if(G(x)&&!Cr(x)||(x=Ke(),x.setFormat(s),g.canInsertTextBefore()?f.insertBefore(x):g.insertBefore(x)),x.select(),f=x,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&a!==h){const x=Ke(f.getTextContent());x.setFormat(s),f.replace(x),f=x}else if(!this.isCollapsed()&&e!==""){const x=m.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||P(x)&&(!x.canInsertTextBefore()||!x.canInsertTextAfter()))return this.insertText(""),nc(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(f.isToken()){const C=Ke(e);return C.select(),void f.replace(C)}const x=f.getFormat(),v=f.getStyle();if(a!==u||x===s&&v===i){if(Dh(f)){const C=Ke(e);return C.setFormat(s),C.setStyle(i),C.select(),void f.replace(C)}}else{if(f.getTextContent()!==""){const C=Ke(e);if(C.setFormat(s),C.setStyle(i),C.select(),a===0)f.insertBefore(C,!1);else{const[S]=f.splitText(a);S.insertAfter(C,!1)}return void(C.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(s),f.setStyle(i)}const _=u-a;f=f.spliceText(a,_,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=x,this.style=v))}else{const x=new Set([...f.getParentKeys(),...m.getParentKeys()]),v=P(f)?f:f.getParentOrThrow();let _=P(m)?m:m.getParentOrThrow(),C=m;if(!v.is(_)&&_.isInline())do C=_,_=_.getParentOrThrow();while(_.isInline());if(l.type==="text"&&(u!==0||m.getTextContent()==="")||l.type==="element"&&m.getIndexWithinParent()<u)if(G(m)&&!m.isToken()&&u!==m.getTextContentSize()){if(m.isSegmented()){const k=Ke(m.getTextContent());m.replace(k),m=k}lt(l.getNode())||l.type!=="text"||(m=m.spliceText(0,u,"")),x.add(m.__key)}else{const k=m.getParentOrThrow();k.canBeEmpty()||k.getChildrenSize()!==1?m.remove():k.remove()}else x.add(m.__key);const S=_.getChildren(),D=new Set(c),w=v.is(_),y=v.isInline()&&f.getNextSibling()===null?v:f;for(let k=S.length-1;k>=0;k--){const B=S[k];if(B.is(f)||P(B)&&B.isParentOf(f))break;B.isAttached()&&(!D.has(B)||B.is(C)?w||y.insertAfter(B,!1):B.remove())}if(!w){let k=_,B=null;for(;k!==null;){const F=k.getChildren(),T=F.length;(T===0||F[T-1].is(B))&&(x.delete(k.__key),B=k),k=k.getParent()}}if(f.isToken())if(a===h)f.select();else{const k=Ke(e);k.select(),f.replace(k)}else f=f.spliceText(a,h-a,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let k=1;k<d;k++){const B=c[k],F=B.__key;x.has(F)||B.remove()}}}removeText(){if(this.isCollapsed())return;const{anchor:e,focus:t}=this,n=this.getNodes(),s=this.isBackward()?t:e,i=this.isBackward()?e:t;let o=s.getNode(),l=i.getNode();const a=pn(o,cr),u=pn(l,cr);G(o)&&o.isToken()&&s.offset<o.getTextContentSize()&&(s.offset=0),i.offset>0&&G(l)&&l.isToken()&&(i.offset=l.getTextContentSize()),n.forEach(d=>{Tn(o,d)||Tn(l,d)||d.getKey()===o.getKey()||d.getKey()===l.getKey()||d.remove()});const c=(d,f)=>{if(d.getTextContent()==="")d.remove();else if(f!==0&&Cr(d)){const h=Ke(d.getTextContent());return h.setFormat(d.getFormat()),h.setStyle(d.getStyle()),d.replace(h)}};if(o===l&&G(o)){const d=Math.abs(t.offset-e.offset);return o.spliceText(s.offset,d,"",!0),void c(o,d)}if(G(o)){const d=o.getTextContentSize()-s.offset;o.spliceText(s.offset,d,""),o=c(o,d)||o}G(l)&&(l.spliceText(0,i.offset,""),l=c(l,i.offset)||l),o.isAttached()&&G(o)?o.selectEnd():l.isAttached()&&G(l)&&l.selectStart(),P(a)&&P(u)&&a!==u&&(a.append(...u.getChildren()),u.remove(),i.set(s.key,s.offset,s.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void Ze(null);const n=this.getNodes(),s=[];for(const S of n)G(S)&&s.push(S);const i=S=>{n.forEach(D=>{if(tn(D)){const w=D.getFormatFlags(e,S);D.setTextFormat(w)}})},o=s.length;if(o===0)return this.toggleFormat(e),Ze(null),void i(t);const l=this.anchor,a=this.focus,u=this.isBackward(),c=u?a:l,d=u?l:a;let f=0,h=s[0],g=c.type==="element"?0:c.offset;if(c.type==="text"&&g===h.getTextContentSize()&&(f=1,h=s[1],g=0),h==null)return;const m=h.getFormatFlags(e,t);i(m);const x=o-1;let v=s[x];const _=d.type==="text"?d.offset:v.getTextContentSize();if(h.is(v)){if(g===_)return;if(Cr(h)||g===0&&_===h.getTextContentSize())h.setFormat(m);else{const S=h.splitText(g,_),D=g===0?S[0]:S[1];D.setFormat(m),c.type==="text"&&c.set(D.__key,0,"text"),d.type==="text"&&d.set(D.__key,_-g,"text")}return void(this.format=m)}g===0||Cr(h)||([,h]=h.splitText(g),g=0),h.setFormat(m);const C=v.getFormatFlags(e,m);_>0&&(_===v.getTextContentSize()||Cr(v)||([v]=v.splitText(_)),v.setFormat(C));for(let S=f+1;S<x;S++){const D=s[S],w=D.getFormatFlags(e,C);D.setFormat(w)}c.type==="text"&&c.set(h.__key,g,"text"),d.type==="text"&&d.set(v.__key,_,"text"),this.format=m|C}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const g=te();return z(g)||V(134),g.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=pn(t,cr),s=e[e.length-1];if(P(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const g=Ii(this);n.splice(g,0,e),s.selectEnd()}return}if(!e.some(g=>(P(g)||Ae(g))&&!g.isInline())){P(n)||V(211,t.constructor.name,t.getType());const g=Ii(this);return n.splice(g,0,e),void s.selectEnd()}const i=function(g){const m=He();let x=null;for(let v=0;v<g.length;v++){const _=g[v],C=Ar(_);if(C||Ae(_)&&_.isInline()||P(_)&&_.isInline()||G(_)||_.isParentRequired()){if(x===null&&(x=_.createParentElementNode(),m.append(x),C))continue;x!==null&&x.append(_)}else m.append(_),x=null}return m}(e),o=i.getLastDescendant(),l=i.getChildren(),a=!P(n)||!n.isEmpty()?this.insertParagraph():null,u=l[l.length-1];let c=l[0];var d;P(d=c)&&cr(d)&&!d.isEmpty()&&P(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(P(n)||V(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=l[1]),c&&(n===null&&V(212,t.constructor.name,t.getType()),function(g,m,x){const v=m.getParentOrThrow().getLastChild();let _=m;const C=[m];for(;_!==v;)_.getNextSibling()||V(140),_=_.getNextSibling(),C.push(_);let S=g;for(const D of C)S=S.insertAfter(D)}(n,c));const f=pn(o,cr);a&&P(f)&&(a.canMergeWhenEmpty()||cr(u))&&(f.append(...a.getChildren()),a.remove()),P(n)&&n.isEmpty()&&n.remove(),o.selectEnd();const h=P(n)?n.getLastChild():null;Ar(h)&&f!==n&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const o=He();return Pe().splice(this.anchor.offset,0,[o]),o.select(),o}const e=Ii(this),t=pn(this.anchor.getNode(),cr);P(t)||V(213);const n=t.getChildAtIndex(e),s=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...s),i.selectStart(),i):null}insertLineBreak(e){const t=Rr();if(this.insertNodes([t]),e){const n=t.getParentOrThrow(),s=t.getIndexWithinParent();n.select(s,s)}}extract(){const e=this.getNodes(),t=e.length,n=t-1,s=this.anchor,i=this.focus;let o=e[0],l=e[n];const[a,u]=uo(this);if(t===0)return[];if(t===1){if(G(o)&&!this.isCollapsed()){const d=a>u?u:a,f=a>u?a:u,h=o.splitText(d,f),g=d===0?h[0]:h[1];return g!=null?[g]:[]}return[o]}const c=s.isBefore(i);if(G(o)){const d=c?a:u;d===o.getTextContentSize()?e.shift():d!==0&&([,o]=o.splitText(d),e[0]=o)}if(G(l)){const d=l.getTextContent().length,f=c?u:a;f===0?e.pop():f!==d&&([l]=l.splitText(f),e[n]=l)}return e}modify(e,t,n){const s=this.focus,i=this.anchor,o=e==="move",l=Pn(s,t);if(Ae(l)&&!l.isIsolated()){if(o&&l.isKeyboardSelectable()){const h=el();return h.add(l.__key),void Gt(h)}const f=t?l.getPreviousSibling():l.getNextSibling();if(G(f)){const h=f.__key,g=t?f.getTextContent().length:0;return s.set(h,g,"text"),void(o&&i.set(h,g,"text"))}{const h=l.getParentOrThrow();let g,m;return P(f)?(m=f.__key,g=t?f.getChildrenSize():0):(g=l.getIndexWithinParent(),m=h.__key,t||g++),s.set(m,g,"element"),void(o&&i.set(m,g,"element"))}}const a=ze(),u=Et(a._window);if(!u)return;const c=a._blockCursorElement,d=a._rootElement;if(d===null||c===null||!P(l)||l.isInline()||l.canBeEmpty()||Xo(c,a,d),function(f,h,g,m){f.modify(h,g,m)}(u,e,t?"backward":"forward",n),u.rangeCount>0){const f=u.getRangeAt(0),h=this.anchor.getNode(),g=lt(h)?h:ch(h);if(this.applyDOMRange(f),this.dirty=!0,!o){const m=this.getNodes(),x=[];let v=!1;for(let _=0;_<m.length;_++){const C=m[_];Tn(C,g)?x.push(C):v=!0}if(v&&x.length>0)if(t){const _=x[0];P(_)?_.selectStart():_.getParentOrThrow().selectStart()}else{const _=x[x.length-1];P(_)?_.selectEnd():_.getParentOrThrow().selectEnd()}u.anchorNode===f.startContainer&&u.anchorOffset===f.startOffset||function(_){const C=_.focus,S=_.anchor,D=S.key,w=S.offset,y=S.type;dr(S,C.key,C.offset,C.type),dr(C,D,w,y),_._cachedNodes=null}(this)}}}forwardDeletion(e,t,n){if(!n&&(e.type==="element"&&P(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const s=t.getParent(),i=t.getNextSibling()||(s===null?null:s.getNextSibling());if(P(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const n=this.anchor;let s=n.getNode();if(this.forwardDeletion(n,s,e))return;const i=this.focus,o=Pn(i,e);if(Ae(o)&&!o.isIsolated()){if(o.isKeyboardSelectable()&&P(s)&&s.getChildrenSize()===0){s.remove();const l=el();l.add(o.__key),Gt(l)}else o.remove(),ze().dispatchCommand(Fo,void 0);return}if(!e&&P(o)&&P(s)&&s.isEmpty())return s.remove(),void o.selectStart();if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&n.offset===0&&(n.type==="element"?n.getNode():n.getNode().getParentOrThrow()).collapseAtStart(this))return}else{const l=i.type==="text"?i.getNode():null;if(s=n.type==="text"?n.getNode():null,l!==null&&l.isSegmented()){const a=i.offset,u=l.getTextContentSize();if(l.is(s)||e&&a!==u||!e&&a!==0)return void Xa(l,e,a)}else if(s!==null&&s.isSegmented()){const a=n.offset,u=s.getTextContentSize();if(s.is(l)||e&&a!==0||!e&&a!==u)return void Xa(s,e,a)}(function(a,u){const c=a.anchor,d=a.focus,f=c.getNode(),h=d.getNode();if(f===h&&c.type==="text"&&d.type==="text"){const g=c.offset,m=d.offset,x=g<m,v=x?g:m,_=x?m:g,C=_-1;v!==C&&(Pu(f.getTextContent().slice(v,_))||(u?d.offset=C:c.offset=C))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const n=this.anchor.getNode();n.isEmpty()&&lt(n.getParent())&&n.getIndexWithinParent()===0&&n.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t=this.anchor.type==="element";if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),this.isCollapsed()&&this.anchor.offset===0&&this.modify("extend",e,"character"),t){const n=e?this.anchor:this.focus;n.set(n.key,n.offset+1,n.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Ut(r){return r instanceof pi}function Qa(r){const e=r.offset;if(r.type==="text")return e;const t=r.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function uo(r){const e=r.getStartEndPoints();if(e===null)return[0,0];const[t,n]=e;return t.type==="element"&&n.type==="element"&&t.key===n.key&&t.offset===n.offset?[0,0]:[Qa(t),Qa(n)]}function Xa(r,e,t){const n=r,s=n.getTextContent().split(/(?=\s)/g),i=s.length;let o=0,l=0;for(let u=0;u<i;u++){const c=u===i-1;if(l=o,o+=s[u].length,e&&o===t||o>t||c){s.splice(u,1),c&&(l=void 0);break}}const a=s.join("").trim();a===""?n.remove():(n.setTextContent(a),n.select(l,l))}function Ja(r,e,t,n){let s,i=e;if(r.nodeType===Kn){let o=!1;const l=r.childNodes,a=l.length,u=n._blockCursorElement;i===a&&(o=!0,i=a-1);let c=l[i],d=!1;if(c===u)c=l[i+1],d=!0;else if(u!==null){const f=u.parentNode;r===f&&e>Array.prototype.indexOf.call(f.children,u)&&i--}if(s=Vr(c),G(s))i=Ra(s,o);else{let f=Vr(r);if(f===null)return null;if(P(f)){const h=n.getElementByKey(f.getKey());h===null&&V(214),[f,i]=f.getDOMSlot(h).resolveChildIndex(f,h,r,e),P(f)||V(215),o&&i>=f.getChildrenSize()&&(i=Math.max(0,f.getChildrenSize()-1));let m=f.getChildAtIndex(i);if(P(m)&&function(x,v,_){const C=x.getParent();return _===null||C===null||!C.canBeEmpty()||C!==_.getNode()}(m,0,t)){const x=o?m.getLastDescendant():m.getFirstDescendant();x===null?f=m:(m=x,f=P(m)?m:m.getParentOrThrow()),i=0}G(m)?(s=m,f=null,i=Ra(m,o)):m!==f&&o&&!d&&(P(f)||V(216),i=Math.min(f.getChildrenSize(),i+1))}else{const h=f.getIndexWithinParent();i=e===0&&Ae(f)&&Vr(r)===f?h:h+1,f=f.getParentOrThrow()}if(P(f))return Yt(f.__key,i,"element")}}else s=Vr(r);return G(s)?Yt(s.__key,i,"text"):null}function Za(r,e,t){const n=r.offset,s=r.getNode();if(n===0){const i=s.getPreviousSibling(),o=s.getParent();if(e){if((t||!e)&&i===null&&P(o)&&o.isInline()){const l=o.getPreviousSibling();G(l)&&(r.key=l.__key,r.offset=l.getTextContent().length)}}else P(i)&&!t&&i.isInline()?(r.key=i.__key,r.offset=i.getChildrenSize(),r.type="element"):G(i)&&(r.key=i.__key,r.offset=i.getTextContent().length)}else if(n===s.getTextContent().length){const i=s.getNextSibling(),o=s.getParent();if(e&&P(i)&&i.isInline())r.key=i.__key,r.offset=0,r.type="element";else if((t||e)&&i===null&&P(o)&&o.isInline()&&!o.canInsertTextAfter()){const l=o.getNextSibling();G(l)&&(r.key=l.__key,r.offset=0)}}}function nc(r,e,t){if(r.type==="text"&&e.type==="text"){const n=r.isBefore(e),s=r.is(e);Za(r,n,s),Za(e,!n,s),s&&(e.key=r.key,e.offset=r.offset,e.type=r.type);const i=ze();if(i.isComposing()&&i._compositionKey!==r.key&&z(t)){const o=t.anchor,l=t.focus;dr(r,o.key,o.offset,o.type),dr(e,l.key,l.offset,l.type)}}}function sc(r,e,t,n,s,i){if(r===null||t===null||!Yn(s,r,t))return null;const o=Ja(r,e,z(i)?i.anchor:null,s);if(o===null)return null;const l=Ja(t,n,z(i)?i.focus:null,s);if(l===null)return null;if(o.type==="element"&&l.type==="element"){const a=Vr(r),u=Vr(t);if(Ae(a)&&Ae(u))return null}return nc(o,l,i),[o,l]}function co(r){return P(r)&&!r.isInline()}function ic(r,e,t,n,s,i){const o=ar(),l=new br(Yt(r,e,s),Yt(t,n,i),0,"");return l.dirty=!0,o._selection=l,l}function Th(){const r=Yt("root",0,"element"),e=Yt("root",0,"element");return new br(r,e,0,"")}function el(){return new pi(new Set)}function ta(r,e,t,n){const s=t._window;if(s===null)return null;const i=n||s.event,o=i?i.type:void 0,l=o==="selectionchange",a=!Qi&&(l||o==="beforeinput"||o==="compositionstart"||o==="compositionend"||o==="click"&&i&&i.detail===3||o==="drop"||o===void 0);let u,c,d,f;if(z(r)&&!a)return r.clone();if(e===null)return null;if(u=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,l&&z(r)&&!Yn(t,u,c))return r.clone();const h=sc(u,d,c,f,t,r);if(h===null)return null;const[g,m]=h;return new br(g,m,z(r)?r.format:0,z(r)?r.style:"")}function te(){return ar()._selection}function es(){return ze()._editorState._selection}function Ws(r,e,t,n=1){const s=r.anchor,i=r.focus,o=s.getNode(),l=i.getNode();if(!e.is(o)&&!e.is(l))return;const a=e.__key;if(r.isCollapsed()){const u=s.offset;if(t<=u&&n>0||t<u&&n<0){const c=Math.max(0,u+n);s.set(a,c,"element"),i.set(a,c,"element"),tl(r)}}else{const u=r.isBackward(),c=u?i:s,d=c.getNode(),f=u?s:i,h=f.getNode();if(e.is(d)){const g=c.offset;(t<=g&&n>0||t<g&&n<0)&&c.set(a,Math.max(0,g+n),"element")}if(e.is(h)){const g=f.offset;(t<=g&&n>0||t<g&&n<0)&&f.set(a,Math.max(0,g+n),"element")}}tl(r)}function tl(r){const e=r.anchor,t=e.offset,n=r.focus,s=n.offset,i=e.getNode(),o=n.getNode();if(r.isCollapsed()){if(!P(i))return;const l=i.getChildrenSize(),a=t>=l,u=a?i.getChildAtIndex(l-1):i.getChildAtIndex(t);if(G(u)){let c=0;a&&(c=u.getTextContentSize()),e.set(u.__key,c,"text"),n.set(u.__key,c,"text")}}else{if(P(i)){const l=i.getChildrenSize(),a=t>=l,u=a?i.getChildAtIndex(l-1):i.getChildAtIndex(t);if(G(u)){let c=0;a&&(c=u.getTextContentSize()),e.set(u.__key,c,"text")}}if(P(o)){const l=o.getChildrenSize(),a=s>=l,u=a?o.getChildAtIndex(l-1):o.getChildAtIndex(s);if(G(u)){let c=0;a&&(c=u.getTextContentSize()),n.set(u.__key,c,"text")}}}}function Vs(r,e,t,n,s){let i=null,o=0,l=null;n!==null?(i=n.__key,G(n)?(o=n.getTextContentSize(),l="text"):P(n)&&(o=n.getChildrenSize(),l="element")):s!==null&&(i=s.__key,G(s)?l="text":P(s)&&(l="element")),i!==null&&l!==null?r.set(i,o,l):(o=e.getIndexWithinParent(),o===-1&&(o=t.getChildrenSize()),r.set(t.__key,o,"element"))}function rl(r,e,t,n,s){r.type==="text"?(r.key=t,e||(r.offset+=s)):r.offset>n.getIndexWithinParent()&&(r.offset-=1)}function Bh(r,e,t,n,s,i,o){const l=n.anchorNode,a=n.focusNode,u=n.anchorOffset,c=n.focusOffset,d=document.activeElement;if(s.has("collaboration")&&d!==i||d!==null&&Vo(d))return;if(!z(e))return void(r!==null&&Yn(t,l,a)&&n.removeAllRanges());const f=e.anchor,h=e.focus,g=f.key,m=h.key,x=Os(t,g),v=Os(t,m),_=f.offset,C=h.offset,S=e.format,D=e.style,w=e.isCollapsed();let y=x,k=v,B=!1;if(f.type==="text"){y=js(x);const N=f.getNode();B=N.getFormat()!==S||N.getStyle()!==D}else z(r)&&r.anchor.type==="text"&&(B=!0);var F,T,M,L,E;if(h.type==="text"&&(k=js(v)),y!==null&&k!==null&&(w&&(r===null||B||z(r)&&(r.format!==S||r.style!==D))&&(F=S,T=D,M=_,L=g,E=performance.now(),Qu=[F,T,M,L,E]),u!==_||c!==C||l!==y||a!==k||n.type==="Range"&&w||(d!==null&&i.contains(d)||i.focus({preventScroll:!0}),f.type==="element"))){try{n.setBaseAndExtent(y,_,k,C)}catch{}if(!s.has("skip-scroll-into-view")&&e.isCollapsed()&&i!==null&&i===document.activeElement){const N=e instanceof br&&e.anchor.type==="element"?y.childNodes[_]||null:n.rangeCount>0?n.getRangeAt(0):null;if(N!==null){let R;if(N instanceof Text){const O=document.createRange();O.selectNode(N),R=O.getBoundingClientRect()}else R=N.getBoundingClientRect();(function(O,H,U){const Z=U.ownerDocument,q=Z.defaultView;if(q===null)return;let{top:K,bottom:$}=H,re=0,ae=0,le=U;for(;le!==null;){const ce=le===Z.body;if(ce)re=0,ae=di(O).innerHeight;else{const pe=le.getBoundingClientRect();re=pe.top,ae=pe.bottom}let ve=0;if(K<re?ve=-(re-K):$>ae&&(ve=$-ae),ve!==0)if(ce)q.scrollBy(0,ve);else{const pe=le.scrollTop;le.scrollTop+=ve;const Fe=le.scrollTop-pe;K-=Fe,$-=Fe}if(ce)break;le=Qn(le)}})(t,R,i)}}oo=!0}}function oc(r){let e=te()||es();e===null&&(e=Pe().selectEnd()),e.insertNodes(r)}function Ii(r){let e=r;r.isCollapsed()||e.removeText();const t=te();z(t)&&(e=t),z(e)||V(161);const n=e.anchor;let s=n.getNode(),i=n.offset;for(;!cr(s);)[s,i]=Nh(s,i);return i}function Nh(r,e){const t=r.getParent();if(!t){const s=He();return Pe().append(s),s.select(),[Pe(),0]}if(G(r)){const s=r.splitText(e);if(s.length===0)return[t,r.getIndexWithinParent()];const i=e===0?0:1;return[t,s[0].getIndexWithinParent()+i]}if(!P(r)||e===0)return[t,r.getIndexWithinParent()];const n=r.getChildAtIndex(e);if(n){const s=new br(Yt(r.__key,e,"element"),Yt(r.__key,e,"element"),0,""),i=r.insertNewAfter(s);i&&i.append(n,...n.getNextSiblings())}return[t,r.getIndexWithinParent()+1]}let Qe=null,Xe=null,mt=!1,zi=!1,ws=0;const nl={characterData:!0,childList:!0,subtree:!0};function ts(){return mt||Qe!==null&&Qe._readOnly}function pt(){mt&&V(13)}function ac(){ws>99&&V(14)}function ar(){return Qe===null&&V(195,lc()),Qe}function ze(){return Xe===null&&V(196,lc()),Xe}function lc(){let r=0;const e=new Set,t=mi.version;if(typeof window<"u")for(const s of document.querySelectorAll("[contenteditable]")){const i=li(s);if(Ho(i))r++;else if(i){let o=String(i.constructor.version||"<0.17.1");o===t&&(o+=" (separately built, likely a bundler configuration issue)"),e.add(o)}}let n=` Detected on the page: ${r} compatible editor(s) with version ${t}`;return e.size&&(n+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),n}function Fh(){return Xe}function sl(r,e,t){const n=e.__type,s=function(l,a){const u=l._nodes.get(a);return u===void 0&&V(30,a),u}(r,n);let i=t.get(n);i===void 0&&(i=Array.from(s.transforms),t.set(n,i));const o=i.length;for(let l=0;l<o&&(i[l](e),e.isAttached());l++);}function il(r,e){return r!==void 0&&r.__key!==e&&r.isAttached()}function uc(r,e){if(!e)return;const t=r._updateTags;let n=e;Array.isArray(e)||(n=[e]);for(const s of n)t.add(s)}function Rh(r){return ra(r,ze()._nodes)}function ra(r,e){const t=r.type,n=e.get(t);n===void 0&&V(17,t);const s=n.klass;r.type!==s.getType()&&V(18,s.name);const i=s.importJSON(r),o=r.children;if(P(i)&&Array.isArray(o))for(let l=0;l<o.length;l++){const a=ra(o[l],e);i.append(a)}return i}function ol(r,e,t){const n=Qe,s=mt,i=Xe;Qe=e,mt=!0,Xe=r;try{return t()}finally{Qe=n,mt=s,Xe=i}}function pr(r,e){const t=r._pendingEditorState,n=r._rootElement,s=r._headless||n===null;if(t===null)return;const i=r._editorState,o=i._selection,l=t._selection,a=r._dirtyType!==Br,u=Qe,c=mt,d=Xe,f=r._updating,h=r._observer;let g=null;if(r._pendingEditorState=null,r._editorState=t,!s&&a&&h!==null){Xe=r,Qe=t,mt=!1,r._updating=!0;try{const w=r._dirtyType,y=r._dirtyElements,k=r._dirtyLeaves;h.disconnect(),g=bh(i,t,r,w,y,k)}catch(w){if(w instanceof Error&&r._onError(w),zi)throw w;return pc(r,null,n,t),Bu(r),r._dirtyType=Zr,zi=!0,pr(r,i),void(zi=!1)}finally{h.observe(n,nl),r._updating=f,Qe=u,mt=c,Xe=d}}t._readOnly||(t._readOnly=!0);const m=r._dirtyLeaves,x=r._dirtyElements,v=r._normalizedNodes,_=r._updateTags,C=r._deferred;a&&(r._dirtyType=Br,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set,r._updateTags=new Set),function(w,y){const k=w._decorators;let B=w._pendingDecorators||k;const F=y._nodeMap;let T;for(T in B)F.has(T)||(B===k&&(B=ju(w)),delete B[T])}(r,t);const S=s?null:Et(r._window);if(r._editable&&S!==null&&(a||l===null||l.dirty)){Xe=r,Qe=t;try{if(h!==null&&h.disconnect(),a||l===null||l.dirty){const w=r._blockCursorElement;w!==null&&Xo(w,r,n),Bh(o,l,r,S,_,n)}dh(r,n,l),h!==null&&h.observe(n,nl)}finally{Xe=d,Qe=u}}g!==null&&function(w,y,k,B,F){const T=Array.from(w._listeners.mutation),M=T.length;for(let L=0;L<M;L++){const[E,N]=T[L],R=y.get(N);R!==void 0&&E(R,{dirtyLeaves:B,prevEditorState:F,updateTags:k})}}(r,g,_,m,i),z(l)||l===null||o!==null&&o.is(l)||r.dispatchCommand(Fo,void 0);const D=r._pendingDecorators;D!==null&&(r._decorators=D,r._pendingDecorators=null,Fn("decorator",r,!0,D)),function(w,y,k){const B=Fa(y),F=Fa(k);B!==F&&Fn("textcontent",w,!0,F)}(r,e||i,t),Fn("update",r,!0,{dirtyElements:x,dirtyLeaves:m,editorState:t,normalizedNodes:v,prevEditorState:e||i,tags:_}),function(w,y){if(w._deferred=[],y.length!==0){const k=w._updating;w._updating=!0;try{for(let B=0;B<y.length;B++)y[B]()}finally{w._updating=k}}}(r,C),function(w){const y=w._updates;if(y.length!==0){const k=y.shift();if(k){const[B,F]=k;dc(w,B,F)}}}(r)}function Fn(r,e,t,...n){const s=e._updating;e._updating=t;try{const i=Array.from(e._listeners[r]);for(let o=0;o<i.length;o++)i[o].apply(null,n)}finally{e._updating=s}}function cc(r,e,t){if(r._updating===!1||Xe!==r){let s=!1;return r.update(()=>{s=cc(r,e,t)}),s}const n=Go(r);for(let s=4;s>=0;s--)for(let i=0;i<n.length;i++){const o=n[i]._commands.get(e);if(o!==void 0){const l=o[s];if(l!==void 0){const a=Array.from(l),u=a.length;for(let c=0;c<u;c++)if(a[c](t,r)===!0)return!0}}}return!1}function al(r,e){const t=r._updates;let n=e||!1;for(;t.length!==0;){const s=t.shift();if(s){const[i,o]=s;let l;if(o!==void 0){if(l=o.onUpdate,o.skipTransforms&&(n=!0),o.discrete){const a=r._pendingEditorState;a===null&&V(191),a._flushSync=!0}l&&r._deferred.push(l),uc(r,o.tag)}i()}}return n}function dc(r,e,t){const n=r._updateTags;let s,i=!1,o=!1;t!==void 0&&(s=t.onUpdate,uc(r,t.tag),i=t.skipTransforms||!1,o=t.discrete||!1),s&&r._deferred.push(s);const l=r._editorState;let a=r._pendingEditorState,u=!1;(a===null||a._readOnly)&&(a=r._pendingEditorState=fc(a||l),u=!0),a._flushSync=o;const c=Qe,d=mt,f=Xe,h=r._updating;Qe=a,mt=!1,r._updating=!0,Xe=r;try{u&&(r._headless?l._selection!==null&&(a._selection=l._selection.clone()):a._selection=function(v){const _=v.getEditorState()._selection,C=Et(v._window);return z(_)||_==null?ta(_,C,v,null):_.clone()}(r));const m=r._compositionKey;e(),i=al(r,i),function(v,_){const C=_.getEditorState()._selection,S=v._selection;if(z(S)){const D=S.anchor,w=S.focus;let y;if(D.type==="text"&&(y=D.getNode(),y.selectionTransform(C,S)),w.type==="text"){const k=w.getNode();y!==k&&k.selectionTransform(C,S)}}}(a,r),r._dirtyType!==Br&&(i?function(v,_){const C=_._dirtyLeaves,S=v._nodeMap;for(const D of C){const w=S.get(D);G(w)&&w.isAttached()&&w.isSimpleText()&&!w.isUnmergeable()&&Ba(w)}}(a,r):function(v,_){const C=_._dirtyLeaves,S=_._dirtyElements,D=v._nodeMap,w=hr(),y=new Map;let k=C,B=k.size,F=S,T=F.size;for(;B>0||T>0;){if(B>0){_._dirtyLeaves=new Set;for(const M of k){const L=D.get(M);G(L)&&L.isAttached()&&L.isSimpleText()&&!L.isUnmergeable()&&Ba(L),L!==void 0&&il(L,w)&&sl(_,L,y),C.add(M)}if(k=_._dirtyLeaves,B=k.size,B>0){ws++;continue}}_._dirtyLeaves=new Set,_._dirtyElements=new Map;for(const M of F){const L=M[0],E=M[1];if(L!=="root"&&!E)continue;const N=D.get(L);N!==void 0&&il(N,w)&&sl(_,N,y),S.set(L,E)}k=_._dirtyLeaves,B=k.size,F=_._dirtyElements,T=F.size,ws++}_._dirtyLeaves=C,_._dirtyElements=S}(a,r),al(r),function(v,_,C,S){const D=v._nodeMap,w=_._nodeMap,y=[];for(const[k]of S){const B=w.get(k);B!==void 0&&(B.isAttached()||(P(B)&&$u(B,k,D,w,y,S),D.has(k)||S.delete(k),y.push(k)))}for(const k of y)w.delete(k);for(const k of C){const B=w.get(k);B===void 0||B.isAttached()||(D.has(k)||C.delete(k),w.delete(k))}}(l,a,r._dirtyLeaves,r._dirtyElements)),m!==r._compositionKey&&(a._flushSync=!0);const x=a._selection;if(z(x)){const v=a._nodeMap,_=x.anchor.key,C=x.focus.key;v.get(_)!==void 0&&v.get(C)!==void 0||V(19)}else Ut(x)&&x._nodes.size===0&&(a._selection=null)}catch(m){return m instanceof Error&&r._onError(m),r._pendingEditorState=l,r._dirtyType=Zr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),void pr(r)}finally{Qe=c,mt=d,Xe=f,r._updating=h,ws=0}r._dirtyType!==Br||function(m,x){const v=x.getEditorState()._selection,_=m._selection;if(_!==null){if(_.dirty||!_.is(v))return!0}else if(v!==null)return!0;return!1}(a,r)?a._flushSync?(a._flushSync=!1,pr(r)):u&&ih(()=>{pr(r)}):(a._flushSync=!1,u&&(n.clear(),r._deferred=[],r._pendingEditorState=null))}function bt(r,e,t){r._updating?r._updates.push([e,t]):dc(r,e,t)}class Rn{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new Rn(this.element,e,this.after)}withAfter(e){return new Rn(this.element,this.before,e)}withElement(e){return new Rn(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&V(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&V(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&V(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(Gn||oi);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n=e.nodeName==="IMG"?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const n=this.element,s=this.before,i=document.createElement("br");if(n.insertBefore(i,s),e){const o=document.createElement("img");o.setAttribute("data-lexical-linebreak","true"),o.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",o.alt="",n.insertBefore(o,i),n.__lexicalLineBreak=o}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;t!==null;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,s){if(n===this.element){const a=this.getFirstChildOffset();return[e,Math.min(a+e.getChildrenSize(),Math.max(a,s))]}const i=ll(t,n);i.push(s);const o=ll(t,this.element);let l=e.getIndexWithinParent();for(let a=0;a<o.length;a++){const u=i[a],c=o[a];if(u===void 0||u<c)break;if(u>c){l+=1;break}}return[e.getParentOrThrow(),l]}}function ll(r,e){const t=[];let n=e;for(;n!==r&&n!==null;n=e.parentNode){let s=0;for(let i=n.previousSibling;i!==null;i=n.previousSibling)s++;t.push(s)}return n!==r&&V(225),t.reverse()}class lr extends hi{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return Yf[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=ze()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(G(t)&&e.push(t),P(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;P(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;P(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const i=t[n-1];return P(i)&&i.getLastDescendant()||i||null}const s=t[e];return P(s)&&s.getFirstDescendant()||s||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:st(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&V(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:st(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&V(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,s;if(e<t/2){for(n=this.getFirstChild(),s=0;n!==null&&s<=e;){if(s===e)return n;n=n.getNextSibling(),s++}return null}for(n=this.getLastChild(),s=t-1;n!==null&&s>=e;){if(s===e)return n;n=n.getPreviousSibling(),s--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const i=t[s];e+=i.getTextContent(),P(i)&&s!==n-1&&!i.isInline()&&(e+=sr)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const i=t[s];e+=i.getTextContentSize(),P(i)&&s!==n-1&&!i.isInline()&&(e+=sr.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=Da[e];return!!(this.getFormat()&t)}return!1}select(e,t){pt();const n=te();let s=e,i=t;const o=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const a=this.getFirstChild();if(G(a)||P(a))return a.select(0,0)}else if(!(e!==void 0&&e!==o||t!==void 0&&t!==o)){const a=this.getLastChild();if(G(a)||P(a))return a.select()}}s===void 0&&(s=o),i===void 0&&(i=o);const l=this.__key;return z(n)?(n.anchor.set(l,s,"element"),n.focus.set(l,i,"element"),n.dirty=!0,n):ic(l,s,l,i,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(t=>t.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==""?Da[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){const s=n.length,i=this.getChildrenSize(),o=this.getWritable();e+t<=i||V(226,String(e),String(t),String(i));const l=o.__key,a=[],u=[],c=this.getChildAtIndex(e+t);let d=null,f=i-t+s;if(e!==0)if(e===i)d=this.getLastChild();else{const g=this.getChildAtIndex(e);g!==null&&(d=g.getPreviousSibling())}if(t>0){let g=d===null?this.getFirstChild():d.getNextSibling();for(let m=0;m<t;m++){g===null&&V(100);const x=g.getNextSibling(),v=g.__key;Dr(g.getWritable()),u.push(v),g=x}}let h=d;for(let g=0;g<s;g++){const m=n[g];h!==null&&m.is(h)&&(d=h=h.getPreviousSibling());const x=m.getWritable();x.__parent===l&&f--,Dr(x);const v=m.__key;if(h===null)o.__first=v,x.__prev=null;else{const _=h.getWritable();_.__next=v,x.__prev=_.__key}m.__key===l&&V(76),x.__parent=l,a.push(v),h=m}if(e+t===i)h!==null&&(h.getWritable().__next=null,o.__last=h.__key);else if(c!==null){const g=c.getWritable();if(h!==null){const m=h.getWritable();g.__prev=h.__key,m.__next=c.__key}else g.__prev=null}if(o.__size=f,u.length){const g=te();if(z(g)){const m=new Set(u),x=new Set(a),{anchor:v,focus:_}=g;ul(v,m,x)&&Vs(v,v.getNode(),this,d,c),ul(_,m,x)&&Vs(_,_.getNode(),this,d,c),f!==0||this.canBeEmpty()||Kt(this)||this.remove()}}return o}getDOMSlot(e){return new Rn(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&or(t)){const n=this.getIndent();n>0&&(t.style.paddingInlineStart=40*n+"px")}return{element:t}}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let s=n.getFirstChild();for(let i=this.getFirstChild();i;i=i.getNextSibling()){const o=t.getElementByKey(i.getKey());o!==null&&(s==null?(n.insertChild(o),s=o):s!==o&&n.replaceChild(o,s),s=s.nextSibling)}}}function P(r){return r instanceof lr}function ul(r,e,t){let n=r.getNode();for(;n;){const s=n.__key;if(e.has(s)&&!t.has(s))return!0;n=n.getParent()}return!1}class na extends hi{constructor(e){super(e)}decorate(e,t){V(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Ae(r){return r instanceof na}class rs extends lr{static getType(){return"root"}static clone(){return new rs}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){V(51)}getTextContent(){const e=this.__cachedText;return!ts()&&ze()._dirtyType!==Br||e===null?super.getTextContent():e}remove(){V(52)}replace(e){V(53)}insertBefore(e){V(54)}insertAfter(e){V(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];P(n)||Ae(n)||V(56)}return super.append(...e)}static importJSON(e){const t=Pe();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function lt(r){return r instanceof rs}function fc(r){return new gi(new Map(r._nodeMap))}function sa(){return new gi(new Map([["root",new rs]]))}function hc(r){const e=r.exportJSON(),t=r.constructor;if(e.type!==t.getType()&&V(130,t.name),P(r)){const n=e.children;Array.isArray(n)||V(59,t.name);const s=r.getChildren();for(let i=0;i<s.length;i++){const o=hc(s[i]);n.push(o)}}return e}class gi{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return ol(t&&t.editor||null,this,e)}clone(e){const t=new gi(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return ol(null,this,()=>({root:hc(Pe())}))}}class ia extends lr{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class on extends lr{constructor(e){super(e),this.__textFormat=0,this.__textStyle=""}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=Nr[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return Ls(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}static clone(e){return new on(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=An(e.theme,"paragraph");return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Mh,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&or(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=He();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){const n=He();n.setTextFormat(e.format),n.setTextStyle(e.style);const s=this.getDirection();return n.setDirection(s),n.setFormat(this.getFormatType()),n.setStyle(this.getTextStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(e.length===0||G(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function Mh(r){const e=He();return r.style&&(e.setFormat(r.style.textAlign),Zo(r,e)),{node:e}}function He(){return Qt(new on)}function tn(r){return r instanceof on}const Ee=0,Hr=1,jh=4;function pc(r,e,t,n){const s=r._keyToDOMMap;s.clear(),r._editorState=sa(),r._pendingEditorState=n,r._compositionKey=null,r._dirtyType=Br,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),r._normalizedNodes=new Set,r._updateTags=new Set,r._updates=[],r._blockCursorElement=null;const i=r._observer;i!==null&&(i.disconnect(),r._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",s.set("root",t))}function Lh(r){const e=r||{},t=Fh(),n=e.theme||{},s=r===void 0?t:e.parentEditor||null,i=e.disableEvents||!1,o=sa(),l=e.namespace||(s!==null?s._config.namespace:Ou()),a=e.editorState,u=[rs,sn,Xn,Jn,on,ia,...e.nodes||[]],{onError:c,html:d}=e,f=e.editable===void 0||e.editable;let h;if(r===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let m=0;m<u.length;m++){let x=u[m],v=null,_=null;if(typeof x!="function"){const w=x;x=w.replace,v=w.with,_=w.withKlass||null}const C=x.getType(),S=x.transform(),D=new Set;S!==null&&D.add(S),h.set(C,{exportDOM:d&&d.export?d.export.get(x):void 0,klass:x,replace:v,replaceWithKlass:_,transforms:D})}}const g=new mi(o,s,h,{disableEvents:i,namespace:l,theme:n},c||console.error,function(m,x){const v=new Map,_=new Set,C=S=>{Object.keys(S).forEach(D=>{let w=v.get(D);w===void 0&&(w=[],v.set(D,w)),w.push(S[D])})};return m.forEach(S=>{const D=S.klass.importDOM;if(D==null||_.has(D))return;_.add(D);const w=D.call(S.klass);w!==null&&C(w)}),x&&C(x),v}(h,d?d.import:void 0),f);return a!==void 0&&(g._pendingEditorState=a,g._dirtyType=Zr),g}class mi{constructor(e,t,n,s,i,o,l){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=s,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=Br,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Ou(),this._onError=i,this._htmlConversions=o,this._editable=l,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,n){n===void 0&&V(35);const s=this._commands;s.has(e)||s.set(e,[new Set,new Set,new Set,new Set,new Set]);const i=s.get(e);i===void 0&&V(36,String(e));const o=i[n];return o.add(t),()=>{o.delete(t),i.every(l=>l.size===0)&&s.delete(e)}}registerMutationListener(e,t,n){const s=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;i.set(t,s);const o=n&&n.skipInitialization;return o!==void 0&&o||this.initializeMutationListener(t,s),()=>{i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&V(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,s=gh(n).get(t.getType());if(!s)return;const i=new Map;for(const o of s.keys())i.set(o,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),s=[n],i=n.replaceWithKlass;if(i!=null){const a=this.registerNodeTransformToKlass(i,t);s.push(a)}var o,l;return o=this,l=e.getType(),bt(o,()=>{const a=ar();if(a.isEmpty())return;if(l==="root")return void Pe().markDirty();const u=a._nodeMap;for(const[,c]of u)c.markDirty()},o._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{s.forEach(a=>a.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return J(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=An(this._config.theme,"root"),s=this._pendingEditorState||this._editorState;if(this._rootElement=e,pc(this,t,e,s),t!==null&&(this._config.disableEvents||_h(t),n!=null&&t.classList.remove(...n)),e!==null){const i=function(l){const a=l.ownerDocument;return a&&a.defaultView||null}(e),o=e.style;o.userSelect="text",o.whiteSpace="pre-wrap",o.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=Zr,Bu(this),this._updateTags.add("history-merge"),pr(this),this._config.disableEvents||function(l,a){const u=l.ownerDocument,c=Us.get(u);(c===void 0||c<1)&&u.addEventListener("selectionchange",ec),Us.set(u,(c||0)+1),l.__lexicalEditor=a;const d=Zu(l);for(let f=0;f<io.length;f++){const[h,g]=io[f],m=typeof g=="function"?x=>{Va(x)||(Wa(x),(a.isEditable()||h==="click")&&g(x,a))}:x=>{if(Va(x))return;Wa(x);const v=a.isEditable();switch(h){case"cut":return v&&J(a,jo,x);case"copy":return J(a,ii,x);case"paste":return v&&J(a,si,x);case"dragstart":return v&&J(a,wu,x);case"dragover":return v&&J(a,Cu,x);case"dragend":return v&&J(a,Ff,x);case"focus":return v&&J(a,jf,x);case"blur":return v&&J(a,Lf,x);case"drop":return v&&J(a,vu,x)}};l.addEventListener(h,m),d.push(()=>{l.removeEventListener(h,m)})}}(e,this),n!=null&&e.classList.add(...n)}else this._editorState=s,this._pendingEditorState=null,this._window=null;Fn("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&V(38);let n=e;n._readOnly&&(n=fc(e),n._selection=e._selection?e._selection.clone():null),Tu(this);const s=this._pendingEditorState,i=this._updateTags,o=t!==void 0?t.tag:null;s===null||s.isEmpty()||(o!=null&&i.add(o),pr(this)),this._pendingEditorState=n,this._dirtyType=Zr,this._dirtyElements.set("root",!1),this._compositionKey=null,o!=null&&i.add(o),this._updating||pr(this)}parseEditorState(e,t){return function(n,s,i){const o=sa(),l=Qe,a=mt,u=Xe,c=s._dirtyElements,d=s._dirtyLeaves,f=s._cloneNotNeeded,h=s._dirtyType;s._dirtyElements=new Map,s._dirtyLeaves=new Set,s._cloneNotNeeded=new Set,s._dirtyType=0,Qe=o,mt=!1,Xe=s;try{const g=s._nodes;ra(n.root,g),i&&i(),o._readOnly=!0}catch(g){g instanceof Error&&s._onError(g)}finally{s._dirtyElements=c,s._dirtyLeaves=d,s._cloneNotNeeded=f,s._dirtyType=h,Qe=l,mt=a,Xe=u}return o}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return pr(this),this.getEditorState().read(e,{editor:this})}update(e,t){bt(this,e,t)}focus(e,t={}){const n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),bt(this,()=>{const s=te(),i=Pe();s!==null?s.dirty=!0:i.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?i.selectStart():i.selectEnd())},{onUpdate:()=>{n.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=Et(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Fn("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}mi.version="0.21.0+prod.esm";const gc=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Ph=gc?b.useLayoutEffect:b.useEffect,fs={tag:"history-merge"};function Oh({initialConfig:r,children:e}){const t=b.useMemo(()=>{const{theme:n,namespace:s,nodes:i,onError:o,editorState:l,html:a}=r,u=wf(null,n),c=Lh({editable:r.editable,html:a,namespace:s,nodes:i,onError:d=>o(d,c),theme:n});return function(d,f){if(f!==null){if(f===void 0)d.update(()=>{const h=Pe();if(h.isEmpty()){const g=He();h.append(g);const m=gc?document.activeElement:null;(te()!==null||m!==null&&m===d.getRootElement())&&g.select()}},fs);else if(f!==null)switch(typeof f){case"string":{const h=d.parseEditorState(f);d.setEditorState(h,fs);break}case"object":d.setEditorState(f,fs);break;case"function":d.update(()=>{Pe().isEmpty()&&f(d)},fs)}}}(c,l),[c,u]},[]);return Ph(()=>{const n=r.editable,[s]=t;s.setEditable(n===void 0||n)},[]),p.jsx(fu.Provider,{value:t,children:e})}const Ih=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?b.useLayoutEffect:b.useEffect;function zh(r){return{initialValueFn:()=>r.isEditable(),subscribe:e=>r.registerEditableListener(e)}}function $h(){return function(r){const[e]=Lt(),t=b.useMemo(()=>r(e),[e,r]),[n,s]=b.useState(()=>t.initialValueFn()),i=b.useRef(n);return Ih(()=>{const{initialValueFn:o,subscribe:l}=t,a=o();return i.current!==a&&(i.current=a,s(a)),l(u=>{i.current=u,s(u)})},[t,r]),n}(zh)}function qh(){return Pe().getTextContent()}function Uh(r,e=!0){if(r)return!1;let t=qh();return e&&(t=t.trim()),t===""}function Wh(r){if(!Uh(r,!1))return!1;const e=Pe().getChildren(),t=e.length;if(t>1)return!1;for(let n=0;n<t;n++){const s=e[n];if(Ae(s))return!1;if(P(s)){if(!tn(s)||s.__indent!==0)return!1;const i=s.getChildren(),o=i.length;for(let l=0;l<o;l++){const a=i[n];if(!G(a))return!1}}}return!0}function mc(r){return()=>Wh(r)}function Vh(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}Vh(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Hh(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Gh=Hh(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const Kh=new Map;function Yh(r){const e={};if(!r)return e;const t=r.split(";");for(const n of t)if(n!==""){const[s,i]=n.split(/:([^]+)/);s&&i&&(e[s.trim()]=i.trim())}return e}function yc(r,e){const t=r.getStartEndPoints();if(e.isSelected(r)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[n,s]=t,i=r.isBackward(),o=n.getNode(),l=s.getNode(),a=e.is(o),u=e.is(l);if(a||u){const[c,d]=uo(r),f=o.is(l),h=e.is(i?l:o),g=e.is(i?o:l);let m,x=0;return f?(x=c>d?d:c,m=c>d?c:d):h?(x=i?d:c,m=void 0):g&&(x=0,m=i?c:d),e.__text=e.__text.slice(x,m),e}}return e}function Qh(r){const e=r.getStyle(),t=Yh(e);Kh.set(e,t)}function Xh(r,e){if(r===null)return;const t=r.getStartEndPoints(),n=t?t[0]:null;if(n!==null&&n.key==="root"){const o=e(),l=Pe(),a=l.getFirstChild();return void(a?a.replace(o,!0):l.append(o))}const s=r.getNodes(),i=n!==null&&function(o,l){let a=o;for(;a!==null&&a.getParent()!==null&&!l(a);)a=a.getParentOrThrow();return l(a)?a:null}(n.getNode(),fl);i&&s.indexOf(i)===-1&&s.push(i);for(let o=0;o<s.length;o++){const l=s[o];if(!fl(l))continue;P(l)||Gh(178);const a=e();a.setFormat(l.getFormatType()),a.setIndent(l.getIndent()),l.replace(a,!0)}}function cl(r,e){const t=Pn(r.focus,e);return Ae(t)&&!t.isIsolated()||P(t)&&!t.isInline()&&!t.canBeEmpty()}function Jh(r,e,t,n){r.modify(e?"extend":"move",t,n)}function Zh(r){const e=r.anchor.getNode();return(lt(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function dl(r,e,t){const n=Zh(r);Jh(r,e,t?!n:n,"character")}function fl(r){if(Ae(r)||!P(r)||Kt(r))return!1;const e=r.getFirstChild(),t=e===null||Ar(e)||G(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function ep(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var tp=ep(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const xc=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,rp=xc&&"documentMode"in document?document.documentMode:null;!(!xc||!("InputEvent"in window)||rp)&&"getTargetRanges"in new window.InputEvent("input");function bc(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}function Pr(...r){return()=>{for(let e=r.length-1;e>=0;e--)r[e]();r.length=0}}function ns(r,...e){const t=bc(...e);t.length>0&&r.classList.add(...t)}function _c(r,...e){const t=bc(...e);t.length>0&&r.classList.remove(...t)}function np(r,e){let t=r;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function sp(r){const e=yi(r,t=>P(t)&&!t.isInline());return P(e)||tp(4,r.__key),e}const yi=(r,e)=>{let t=r;for(;t!==Pe()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function gr(r,e){return r!==null&&Object.getPrototypeOf(r).constructor.name===e.name}function ip(r){const e=window.location.origin,t=n=>{if(n.origin!==e)return;const s=r.getRootElement();if(document.activeElement!==s)return;const i=n.data;if(typeof i=="string"){let o;try{o=JSON.parse(i)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"){const l=o.payload;if(l&&l.functionId==="makeChanges"){const a=l.args;if(a){const[u,c,d,f,h,g]=a;r.update(()=>{const m=te();if(z(m)){const x=m.anchor;let v=x.getNode(),_=0,C=0;if(G(v)&&u>=0&&c>=0&&(_=u,C=u+c,m.setTextNodeRange(v,_,v,C)),_===C&&d===""||(m.insertRawText(d),v=x.getNode()),G(v)){_=f,C=f+h;const S=v.getTextContentSize();_=_>S?S:_,C=C>S?S:C,m.setTextNodeRange(v,_,v,C)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function vc(r,e){const t=e.body?e.body.childNodes:[];let n=[];const s=[];for(let i=0;i<t.length;i++){const o=t[i];if(!Sc.has(o.nodeName)){const l=Ec(o,r,s,!1);l!==null&&(n=n.concat(l))}}return function(i){for(const o of i)o.getNextSibling()instanceof ia&&o.insertAfter(Rr());for(const o of i){const l=o.getChildren();for(const a of l)o.insertBefore(a);o.remove()}}(s),n}function wc(r,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),n=Pe().getChildren();for(let s=0;s<n.length;s++)Cc(r,n[s],t,e);return t.innerHTML}function Cc(r,e,t,n=null){let s=n===null||e.isSelected(n);const i=P(e)&&e.excludeFromCopy("html");let o=e;if(n!==null){let h=Jo(e);h=G(h)&&n!==null?yc(n,h):h,o=h}const l=P(o)?o.getChildren():[],a=r._nodes.get(o.getType());let u;u=a&&a.exportDOM!==void 0?a.exportDOM(r,o):o.exportDOM(r);const{element:c,after:d}=u;if(!c)return!1;const f=document.createDocumentFragment();for(let h=0;h<l.length;h++){const g=l[h],m=Cc(r,g,f,n);!s&&P(e)&&m&&e.extractWithChild(g,n,"html")&&(s=!0)}if(s&&!i){if((or(c)||Ia(c))&&c.append(f),t.append(c),d){const h=d.call(o,c);h&&(Ia(c)?c.replaceChildren(h):c.replaceWith(h))}}else t.append(f);return s}const Sc=new Set(["STYLE","SCRIPT"]);function Ec(r,e,t,n,s=new Map,i){let o=[];if(Sc.has(r.nodeName))return o;let l=null;const a=function(g,m){const{nodeName:x}=g,v=m._htmlConversions.get(x.toLowerCase());let _=null;if(v!==void 0)for(const C of v){const S=C(g);S!==null&&(_===null||(_.priority||0)<=(S.priority||0))&&(_=S)}return _!==null?_.conversion:null}(r,e),u=a?a(r):null;let c=null;if(u!==null){c=u.after;const g=u.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,m]of s)if(l=m(l,i),!l)break;l&&o.push(...Array.isArray(g)?g:[l])}u.forChild!=null&&s.set(r.nodeName,u.forChild)}const d=r.childNodes;let f=[];const h=(l==null||!Kt(l))&&(l!=null&&co(l)||n);for(let g=0;g<d.length;g++)f.push(...Ec(d[g],e,t,h,new Map(s),l));return c!=null&&(f=c(f)),Is(r)&&(f=op(r,f,h?()=>{const g=new ia;return t.push(g),g}:He)),l==null?f.length>0?o=o.concat(f):Is(r)&&function(g){return g.nextSibling==null||g.previousSibling==null?!1:Xi(g.nextSibling)&&Xi(g.previousSibling)}(r)&&(o=o.concat(Rr())):P(l)&&l.append(...f),o}function op(r,e,t){const n=r.style.textAlign,s=[];let i=[];for(let o=0;o<e.length;o++){const l=e[o];if(co(l))n&&!l.getFormat()&&l.setFormat(n),s.push(l);else if(i.push(l),o===e.length-1||o<e.length-1&&co(e[o+1])){const a=t();a.setFormat(n),a.append(...i),s.push(a),i=[]}}return s}function ap(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Hs=ap(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function lp(r,e=te()){return e==null&&Hs(166),z(e)&&e.isCollapsed()||e.getNodes().length===0?"":wc(r,e)}function up(r,e=te()){return e==null&&Hs(166),z(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(cp(r,e))}function hl(r,e,t){const n=r.getData("application/x-lexical-editor");if(n)try{const o=JSON.parse(n);if(o.namespace===t._config.namespace&&Array.isArray(o.nodes))return pl(t,dp(o.nodes),e)}catch{}const s=r.getData("text/html");if(s)try{const o=new DOMParser().parseFromString(function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:a=>a}).createHTML(l):l}(s),"text/html");return pl(t,vc(t,o),e)}catch{}const i=r.getData("text/plain")||r.getData("text/uri-list");if(i!=null)if(z(e)){const o=i.split(/(\r?\n|\t)/);o[o.length-1]===""&&o.pop();for(let l=0;l<o.length;l++){const a=te();if(z(a)){const u=o[l];u===`
72
94
  `||u===`\r
73
- `?l.insertParagraph():u===" "?l.insertNodes([En()]):l.insertText(u)}}}else e.insertRawText(i)}function Qo(r,e,t){r.dispatchCommand(Gu,{nodes:e,selection:t})||t.insertNodes(e)}function Ia(r,e,t,n=[]){let s=e===null||t.isSelected(e);const i=F(t)&&t.excludeFromCopy("html");let o=t;if(e!==null){let u=Ii(t);u=z(u)&&e!==null?Na(e,u):u,o=u}const a=F(o)?o.getChildren():[],l=function(u){const c=u.exportJSON(),d=u.constructor;if(c.type!==d.getType()&&ls(58,d.name),F(u)){const f=c.children;Array.isArray(f)||ls(59,d.name)}return c}(o);if(z(o)){const u=o.__text;u.length>0?l.text=u:s=!1}for(let u=0;u<a.length;u++){const c=a[u],d=Ia(r,e,c,l.children);!s&&F(t)&&d&&t.extractWithChild(c,e,"clone")&&(s=!0)}if(s&&!i)n.push(l);else if(Array.isArray(l.children))for(let u=0;u<l.children.length;u++){const c=l.children[u];n.push(c)}return s}function Fd(r,e){const t=[],n=Fe().getChildren();for(let s=0;s<n.length;s++)Ia(r,e,n[s],t);return{namespace:r._config.namespace,nodes:t}}function Rd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t],s=td(n);z(s)&&xd(s),e.push(s)}return e}let Sr=null;async function Jo(r,e,t){if(Sr!==null)return!1;if(e!==null)return new Promise((l,u)=>{r.update(()=>{l(Yo(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,i=gt(r._window);if(n===null||i===null)return!1;const o=s.createElement("span");o.style.cssText="position: fixed; top: -1000px;",o.append(s.createTextNode("#")),n.append(o);const a=new Range;return a.setStart(o,0),a.setEnd(o,1),i.removeAllRanges(),i.addRange(a),new Promise((l,u)=>{const c=r.registerCommand(hs,d=>(nr(d,ClipboardEvent)&&(c(),Sr!==null&&(window.clearTimeout(Sr),Sr=null),l(Yo(r,d,t))),!0),nd);Sr=window.setTimeout(()=>{c(),Sr=null,l(!1)},50),s.execCommand("copy"),o.remove()})}function Yo(r,e,t){if(t===void 0){const s=gt(r._window);if(!s)return!1;const i=s.anchorNode,o=s.focusNode;if(i!==null&&o!==null&&!vn(r,i,o))return!1;const a=K();if(a===null)return!1;t=Md(a)}e.preventDefault();const n=e.clipboardData;return n!==null&&(Pd(n,t),!0)}const Ld=[["text/html",Nd],["application/x-lexical-editor",Bd]];function Md(r=K()){const e={"text/plain":r?r.getTextContent():""};if(r){const t=Mc();for(const[n,s]of Ld){const i=s(t,r);i!==null&&(e[n]=i)}}return e}function Pd(r,e){for(const t in e){const n=e[t];n!==void 0&&r.setData(t,n)}}function Xo(r,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(r,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(r,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const zr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,jd=zr&&"documentMode"in document?document.documentMode:null,Od=!(!zr||!("InputEvent"in window)||jd)&&"getTargetRanges"in new window.InputEvent("input"),Id=zr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Zo=zr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,$d=zr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),zd=zr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!$d,el=xn();class Ss extends Jt{static getType(){return"quote"}static clone(e){return new Ss(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return Tn(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:qd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=Ki();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,t){const n=Ue(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=Ue();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Ki(){return $t(new Ss)}class As extends Jt{static getType(){return"heading"}static clone(e){return new As(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}createDOM(e){const t=this.__tag,n=document.createElement(t),s=e.theme.heading;if(s!==void 0){const i=s[t];Tn(n,i)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:Ar,priority:0}),h2:e=>({conversion:Ar,priority:0}),h3:e=>({conversion:Ar,priority:0}),h4:e=>({conversion:Ar,priority:0}),h5:e=>({conversion:Ar,priority:0}),h6:e=>({conversion:Ar,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&tl(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>tl(e)?{conversion:t=>({node:en("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=en(e.tag);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,s=this.getLastDescendant(),i=!s||e&&e.anchor.key===s.getKey()&&n===s.getTextContentSize()||!e?Ue():en(this.getTag()),o=this.getDirection();if(i.setDirection(o),this.insertAfter(i,t),n===0&&!this.isEmpty()&&e){const a=Ue();a.select(),this.replace(a,!0)}return i}collapseAtStart(){const e=this.isEmpty()?Ue():en(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function tl(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function Ar(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=en(e),r.style!==null&&($i(r,t),t.setFormat(r.style.textAlign))),{node:t}}function qd(r){const e=Ki();return r.style!==null&&(e.setFormat(r.style.textAlign),$i(r,e)),{node:e}}function en(r){return $t(new As(r))}function jn(r){let e=null;if(nr(r,DragEvent)?e=r.dataTransfer:nr(r,ClipboardEvent)&&(e=r.clipboardData),e===null)return[!1,[],!1];const t=e.types,n=t.includes("Files"),s=t.includes("text/html")||t.includes("text/plain");return[n,Array.from(e.files),s]}function rl(r){const e=K();if(!O(e))return!1;const t=new Set,n=e.getNodes();for(let s=0;s<n.length;s++){const i=n[s],o=i.getKey();if(t.has(o))continue;const a=Es(i,u=>F(u)&&!u.isInline());if(a===null)continue;const l=a.getKey();a.canIndent()&&!t.has(l)&&(t.add(l),r(a))}return t.size>0}function On(r){const e=jr(r);return Ce(e)}function Ud(r){return vr(r.registerCommand(Sl,e=>{const t=K();return!!Lt(t)&&(t.clear(),!0)},0),r.registerCommand(fr,e=>{const t=K();return!!O(t)&&(t.deleteCharacter(e),!0)},ye),r.registerCommand(fn,e=>{const t=K();return!!O(t)&&(t.deleteWord(e),!0)},ye),r.registerCommand(hn,e=>{const t=K();return!!O(t)&&(t.deleteLine(e),!0)},ye),r.registerCommand(Rr,e=>{const t=K();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const n=e.dataTransfer;if(n!=null)Ho(n,t,r);else if(O(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},ye),r.registerCommand(Hs,()=>{const e=K();return!!O(e)&&(e.removeText(),!0)},ye),r.registerCommand(Dt,e=>{const t=K();return!!O(t)&&(t.formatText(e),!0)},ye),r.registerCommand(Zu,e=>{const t=K();if(!O(t)&&!Lt(t))return!1;const n=t.getNodes();for(const s of n){const i=Es(s,o=>F(o)&&!o.isInline());i!==null&&i.setFormat(e)}return!0},ye),r.registerCommand(Fr,e=>{const t=K();return!!O(t)&&(t.insertLineBreak(e),!0)},ye),r.registerCommand(dn,()=>{const e=K();return!!O(e)&&(e.insertParagraph(),!0)},ye),r.registerCommand(Yu,()=>(ba([En()]),!0),ye),r.registerCommand(Xu,()=>rl(e=>{const t=e.getIndent();e.setIndent(t+1)}),ye),r.registerCommand(oo,()=>rl(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),ye),r.registerCommand(Tl,e=>{const t=K();if(Lt(t)&&!On(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(O(t)){const n=pn(t.focus,!0);if(!e.shiftKey&&Ce(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},ye),r.registerCommand(Nl,e=>{const t=K();if(Lt(t)){const n=t.getNodes();if(n.length>0)return n[0].selectNext(0,0),!0}else if(O(t)){if(function(s){const i=s.focus;return i.key==="root"&&i.offset===Fe().getChildrenSize()}(t))return e.preventDefault(),!0;const n=pn(t.focus,!1);if(!e.shiftKey&&Ce(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},ye),r.registerCommand(kl,e=>{const t=K();if(Lt(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!O(t))return!1;if(Go(t,!0)){const n=e.shiftKey;return e.preventDefault(),Vo(t,n,!0),!0}return!1},ye),r.registerCommand(Al,e=>{const t=K();if(Lt(t)&&!On(e.target)){const s=t.getNodes();if(s.length>0)return e.preventDefault(),s[0].selectNext(0,0),!0}if(!O(t))return!1;const n=e.shiftKey;return!!Go(t,!1)&&(e.preventDefault(),Vo(t,n,!1),!0)},ye),r.registerCommand(Bl,e=>{if(On(e.target))return!1;const t=K();if(!O(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!tt(s)&&Sd(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(oo,void 0)):(!Zo||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(fr,!0))},ye),r.registerCommand(Rl,e=>{if(On(e.target))return!1;const t=K();return!!O(t)&&(e.preventDefault(),r.dispatchCommand(fr,!1))},ye),r.registerCommand(Gn,e=>{const t=K();if(!O(t))return!1;if(e!==null){if((Zo||Id||zd)&&Od)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(Fr,!1)}return r.dispatchCommand(dn,void 0)},ye),r.registerCommand(Fl,()=>{const e=K();return!!O(e)&&(r.blur(),!0)},ye),r.registerCommand(Ll,e=>{const[,t]=jn(e);if(t.length>0){const s=Xo(e.clientX,e.clientY);if(s!==null){const{offset:i,node:o}=s,a=jr(o);if(a!==null){const l=Yc();if(z(a))l.anchor.set(a.getKey(),i,"text"),l.focus.set(a.getKey(),i,"text");else{const c=a.getParentOrThrow().getKey(),d=a.getIndexWithinParent()+1;l.anchor.set(c,d,"element"),l.focus.set(c,d,"element")}const u=Wl(l);jt(u)}r.dispatchCommand(el,t)}return e.preventDefault(),!0}const n=K();return!!O(n)},ye),r.registerCommand(Ml,e=>{const[t]=jn(e),n=K();return!(t&&!O(n))},ye),r.registerCommand(Pl,e=>{const[t]=jn(e),n=K();if(t&&!O(n))return!1;const s=Xo(e.clientX,e.clientY);if(s!==null){const i=jr(s.node);Ce(i)&&e.preventDefault()}return!0},ye),r.registerCommand(Qs,()=>(Bc(),!0),ye),r.registerCommand(hs,e=>(Jo(r,nr(e,ClipboardEvent)?e:null),!0),ye),r.registerCommand(Ci,e=>(async function(t,n){await Jo(n,nr(t,ClipboardEvent)?t:null),n.update(()=>{const s=K();O(s)?s.removeText():Lt(s)&&s.getNodes().forEach(i=>i.remove())})}(e,r),!0),ye),r.registerCommand(fs,e=>{const[,t,n]=jn(e);return t.length>0&&!n?(r.dispatchCommand(el,t),!0):Fi(e.target)?!1:K()!==null&&(function(s,i){s.preventDefault(),i.update(()=>{const o=K(),a=nr(s,InputEvent)||nr(s,KeyboardEvent)?null:s.clipboardData;a!=null&&o!==null&&Ho(a,o,i)},{tag:"paste"})}(e,r),!0)},ye))}const di=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function nl(r){return r.getEditorState().read(Ta(r.isComposing()))}function Wd({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=St(),s=function(i,o){const[a,l]=w.useState(()=>i.getDecorators());return di(()=>i.registerDecoratorListener(u=>{Ji.flushSync(()=>{l(u)})}),[i]),w.useEffect(()=>{l(i.getDecorators())},[i]),w.useMemo(()=>{const u=[],c=Object.keys(a);for(let d=0;d<c.length;d++){const f=c[d],h=g.jsx(o,{onError:m=>i._onError(m),children:g.jsx(w.Suspense,{fallback:null,children:a[f]})}),p=i.getElementByKey(f);p!==null&&u.push(Ji.createPortal(h,p,f))}return u},[o,a,i])}(n,t);return function(i){di(()=>vr(Ud(i),Ad(i)),[i])}(n),g.jsxs(g.Fragment,{children:[r,g.jsx(Gd,{content:e}),s]})}function Gd({content:r}){const[e]=St(),t=function(s){const[i,o]=w.useState(()=>nl(s));return di(()=>{function a(){const l=nl(s);o(l)}return a(),vr(s.registerUpdateListener(()=>{a()}),s.registerEditableListener(()=>{a()}))},[s]),i}(e),n=ud();return t?typeof r=="function"?r(n):r:null}const $a=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function Vd({editor:r,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:s,ariaErrorMessage:i,ariaExpanded:o,ariaInvalid:a,ariaLabel:l,ariaLabelledBy:u,ariaMultiline:c,ariaOwns:d,ariaRequired:f,autoCapitalize:h,className:p,id:m,role:y="textbox",spellCheck:D=!0,style:x,tabIndex:E,"data-testid":_,...A},b){const[v,S]=w.useState(r.isEditable()),k=w.useCallback(T=>{T&&T.ownerDocument&&T.ownerDocument.defaultView?r.setRootElement(T):r.setRootElement(null)},[r]),j=w.useMemo(()=>function(...T){return B=>{T.forEach(L=>{typeof L=="function"?L(B):L!=null&&(L.current=B)})}}(b,k),[k,b]);return $a(()=>(S(r.isEditable()),r.registerEditableListener(T=>{S(T)})),[r]),g.jsx("div",{"aria-activedescendant":v?e:void 0,"aria-autocomplete":v?t:"none","aria-controls":v?n:void 0,"aria-describedby":s,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":v&&y==="combobox"?!!o:void 0,...a!=null?{"aria-invalid":a}:{},"aria-label":l,"aria-labelledby":u,"aria-multiline":c,"aria-owns":v?d:void 0,"aria-readonly":!v||void 0,"aria-required":f,autoCapitalize:h,className:p,contentEditable:v,"data-testid":_,id:m,ref:j,role:v?y:void 0,spellCheck:D,style:x,tabIndex:E,...A})}const Kd=w.forwardRef(Vd);function sl(r){return r.getEditorState().read(Ta(r.isComposing()))}const Hd=w.forwardRef(Qd);function Qd(r,e){const{placeholder:t,...n}=r,[s]=St();return g.jsxs(g.Fragment,{children:[g.jsx(Kd,{editor:s,...n,ref:e}),t!=null&&g.jsx(Jd,{editor:s,content:t})]})}function Jd({content:r,editor:e}){const t=function(o){const[a,l]=w.useState(()=>sl(o));return $a(()=>{function u(){const c=sl(o);l(c)}return u(),vr(o.registerUpdateListener(()=>{u()}),o.registerEditableListener(()=>{u()}))},[o]),a}(e),[n,s]=w.useState(e.isEditable());if(w.useLayoutEffect(()=>(s(e.isEditable()),e.registerEditableListener(o=>{s(o)})),[e]),!t)return null;let i=null;return typeof r=="function"?i=r(n):r!==null&&(i=r),i===null?null:g.jsx("div",{"aria-hidden":!0,children:i})}const In=0,fi=1,hi=2,wt=0,Yd=1,il=2,Xd=3,Zd=4;function ef(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return wt;const i=e._selection,o=r._selection;if(s)return Yd;if(!(O(i)&&O(o)&&o.isCollapsed()&&i.isCollapsed()))return wt;const a=function(D,x,E){const _=D._nodeMap,A=[];for(const b of x){const v=_.get(b);v!==void 0&&A.push(v)}for(const[b,v]of E){if(!v)continue;const S=_.get(b);S===void 0||tt(S)||A.push(S)}return A}(e,t,n);if(a.length===0)return wt;if(a.length>1){const D=e._nodeMap,x=D.get(i.anchor.key),E=D.get(o.anchor.key);return x&&E&&!r._nodeMap.has(x.__key)&&z(x)&&x.__text.length===1&&i.anchor.offset===1?il:wt}const l=a[0],u=r._nodeMap.get(l.__key);if(!z(u)||!z(l)||u.__mode!==l.__mode)return wt;const c=u.__text,d=l.__text;if(c===d)return wt;const f=i.anchor,h=o.anchor;if(f.key!==h.key||f.type!=="text")return wt;const p=f.offset,m=h.offset,y=d.length-c.length;return y===1&&m===p-1?il:y===-1&&m===p+1?Xd:y===-1&&m===p?Zd:wt}function tf(r,e){let t=Date.now(),n=wt;return(s,i,o,a,l,u)=>{const c=Date.now();if(u.has("historic"))return n=wt,t=c,hi;const d=ef(s,i,a,l,r.isComposing()),f=(()=>{const h=o===null||o.editor===r,p=u.has("history-push");if(!p&&h&&u.has("history-merge"))return In;if(s===null)return fi;const m=i._selection;return a.size>0||l.size>0?p===!1&&d!==wt&&d===n&&c<t+e&&h||a.size===1&&function(y,D,x){const E=D._nodeMap.get(y),_=x._nodeMap.get(y),A=D._selection,b=x._selection;return!(O(A)&&O(b)&&A.anchor.type==="element"&&A.focus.type==="element"&&b.anchor.type==="text"&&b.focus.type==="text"||!z(E)||!z(_)||E.__parent!==_.__parent)&&JSON.stringify(D.read(()=>E.exportJSON()))===JSON.stringify(x.read(()=>_.exportJSON()))}(Array.from(a)[0],s,i)?In:fi:m!==null?In:hi})();return t=c,n=d,f}}function ol(r){r.undoStack=[],r.redoStack=[],r.current=null}function rf(r,e,t){const n=tf(r,t);return vr(r.registerCommand(_i,()=>(function(i,o){const a=o.redoStack,l=o.undoStack;if(l.length!==0){const u=o.current,c=l.pop();u!==null&&(a.push(u),i.dispatchCommand(Fn,!0)),l.length===0&&i.dispatchCommand(Rn,!1),o.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),ye),r.registerCommand(vi,()=>(function(i,o){const a=o.redoStack,l=o.undoStack;if(a.length!==0){const u=o.current;u!==null&&(l.push(u),i.dispatchCommand(Rn,!0));const c=a.pop();a.length===0&&i.dispatchCommand(Fn,!1),o.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),ye),r.registerCommand(tc,()=>(ol(e),!1),ye),r.registerCommand(rc,()=>(ol(e),r.dispatchCommand(Fn,!1),r.dispatchCommand(Rn,!1),!0),ye),r.registerUpdateListener(({editorState:i,prevEditorState:o,dirtyLeaves:a,dirtyElements:l,tags:u})=>{const c=e.current,d=e.redoStack,f=e.undoStack,h=c===null?null:c.editorState;if(c!==null&&i===h)return;const p=n(o,i,c,a,l,u);if(p===fi)d.length!==0&&(e.redoStack=[],r.dispatchCommand(Fn,!1)),c!==null&&(f.push({...c}),r.dispatchCommand(Rn,!0));else if(p===hi)return;e.current={editor:r,editorState:i}}))}function nf(){return{current:null,redoStack:[],undoStack:[]}}function sf({delay:r,externalHistoryState:e}){const[t]=St();return function(n,s,i=1e3){const o=w.useMemo(()=>s||nf(),[s]);w.useEffect(()=>rf(n,o,i),[i,n,o])}(t,e,r),null}const of=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function lf({ignoreHistoryMergeTagChange:r=!0,ignoreSelectionChange:e=!1,onChange:t}){const[n]=St();return of(()=>{if(t)return n.registerUpdateListener(({editorState:s,dirtyElements:i,dirtyLeaves:o,prevEditorState:a,tags:l})=>{e&&i.size===0&&o.size===0||r&&l.has("history-merge")||a.isEmpty()||t(s,n,l)})},[n,r,e,t]),null}function pi(r,e){return pi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},pi(r,e)}var ll={error:null},af=function(r){var e,t;function n(){for(var i,o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return(i=r.call.apply(r,[this].concat(a))||this).state=ll,i.resetErrorBoundary=function(){for(var u,c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];i.props.onReset==null||(u=i.props).onReset.apply(u,d),i.reset()},i}t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,pi(e,t),n.getDerivedStateFromError=function(i){return{error:i}};var s=n.prototype;return s.reset=function(){this.setState(ll)},s.componentDidCatch=function(i,o){var a,l;(a=(l=this.props).onError)==null||a.call(l,i,o)},s.componentDidUpdate=function(i,o){var a,l,u,c,d=this.state.error,f=this.props.resetKeys;d!==null&&o.error!==null&&((u=i.resetKeys)===void 0&&(u=[]),(c=f)===void 0&&(c=[]),u.length!==c.length||u.some(function(h,p){return!Object.is(h,c[p])}))&&((a=(l=this.props).onResetKeysChange)==null||a.call(l,i.resetKeys,f),this.reset())},s.render=function(){var i=this.state.error,o=this.props,a=o.fallbackRender,l=o.FallbackComponent,u=o.fallback;if(i!==null){var c={error:i,resetErrorBoundary:this.resetErrorBoundary};if(Ns.isValidElement(u))return u;if(typeof a=="function")return a(c);if(l)return Ns.createElement(l,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(Ns.Component);function uf({children:r,onError:e}){return g.jsx(af,{fallback:g.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function cf(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Mt=cf(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function df(r){let e=1,t=r.getParent();for(;t!=null;){if(Me(t)){const n=t.getParent();if(de(n)){e++,t=n.getParent();continue}Mt(40)}return e}return e}function gi(r){let e=r.getParent();de(e)||Mt(40);let t=e;for(;t!==null;)t=t.getParent(),de(t)&&(e=t);return e}function za(r){let e=[];const t=r.getChildren().filter(Me);for(let n=0;n<t.length;n++){const s=t[n],i=s.getFirstChild();de(i)?e=e.concat(za(i)):e.push(s)}return e}function Pt(r){return Me(r)&&de(r.getFirstChild())}function al(r){return dt().append(r)}function qa(r,e){return Me(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function ul(r,e){r.update(()=>{const t=K();if(t!==null){const n=t.getNodes();if(O(t)){const i=t.getStartEndPoints();i===null&&Mt(143);const[o]=i,a=o.getNode(),l=a.getParent();if(qa(a,n)){const u=lt(e);if(Ot(l)){a.replace(u);const c=dt();F(a)&&(c.setFormat(a.getFormatType()),c.setIndent(a.getIndent())),u.append(c)}else if(Me(a)){const c=a.getParentOrThrow();br(u,c.getChildren()),c.replace(u)}return}}const s=new Set;for(let i=0;i<n.length;i++){const o=n[i];if(!F(o)||!o.isEmpty()||Me(o)||s.has(o.getKey())){if(Vl(o)){let a=o.getParent();for(;a!=null;){const l=a.getKey();if(de(a)){if(!s.has(l)){const u=lt(e);br(u,a.getChildren()),a.replace(u),s.add(l)}break}{const u=a.getParent();if(Ot(u)&&!s.has(l)){s.add(l),cl(a,e);break}a=u}}}}else cl(o,e)}}})}function br(r,e){r.splice(r.getChildrenSize(),0,e)}function cl(r,e){if(de(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=dt();let i;if(br(s,r.getChildren()),de(t)&&e===t.getListType())t.append(s),de(n)&&e===n.getListType()&&(br(t,n.getChildren()),n.remove()),i=t;else if(de(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),i=n;else{const o=lt(e);o.append(s),r.replace(o),i=o}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),i}function Hi(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&Pt(t)&&Pt(n)&&(Hi(t.getFirstChild(),n.getFirstChild()),n.remove());const s=e.getChildren();s.length>0&&r.append(...s),e.remove()}function ff(r){r.update(()=>{const e=K();if(O(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(qa(s,n))t.add(gi(s));else for(let i=0;i<n.length;i++){const o=n[i];if(Vl(o)){const a=Ed(o,Cr);a!=null&&t.add(gi(a))}}for(const i of t){let o=i;const a=za(i);for(const l of a){const u=Ue();br(u,l.getChildren()),o.insertAfter(u),o=u,l.__key===e.anchor.key&&e.anchor.set(u.getKey(),0,"element"),l.__key===e.focus.key&&e.focus.set(u.getKey(),0,"element"),l.remove()}i.remove()}}})}function hf(r){const e=new Set;if(Pt(r)||e.has(r.getKey()))return;const t=r.getParent(),n=r.getNextSibling(),s=r.getPreviousSibling();if(Pt(n)&&Pt(s)){const i=s.getFirstChild();if(de(i)){i.append(r);const o=n.getFirstChild();de(o)&&(br(i,o.getChildren()),n.remove(),e.add(n.getKey()))}}else if(Pt(n)){const i=n.getFirstChild();if(de(i)){const o=i.getFirstChild();o!==null&&o.insertBefore(r)}}else if(Pt(s)){const i=s.getFirstChild();de(i)&&i.append(r)}else if(de(t)){const i=dt(),o=lt(t.getListType());i.append(o),o.append(r),s?s.insertAfter(i):n?n.insertBefore(i):t.append(i)}}function pf(r){if(Pt(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(de(t?t.getParent():void 0)&&Me(t)&&de(e)){const n=e?e.getFirstChild():void 0,s=e?e.getLastChild():void 0;if(r.is(n))t.insertBefore(r),e.isEmpty()&&t.remove();else if(r.is(s))t.insertAfter(r),e.isEmpty()&&t.remove();else{const i=e.getListType(),o=dt(),a=lt(i);o.append(a),r.getPreviousSiblings().forEach(c=>a.append(c));const l=dt(),u=lt(i);l.append(u),br(u,r.getNextSiblings()),t.insertBefore(o),t.insertAfter(l),t.replace(r)}}}function gf(){const r=K();if(!O(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!Me(e)||e.getChildrenSize()!==0)return!1;const t=gi(e),n=e.getParent();de(n)||Mt(40);const s=n.getParent();let i;if(Ot(s))i=Ue(),t.insertAfter(i);else{if(!Me(s))return!1;i=dt(),s.insertAfter(i)}i.select();const o=e.getNextSiblings();if(o.length>0){const a=lt(n.getListType());if(Or(i))i.insertAfter(a);else{const l=dt();l.append(a),i.insertAfter(l)}o.forEach(l=>{l.remove(),a.append(l)})}return function(a){let l=a;for(;l.getNextSibling()==null&&l.getPreviousSibling()==null;){const u=l.getParent();if(u==null||!Me(l)&&!de(l))break;l=u}l.remove()}(e),!0}function as(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}class Cr extends Jt{static getType(){return"listitem"}static clone(e){return new Cr(e.__value,e.__checked,e.__key)}constructor(e,t,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}createDOM(e){const t=document.createElement("li"),n=this.getParent();return de(n)&&n.getListType()==="check"&&fl(t,this,null),t.value=this.__value,dl(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return de(s)&&s.getListType()==="check"&&fl(t,this,e),t.value=this.__value,dl(t,n.theme,this),!1}static transform(){return e=>{if(Me(e)||Mt(144),e.__checked==null)return;const t=e.getParent();de(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:mf,priority:0})}}static importJSON(e){const t=dt();return t.setChecked(e.checked),t.setValue(e.value),t.setFormat(e.format),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config);return t.style.textAlign=this.getFormatType(),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(F(n)&&this.canMergeWith(n)){const s=n.getChildren();this.append(...s),n.remove()}else super.append(n)}return this}replace(e,t){if(Me(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!de(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=lt(n.getListType());let i=this.getNextSibling();for(;i;){const o=i;i=i.getNextSibling(),s.append(o)}n.insertAfter(e),e.insertAfter(s)}return t&&(F(e)||Mt(139),this.getChildren().forEach(s=>{e.append(s)})),this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(de(n)||Mt(39),Me(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const i=lt(n.getListType());s.forEach(o=>i.append(o)),e.insertAfter(i,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&Pt(t)&&Pt(n)&&(Hi(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=dt(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=Ue();this.getChildren().forEach(o=>t.append(o));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),i=Me(s);if(n.getChildrenSize()===1)if(i)n.remove(),s.select();else{n.insertBefore(t),n.remove();const o=e.anchor,a=e.focus,l=t.getKey();o.type==="element"&&o.getNode().is(this)&&o.set(l,o.offset,"element"),a.type==="element"&&a.getNode().is(this)&&a.set(l,a.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){this.getWritable().__value=e}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return de(n)&&(t=n.getListType()),t==="check"?!!e.__checked:void 0}setChecked(e){this.getWritable().__checked=e}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){const e=this.getParent();if(e===null)return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;Me(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&Mt(117),(e=Math.floor(e))>=0||Mt(199);let t=this.getIndent();for(;t!==e;)t<e?(hf(this),t++):(pf(this),t--);return this}canInsertAfter(e){return Me(e)}canReplaceWith(e){return Me(e)}canMergeWith(e){return Or(e)||Me(e)}extractWithChild(e,t){if(!O(t))return!1;const n=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(s)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return lt("bullet")}canMergeWhenEmpty(){return!0}}function dl(r,e,t){const n=[],s=[],i=e.list,o=i?i.listitem:void 0;let a;if(i&&i.nested&&(a=i.nested.listitem),o!==void 0&&n.push(...as(o)),i){const l=t.getParent(),u=de(l)&&l.getListType()==="check",c=t.getChecked();u&&!c||s.push(i.listitemUnchecked),u&&c||s.push(i.listitemChecked),u&&n.push(c?i.listitemChecked:i.listitemUnchecked)}if(a!==void 0){const l=as(a);t.getChildren().some(u=>de(u))?n.push(...l):s.push(...l)}s.length>0&&Ra(r,...s),n.length>0&&Tn(r,...n)}function fl(r,e,t,n){de(e.getFirstChild())?(r.removeAttribute("role"),r.removeAttribute("tabIndex"),r.removeAttribute("aria-checked")):(r.setAttribute("role","checkbox"),r.setAttribute("tabIndex","-1"),t&&e.__checked===t.__checked||r.setAttribute("aria-checked",e.getChecked()?"true":"false"))}function mf(r){if(r.classList.contains("task-list-item")){for(const t of r.children)if(t.tagName==="INPUT")return yf(t)}const e=r.getAttribute("aria-checked");return{node:dt(e==="true"||e!=="false"&&void 0)}}function yf(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:dt(r.hasAttribute("checked"))}}function dt(r){return $t(new Cr(void 0,r))}function Me(r){return r instanceof Cr}class qr extends Jt{static getType(){return"list"}static clone(e){const t=e.__listType||gl[e.__tag];return new qr(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=gl[e]||e;this.__listType=s,this.__tag=s==="number"?"ol":"ul",this.__start=t}getTag(){return this.__tag}setListType(e){const t=this.getWritable();t.__listType=e,t.__tag=e==="number"?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(e,t){const n=this.__tag,s=document.createElement(n);return this.__start!==1&&s.setAttribute("start",String(this.__start)),s.__lexicalListType=this.__listType,hl(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(hl(t,n.theme,this),!1)}static transform(){return e=>{de(e)||Mt(163),function(t){const n=t.getNextSibling();de(n)&&t.getListType()===n.getListType()&&Hi(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const i of t.getChildren())Me(i)&&(i.getValue()!==s&&i.setValue(s),n&&i.getLatest().__checked!=null&&i.setChecked(void 0),de(i.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:pl,priority:0}),ul:()=>({conversion:pl,priority:0})}}static importJSON(e){const t=lt(e.listType,e.start);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config,e);return t&&Ht(t)&&(this.__start!==1&&t.setAttribute("start",String(this.__start)),this.__listType==="check"&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(Me(n))super.append(n);else{const s=dt();if(de(n))s.append(n);else if(F(n))if(n.isInline())s.append(n);else{const i=Ge(n.getTextContent());s.append(i)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return Me(e)}}function hl(r,e,t){const n=[],s=[],i=e.list;if(i!==void 0){const o=i[`${t.__tag}Depth`]||[],a=df(t)-1,l=a%o.length,u=o[l],c=i[t.__tag];let d;const f=i.nested,h=i.checklist;if(f!==void 0&&f.list&&(d=f.list),c!==void 0&&n.push(c),h!==void 0&&t.__listType==="check"&&n.push(h),u!==void 0){n.push(...as(u));for(let p=0;p<o.length;p++)p!==l&&s.push(t.__tag+p)}if(d!==void 0){const p=as(d);a>1?n.push(...p):s.push(...p)}}s.length>0&&Ra(r,...s),n.length>0&&Tn(r,...n)}function xf(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(Me(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(i=>{de(i)&&e.push(al(i))})}else e.push(al(n))}return e}function pl(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=lt("number",r.start):e==="ul"&&(t=function(n){if(n.getAttribute("__lexicallisttype")==="check"||n.classList.contains("contains-task-list"))return!0;for(const s of n.childNodes)if(Ht(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?lt("check"):lt("bullet")),{after:xf,node:t}}const gl={ol:"number",ul:"bullet"};function lt(r,e=1){return $t(new qr(r,e))}function de(r){return r instanceof qr}const Ua=xn(),Wa=xn(),bf=xn();function _f(r){return vr(r.registerCommand(Wa,()=>(ul(r,"number"),!0),Nr),r.registerCommand(Ua,()=>(ul(r,"bullet"),!0),Nr),r.registerCommand(bf,()=>(ff(r),!0),Nr),r.registerCommand(dn,()=>!!gf(),Nr))}function vf(){const[r]=St();return w.useEffect(()=>{if(!r.hasNodes([qr,Cr]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[r]),function(e){w.useEffect(()=>_f(e),[e])}(r),null}const Cf=new Set(["http:","https:","mailto:","sms:","tel:"]);class wr extends Jt{static getType(){return"link"}static clone(e){return new wr(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},n){super(n);const{target:s=null,rel:i=null,title:o=null}=t;this.__url=e,this.__target=s,this.__rel=i,this.__title=o}createDOM(e){const t=document.createElement("a");return t.href=this.sanitizeUrl(this.__url),this.__target!==null&&(t.target=this.__target),this.__rel!==null&&(t.rel=this.__rel),this.__title!==null&&(t.title=this.__title),Tn(t,e.theme.link),t}updateDOM(e,t,n){if(t instanceof HTMLAnchorElement){const s=this.__url,i=this.__target,o=this.__rel,a=this.__title;s!==e.__url&&(t.href=s),i!==e.__target&&(i?t.target=i:t.removeAttribute("target")),o!==e.__rel&&(o?t.rel=o:t.removeAttribute("rel")),a!==e.__title&&(a?t.title=a:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:wf,priority:1})}}static importJSON(e){const t=us(e.url,{rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}sanitizeUrl(e){try{const t=new URL(e);if(!Cf.has(t.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){this.getWritable().__title=e}insertNewAfter(e,t=!0){const n=us(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!O(t))return!1;const s=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(s)&&this.isParentOf(i)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function wf(r){let e=null;if(Lc(r)){const t=r.textContent;(t!==null&&t!==""||r.children.length>0)&&(e=us(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function us(r,e){return $t(new wr(r,e))}function Jr(r){return r instanceof wr}class Nn extends wr{constructor(e,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new Nn(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){const t=ml(e.url,{isUnlinked:e.isUnlinked,rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked,type:"autolink",version:1}}insertNewAfter(e,t=!0){const n=this.getParentOrThrow().insertNewAfter(e,t);if(F(n)){const s=ml(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function ml(r,e){return $t(new Nn(r,e))}function Df(r){return r instanceof Nn}const yl=xn();function Gs(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,i=K();if(!O(i))return;const o=i.extract();if(r===null)o.forEach(a=>{const l=Es(a,u=>!Df(u)&&Jr(u));if(l){const u=l.getChildren();for(let c=0;c<u.length;c++)l.insertBefore(u[c]);l.remove()}});else{if(o.length===1){const u=function(c,d){let f=c;for(;f!==null&&f.getParent()!==null&&!d(f);)f=f.getParentOrThrow();return d(f)?f:null}(o[0],Jr);if(u!==null)return u.setURL(r),t!==void 0&&u.setTarget(t),s!==null&&u.setRel(s),void(n!==void 0&&u.setTitle(n))}let a=null,l=null;o.forEach(u=>{const c=u.getParent();if(c!==l&&c!==null&&(!F(u)||u.isInline())){if(Jr(c))return l=c,c.setURL(r),t!==void 0&&c.setTarget(t),s!==null&&l.setRel(s),void(n!==void 0&&l.setTitle(n));if(c.is(a)||(a=c,l=us(r,{rel:s,target:t,title:n}),Jr(c)?u.getPreviousSibling()===null?c.insertBefore(l):c.insertAfter(l):u.insertBefore(l)),Jr(u)){if(u.is(l))return;if(l!==null){const d=u.getChildren();for(let f=0;f<d.length;f++)l.append(d[f])}u.remove()}else l!==null&&l.append(u)}})}}function Ef({validateUrl:r,attributes:e}){const[t]=St();return w.useEffect(()=>{if(!t.hasNodes([wr]))throw new Error("LinkPlugin: LinkNode not registered on editor");return vr(t.registerCommand(yl,n=>{if(n===null)return Gs(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(Gs(n,e),!0);{const{url:s,target:i,rel:o,title:a}=n;return Gs(s,{...e,rel:o,target:i,title:a}),!0}},Nr),r!==void 0?t.registerCommand(fs,n=>{const s=K();if(!O(s)||s.isCollapsed()||!nr(n,ClipboardEvent))return!1;const i=n;if(i.clipboardData===null)return!1;const o=i.clipboardData.getData("text");return!!r(o)&&!s.getNodes().some(a=>F(a))&&(t.dispatchCommand(yl,{...e,url:o}),n.preventDefault(),!0)},Nr):()=>{})},[t,r,e]),null}function Sf(r){if(r instanceof HTMLImageElement){const e=r.getAttribute("src")||"",t=r.getAttribute("alt")||"",n=r.getAttribute("width"),s=r.getAttribute("height");return{node:Ga({src:e,altText:t,width:n?parseInt(n,10):void 0,height:s?parseInt(s,10):void 0})}}return null}function Af({src:r,alt:e,width:t,height:n}){return g.jsx("img",{src:r,alt:e,width:t,height:n,style:{maxWidth:"100%",height:"auto",display:"block",margin:"8px 0",borderRadius:"4px"}})}class ks extends Wi{constructor(t,n,s,i,o){super(o);_t(this,"__src");_t(this,"__altText");_t(this,"__width");_t(this,"__height");this.__src=t,this.__altText=n||"",this.__width=s,this.__height=i}static getType(){return"image"}static clone(t){return new ks(t.__src,t.__altText,t.__width,t.__height,t.__key)}static importJSON(t){const{src:n,altText:s,width:i,height:o}=t;return Ga({src:n,altText:s,width:i,height:o})}exportJSON(){return{type:"image",version:1,src:this.__src,altText:this.__altText,width:this.__width,height:this.__height}}static importDOM(){return{img:()=>({conversion:Sf,priority:0})}}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),this.__altText&&t.setAttribute("alt",this.__altText),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),t.style.maxWidth="100%",t.style.height="auto",{element:t}}createDOM(){const t=document.createElement("span");return t.style.display="inline-block",t}updateDOM(){return!1}decorate(){return g.jsx(Af,{src:this.__src,alt:this.__altText,width:this.__width,height:this.__height})}}function Ga(r){return new ks(r.src,r.altText,r.width,r.height)}var kf=Object.defineProperty,cs=Object.getOwnPropertySymbols,Va=Object.prototype.hasOwnProperty,Ka=Object.prototype.propertyIsEnumerable,xl=(r,e,t)=>e in r?kf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,mi=(r,e)=>{for(var t in e||(e={}))Va.call(e,t)&&xl(r,t,e[t]);if(cs)for(var t of cs(e))Ka.call(e,t)&&xl(r,t,e[t]);return r},yi=(r,e)=>{var t={};for(var n in r)Va.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&cs)for(var n of cs(r))e.indexOf(n)<0&&Ka.call(r,n)&&(t[n]=r[n]);return t};/**
95
+ `?a.insertParagraph():u===" "?a.insertNodes([Zn()]):a.insertText(u)}}}else e.insertRawText(i)}function pl(r,e,t){r.dispatchCommand(Cf,{nodes:e,selection:t})||t.insertNodes(e)}function kc(r,e,t,n=[]){let s=e===null||t.isSelected(e);const i=P(t)&&t.excludeFromCopy("html");let o=t;if(e!==null){let u=Jo(t);u=G(u)&&e!==null?yc(e,u):u,o=u}const l=P(o)?o.getChildren():[],a=function(u){const c=u.exportJSON(),d=u.constructor;if(c.type!==d.getType()&&Hs(58,d.name),P(u)){const f=c.children;Array.isArray(f)||Hs(59,d.name)}return c}(o);if(G(o)){const u=o.__text;u.length>0?a.text=u:s=!1}for(let u=0;u<l.length;u++){const c=l[u],d=kc(r,e,c,a.children);!s&&P(t)&&d&&t.extractWithChild(c,e,"clone")&&(s=!0)}if(s&&!i)n.push(a);else if(Array.isArray(a.children))for(let u=0;u<a.children.length;u++){const c=a.children[u];n.push(c)}return s}function cp(r,e){const t=[],n=Pe().getChildren();for(let s=0;s<n.length;s++)kc(r,e,n[s],t);return{namespace:r._config.namespace,nodes:t}}function dp(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t],s=Rh(n);G(s)&&Qh(s),e.push(s)}return e}let qr=null;async function gl(r,e,t){if(qr!==null)return!1;if(e!==null)return new Promise((a,u)=>{r.update(()=>{a(ml(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,i=Et(r._window);if(n===null||i===null)return!1;const o=s.createElement("span");o.style.cssText="position: fixed; top: -1000px;",o.append(s.createTextNode("#")),n.append(o);const l=new Range;return l.setStart(o,0),l.setEnd(o,1),i.removeAllRanges(),i.addRange(l),new Promise((a,u)=>{const c=r.registerCommand(ii,d=>(gr(d,ClipboardEvent)&&(c(),qr!==null&&(window.clearTimeout(qr),qr=null),a(ml(r,d,t))),!0),jh);qr=window.setTimeout(()=>{c(),qr=null,a(!1)},50),s.execCommand("copy"),o.remove()})}function ml(r,e,t){if(t===void 0){const s=Et(r._window);if(!s)return!1;const i=s.anchorNode,o=s.focusNode;if(i!==null&&o!==null&&!Yn(r,i,o))return!1;const l=te();if(l===null)return!1;t=hp(l)}e.preventDefault();const n=e.clipboardData;return n!==null&&(pp(n,t),!0)}const fp=[["text/html",lp],["application/x-lexical-editor",up]];function hp(r=te()){const e={"text/plain":r?r.getTextContent():""};if(r){const t=hh();for(const[n,s]of fp){const i=s(t,r);i!==null&&(e[n]=i)}}return e}function pp(r,e){for(const t in e){const n=e[t];n!==void 0&&r.setData(t,n)}}function yl(r,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(r,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(r,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const an=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,gp=an&&"documentMode"in document?document.documentMode:null,mp=!(!an||!("InputEvent"in window)||gp)&&"getTargetRanges"in new window.InputEvent("input"),yp=an&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),xl=an&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,xp=an&&/^(?=.*Chrome).*/i.test(navigator.userAgent),bp=an&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!xp,bl=Hn();class xi extends lr{static getType(){return"quote"}static clone(e){return new xi(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return ns(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:_p,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&or(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=oa();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,t){const n=He(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=He();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function oa(){return Qt(new xi)}class bi extends lr{static getType(){return"heading"}static clone(e){return new bi(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}createDOM(e){const t=this.__tag,n=document.createElement(t),s=e.theme.heading;if(s!==void 0){const i=s[t];ns(n,i)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:Ur,priority:0}),h2:e=>({conversion:Ur,priority:0}),h3:e=>({conversion:Ur,priority:0}),h4:e=>({conversion:Ur,priority:0}),h5:e=>({conversion:Ur,priority:0}),h6:e=>({conversion:Ur,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&_l(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>_l(e)?{conversion:t=>({node:wn("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&or(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=wn(e.tag);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,s=this.getLastDescendant(),i=!s||e&&e.anchor.key===s.getKey()&&n===s.getTextContentSize()||!e?He():wn(this.getTag()),o=this.getDirection();if(i.setDirection(o),this.insertAfter(i,t),n===0&&!this.isEmpty()&&e){const l=He();l.select(),this.replace(l,!0)}return i}collapseAtStart(){const e=this.isEmpty()?He():wn(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function _l(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function Ur(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=wn(e),r.style!==null&&(Zo(r,t),t.setFormat(r.style.textAlign))),{node:t}}function _p(r){const e=oa();return r.style!==null&&(e.setFormat(r.style.textAlign),Zo(r,e)),{node:e}}function wn(r){return Qt(new bi(r))}function hs(r){let e=null;if(gr(r,DragEvent)?e=r.dataTransfer:gr(r,ClipboardEvent)&&(e=r.clipboardData),e===null)return[!1,[],!1];const t=e.types,n=t.includes("Files"),s=t.includes("text/html")||t.includes("text/plain");return[n,Array.from(e.files),s]}function vl(r){const e=te();if(!z(e))return!1;const t=new Set,n=e.getNodes();for(let s=0;s<n.length;s++){const i=n[s],o=i.getKey();if(t.has(o))continue;const l=yi(i,u=>P(u)&&!u.isInline());if(l===null)continue;const a=l.getKey();l.canIndent()&&!t.has(a)&&(t.add(a),r(l))}return t.size>0}function ps(r){const e=en(r);return Ae(e)}function vp(r){return Pr(r.registerCommand(hu,e=>{const t=te();return!!Ut(t)&&(t.clear(),!0)},0),r.registerCommand(kr,e=>{const t=te();return!!z(t)&&(t.deleteCharacter(e),!0)},Ee),r.registerCommand(jn,e=>{const t=te();return!!z(t)&&(t.deleteWord(e),!0)},Ee),r.registerCommand(Ln,e=>{const t=te();return!!z(t)&&(t.deleteLine(e),!0)},Ee),r.registerCommand(Yr,e=>{const t=te();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const n=e.dataTransfer;if(n!=null)hl(n,t,r);else if(z(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},Ee),r.registerCommand(Ki,()=>{const e=te();return!!z(e)&&(e.removeText(),!0)},Ee),r.registerCommand(Mt,e=>{const t=te();return!!z(t)&&(t.formatText(e),!0)},Ee),r.registerCommand(Nf,e=>{const t=te();if(!z(t)&&!Ut(t))return!1;const n=t.getNodes();for(const s of n){const i=yi(s,o=>P(o)&&!o.isInline());i!==null&&i.setFormat(e)}return!0},Ee),r.registerCommand(Kr,e=>{const t=te();return!!z(t)&&(t.insertLineBreak(e),!0)},Ee),r.registerCommand(Mn,()=>{const e=te();return!!z(e)&&(e.insertParagraph(),!0)},Ee),r.registerCommand(Tf,()=>(oc([Zn()]),!0),Ee),r.registerCommand(Bf,()=>vl(e=>{const t=e.getIndent();e.setIndent(t+1)}),Ee),r.registerCommand(ka,()=>vl(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),Ee),r.registerCommand(mu,e=>{const t=te();if(Ut(t)&&!ps(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(z(t)){const n=Pn(t.focus,!0);if(!e.shiftKey&&Ae(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},Ee),r.registerCommand(yu,e=>{const t=te();if(Ut(t)){const n=t.getNodes();if(n.length>0)return n[0].selectNext(0,0),!0}else if(z(t)){if(function(s){const i=s.focus;return i.key==="root"&&i.offset===Pe().getChildrenSize()}(t))return e.preventDefault(),!0;const n=Pn(t.focus,!1);if(!e.shiftKey&&Ae(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},Ee),r.registerCommand(gu,e=>{const t=te();if(Ut(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!z(t))return!1;if(cl(t,!0)){const n=e.shiftKey;return e.preventDefault(),dl(t,n,!0),!0}return!1},Ee),r.registerCommand(pu,e=>{const t=te();if(Ut(t)&&!ps(e.target)){const s=t.getNodes();if(s.length>0)return e.preventDefault(),s[0].selectNext(0,0),!0}if(!z(t))return!1;const n=e.shiftKey;return!!cl(t,!1)&&(e.preventDefault(),dl(t,n,!1),!0)},Ee),r.registerCommand(xu,e=>{if(ps(e.target))return!1;const t=te();if(!z(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!lt(s)&&sp(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(ka,void 0)):(!xl||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(kr,!0))},Ee),r.registerCommand(_u,e=>{if(ps(e.target))return!1;const t=te();return!!z(t)&&(e.preventDefault(),r.dispatchCommand(kr,!1))},Ee),r.registerCommand(Bs,e=>{const t=te();if(!z(t))return!1;if(e!==null){if((xl||yp||bp)&&mp)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(Kr,!1)}return r.dispatchCommand(Mn,void 0)},Ee),r.registerCommand(bu,()=>{const e=te();return!!z(e)&&(r.blur(),!0)},Ee),r.registerCommand(vu,e=>{const[,t]=hs(e);if(t.length>0){const s=yl(e.clientX,e.clientY);if(s!==null){const{offset:i,node:o}=s,l=en(o);if(l!==null){const a=Th();if(G(l))a.anchor.set(l.getKey(),i,"text"),a.focus.set(l.getKey(),i,"text");else{const c=l.getParentOrThrow().getKey(),d=l.getIndexWithinParent()+1;a.anchor.set(c,d,"element"),a.focus.set(c,d,"element")}const u=Nu(a);Gt(u)}r.dispatchCommand(bl,t)}return e.preventDefault(),!0}const n=te();return!!z(n)},Ee),r.registerCommand(wu,e=>{const[t]=hs(e),n=te();return!(t&&!z(n))},Ee),r.registerCommand(Cu,e=>{const[t]=hs(e),n=te();if(t&&!z(n))return!1;const s=yl(e.clientX,e.clientY);if(s!==null){const i=en(s.node);Ae(i)&&e.preventDefault()}return!0},Ee),r.registerCommand(Yi,()=>(uh(),!0),Ee),r.registerCommand(ii,e=>(gl(r,gr(e,ClipboardEvent)?e:null),!0),Ee),r.registerCommand(jo,e=>(async function(t,n){await gl(n,gr(t,ClipboardEvent)?t:null),n.update(()=>{const s=te();z(s)?s.removeText():Ut(s)&&s.getNodes().forEach(i=>i.remove())})}(e,r),!0),Ee),r.registerCommand(si,e=>{const[,t,n]=hs(e);return t.length>0&&!n?(r.dispatchCommand(bl,t),!0):Vo(e.target)?!1:te()!==null&&(function(s,i){s.preventDefault(),i.update(()=>{const o=te(),l=gr(s,InputEvent)||gr(s,KeyboardEvent)?null:s.clipboardData;l!=null&&o!==null&&hl(l,o,i)},{tag:"paste"})}(e,r),!0)},Ee))}const fo=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?b.useLayoutEffect:b.useEffect;function wl(r){return r.getEditorState().read(mc(r.isComposing()))}function wp({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=Lt(),s=function(i,o){const[l,a]=b.useState(()=>i.getDecorators());return fo(()=>i.registerDecoratorListener(u=>{ma.flushSync(()=>{a(u)})}),[i]),b.useEffect(()=>{a(i.getDecorators())},[i]),b.useMemo(()=>{const u=[],c=Object.keys(l);for(let d=0;d<c.length;d++){const f=c[d],h=p.jsx(o,{onError:m=>i._onError(m),children:p.jsx(b.Suspense,{fallback:null,children:l[f]})}),g=i.getElementByKey(f);g!==null&&u.push(ma.createPortal(h,g,f))}return u},[o,l,i])}(n,t);return function(i){fo(()=>Pr(vp(i),ip(i)),[i])}(n),p.jsxs(p.Fragment,{children:[r,p.jsx(Cp,{content:e}),s]})}function Cp({content:r}){const[e]=Lt(),t=function(s){const[i,o]=b.useState(()=>wl(s));return fo(()=>{function l(){const a=wl(s);o(a)}return l(),Pr(s.registerUpdateListener(()=>{l()}),s.registerEditableListener(()=>{l()}))},[s]),i}(e),n=$h();return t?typeof r=="function"?r(n):r:null}const Dc=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?b.useLayoutEffect:b.useEffect;function Sp({editor:r,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:s,ariaErrorMessage:i,ariaExpanded:o,ariaInvalid:l,ariaLabel:a,ariaLabelledBy:u,ariaMultiline:c,ariaOwns:d,ariaRequired:f,autoCapitalize:h,className:g,id:m,role:x="textbox",spellCheck:v=!0,style:_,tabIndex:C,"data-testid":S,...D},w){const[y,k]=b.useState(r.isEditable()),B=b.useCallback(T=>{T&&T.ownerDocument&&T.ownerDocument.defaultView?r.setRootElement(T):r.setRootElement(null)},[r]),F=b.useMemo(()=>function(...T){return M=>{T.forEach(L=>{typeof L=="function"?L(M):L!=null&&(L.current=M)})}}(w,B),[B,w]);return Dc(()=>(k(r.isEditable()),r.registerEditableListener(T=>{k(T)})),[r]),p.jsx("div",{"aria-activedescendant":y?e:void 0,"aria-autocomplete":y?t:"none","aria-controls":y?n:void 0,"aria-describedby":s,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":y&&x==="combobox"?!!o:void 0,...l!=null?{"aria-invalid":l}:{},"aria-label":a,"aria-labelledby":u,"aria-multiline":c,"aria-owns":y?d:void 0,"aria-readonly":!y||void 0,"aria-required":f,autoCapitalize:h,className:g,contentEditable:y,"data-testid":S,id:m,ref:F,role:y?x:void 0,spellCheck:v,style:_,tabIndex:C,...D})}const Ep=b.forwardRef(Sp);function Cl(r){return r.getEditorState().read(mc(r.isComposing()))}const kp=b.forwardRef(Dp);function Dp(r,e){const{placeholder:t,...n}=r,[s]=Lt();return p.jsxs(p.Fragment,{children:[p.jsx(Ep,{editor:s,...n,ref:e}),t!=null&&p.jsx(Ap,{editor:s,content:t})]})}function Ap({content:r,editor:e}){const t=function(o){const[l,a]=b.useState(()=>Cl(o));return Dc(()=>{function u(){const c=Cl(o);a(c)}return u(),Pr(o.registerUpdateListener(()=>{u()}),o.registerEditableListener(()=>{u()}))},[o]),l}(e),[n,s]=b.useState(e.isEditable());if(b.useLayoutEffect(()=>(s(e.isEditable()),e.registerEditableListener(o=>{s(o)})),[e]),!t)return null;let i=null;return typeof r=="function"?i=r(n):r!==null&&(i=r),i===null?null:p.jsx("div",{"aria-hidden":!0,children:i})}const gs=0,ho=1,po=2,Nt=0,Tp=1,Sl=2,Bp=3,Np=4;function Fp(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return Nt;const i=e._selection,o=r._selection;if(s)return Tp;if(!(z(i)&&z(o)&&o.isCollapsed()&&i.isCollapsed()))return Nt;const l=function(v,_,C){const S=v._nodeMap,D=[];for(const w of _){const y=S.get(w);y!==void 0&&D.push(y)}for(const[w,y]of C){if(!y)continue;const k=S.get(w);k===void 0||lt(k)||D.push(k)}return D}(e,t,n);if(l.length===0)return Nt;if(l.length>1){const v=e._nodeMap,_=v.get(i.anchor.key),C=v.get(o.anchor.key);return _&&C&&!r._nodeMap.has(_.__key)&&G(_)&&_.__text.length===1&&i.anchor.offset===1?Sl:Nt}const a=l[0],u=r._nodeMap.get(a.__key);if(!G(u)||!G(a)||u.__mode!==a.__mode)return Nt;const c=u.__text,d=a.__text;if(c===d)return Nt;const f=i.anchor,h=o.anchor;if(f.key!==h.key||f.type!=="text")return Nt;const g=f.offset,m=h.offset,x=d.length-c.length;return x===1&&m===g-1?Sl:x===-1&&m===g+1?Bp:x===-1&&m===g?Np:Nt}function Rp(r,e){let t=Date.now(),n=Nt;return(s,i,o,l,a,u)=>{const c=Date.now();if(u.has("historic"))return n=Nt,t=c,po;const d=Fp(s,i,l,a,r.isComposing()),f=(()=>{const h=o===null||o.editor===r,g=u.has("history-push");if(!g&&h&&u.has("history-merge"))return gs;if(s===null)return ho;const m=i._selection;return l.size>0||a.size>0?g===!1&&d!==Nt&&d===n&&c<t+e&&h||l.size===1&&function(x,v,_){const C=v._nodeMap.get(x),S=_._nodeMap.get(x),D=v._selection,w=_._selection;return!(z(D)&&z(w)&&D.anchor.type==="element"&&D.focus.type==="element"&&w.anchor.type==="text"&&w.focus.type==="text"||!G(C)||!G(S)||C.__parent!==S.__parent)&&JSON.stringify(v.read(()=>C.exportJSON()))===JSON.stringify(_.read(()=>S.exportJSON()))}(Array.from(l)[0],s,i)?gs:ho:m!==null?gs:po})();return t=c,n=d,f}}function El(r){r.undoStack=[],r.redoStack=[],r.current=null}function Mp(r,e,t){const n=Rp(r,t);return Pr(r.registerCommand(Ro,()=>(function(i,o){const l=o.redoStack,a=o.undoStack;if(a.length!==0){const u=o.current,c=a.pop();u!==null&&(l.push(u),i.dispatchCommand(ls,!0)),a.length===0&&i.dispatchCommand(us,!1),o.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),Ee),r.registerCommand(Mo,()=>(function(i,o){const l=o.redoStack,a=o.undoStack;if(l.length!==0){const u=o.current;u!==null&&(a.push(u),i.dispatchCommand(us,!0));const c=l.pop();l.length===0&&i.dispatchCommand(ls,!1),o.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),Ee),r.registerCommand(Rf,()=>(El(e),!1),Ee),r.registerCommand(Mf,()=>(El(e),r.dispatchCommand(ls,!1),r.dispatchCommand(us,!1),!0),Ee),r.registerUpdateListener(({editorState:i,prevEditorState:o,dirtyLeaves:l,dirtyElements:a,tags:u})=>{const c=e.current,d=e.redoStack,f=e.undoStack,h=c===null?null:c.editorState;if(c!==null&&i===h)return;const g=n(o,i,c,l,a,u);if(g===ho)d.length!==0&&(e.redoStack=[],r.dispatchCommand(ls,!1)),c!==null&&(f.push({...c}),r.dispatchCommand(us,!0));else if(g===po)return;e.current={editor:r,editorState:i}}))}function jp(){return{current:null,redoStack:[],undoStack:[]}}function Lp({delay:r,externalHistoryState:e}){const[t]=Lt();return function(n,s,i=1e3){const o=b.useMemo(()=>s||jp(),[s]);b.useEffect(()=>Mp(n,o,i),[i,n,o])}(t,e,r),null}const Pp=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?b.useLayoutEffect:b.useEffect;function Op({ignoreHistoryMergeTagChange:r=!0,ignoreSelectionChange:e=!1,onChange:t}){const[n]=Lt();return Pp(()=>{if(t)return n.registerUpdateListener(({editorState:s,dirtyElements:i,dirtyLeaves:o,prevEditorState:l,tags:a})=>{e&&i.size===0&&o.size===0||r&&a.has("history-merge")||l.isEmpty()||t(s,n,a)})},[n,r,e,t]),null}function go(r,e){return go=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},go(r,e)}var kl={error:null},Ip=function(r){var e,t;function n(){for(var i,o=arguments.length,l=new Array(o),a=0;a<o;a++)l[a]=arguments[a];return(i=r.call.apply(r,[this].concat(l))||this).state=kl,i.resetErrorBoundary=function(){for(var u,c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];i.props.onReset==null||(u=i.props).onReset.apply(u,d),i.reset()},i}t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,go(e,t),n.getDerivedStateFromError=function(i){return{error:i}};var s=n.prototype;return s.reset=function(){this.setState(kl)},s.componentDidCatch=function(i,o){var l,a;(l=(a=this.props).onError)==null||l.call(a,i,o)},s.componentDidUpdate=function(i,o){var l,a,u,c,d=this.state.error,f=this.props.resetKeys;d!==null&&o.error!==null&&((u=i.resetKeys)===void 0&&(u=[]),(c=f)===void 0&&(c=[]),u.length!==c.length||u.some(function(h,g){return!Object.is(h,c[g])}))&&((l=(a=this.props).onResetKeysChange)==null||l.call(a,i.resetKeys,f),this.reset())},s.render=function(){var i=this.state.error,o=this.props,l=o.fallbackRender,a=o.FallbackComponent,u=o.fallback;if(i!==null){var c={error:i,resetErrorBoundary:this.resetErrorBoundary};if(Ei.isValidElement(u))return u;if(typeof l=="function")return l(c);if(a)return Ei.createElement(a,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(Ei.Component);function zp({children:r,onError:e}){return p.jsx(Ip,{fallback:p.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function $p(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Wt=$p(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function qp(r){let e=1,t=r.getParent();for(;t!=null;){if(Ie(t)){const n=t.getParent();if(Ce(n)){e++,t=n.getParent();continue}Wt(40)}return e}return e}function mo(r){let e=r.getParent();Ce(e)||Wt(40);let t=e;for(;t!==null;)t=t.getParent(),Ce(t)&&(e=t);return e}function Ac(r){let e=[];const t=r.getChildren().filter(Ie);for(let n=0;n<t.length;n++){const s=t[n],i=s.getFirstChild();Ce(i)?e=e.concat(Ac(i)):e.push(s)}return e}function Vt(r){return Ie(r)&&Ce(r.getFirstChild())}function Dl(r){return _t().append(r)}function Tc(r,e){return Ie(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function Al(r,e){r.update(()=>{const t=te();if(t!==null){const n=t.getNodes();if(z(t)){const i=t.getStartEndPoints();i===null&&Wt(143);const[o]=i,l=o.getNode(),a=l.getParent();if(Tc(l,n)){const u=yt(e);if(Kt(a)){l.replace(u);const c=_t();P(l)&&(c.setFormat(l.getFormatType()),c.setIndent(l.getIndent())),u.append(c)}else if(Ie(l)){const c=l.getParentOrThrow();Mr(u,c.getChildren()),c.replace(u)}return}}const s=new Set;for(let i=0;i<n.length;i++){const o=n[i];if(!P(o)||!o.isEmpty()||Ie(o)||s.has(o.getKey())){if(Ru(o)){let l=o.getParent();for(;l!=null;){const a=l.getKey();if(Ce(l)){if(!s.has(a)){const u=yt(e);Mr(u,l.getChildren()),l.replace(u),s.add(a)}break}{const u=l.getParent();if(Kt(u)&&!s.has(a)){s.add(a),Tl(l,e);break}l=u}}}}else Tl(o,e)}}})}function Mr(r,e){r.splice(r.getChildrenSize(),0,e)}function Tl(r,e){if(Ce(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=_t();let i;if(Mr(s,r.getChildren()),Ce(t)&&e===t.getListType())t.append(s),Ce(n)&&e===n.getListType()&&(Mr(t,n.getChildren()),n.remove()),i=t;else if(Ce(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),i=n;else{const o=yt(e);o.append(s),r.replace(o),i=o}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),i}function aa(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&Vt(t)&&Vt(n)&&(aa(t.getFirstChild(),n.getFirstChild()),n.remove());const s=e.getChildren();s.length>0&&r.append(...s),e.remove()}function Up(r){r.update(()=>{const e=te();if(z(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(Tc(s,n))t.add(mo(s));else for(let i=0;i<n.length;i++){const o=n[i];if(Ru(o)){const l=np(o,Or);l!=null&&t.add(mo(l))}}for(const i of t){let o=i;const l=Ac(i);for(const a of l){const u=He();Mr(u,a.getChildren()),o.insertAfter(u),o=u,a.__key===e.anchor.key&&e.anchor.set(u.getKey(),0,"element"),a.__key===e.focus.key&&e.focus.set(u.getKey(),0,"element"),a.remove()}i.remove()}}})}function Wp(r){const e=new Set;if(Vt(r)||e.has(r.getKey()))return;const t=r.getParent(),n=r.getNextSibling(),s=r.getPreviousSibling();if(Vt(n)&&Vt(s)){const i=s.getFirstChild();if(Ce(i)){i.append(r);const o=n.getFirstChild();Ce(o)&&(Mr(i,o.getChildren()),n.remove(),e.add(n.getKey()))}}else if(Vt(n)){const i=n.getFirstChild();if(Ce(i)){const o=i.getFirstChild();o!==null&&o.insertBefore(r)}}else if(Vt(s)){const i=s.getFirstChild();Ce(i)&&i.append(r)}else if(Ce(t)){const i=_t(),o=yt(t.getListType());i.append(o),o.append(r),s?s.insertAfter(i):n?n.insertBefore(i):t.append(i)}}function Vp(r){if(Vt(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(Ce(t?t.getParent():void 0)&&Ie(t)&&Ce(e)){const n=e?e.getFirstChild():void 0,s=e?e.getLastChild():void 0;if(r.is(n))t.insertBefore(r),e.isEmpty()&&t.remove();else if(r.is(s))t.insertAfter(r),e.isEmpty()&&t.remove();else{const i=e.getListType(),o=_t(),l=yt(i);o.append(l),r.getPreviousSiblings().forEach(c=>l.append(c));const a=_t(),u=yt(i);a.append(u),Mr(u,r.getNextSiblings()),t.insertBefore(o),t.insertAfter(a),t.replace(r)}}}function Hp(){const r=te();if(!z(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!Ie(e)||e.getChildrenSize()!==0)return!1;const t=mo(e),n=e.getParent();Ce(n)||Wt(40);const s=n.getParent();let i;if(Kt(s))i=He(),t.insertAfter(i);else{if(!Ie(s))return!1;i=_t(),s.insertAfter(i)}i.select();const o=e.getNextSiblings();if(o.length>0){const l=yt(n.getListType());if(tn(i))i.insertAfter(l);else{const a=_t();a.append(l),i.insertAfter(a)}o.forEach(a=>{a.remove(),l.append(a)})}return function(l){let a=l;for(;a.getNextSibling()==null&&a.getPreviousSibling()==null;){const u=a.getParent();if(u==null||!Ie(a)&&!Ce(a))break;a=u}a.remove()}(e),!0}function Gs(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}class Or extends lr{static getType(){return"listitem"}static clone(e){return new Or(e.__value,e.__checked,e.__key)}constructor(e,t,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}createDOM(e){const t=document.createElement("li"),n=this.getParent();return Ce(n)&&n.getListType()==="check"&&Nl(t,this,null),t.value=this.__value,Bl(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return Ce(s)&&s.getListType()==="check"&&Nl(t,this,e),t.value=this.__value,Bl(t,n.theme,this),!1}static transform(){return e=>{if(Ie(e)||Wt(144),e.__checked==null)return;const t=e.getParent();Ce(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:Gp,priority:0})}}static importJSON(e){const t=_t();return t.setChecked(e.checked),t.setValue(e.value),t.setFormat(e.format),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config);return t.style.textAlign=this.getFormatType(),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(P(n)&&this.canMergeWith(n)){const s=n.getChildren();this.append(...s),n.remove()}else super.append(n)}return this}replace(e,t){if(Ie(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!Ce(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=yt(n.getListType());let i=this.getNextSibling();for(;i;){const o=i;i=i.getNextSibling(),s.append(o)}n.insertAfter(e),e.insertAfter(s)}return t&&(P(e)||Wt(139),this.getChildren().forEach(s=>{e.append(s)})),this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(Ce(n)||Wt(39),Ie(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const i=yt(n.getListType());s.forEach(o=>i.append(o)),e.insertAfter(i,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&Vt(t)&&Vt(n)&&(aa(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=_t(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=He();this.getChildren().forEach(o=>t.append(o));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),i=Ie(s);if(n.getChildrenSize()===1)if(i)n.remove(),s.select();else{n.insertBefore(t),n.remove();const o=e.anchor,l=e.focus,a=t.getKey();o.type==="element"&&o.getNode().is(this)&&o.set(a,o.offset,"element"),l.type==="element"&&l.getNode().is(this)&&l.set(a,l.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){this.getWritable().__value=e}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return Ce(n)&&(t=n.getListType()),t==="check"?!!e.__checked:void 0}setChecked(e){this.getWritable().__checked=e}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){const e=this.getParent();if(e===null)return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;Ie(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&Wt(117),(e=Math.floor(e))>=0||Wt(199);let t=this.getIndent();for(;t!==e;)t<e?(Wp(this),t++):(Vp(this),t--);return this}canInsertAfter(e){return Ie(e)}canReplaceWith(e){return Ie(e)}canMergeWith(e){return tn(e)||Ie(e)}extractWithChild(e,t){if(!z(t))return!1;const n=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(s)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return yt("bullet")}canMergeWhenEmpty(){return!0}}function Bl(r,e,t){const n=[],s=[],i=e.list,o=i?i.listitem:void 0;let l;if(i&&i.nested&&(l=i.nested.listitem),o!==void 0&&n.push(...Gs(o)),i){const a=t.getParent(),u=Ce(a)&&a.getListType()==="check",c=t.getChecked();u&&!c||s.push(i.listitemUnchecked),u&&c||s.push(i.listitemChecked),u&&n.push(c?i.listitemChecked:i.listitemUnchecked)}if(l!==void 0){const a=Gs(l);t.getChildren().some(u=>Ce(u))?n.push(...a):s.push(...a)}s.length>0&&_c(r,...s),n.length>0&&ns(r,...n)}function Nl(r,e,t,n){Ce(e.getFirstChild())?(r.removeAttribute("role"),r.removeAttribute("tabIndex"),r.removeAttribute("aria-checked")):(r.setAttribute("role","checkbox"),r.setAttribute("tabIndex","-1"),t&&e.__checked===t.__checked||r.setAttribute("aria-checked",e.getChecked()?"true":"false"))}function Gp(r){if(r.classList.contains("task-list-item")){for(const t of r.children)if(t.tagName==="INPUT")return Kp(t)}const e=r.getAttribute("aria-checked");return{node:_t(e==="true"||e!=="false"&&void 0)}}function Kp(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:_t(r.hasAttribute("checked"))}}function _t(r){return Qt(new Or(void 0,r))}function Ie(r){return r instanceof Or}class ln extends lr{static getType(){return"list"}static clone(e){const t=e.__listType||Ml[e.__tag];return new ln(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=Ml[e]||e;this.__listType=s,this.__tag=s==="number"?"ol":"ul",this.__start=t}getTag(){return this.__tag}setListType(e){const t=this.getWritable();t.__listType=e,t.__tag=e==="number"?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(e,t){const n=this.__tag,s=document.createElement(n);return this.__start!==1&&s.setAttribute("start",String(this.__start)),s.__lexicalListType=this.__listType,Fl(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(Fl(t,n.theme,this),!1)}static transform(){return e=>{Ce(e)||Wt(163),function(t){const n=t.getNextSibling();Ce(n)&&t.getListType()===n.getListType()&&aa(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const i of t.getChildren())Ie(i)&&(i.getValue()!==s&&i.setValue(s),n&&i.getLatest().__checked!=null&&i.setChecked(void 0),Ce(i.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:Rl,priority:0}),ul:()=>({conversion:Rl,priority:0})}}static importJSON(e){const t=yt(e.listType,e.start);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config,e);return t&&or(t)&&(this.__start!==1&&t.setAttribute("start",String(this.__start)),this.__listType==="check"&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(Ie(n))super.append(n);else{const s=_t();if(Ce(n))s.append(n);else if(P(n))if(n.isInline())s.append(n);else{const i=Ke(n.getTextContent());s.append(i)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return Ie(e)}}function Fl(r,e,t){const n=[],s=[],i=e.list;if(i!==void 0){const o=i[`${t.__tag}Depth`]||[],l=qp(t)-1,a=l%o.length,u=o[a],c=i[t.__tag];let d;const f=i.nested,h=i.checklist;if(f!==void 0&&f.list&&(d=f.list),c!==void 0&&n.push(c),h!==void 0&&t.__listType==="check"&&n.push(h),u!==void 0){n.push(...Gs(u));for(let g=0;g<o.length;g++)g!==a&&s.push(t.__tag+g)}if(d!==void 0){const g=Gs(d);l>1?n.push(...g):s.push(...g)}}s.length>0&&_c(r,...s),n.length>0&&ns(r,...n)}function Yp(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(Ie(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(i=>{Ce(i)&&e.push(Dl(i))})}else e.push(Dl(n))}return e}function Rl(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=yt("number",r.start):e==="ul"&&(t=function(n){if(n.getAttribute("__lexicallisttype")==="check"||n.classList.contains("contains-task-list"))return!0;for(const s of n.childNodes)if(or(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?yt("check"):yt("bullet")),{after:Yp,node:t}}const Ml={ol:"number",ul:"bullet"};function yt(r,e=1){return Qt(new ln(r,e))}function Ce(r){return r instanceof ln}const Bc=Hn(),Nc=Hn(),Qp=Hn();function Xp(r){return Pr(r.registerCommand(Nc,()=>(Al(r,"number"),!0),Hr),r.registerCommand(Bc,()=>(Al(r,"bullet"),!0),Hr),r.registerCommand(Qp,()=>(Up(r),!0),Hr),r.registerCommand(Mn,()=>!!Hp(),Hr))}function Jp(){const[r]=Lt();return b.useEffect(()=>{if(!r.hasNodes([ln,Or]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[r]),function(e){b.useEffect(()=>Xp(e),[e])}(r),null}const Zp=new Set(["http:","https:","mailto:","sms:","tel:"]);class Ir extends lr{static getType(){return"link"}static clone(e){return new Ir(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},n){super(n);const{target:s=null,rel:i=null,title:o=null}=t;this.__url=e,this.__target=s,this.__rel=i,this.__title=o}createDOM(e){const t=document.createElement("a");return t.href=this.sanitizeUrl(this.__url),this.__target!==null&&(t.target=this.__target),this.__rel!==null&&(t.rel=this.__rel),this.__title!==null&&(t.title=this.__title),ns(t,e.theme.link),t}updateDOM(e,t,n){if(t instanceof HTMLAnchorElement){const s=this.__url,i=this.__target,o=this.__rel,l=this.__title;s!==e.__url&&(t.href=s),i!==e.__target&&(i?t.target=i:t.removeAttribute("target")),o!==e.__rel&&(o?t.rel=o:t.removeAttribute("rel")),l!==e.__title&&(l?t.title=l:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:eg,priority:1})}}static importJSON(e){const t=Ks(e.url,{rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}sanitizeUrl(e){try{const t=new URL(e);if(!Zp.has(t.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){this.getWritable().__title=e}insertNewAfter(e,t=!0){const n=Ks(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!z(t))return!1;const s=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(s)&&this.isParentOf(i)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function eg(r){let e=null;if(fh(r)){const t=r.textContent;(t!==null&&t!==""||r.children.length>0)&&(e=Ks(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function Ks(r,e){return Qt(new Ir(r,e))}function mn(r){return r instanceof Ir}class ss extends Ir{constructor(e,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new ss(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){const t=jl(e.url,{isUnlinked:e.isUnlinked,rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked,type:"autolink",version:1}}insertNewAfter(e,t=!0){const n=this.getParentOrThrow().insertNewAfter(e,t);if(P(n)){const s=jl(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function jl(r,e){return Qt(new ss(r,e))}function tg(r){return r instanceof ss}const Ll=Hn();function $i(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,i=te();if(!z(i))return;const o=i.extract();if(r===null)o.forEach(l=>{const a=yi(l,u=>!tg(u)&&mn(u));if(a){const u=a.getChildren();for(let c=0;c<u.length;c++)a.insertBefore(u[c]);a.remove()}});else{if(o.length===1){const u=function(c,d){let f=c;for(;f!==null&&f.getParent()!==null&&!d(f);)f=f.getParentOrThrow();return d(f)?f:null}(o[0],mn);if(u!==null)return u.setURL(r),t!==void 0&&u.setTarget(t),s!==null&&u.setRel(s),void(n!==void 0&&u.setTitle(n))}let l=null,a=null;o.forEach(u=>{const c=u.getParent();if(c!==a&&c!==null&&(!P(u)||u.isInline())){if(mn(c))return a=c,c.setURL(r),t!==void 0&&c.setTarget(t),s!==null&&a.setRel(s),void(n!==void 0&&a.setTitle(n));if(c.is(l)||(l=c,a=Ks(r,{rel:s,target:t,title:n}),mn(c)?u.getPreviousSibling()===null?c.insertBefore(a):c.insertAfter(a):u.insertBefore(a)),mn(u)){if(u.is(a))return;if(a!==null){const d=u.getChildren();for(let f=0;f<d.length;f++)a.append(d[f])}u.remove()}else a!==null&&a.append(u)}})}}function rg({validateUrl:r,attributes:e}){const[t]=Lt();return b.useEffect(()=>{if(!t.hasNodes([Ir]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Pr(t.registerCommand(Ll,n=>{if(n===null)return $i(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&($i(n,e),!0);{const{url:s,target:i,rel:o,title:l}=n;return $i(s,{...e,rel:o,target:i,title:l}),!0}},Hr),r!==void 0?t.registerCommand(si,n=>{const s=te();if(!z(s)||s.isCollapsed()||!gr(n,ClipboardEvent))return!1;const i=n;if(i.clipboardData===null)return!1;const o=i.clipboardData.getData("text");return!!r(o)&&!s.getNodes().some(l=>P(l))&&(t.dispatchCommand(Ll,{...e,url:o}),n.preventDefault(),!0)},Hr):()=>{})},[t,r,e]),null}function ng(r){if(r instanceof HTMLImageElement){const e=r.getAttribute("src")||"",t=r.getAttribute("alt")||"",n=r.getAttribute("width"),s=r.getAttribute("height");return{node:Fc({src:e,altText:t,width:n?parseInt(n,10):void 0,height:s?parseInt(s,10):void 0})}}return null}function sg({src:r,alt:e,width:t,height:n}){return p.jsx("img",{src:r,alt:e,width:t,height:n,style:{maxWidth:"100%",height:"auto",display:"block",margin:"8px 0",borderRadius:"4px"}})}class _i extends na{constructor(t,n,s,i,o){super(o);St(this,"__src");St(this,"__altText");St(this,"__width");St(this,"__height");this.__src=t,this.__altText=n||"",this.__width=s,this.__height=i}static getType(){return"image"}static clone(t){return new _i(t.__src,t.__altText,t.__width,t.__height,t.__key)}static importJSON(t){const{src:n,altText:s,width:i,height:o}=t;return Fc({src:n,altText:s,width:i,height:o})}exportJSON(){return{type:"image",version:1,src:this.__src,altText:this.__altText,width:this.__width,height:this.__height}}static importDOM(){return{img:()=>({conversion:ng,priority:0})}}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),this.__altText&&t.setAttribute("alt",this.__altText),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),t.style.maxWidth="100%",t.style.height="auto",{element:t}}createDOM(){const t=document.createElement("span");return t.style.display="inline-block",t}updateDOM(){return!1}decorate(){return p.jsx(sg,{src:this.__src,alt:this.__altText,width:this.__width,height:this.__height})}}function Fc(r){return new _i(r.src,r.altText,r.width,r.height)}var ig=Object.defineProperty,Ys=Object.getOwnPropertySymbols,Rc=Object.prototype.hasOwnProperty,Mc=Object.prototype.propertyIsEnumerable,Pl=(r,e,t)=>e in r?ig(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,yo=(r,e)=>{for(var t in e||(e={}))Rc.call(e,t)&&Pl(r,t,e[t]);if(Ys)for(var t of Ys(e))Mc.call(e,t)&&Pl(r,t,e[t]);return r},xo=(r,e)=>{var t={};for(var n in r)Rc.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&Ys)for(var n of Ys(r))e.indexOf(n)<0&&Mc.call(r,n)&&(t[n]=r[n]);return t};/**
74
96
  * @license QR Code generator library (TypeScript)
75
97
  * Copyright (c) Project Nayuki.
76
98
  * SPDX-License-Identifier: MIT
77
- */var _r;(r=>{const e=class ie{constructor(l,u,c,d){if(this.version=l,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],l<ie.MIN_VERSION||l>ie.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=l*4+17;let f=[];for(let p=0;p<this.size;p++)f.push(!1);for(let p=0;p<this.size;p++)this.modules.push(f.slice()),this.isFunction.push(f.slice());this.drawFunctionPatterns();const h=this.addEccAndInterleave(c);if(this.drawCodewords(h),d==-1){let p=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const y=this.getPenaltyScore();y<p&&(d=m,p=y),this.applyMask(m)}}s(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(l,u){const c=r.QrSegment.makeSegments(l);return ie.encodeSegments(c,u)}static encodeBinary(l,u){const c=r.QrSegment.makeBytes(l);return ie.encodeSegments([c],u)}static encodeSegments(l,u,c=1,d=40,f=-1,h=!0){if(!(ie.MIN_VERSION<=c&&c<=d&&d<=ie.MAX_VERSION)||f<-1||f>7)throw new RangeError("Invalid value");let p,m;for(p=c;;p++){const E=ie.getNumDataCodewords(p,u)*8,_=o.getTotalBits(l,p);if(_<=E){m=_;break}if(p>=d)throw new RangeError("Data too long")}for(const E of[ie.Ecc.MEDIUM,ie.Ecc.QUARTILE,ie.Ecc.HIGH])h&&m<=ie.getNumDataCodewords(p,E)*8&&(u=E);let y=[];for(const E of l){t(E.mode.modeBits,4,y),t(E.numChars,E.mode.numCharCountBits(p),y);for(const _ of E.getData())y.push(_)}s(y.length==m);const D=ie.getNumDataCodewords(p,u)*8;s(y.length<=D),t(0,Math.min(4,D-y.length),y),t(0,(8-y.length%8)%8,y),s(y.length%8==0);for(let E=236;y.length<D;E^=253)t(E,8,y);let x=[];for(;x.length*8<y.length;)x.push(0);return y.forEach((E,_)=>x[_>>>3]|=E<<7-(_&7)),new ie(p,u,x,f)}getModule(l,u){return 0<=l&&l<this.size&&0<=u&&u<this.size&&this.modules[u][l]}getModules(){return this.modules}drawFunctionPatterns(){for(let c=0;c<this.size;c++)this.setFunctionModule(6,c,c%2==0),this.setFunctionModule(c,6,c%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const l=this.getAlignmentPatternPositions(),u=l.length;for(let c=0;c<u;c++)for(let d=0;d<u;d++)c==0&&d==0||c==0&&d==u-1||c==u-1&&d==0||this.drawAlignmentPattern(l[c],l[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(l){const u=this.errorCorrectionLevel.formatBits<<3|l;let c=u;for(let f=0;f<10;f++)c=c<<1^(c>>>9)*1335;const d=(u<<10|c)^21522;s(d>>>15==0);for(let f=0;f<=5;f++)this.setFunctionModule(8,f,n(d,f));this.setFunctionModule(8,7,n(d,6)),this.setFunctionModule(8,8,n(d,7)),this.setFunctionModule(7,8,n(d,8));for(let f=9;f<15;f++)this.setFunctionModule(14-f,8,n(d,f));for(let f=0;f<8;f++)this.setFunctionModule(this.size-1-f,8,n(d,f));for(let f=8;f<15;f++)this.setFunctionModule(8,this.size-15+f,n(d,f));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let l=this.version;for(let c=0;c<12;c++)l=l<<1^(l>>>11)*7973;const u=this.version<<12|l;s(u>>>18==0);for(let c=0;c<18;c++){const d=n(u,c),f=this.size-11+c%3,h=Math.floor(c/3);this.setFunctionModule(f,h,d),this.setFunctionModule(h,f,d)}}drawFinderPattern(l,u){for(let c=-4;c<=4;c++)for(let d=-4;d<=4;d++){const f=Math.max(Math.abs(d),Math.abs(c)),h=l+d,p=u+c;0<=h&&h<this.size&&0<=p&&p<this.size&&this.setFunctionModule(h,p,f!=2&&f!=4)}}drawAlignmentPattern(l,u){for(let c=-2;c<=2;c++)for(let d=-2;d<=2;d++)this.setFunctionModule(l+d,u+c,Math.max(Math.abs(d),Math.abs(c))!=1)}setFunctionModule(l,u,c){this.modules[u][l]=c,this.isFunction[u][l]=!0}addEccAndInterleave(l){const u=this.version,c=this.errorCorrectionLevel;if(l.length!=ie.getNumDataCodewords(u,c))throw new RangeError("Invalid argument");const d=ie.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][u],f=ie.ECC_CODEWORDS_PER_BLOCK[c.ordinal][u],h=Math.floor(ie.getNumRawDataModules(u)/8),p=d-h%d,m=Math.floor(h/d);let y=[];const D=ie.reedSolomonComputeDivisor(f);for(let E=0,_=0;E<d;E++){let A=l.slice(_,_+m-f+(E<p?0:1));_+=A.length;const b=ie.reedSolomonComputeRemainder(A,D);E<p&&A.push(0),y.push(A.concat(b))}let x=[];for(let E=0;E<y[0].length;E++)y.forEach((_,A)=>{(E!=m-f||A>=p)&&x.push(_[E])});return s(x.length==h),x}drawCodewords(l){if(l.length!=Math.floor(ie.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let c=this.size-1;c>=1;c-=2){c==6&&(c=5);for(let d=0;d<this.size;d++)for(let f=0;f<2;f++){const h=c-f,m=(c+1&2)==0?this.size-1-d:d;!this.isFunction[m][h]&&u<l.length*8&&(this.modules[m][h]=n(l[u>>>3],7-(u&7)),u++)}}s(u==l.length*8)}applyMask(l){if(l<0||l>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let c=0;c<this.size;c++){let d;switch(l){case 0:d=(c+u)%2==0;break;case 1:d=u%2==0;break;case 2:d=c%3==0;break;case 3:d=(c+u)%3==0;break;case 4:d=(Math.floor(c/3)+Math.floor(u/2))%2==0;break;case 5:d=c*u%2+c*u%3==0;break;case 6:d=(c*u%2+c*u%3)%2==0;break;case 7:d=((c+u)%2+c*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][c]&&d&&(this.modules[u][c]=!this.modules[u][c])}}getPenaltyScore(){let l=0;for(let f=0;f<this.size;f++){let h=!1,p=0,m=[0,0,0,0,0,0,0];for(let y=0;y<this.size;y++)this.modules[f][y]==h?(p++,p==5?l+=ie.PENALTY_N1:p>5&&l++):(this.finderPenaltyAddHistory(p,m),h||(l+=this.finderPenaltyCountPatterns(m)*ie.PENALTY_N3),h=this.modules[f][y],p=1);l+=this.finderPenaltyTerminateAndCount(h,p,m)*ie.PENALTY_N3}for(let f=0;f<this.size;f++){let h=!1,p=0,m=[0,0,0,0,0,0,0];for(let y=0;y<this.size;y++)this.modules[y][f]==h?(p++,p==5?l+=ie.PENALTY_N1:p>5&&l++):(this.finderPenaltyAddHistory(p,m),h||(l+=this.finderPenaltyCountPatterns(m)*ie.PENALTY_N3),h=this.modules[y][f],p=1);l+=this.finderPenaltyTerminateAndCount(h,p,m)*ie.PENALTY_N3}for(let f=0;f<this.size-1;f++)for(let h=0;h<this.size-1;h++){const p=this.modules[f][h];p==this.modules[f][h+1]&&p==this.modules[f+1][h]&&p==this.modules[f+1][h+1]&&(l+=ie.PENALTY_N2)}let u=0;for(const f of this.modules)u=f.reduce((h,p)=>h+(p?1:0),u);const c=this.size*this.size,d=Math.ceil(Math.abs(u*20-c*10)/c)-1;return s(0<=d&&d<=9),l+=d*ie.PENALTY_N4,s(0<=l&&l<=2568888),l}getAlignmentPatternPositions(){if(this.version==1)return[];{const l=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(l*2-2))*2;let c=[6];for(let d=this.size-7;c.length<l;d-=u)c.splice(1,0,d);return c}}static getNumRawDataModules(l){if(l<ie.MIN_VERSION||l>ie.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*l+128)*l+64;if(l>=2){const c=Math.floor(l/7)+2;u-=(25*c-10)*c-55,l>=7&&(u-=36)}return s(208<=u&&u<=29648),u}static getNumDataCodewords(l,u){return Math.floor(ie.getNumRawDataModules(l)/8)-ie.ECC_CODEWORDS_PER_BLOCK[u.ordinal][l]*ie.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][l]}static reedSolomonComputeDivisor(l){if(l<1||l>255)throw new RangeError("Degree out of range");let u=[];for(let d=0;d<l-1;d++)u.push(0);u.push(1);let c=1;for(let d=0;d<l;d++){for(let f=0;f<u.length;f++)u[f]=ie.reedSolomonMultiply(u[f],c),f+1<u.length&&(u[f]^=u[f+1]);c=ie.reedSolomonMultiply(c,2)}return u}static reedSolomonComputeRemainder(l,u){let c=u.map(d=>0);for(const d of l){const f=d^c.shift();c.push(0),u.forEach((h,p)=>c[p]^=ie.reedSolomonMultiply(h,f))}return c}static reedSolomonMultiply(l,u){if(l>>>8||u>>>8)throw new RangeError("Byte out of range");let c=0;for(let d=7;d>=0;d--)c=c<<1^(c>>>7)*285,c^=(u>>>d&1)*l;return s(c>>>8==0),c}finderPenaltyCountPatterns(l){const u=l[1];s(u<=this.size*3);const c=u>0&&l[2]==u&&l[3]==u*3&&l[4]==u&&l[5]==u;return(c&&l[0]>=u*4&&l[6]>=u?1:0)+(c&&l[6]>=u*4&&l[0]>=u?1:0)}finderPenaltyTerminateAndCount(l,u,c){return l&&(this.finderPenaltyAddHistory(u,c),u=0),u+=this.size,this.finderPenaltyAddHistory(u,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(l,u){u[0]==0&&(l+=this.size),u.pop(),u.unshift(l)}};e.MIN_VERSION=1,e.MAX_VERSION=40,e.PENALTY_N1=3,e.PENALTY_N2=3,e.PENALTY_N3=40,e.PENALTY_N4=10,e.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],e.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],r.QrCode=e;function t(a,l,u){if(l<0||l>31||a>>>l)throw new RangeError("Value out of range");for(let c=l-1;c>=0;c--)u.push(a>>>c&1)}function n(a,l){return(a>>>l&1)!=0}function s(a){if(!a)throw new Error("Assertion error")}const i=class Le{constructor(l,u,c){if(this.mode=l,this.numChars=u,this.bitData=c,u<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}static makeBytes(l){let u=[];for(const c of l)t(c,8,u);return new Le(Le.Mode.BYTE,l.length,u)}static makeNumeric(l){if(!Le.isNumeric(l))throw new RangeError("String contains non-numeric characters");let u=[];for(let c=0;c<l.length;){const d=Math.min(l.length-c,3);t(parseInt(l.substring(c,c+d),10),d*3+1,u),c+=d}return new Le(Le.Mode.NUMERIC,l.length,u)}static makeAlphanumeric(l){if(!Le.isAlphanumeric(l))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],c;for(c=0;c+2<=l.length;c+=2){let d=Le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(c))*45;d+=Le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(c+1)),t(d,11,u)}return c<l.length&&t(Le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(c)),6,u),new Le(Le.Mode.ALPHANUMERIC,l.length,u)}static makeSegments(l){return l==""?[]:Le.isNumeric(l)?[Le.makeNumeric(l)]:Le.isAlphanumeric(l)?[Le.makeAlphanumeric(l)]:[Le.makeBytes(Le.toUtf8ByteArray(l))]}static makeEci(l){let u=[];if(l<0)throw new RangeError("ECI assignment value out of range");if(l<128)t(l,8,u);else if(l<16384)t(2,2,u),t(l,14,u);else if(l<1e6)t(6,3,u),t(l,21,u);else throw new RangeError("ECI assignment value out of range");return new Le(Le.Mode.ECI,0,u)}static isNumeric(l){return Le.NUMERIC_REGEX.test(l)}static isAlphanumeric(l){return Le.ALPHANUMERIC_REGEX.test(l)}getData(){return this.bitData.slice()}static getTotalBits(l,u){let c=0;for(const d of l){const f=d.mode.numCharCountBits(u);if(d.numChars>=1<<f)return 1/0;c+=4+f+d.bitData.length}return c}static toUtf8ByteArray(l){l=encodeURI(l);let u=[];for(let c=0;c<l.length;c++)l.charAt(c)!="%"?u.push(l.charCodeAt(c)):(u.push(parseInt(l.substring(c+1,c+3),16)),c+=2);return u}};i.NUMERIC_REGEX=/^[0-9]*$/,i.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,i.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let o=i;r.QrSegment=i})(_r||(_r={}));(r=>{(e=>{const t=class{constructor(s,i){this.ordinal=s,this.formatBits=i}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(r.QrCode||(r.QrCode={}))})(_r||(_r={}));(r=>{(e=>{const t=class{constructor(s,i){this.modeBits=s,this.numBitsCharCount=i}numCharCountBits(s){return this.numBitsCharCount[Math.floor((s+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(r.QrSegment||(r.QrSegment={}))})(_r||(_r={}));var Br=_r;/**
99
+ */var jr;(r=>{const e=class ye{constructor(a,u,c,d){if(this.version=a,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],a<ye.MIN_VERSION||a>ye.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=a*4+17;let f=[];for(let g=0;g<this.size;g++)f.push(!1);for(let g=0;g<this.size;g++)this.modules.push(f.slice()),this.isFunction.push(f.slice());this.drawFunctionPatterns();const h=this.addEccAndInterleave(c);if(this.drawCodewords(h),d==-1){let g=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const x=this.getPenaltyScore();x<g&&(d=m,g=x),this.applyMask(m)}}s(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(a,u){const c=r.QrSegment.makeSegments(a);return ye.encodeSegments(c,u)}static encodeBinary(a,u){const c=r.QrSegment.makeBytes(a);return ye.encodeSegments([c],u)}static encodeSegments(a,u,c=1,d=40,f=-1,h=!0){if(!(ye.MIN_VERSION<=c&&c<=d&&d<=ye.MAX_VERSION)||f<-1||f>7)throw new RangeError("Invalid value");let g,m;for(g=c;;g++){const C=ye.getNumDataCodewords(g,u)*8,S=o.getTotalBits(a,g);if(S<=C){m=S;break}if(g>=d)throw new RangeError("Data too long")}for(const C of[ye.Ecc.MEDIUM,ye.Ecc.QUARTILE,ye.Ecc.HIGH])h&&m<=ye.getNumDataCodewords(g,C)*8&&(u=C);let x=[];for(const C of a){t(C.mode.modeBits,4,x),t(C.numChars,C.mode.numCharCountBits(g),x);for(const S of C.getData())x.push(S)}s(x.length==m);const v=ye.getNumDataCodewords(g,u)*8;s(x.length<=v),t(0,Math.min(4,v-x.length),x),t(0,(8-x.length%8)%8,x),s(x.length%8==0);for(let C=236;x.length<v;C^=253)t(C,8,x);let _=[];for(;_.length*8<x.length;)_.push(0);return x.forEach((C,S)=>_[S>>>3]|=C<<7-(S&7)),new ye(g,u,_,f)}getModule(a,u){return 0<=a&&a<this.size&&0<=u&&u<this.size&&this.modules[u][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let c=0;c<this.size;c++)this.setFunctionModule(6,c,c%2==0),this.setFunctionModule(c,6,c%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),u=a.length;for(let c=0;c<u;c++)for(let d=0;d<u;d++)c==0&&d==0||c==0&&d==u-1||c==u-1&&d==0||this.drawAlignmentPattern(a[c],a[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const u=this.errorCorrectionLevel.formatBits<<3|a;let c=u;for(let f=0;f<10;f++)c=c<<1^(c>>>9)*1335;const d=(u<<10|c)^21522;s(d>>>15==0);for(let f=0;f<=5;f++)this.setFunctionModule(8,f,n(d,f));this.setFunctionModule(8,7,n(d,6)),this.setFunctionModule(8,8,n(d,7)),this.setFunctionModule(7,8,n(d,8));for(let f=9;f<15;f++)this.setFunctionModule(14-f,8,n(d,f));for(let f=0;f<8;f++)this.setFunctionModule(this.size-1-f,8,n(d,f));for(let f=8;f<15;f++)this.setFunctionModule(8,this.size-15+f,n(d,f));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let c=0;c<12;c++)a=a<<1^(a>>>11)*7973;const u=this.version<<12|a;s(u>>>18==0);for(let c=0;c<18;c++){const d=n(u,c),f=this.size-11+c%3,h=Math.floor(c/3);this.setFunctionModule(f,h,d),this.setFunctionModule(h,f,d)}}drawFinderPattern(a,u){for(let c=-4;c<=4;c++)for(let d=-4;d<=4;d++){const f=Math.max(Math.abs(d),Math.abs(c)),h=a+d,g=u+c;0<=h&&h<this.size&&0<=g&&g<this.size&&this.setFunctionModule(h,g,f!=2&&f!=4)}}drawAlignmentPattern(a,u){for(let c=-2;c<=2;c++)for(let d=-2;d<=2;d++)this.setFunctionModule(a+d,u+c,Math.max(Math.abs(d),Math.abs(c))!=1)}setFunctionModule(a,u,c){this.modules[u][a]=c,this.isFunction[u][a]=!0}addEccAndInterleave(a){const u=this.version,c=this.errorCorrectionLevel;if(a.length!=ye.getNumDataCodewords(u,c))throw new RangeError("Invalid argument");const d=ye.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][u],f=ye.ECC_CODEWORDS_PER_BLOCK[c.ordinal][u],h=Math.floor(ye.getNumRawDataModules(u)/8),g=d-h%d,m=Math.floor(h/d);let x=[];const v=ye.reedSolomonComputeDivisor(f);for(let C=0,S=0;C<d;C++){let D=a.slice(S,S+m-f+(C<g?0:1));S+=D.length;const w=ye.reedSolomonComputeRemainder(D,v);C<g&&D.push(0),x.push(D.concat(w))}let _=[];for(let C=0;C<x[0].length;C++)x.forEach((S,D)=>{(C!=m-f||D>=g)&&_.push(S[C])});return s(_.length==h),_}drawCodewords(a){if(a.length!=Math.floor(ye.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let c=this.size-1;c>=1;c-=2){c==6&&(c=5);for(let d=0;d<this.size;d++)for(let f=0;f<2;f++){const h=c-f,m=(c+1&2)==0?this.size-1-d:d;!this.isFunction[m][h]&&u<a.length*8&&(this.modules[m][h]=n(a[u>>>3],7-(u&7)),u++)}}s(u==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let c=0;c<this.size;c++){let d;switch(a){case 0:d=(c+u)%2==0;break;case 1:d=u%2==0;break;case 2:d=c%3==0;break;case 3:d=(c+u)%3==0;break;case 4:d=(Math.floor(c/3)+Math.floor(u/2))%2==0;break;case 5:d=c*u%2+c*u%3==0;break;case 6:d=(c*u%2+c*u%3)%2==0;break;case 7:d=((c+u)%2+c*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][c]&&d&&(this.modules[u][c]=!this.modules[u][c])}}getPenaltyScore(){let a=0;for(let f=0;f<this.size;f++){let h=!1,g=0,m=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[f][x]==h?(g++,g==5?a+=ye.PENALTY_N1:g>5&&a++):(this.finderPenaltyAddHistory(g,m),h||(a+=this.finderPenaltyCountPatterns(m)*ye.PENALTY_N3),h=this.modules[f][x],g=1);a+=this.finderPenaltyTerminateAndCount(h,g,m)*ye.PENALTY_N3}for(let f=0;f<this.size;f++){let h=!1,g=0,m=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[x][f]==h?(g++,g==5?a+=ye.PENALTY_N1:g>5&&a++):(this.finderPenaltyAddHistory(g,m),h||(a+=this.finderPenaltyCountPatterns(m)*ye.PENALTY_N3),h=this.modules[x][f],g=1);a+=this.finderPenaltyTerminateAndCount(h,g,m)*ye.PENALTY_N3}for(let f=0;f<this.size-1;f++)for(let h=0;h<this.size-1;h++){const g=this.modules[f][h];g==this.modules[f][h+1]&&g==this.modules[f+1][h]&&g==this.modules[f+1][h+1]&&(a+=ye.PENALTY_N2)}let u=0;for(const f of this.modules)u=f.reduce((h,g)=>h+(g?1:0),u);const c=this.size*this.size,d=Math.ceil(Math.abs(u*20-c*10)/c)-1;return s(0<=d&&d<=9),a+=d*ye.PENALTY_N4,s(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let c=[6];for(let d=this.size-7;c.length<a;d-=u)c.splice(1,0,d);return c}}static getNumRawDataModules(a){if(a<ye.MIN_VERSION||a>ye.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*a+128)*a+64;if(a>=2){const c=Math.floor(a/7)+2;u-=(25*c-10)*c-55,a>=7&&(u-=36)}return s(208<=u&&u<=29648),u}static getNumDataCodewords(a,u){return Math.floor(ye.getNumRawDataModules(a)/8)-ye.ECC_CODEWORDS_PER_BLOCK[u.ordinal][a]*ye.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let u=[];for(let d=0;d<a-1;d++)u.push(0);u.push(1);let c=1;for(let d=0;d<a;d++){for(let f=0;f<u.length;f++)u[f]=ye.reedSolomonMultiply(u[f],c),f+1<u.length&&(u[f]^=u[f+1]);c=ye.reedSolomonMultiply(c,2)}return u}static reedSolomonComputeRemainder(a,u){let c=u.map(d=>0);for(const d of a){const f=d^c.shift();c.push(0),u.forEach((h,g)=>c[g]^=ye.reedSolomonMultiply(h,f))}return c}static reedSolomonMultiply(a,u){if(a>>>8||u>>>8)throw new RangeError("Byte out of range");let c=0;for(let d=7;d>=0;d--)c=c<<1^(c>>>7)*285,c^=(u>>>d&1)*a;return s(c>>>8==0),c}finderPenaltyCountPatterns(a){const u=a[1];s(u<=this.size*3);const c=u>0&&a[2]==u&&a[3]==u*3&&a[4]==u&&a[5]==u;return(c&&a[0]>=u*4&&a[6]>=u?1:0)+(c&&a[6]>=u*4&&a[0]>=u?1:0)}finderPenaltyTerminateAndCount(a,u,c){return a&&(this.finderPenaltyAddHistory(u,c),u=0),u+=this.size,this.finderPenaltyAddHistory(u,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(a,u){u[0]==0&&(a+=this.size),u.pop(),u.unshift(a)}};e.MIN_VERSION=1,e.MAX_VERSION=40,e.PENALTY_N1=3,e.PENALTY_N2=3,e.PENALTY_N3=40,e.PENALTY_N4=10,e.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],e.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],r.QrCode=e;function t(l,a,u){if(a<0||a>31||l>>>a)throw new RangeError("Value out of range");for(let c=a-1;c>=0;c--)u.push(l>>>c&1)}function n(l,a){return(l>>>a&1)!=0}function s(l){if(!l)throw new Error("Assertion error")}const i=class Oe{constructor(a,u,c){if(this.mode=a,this.numChars=u,this.bitData=c,u<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}static makeBytes(a){let u=[];for(const c of a)t(c,8,u);return new Oe(Oe.Mode.BYTE,a.length,u)}static makeNumeric(a){if(!Oe.isNumeric(a))throw new RangeError("String contains non-numeric characters");let u=[];for(let c=0;c<a.length;){const d=Math.min(a.length-c,3);t(parseInt(a.substring(c,c+d),10),d*3+1,u),c+=d}return new Oe(Oe.Mode.NUMERIC,a.length,u)}static makeAlphanumeric(a){if(!Oe.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],c;for(c=0;c+2<=a.length;c+=2){let d=Oe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(c))*45;d+=Oe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(c+1)),t(d,11,u)}return c<a.length&&t(Oe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(c)),6,u),new Oe(Oe.Mode.ALPHANUMERIC,a.length,u)}static makeSegments(a){return a==""?[]:Oe.isNumeric(a)?[Oe.makeNumeric(a)]:Oe.isAlphanumeric(a)?[Oe.makeAlphanumeric(a)]:[Oe.makeBytes(Oe.toUtf8ByteArray(a))]}static makeEci(a){let u=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)t(a,8,u);else if(a<16384)t(2,2,u),t(a,14,u);else if(a<1e6)t(6,3,u),t(a,21,u);else throw new RangeError("ECI assignment value out of range");return new Oe(Oe.Mode.ECI,0,u)}static isNumeric(a){return Oe.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return Oe.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,u){let c=0;for(const d of a){const f=d.mode.numCharCountBits(u);if(d.numChars>=1<<f)return 1/0;c+=4+f+d.bitData.length}return c}static toUtf8ByteArray(a){a=encodeURI(a);let u=[];for(let c=0;c<a.length;c++)a.charAt(c)!="%"?u.push(a.charCodeAt(c)):(u.push(parseInt(a.substring(c+1,c+3),16)),c+=2);return u}};i.NUMERIC_REGEX=/^[0-9]*$/,i.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,i.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let o=i;r.QrSegment=i})(jr||(jr={}));(r=>{(e=>{const t=class{constructor(s,i){this.ordinal=s,this.formatBits=i}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(r.QrCode||(r.QrCode={}))})(jr||(jr={}));(r=>{(e=>{const t=class{constructor(s,i){this.modeBits=s,this.numBitsCharCount=i}numCharCountBits(s){return this.numBitsCharCount[Math.floor((s+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(r.QrSegment||(r.QrSegment={}))})(jr||(jr={}));var Gr=jr;/**
78
100
  * @license qrcode.react
79
101
  * Copyright (c) Paul O'Shannessy
80
102
  * SPDX-License-Identifier: ISC
81
- */var Tf={L:Br.QrCode.Ecc.LOW,M:Br.QrCode.Ecc.MEDIUM,Q:Br.QrCode.Ecc.QUARTILE,H:Br.QrCode.Ecc.HIGH},Ha=128,Qa="L",Ja="#FFFFFF",Ya="#000000",Xa=!1,Za=1,Nf=4,Bf=0,Ff=.1;function eu(r,e=0){const t=[];return r.forEach(function(n,s){let i=null;n.forEach(function(o,a){if(!o&&i!==null){t.push(`M${i+e} ${s+e}h${a-i}v1H${i+e}z`),i=null;return}if(a===n.length-1){if(!o)return;i===null?t.push(`M${a+e},${s+e} h1v1H${a+e}z`):t.push(`M${i+e},${s+e} h${a+1-i}v1H${i+e}z`);return}o&&i===null&&(i=a)})}),t.join("")}function tu(r,e){return r.slice().map((t,n)=>n<e.y||n>=e.y+e.h?t:t.map((s,i)=>i<e.x||i>=e.x+e.w?s:!1))}function Rf(r,e,t,n){if(n==null)return null;const s=r.length+t*2,i=Math.floor(e*Ff),o=s/e,a=(n.width||i)*o,l=(n.height||i)*o,u=n.x==null?r.length/2-a/2:n.x*o,c=n.y==null?r.length/2-l/2:n.y*o,d=n.opacity==null?1:n.opacity;let f=null;if(n.excavate){let p=Math.floor(u),m=Math.floor(c),y=Math.ceil(a+u-p),D=Math.ceil(l+c-m);f={x:p,y:m,w:y,h:D}}const h=n.crossOrigin;return{x:u,y:c,h:l,w:a,excavation:f,opacity:d,crossOrigin:h}}function Lf(r,e){return e!=null?Math.max(Math.floor(e),0):r?Nf:Bf}function ru({value:r,level:e,minVersion:t,includeMargin:n,marginSize:s,imageSettings:i,size:o,boostLevel:a}){let l=w.useMemo(()=>{const p=(Array.isArray(r)?r:[r]).reduce((m,y)=>(m.push(...Br.QrSegment.makeSegments(y)),m),[]);return Br.QrCode.encodeSegments(p,Tf[e],t,void 0,void 0,a)},[r,e,t,a]);const{cells:u,margin:c,numCells:d,calculatedImageSettings:f}=w.useMemo(()=>{let h=l.getModules();const p=Lf(n,s),m=h.length+p*2,y=Rf(h,o,p,i);return{cells:h,margin:p,numCells:m,calculatedImageSettings:y}},[l,o,i,n,s]);return{qrcode:l,margin:c,cells:u,numCells:d,calculatedImageSettings:f}}var Mf=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Pf=w.forwardRef(function(e,t){const n=e,{value:s,size:i=Ha,level:o=Qa,bgColor:a=Ja,fgColor:l=Ya,includeMargin:u=Xa,minVersion:c=Za,boostLevel:d,marginSize:f,imageSettings:h}=n,m=yi(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:y}=m,D=yi(m,["style"]),x=h==null?void 0:h.src,E=w.useRef(null),_=w.useRef(null),A=w.useCallback(R=>{E.current=R,typeof t=="function"?t(R):t&&(t.current=R)},[t]),[b,v]=w.useState(!1),{margin:S,cells:k,numCells:j,calculatedImageSettings:T}=ru({value:s,level:o,minVersion:c,boostLevel:d,includeMargin:u,marginSize:f,imageSettings:h,size:i});w.useEffect(()=>{if(E.current!=null){const R=E.current,P=R.getContext("2d");if(!P)return;let Q=k;const se=_.current,xe=T!=null&&se!==null&&se.complete&&se.naturalHeight!==0&&se.naturalWidth!==0;xe&&T.excavation!=null&&(Q=tu(k,T.excavation));const oe=window.devicePixelRatio||1;R.height=R.width=i*oe;const Se=i/j*oe;P.scale(Se,Se),P.fillStyle=a,P.fillRect(0,0,j,j),P.fillStyle=l,Mf?P.fill(new Path2D(eu(Q,S))):k.forEach(function(he,fe){he.forEach(function(pe,ge){pe&&P.fillRect(ge+S,fe+S,1,1)})}),T&&(P.globalAlpha=T.opacity),xe&&P.drawImage(se,T.x+S,T.y+S,T.w,T.h)}}),w.useEffect(()=>{v(!1)},[x]);const B=mi({height:i,width:i},y);let L=null;return x!=null&&(L=w.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{v(!0)},ref:_,crossOrigin:T==null?void 0:T.crossOrigin})),w.createElement(w.Fragment,null,w.createElement("canvas",mi({style:B,height:i,width:i,ref:A,role:"img"},D)),L)});Pf.displayName="QRCodeCanvas";var nu=w.forwardRef(function(e,t){const n=e,{value:s,size:i=Ha,level:o=Qa,bgColor:a=Ja,fgColor:l=Ya,includeMargin:u=Xa,minVersion:c=Za,boostLevel:d,title:f,marginSize:h,imageSettings:p}=n,m=yi(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:y,cells:D,numCells:x,calculatedImageSettings:E}=ru({value:s,level:o,minVersion:c,boostLevel:d,includeMargin:u,marginSize:h,imageSettings:p,size:i});let _=D,A=null;p!=null&&E!=null&&(E.excavation!=null&&(_=tu(D,E.excavation)),A=w.createElement("image",{href:p.src,height:E.h,width:E.w,x:E.x+y,y:E.y+y,preserveAspectRatio:"none",opacity:E.opacity,crossOrigin:E.crossOrigin}));const b=eu(_,y);return w.createElement("svg",mi({height:i,width:i,viewBox:`0 0 ${x} ${x}`,ref:t,role:"img"},m),!!f&&w.createElement("title",null,f),w.createElement("path",{fill:a,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),w.createElement("path",{fill:l,d:b,shapeRendering:"crispEdges"}),A)});nu.displayName="QRCodeSVG";function jf(r){if(r instanceof HTMLElement&&r.dataset.qrcodeData){const e=r.dataset.qrcodeData,t=r.dataset.qrcodeSize?parseInt(r.dataset.qrcodeSize,10):void 0;return{node:Qi({data:e,size:t})}}return null}function Of({data:r,size:e=150}){return g.jsx("div",{style:{display:"inline-block",background:"#f9f9f9",padding:"12px",borderRadius:"8px",margin:"8px 0"},children:g.jsx(nu,{value:r,size:e,level:"M"})})}class Ur extends Wi{constructor(t,n=150,s){super(s);_t(this,"__data");_t(this,"__size");this.__data=t,this.__size=n}static getType(){return"qrcode"}static clone(t){return new Ur(t.__data,t.__size,t.__key)}static importJSON(t){const{data:n,size:s}=t;return Qi({data:n,size:s})}exportJSON(){return{type:"qrcode",version:1,data:this.__data,size:this.__size}}static importDOM(){return{div:t=>t.dataset.qrcodeData?{conversion:jf,priority:1}:null}}exportDOM(){const t=document.createElement("div");return t.dataset.qrcodeData=this.__data,t.dataset.qrcodeSize=String(this.__size),t.style.display="inline-block",t.style.background="#f9f9f9",t.style.padding="12px",t.style.borderRadius="8px",t.textContent="[QR Code]",{element:t}}createDOM(){const t=document.createElement("span");return t.style.display="inline-block",t}updateDOM(){return!1}decorate(){return g.jsx(Of,{data:this.__data,size:this.__size})}getData(){return this.__data}getSize(){return this.__size}}function Qi(r){return new Ur(r.data,r.size)}function If(r){return r instanceof Ur}const $f={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6"},zf={paragraph:"mail-editor-paragraph",text:{bold:"mail-editor-bold",italic:"mail-editor-italic",underline:"mail-editor-underline"},list:{ul:"mail-editor-ul",ol:"mail-editor-ol",listitem:"mail-editor-li"},link:"mail-editor-link",quote:"mail-editor-quote",heading:{h1:"mail-editor-h1",h2:"mail-editor-h2",h3:"mail-editor-h3"}};function qf({theme:r,disabled:e,onAiRestructure:t,onAiProofread:n,onAiRewrite:s,aiProcessing:i,aiProcessingAction:o,onAiAction:a,hasContent:l}){const[u]=St(),[c,d]=w.useState(!1),f=w.useRef(null),h=t||n||s,p=w.useCallback(()=>{u.dispatchCommand(Dt,"bold")},[u]),m=w.useCallback(()=>{u.dispatchCommand(Dt,"italic")},[u]),y=w.useCallback(()=>{u.dispatchCommand(Dt,"underline")},[u]),D=w.useCallback(()=>{u.dispatchCommand(Ua,void 0)},[u]),x=w.useCallback(()=>{u.dispatchCommand(Wa,void 0)},[u]),E=w.useCallback(()=>{u.update(()=>{const v=K();O(v)&&bd(v,()=>Ki())})},[u]),_={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",borderRadius:"4px",cursor:e?"not-allowed":"pointer",color:e?r.textSecondary:r.text,fontSize:"14px",fontWeight:600,opacity:e?.5:1},A=`
103
+ */var og={L:Gr.QrCode.Ecc.LOW,M:Gr.QrCode.Ecc.MEDIUM,Q:Gr.QrCode.Ecc.QUARTILE,H:Gr.QrCode.Ecc.HIGH},jc=128,Lc="L",Pc="#FFFFFF",Oc="#000000",Ic=!1,zc=1,ag=4,lg=0,ug=.1;function $c(r,e=0){const t=[];return r.forEach(function(n,s){let i=null;n.forEach(function(o,l){if(!o&&i!==null){t.push(`M${i+e} ${s+e}h${l-i}v1H${i+e}z`),i=null;return}if(l===n.length-1){if(!o)return;i===null?t.push(`M${l+e},${s+e} h1v1H${l+e}z`):t.push(`M${i+e},${s+e} h${l+1-i}v1H${i+e}z`);return}o&&i===null&&(i=l)})}),t.join("")}function qc(r,e){return r.slice().map((t,n)=>n<e.y||n>=e.y+e.h?t:t.map((s,i)=>i<e.x||i>=e.x+e.w?s:!1))}function cg(r,e,t,n){if(n==null)return null;const s=r.length+t*2,i=Math.floor(e*ug),o=s/e,l=(n.width||i)*o,a=(n.height||i)*o,u=n.x==null?r.length/2-l/2:n.x*o,c=n.y==null?r.length/2-a/2:n.y*o,d=n.opacity==null?1:n.opacity;let f=null;if(n.excavate){let g=Math.floor(u),m=Math.floor(c),x=Math.ceil(l+u-g),v=Math.ceil(a+c-m);f={x:g,y:m,w:x,h:v}}const h=n.crossOrigin;return{x:u,y:c,h:a,w:l,excavation:f,opacity:d,crossOrigin:h}}function dg(r,e){return e!=null?Math.max(Math.floor(e),0):r?ag:lg}function Uc({value:r,level:e,minVersion:t,includeMargin:n,marginSize:s,imageSettings:i,size:o,boostLevel:l}){let a=b.useMemo(()=>{const g=(Array.isArray(r)?r:[r]).reduce((m,x)=>(m.push(...Gr.QrSegment.makeSegments(x)),m),[]);return Gr.QrCode.encodeSegments(g,og[e],t,void 0,void 0,l)},[r,e,t,l]);const{cells:u,margin:c,numCells:d,calculatedImageSettings:f}=b.useMemo(()=>{let h=a.getModules();const g=dg(n,s),m=h.length+g*2,x=cg(h,o,g,i);return{cells:h,margin:g,numCells:m,calculatedImageSettings:x}},[a,o,i,n,s]);return{qrcode:a,margin:c,cells:u,numCells:d,calculatedImageSettings:f}}var fg=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),hg=b.forwardRef(function(e,t){const n=e,{value:s,size:i=jc,level:o=Lc,bgColor:l=Pc,fgColor:a=Oc,includeMargin:u=Ic,minVersion:c=zc,boostLevel:d,marginSize:f,imageSettings:h}=n,m=xo(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:x}=m,v=xo(m,["style"]),_=h==null?void 0:h.src,C=b.useRef(null),S=b.useRef(null),D=b.useCallback(E=>{C.current=E,typeof t=="function"?t(E):t&&(t.current=E)},[t]),[w,y]=b.useState(!1),{margin:k,cells:B,numCells:F,calculatedImageSettings:T}=Uc({value:s,level:o,minVersion:c,boostLevel:d,includeMargin:u,marginSize:f,imageSettings:h,size:i});b.useEffect(()=>{if(C.current!=null){const E=C.current,N=E.getContext("2d");if(!N)return;let R=B;const O=S.current,H=T!=null&&O!==null&&O.complete&&O.naturalHeight!==0&&O.naturalWidth!==0;H&&T.excavation!=null&&(R=qc(B,T.excavation));const U=window.devicePixelRatio||1;E.height=E.width=i*U;const Z=i/F*U;N.scale(Z,Z),N.fillStyle=l,N.fillRect(0,0,F,F),N.fillStyle=a,fg?N.fill(new Path2D($c(R,k))):B.forEach(function(q,K){q.forEach(function($,re){$&&N.fillRect(re+k,K+k,1,1)})}),T&&(N.globalAlpha=T.opacity),H&&N.drawImage(O,T.x+k,T.y+k,T.w,T.h)}}),b.useEffect(()=>{y(!1)},[_]);const M=yo({height:i,width:i},x);let L=null;return _!=null&&(L=b.createElement("img",{src:_,key:_,style:{display:"none"},onLoad:()=>{y(!0)},ref:S,crossOrigin:T==null?void 0:T.crossOrigin})),b.createElement(b.Fragment,null,b.createElement("canvas",yo({style:M,height:i,width:i,ref:D,role:"img"},v)),L)});hg.displayName="QRCodeCanvas";var Wc=b.forwardRef(function(e,t){const n=e,{value:s,size:i=jc,level:o=Lc,bgColor:l=Pc,fgColor:a=Oc,includeMargin:u=Ic,minVersion:c=zc,boostLevel:d,title:f,marginSize:h,imageSettings:g}=n,m=xo(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:x,cells:v,numCells:_,calculatedImageSettings:C}=Uc({value:s,level:o,minVersion:c,boostLevel:d,includeMargin:u,marginSize:h,imageSettings:g,size:i});let S=v,D=null;g!=null&&C!=null&&(C.excavation!=null&&(S=qc(v,C.excavation)),D=b.createElement("image",{href:g.src,height:C.h,width:C.w,x:C.x+x,y:C.y+x,preserveAspectRatio:"none",opacity:C.opacity,crossOrigin:C.crossOrigin}));const w=$c(S,x);return b.createElement("svg",yo({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:"img"},m),!!f&&b.createElement("title",null,f),b.createElement("path",{fill:l,d:`M0,0 h${_}v${_}H0z`,shapeRendering:"crispEdges"}),b.createElement("path",{fill:a,d:w,shapeRendering:"crispEdges"}),D)});Wc.displayName="QRCodeSVG";function pg(r){if(r instanceof HTMLElement&&r.dataset.qrcodeData){const e=r.dataset.qrcodeData,t=r.dataset.qrcodeSize?parseInt(r.dataset.qrcodeSize,10):void 0;return{node:la({data:e,size:t})}}return null}function gg({data:r,size:e=150}){return p.jsx("div",{style:{display:"inline-block",background:"#f9f9f9",padding:"12px",borderRadius:"8px",margin:"8px 0"},children:p.jsx(Wc,{value:r,size:e,level:"M"})})}class un extends na{constructor(t,n=150,s){super(s);St(this,"__data");St(this,"__size");this.__data=t,this.__size=n}static getType(){return"qrcode"}static clone(t){return new un(t.__data,t.__size,t.__key)}static importJSON(t){const{data:n,size:s}=t;return la({data:n,size:s})}exportJSON(){return{type:"qrcode",version:1,data:this.__data,size:this.__size}}static importDOM(){return{div:t=>t.dataset.qrcodeData?{conversion:pg,priority:1}:null}}exportDOM(){const t=document.createElement("div");return t.dataset.qrcodeData=this.__data,t.dataset.qrcodeSize=String(this.__size),t.style.display="inline-block",t.style.background="#f9f9f9",t.style.padding="12px",t.style.borderRadius="8px",t.textContent="[QR Code]",{element:t}}createDOM(){const t=document.createElement("span");return t.style.display="inline-block",t}updateDOM(){return!1}decorate(){return p.jsx(gg,{data:this.__data,size:this.__size})}getData(){return this.__data}getSize(){return this.__size}}function la(r){return new un(r.data,r.size)}function mg(r){return r instanceof un}const yg={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6"},xg={paragraph:"mail-editor-paragraph",text:{bold:"mail-editor-bold",italic:"mail-editor-italic",underline:"mail-editor-underline"},list:{ul:"mail-editor-ul",ol:"mail-editor-ol",listitem:"mail-editor-li"},link:"mail-editor-link",quote:"mail-editor-quote",heading:{h1:"mail-editor-h1",h2:"mail-editor-h2",h3:"mail-editor-h3"}};function bg({theme:r,disabled:e,onAiRestructure:t,onAiProofread:n,onAiRewrite:s,aiProcessing:i,aiProcessingAction:o,onAiAction:l,hasContent:a}){const[u]=Lt(),[c,d]=b.useState(!1),f=b.useRef(null),h=t||n||s,g=b.useCallback(()=>{u.dispatchCommand(Mt,"bold")},[u]),m=b.useCallback(()=>{u.dispatchCommand(Mt,"italic")},[u]),x=b.useCallback(()=>{u.dispatchCommand(Mt,"underline")},[u]),v=b.useCallback(()=>{u.dispatchCommand(Bc,void 0)},[u]),_=b.useCallback(()=>{u.dispatchCommand(Nc,void 0)},[u]),C=b.useCallback(()=>{u.update(()=>{const y=te();z(y)&&Xh(y,()=>oa())})},[u]),S={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",borderRadius:"4px",cursor:e?"not-allowed":"pointer",color:e?r.textSecondary:r.text,fontSize:"14px",fontWeight:600,opacity:e?.5:1},D=`
82
104
  .mail-editor-toolbar-btn:hover:not(:disabled) {
83
105
  background: ${r.border};
84
106
  }
85
- `,b=()=>{setTimeout(()=>{var v;(v=f.current)!=null&&v.contains(document.activeElement)||d(!1)},150)};return g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px",borderBottom:`1px solid ${r.border}`,background:r.toolbarBackground},children:[g.jsx("style",{children:A}),g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px"},children:[g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:p,disabled:e,style:_,title:"Bold (Ctrl+B)",children:"B"}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:m,disabled:e,style:{..._,fontStyle:"italic"},title:"Italic (Ctrl+I)",children:"I"}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:y,disabled:e,style:{..._,textDecoration:"underline"},title:"Underline (Ctrl+U)",children:"U"}),g.jsx("div",{style:{width:"1px",height:"20px",background:r.border,margin:"0 6px"}}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:D,disabled:e,style:_,title:"Bullet List",children:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[g.jsx("circle",{cx:"4",cy:"6",r:"2"}),g.jsx("circle",{cx:"4",cy:"12",r:"2"}),g.jsx("circle",{cx:"4",cy:"18",r:"2"}),g.jsx("rect",{x:"8",y:"5",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"11",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"17",width:"14",height:"2"})]})}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:x,disabled:e,style:_,title:"Numbered List",children:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[g.jsx("text",{x:"2",y:"8",fontSize:"8",fontFamily:"sans-serif",children:"1"}),g.jsx("text",{x:"2",y:"14",fontSize:"8",fontFamily:"sans-serif",children:"2"}),g.jsx("text",{x:"2",y:"20",fontSize:"8",fontFamily:"sans-serif",children:"3"}),g.jsx("rect",{x:"8",y:"5",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"11",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"17",width:"14",height:"2"})]})}),g.jsx("div",{style:{width:"1px",height:"20px",background:r.border,margin:"0 6px"}}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:E,disabled:e,style:_,title:"Quote",children:g.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:g.jsx("path",{d:"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"})})})]}),h&&g.jsxs("div",{style:{position:"relative"},ref:f,children:[g.jsx("button",{type:"button",onClick:()=>d(!c),disabled:i||!l||e,onBlur:b,style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",fontSize:"13px",color:i||!l?r.textSecondary:"#9333ea",background:"transparent",border:"none",borderRadius:"4px",cursor:i||!l||e?"not-allowed":"pointer",opacity:i||!l?.5:1},children:i?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"material-icons",style:{fontSize:"16px",animation:"spin 1s linear infinite"},children:"hourglass_empty"}),o==="restructure"&&"Restructuring...",o==="proofread"&&"Proofreading...",o==="rewrite"&&"Rewriting..."]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"material-icons",style:{fontSize:"16px"},children:"auto_fix_high"}),"AI",g.jsx("span",{className:"material-icons",style:{fontSize:"14px"},children:"expand_more"})]})}),c&&!i&&g.jsxs("div",{style:{position:"absolute",right:0,top:"100%",marginTop:"4px",background:"#ffffff",border:"1px solid #e5e7eb",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",zIndex:50,minWidth:"200px",padding:"4px 0"},children:[t&&g.jsxs("button",{type:"button",onClick:()=>{a==null||a("restructure"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:v=>v.currentTarget.style.background="#f3f4f6",onMouseLeave:v=>v.currentTarget.style.background="transparent",children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#3b82f6"},children:"format_list_bulleted"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontWeight:500},children:"Restructure"}),g.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Organize & clarify"})]})]}),n&&g.jsxs("button",{type:"button",onClick:()=>{a==null||a("proofread"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:v=>v.currentTarget.style.background="#f3f4f6",onMouseLeave:v=>v.currentTarget.style.background="transparent",children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#22c55e"},children:"spellcheck"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontWeight:500},children:"Proofread"}),g.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Fix grammar & spelling"})]})]}),s&&g.jsxs("button",{type:"button",onClick:()=>{a==null||a("rewrite"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:v=>v.currentTarget.style.background="#f3f4f6",onMouseLeave:v=>v.currentTarget.style.background="transparent",children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#9333ea"},children:"brush"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontWeight:500},children:"Rewrite"}),g.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Your voice & style"})]})]})]})]})]})}function Uf({html:r,isExternalUpdate:e,onImportComplete:t}){const[n]=St(),s=w.useRef(!1);return w.useEffect(()=>{r&&(s.current&&!e||(s.current=!0,n.update(()=>{const i=Fe();i.clear();const o=Ue();i.append(o),o.select();const l=new DOMParser().parseFromString(r,"text/html"),c=La(n,l).filter(d=>d.getParent()===null);c.length>0&&ba(c),o.getTextContent()===""&&i.getChildrenSize()>1&&o.remove(),i.selectEnd()},{discrete:!0}),t(),setTimeout(()=>{n.focus()},0)))},[r,e,n,t]),null}function Wf({text:r,trigger:e}){const[t]=St(),n=w.useRef(void 0);return w.useEffect(()=>{if(e===void 0||e===n.current||!r)return;n.current=e;const s=r.trim();s&&(t.update(()=>{const i=K();if(O(i))i.insertText(s);else{const o=Fe(),a=o.getLastChild();if(a){a.selectEnd();const l=K();O(l)&&l.insertText(s)}else{const l=Ue(),u=Ge(s);l.append(u),o.append(l)}}}),setTimeout(()=>{t.focus()},0))},[r,e,t]),null}function Gf({replyTo:r,theme:e}){const t=n=>{try{return new Date(n).toLocaleString()}catch{return n}};return g.jsxs("div",{style:{marginTop:"16px",paddingTop:"16px",borderTop:`1px solid ${e.border}`},children:[g.jsxs("div",{style:{fontSize:"12px",color:e.textSecondary,marginBottom:"8px"},children:["On ",t(r.date),", ",r.from," wrote:"]}),g.jsx("blockquote",{style:{margin:0,padding:"12px 16px",borderLeft:`3px solid ${e.quoteBorder}`,background:e.quoteBackground,fontSize:"14px",color:e.textSecondary,maxHeight:"200px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:r.body}})]})}function su({value:r="",onChange:e,placeholder:t="Write your message...",replyTo:n,theme:s={},disabled:i=!1,className:o="",minHeight:a="200px",externalUpdate:l,insertText:u,insertTextTrigger:c,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:p,aiProcessingAction:m,renderAboveToolbar:y}){const D={...$f,...s},[x,E]=w.useState(!1),_=w.useRef(void 0),[A,b]=w.useState(r),[v,S]=w.useState(!1),[k,j]=w.useState(null),T=p??v,B=m??k;w.useEffect(()=>{l!==void 0&&l!==_.current&&(_.current=l,E(!0))},[l]);const L=w.useCallback(()=>{E(!1)},[]),R=he=>he.replace(/<[^>]*>/g,"").trim(),P=he=>he.split(`
86
- `).map(fe=>`<p>${fe||"<br>"}</p>`).join(""),Q=async he=>{const fe=R(A);if(!fe)return;const pe=he==="restructure"?d:he==="proofread"?f:h;if(pe){S(!0),j(he);try{const ge=await pe(fe),Ae=P(ge);b(Ae),e==null||e(Ae),_.current=Date.now(),E(!0)}catch(ge){console.error(`AI ${he} failed:`,ge)}finally{S(!1),j(null)}}},se=R(A).length>0,xe={namespace:"MailEditor",theme:zf,onError:he=>{console.error("Lexical error:",he)},nodes:[qr,Cr,wr,Nn,As,Ss,ks,Ur],editable:!i},oe=w.useCallback((he,fe)=>{he.read(()=>{const pe=Ma(fe,null);b(pe),e==null||e(pe)})},[e]),Se=`
107
+ `,w=()=>{setTimeout(()=>{var y;(y=f.current)!=null&&y.contains(document.activeElement)||d(!1)},150)};return p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px",borderBottom:`1px solid ${r.border}`,background:r.toolbarBackground},children:[p.jsx("style",{children:D}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px"},children:[p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:g,disabled:e,style:S,title:"Bold (Ctrl+B)",children:"B"}),p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:m,disabled:e,style:{...S,fontStyle:"italic"},title:"Italic (Ctrl+I)",children:"I"}),p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:x,disabled:e,style:{...S,textDecoration:"underline"},title:"Underline (Ctrl+U)",children:"U"}),p.jsx("div",{style:{width:"1px",height:"20px",background:r.border,margin:"0 6px"}}),p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:v,disabled:e,style:S,title:"Bullet List",children:p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("circle",{cx:"4",cy:"6",r:"2"}),p.jsx("circle",{cx:"4",cy:"12",r:"2"}),p.jsx("circle",{cx:"4",cy:"18",r:"2"}),p.jsx("rect",{x:"8",y:"5",width:"14",height:"2"}),p.jsx("rect",{x:"8",y:"11",width:"14",height:"2"}),p.jsx("rect",{x:"8",y:"17",width:"14",height:"2"})]})}),p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:_,disabled:e,style:S,title:"Numbered List",children:p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("text",{x:"2",y:"8",fontSize:"8",fontFamily:"sans-serif",children:"1"}),p.jsx("text",{x:"2",y:"14",fontSize:"8",fontFamily:"sans-serif",children:"2"}),p.jsx("text",{x:"2",y:"20",fontSize:"8",fontFamily:"sans-serif",children:"3"}),p.jsx("rect",{x:"8",y:"5",width:"14",height:"2"}),p.jsx("rect",{x:"8",y:"11",width:"14",height:"2"}),p.jsx("rect",{x:"8",y:"17",width:"14",height:"2"})]})}),p.jsx("div",{style:{width:"1px",height:"20px",background:r.border,margin:"0 6px"}}),p.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:C,disabled:e,style:S,title:"Quote",children:p.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:p.jsx("path",{d:"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"})})})]}),h&&p.jsxs("div",{style:{position:"relative"},ref:f,children:[p.jsx("button",{type:"button",onClick:()=>d(!c),disabled:i||!a||e,onBlur:w,style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",fontSize:"13px",color:i||!a?r.textSecondary:"#9333ea",background:"transparent",border:"none",borderRadius:"4px",cursor:i||!a||e?"not-allowed":"pointer",opacity:i||!a?.5:1},children:i?p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"material-icons",style:{fontSize:"16px",animation:"spin 1s linear infinite"},children:"hourglass_empty"}),o==="restructure"&&"Restructuring...",o==="proofread"&&"Proofreading...",o==="rewrite"&&"Rewriting..."]}):p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"material-icons",style:{fontSize:"16px"},children:"auto_fix_high"}),"AI",p.jsx("span",{className:"material-icons",style:{fontSize:"14px"},children:"expand_more"})]})}),c&&!i&&p.jsxs("div",{style:{position:"absolute",right:0,top:"100%",marginTop:"4px",background:"#ffffff",border:"1px solid #e5e7eb",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",zIndex:50,minWidth:"200px",padding:"4px 0"},children:[t&&p.jsxs("button",{type:"button",onClick:()=>{l==null||l("restructure"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:y=>y.currentTarget.style.background="#f3f4f6",onMouseLeave:y=>y.currentTarget.style.background="transparent",children:[p.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#3b82f6"},children:"format_list_bulleted"}),p.jsxs("div",{children:[p.jsx("div",{style:{fontWeight:500},children:"Restructure"}),p.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Organize & clarify"})]})]}),n&&p.jsxs("button",{type:"button",onClick:()=>{l==null||l("proofread"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:y=>y.currentTarget.style.background="#f3f4f6",onMouseLeave:y=>y.currentTarget.style.background="transparent",children:[p.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#22c55e"},children:"spellcheck"}),p.jsxs("div",{children:[p.jsx("div",{style:{fontWeight:500},children:"Proofread"}),p.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Fix grammar & spelling"})]})]}),s&&p.jsxs("button",{type:"button",onClick:()=>{l==null||l("rewrite"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:y=>y.currentTarget.style.background="#f3f4f6",onMouseLeave:y=>y.currentTarget.style.background="transparent",children:[p.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#9333ea"},children:"brush"}),p.jsxs("div",{children:[p.jsx("div",{style:{fontWeight:500},children:"Rewrite"}),p.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Your voice & style"})]})]})]})]})]})}function _g({html:r,isExternalUpdate:e,onImportComplete:t}){const[n]=Lt(),s=b.useRef(!1);return b.useEffect(()=>{r&&(s.current&&!e||(s.current=!0,n.update(()=>{const i=Pe();i.clear();const o=He();i.append(o),o.select();const a=new DOMParser().parseFromString(r,"text/html"),c=vc(n,a).filter(d=>d.getParent()===null);c.length>0&&oc(c),o.getTextContent()===""&&i.getChildrenSize()>1&&o.remove(),i.selectEnd()},{discrete:!0}),t(),setTimeout(()=>{n.focus()},0)))},[r,e,n,t]),null}function vg({text:r,trigger:e}){const[t]=Lt(),n=b.useRef(void 0);return b.useEffect(()=>{if(e===void 0||e===n.current||!r)return;n.current=e;const s=r.trim();s&&(t.update(()=>{const i=te();if(z(i))i.insertText(s);else{const o=Pe(),l=o.getLastChild();if(l){l.selectEnd();const a=te();z(a)&&a.insertText(s)}else{const a=He(),u=Ke(s);a.append(u),o.append(a)}}}),setTimeout(()=>{t.focus()},0))},[r,e,t]),null}function wg({replyTo:r,theme:e}){const t=n=>{try{return new Date(n).toLocaleString()}catch{return n}};return p.jsxs("div",{style:{marginTop:"16px",paddingTop:"16px",borderTop:`1px solid ${e.border}`},children:[p.jsxs("div",{style:{fontSize:"12px",color:e.textSecondary,marginBottom:"8px"},children:["On ",t(r.date),", ",r.from," wrote:"]}),p.jsx("blockquote",{style:{margin:0,padding:"12px 16px",borderLeft:`3px solid ${e.quoteBorder}`,background:e.quoteBackground,fontSize:"14px",color:e.textSecondary,maxHeight:"200px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:r.body}})]})}function Vc({value:r="",onChange:e,placeholder:t="Write your message...",replyTo:n,theme:s={},disabled:i=!1,className:o="",minHeight:l="200px",externalUpdate:a,insertText:u,insertTextTrigger:c,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:g,aiProcessingAction:m,renderAboveToolbar:x}){const v={...yg,...s},[_,C]=b.useState(!1),S=b.useRef(void 0),[D,w]=b.useState(r),[y,k]=b.useState(!1),[B,F]=b.useState(null),T=g??y,M=m??B;b.useEffect(()=>{a!==void 0&&a!==S.current&&(S.current=a,C(!0))},[a]);const L=b.useCallback(()=>{C(!1)},[]),E=q=>q.replace(/<[^>]*>/g,"").trim(),N=q=>q.split(`
108
+ `).map(K=>`<p>${K||"<br>"}</p>`).join(""),R=async q=>{const K=E(D);if(!K)return;const $=q==="restructure"?d:q==="proofread"?f:h;if($){k(!0),F(q);try{const re=await $(K),ae=N(re);w(ae),e==null||e(ae),S.current=Date.now(),C(!0)}catch(re){console.error(`AI ${q} failed:`,re)}finally{k(!1),F(null)}}},O=E(D).length>0,H={namespace:"MailEditor",theme:xg,onError:q=>{console.error("Lexical error:",q)},nodes:[ln,Or,Ir,ss,bi,xi,_i,un],editable:!i},U=b.useCallback((q,K)=>{q.read(()=>{const $=wc(K,null);w($),e==null||e($)})},[e]),Z=`
87
109
  .mail-editor-paragraph {
88
110
  margin: 0 0 8px 0;
89
111
  line-height: 1.5;
@@ -105,15 +127,15 @@ React keys must be passed directly to JSX without using spread:
105
127
  margin: 4px 0;
106
128
  }
107
129
  .mail-editor-link {
108
- color: ${D.primary};
130
+ color: ${v.primary};
109
131
  text-decoration: underline;
110
132
  }
111
133
  .mail-editor-quote {
112
134
  margin: 8px 0;
113
135
  padding: 8px 16px;
114
- border-left: 3px solid ${D.quoteBorder};
115
- background: ${D.quoteBackground};
116
- color: ${D.textSecondary};
136
+ border-left: 3px solid ${v.quoteBorder};
137
+ background: ${v.quoteBackground};
138
+ color: ${v.textSecondary};
117
139
  }
118
140
  .mail-editor-h1 {
119
141
  font-size: 24px;
@@ -132,11 +154,11 @@ React keys must be passed directly to JSX without using spread:
132
154
  }
133
155
  .mail-editor-content {
134
156
  outline: none;
135
- min-height: ${a};
157
+ min-height: ${l};
136
158
  padding: 16px;
137
159
  font-size: 14px;
138
160
  line-height: 1.6;
139
- color: ${D.text};
161
+ color: ${v.text};
140
162
  }
141
163
  .mail-editor-content:focus {
142
164
  outline: none;
@@ -145,7 +167,7 @@ React keys must be passed directly to JSX without using spread:
145
167
  position: absolute;
146
168
  top: 16px;
147
169
  left: 16px;
148
- color: ${D.textSecondary};
170
+ color: ${v.textSecondary};
149
171
  pointer-events: none;
150
172
  font-size: 14px;
151
173
  }
@@ -153,9 +175,12 @@ React keys must be passed directly to JSX without using spread:
153
175
  from { transform: rotate(0deg); }
154
176
  to { transform: rotate(360deg); }
155
177
  }
156
- `;return g.jsxs("div",{className:o,style:{border:`1px solid ${D.border}`,borderRadius:"8px",background:D.background,overflow:"hidden",display:"flex",flexDirection:"column",height:"100%",minHeight:a},children:[g.jsx("style",{children:Se}),y,g.jsxs(od,{initialConfig:xe,children:[g.jsx(qf,{theme:D,disabled:i,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:T,aiProcessingAction:B,onAiAction:Q,hasContent:se}),g.jsx("div",{style:{position:"relative",flex:1,display:"flex",flexDirection:"column"},children:g.jsx(Wd,{contentEditable:g.jsx(Hd,{className:"mail-editor-content",style:{outline:"none",flex:1,minHeight:"100px",padding:"16px",fontSize:"14px",lineHeight:1.6,color:D.text}}),placeholder:g.jsx("div",{className:"mail-editor-placeholder",children:t}),ErrorBoundary:uf})}),g.jsx(vf,{}),g.jsx(Ef,{}),g.jsx(sf,{}),g.jsx(lf,{onChange:oe}),g.jsx(Uf,{html:x?A:r,isExternalUpdate:x,onImportComplete:L}),g.jsx(Wf,{text:u,trigger:c})]}),n&&g.jsx(Gf,{replyTo:n,theme:D})]})}const Vf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6",inputBackground:"#ffffff",inputBorder:"#d1d5db",inputFocus:"#3b82f6",buttonPrimary:"#3b82f6",buttonPrimaryHover:"#2563eb",buttonSecondary:"#f3f4f6",buttonSecondaryHover:"#e5e7eb",attachmentBackground:"#f9fafb",attachmentBorder:"#e5e7eb"};function Kf({to:r="",subject:e="",body:t="",replyTo:n,onSend:s,onCancel:i,onBodyChange:o,externalUpdate:a,insertText:l,insertTextTrigger:u,theme:c={},disabled:d=!1,showCcBcc:f=!1,placeholder:h="Write your message...",className:p="",minHeight:m="200px",sendButtonText:y="Send",hideCancelButton:D=!1,onAiRestructure:x,onAiProofread:E,onAiRewrite:_,renderAboveToolbar:A}){const b={...Vf,...c},[v,S]=w.useState(r),[k,j]=w.useState(""),[T,B]=w.useState(""),[L,R]=w.useState(e),[P,Q]=w.useState(t),[se,xe]=w.useState([]),[oe,Se]=w.useState(!1),[he,fe]=w.useState(""),[pe,ge]=w.useState(f),[Ae,be]=w.useState(!1),we=w.useRef(void 0);w.useEffect(()=>{a!==void 0&&a!==we.current&&(we.current=a,Q(t),be(!0))},[a,t]);const Re=W=>{Q(W),be(!1),o==null||o(W)},ce=w.useRef(null),[je,at]=w.useState(!1),kt=W=>{const De=W.target.files;if(De){const Te=Array.from(De);console.log("[MailComposer] Files selected:",Te.map(ke=>({name:ke.name,size:ke.size,type:ke.type}))),xe(ke=>[...ke,...Te])}ce.current&&(ce.current.value="")},zt=W=>{W.preventDefault(),W.stopPropagation(),at(!0)},nt=W=>{W.preventDefault(),W.stopPropagation(),at(!1)},mt=W=>{if(W.preventDefault(),W.stopPropagation(),at(!1),W.dataTransfer.files&&W.dataTransfer.files.length>0){const De=Array.from(W.dataTransfer.files);console.log("[MailComposer] Files dropped:",De.map(Te=>({name:Te.name,size:Te.size,type:Te.type}))),xe(Te=>[...Te,...De])}else console.log("[MailComposer] Drop event but no files:",W.dataTransfer.types)},ft=W=>W.type.startsWith("image/")?"image":W.type==="application/pdf"?"picture_as_pdf":W.type.includes("spreadsheet")||W.type.includes("excel")?"table_chart":W.type.includes("document")||W.type.includes("word")?"description":"attach_file",Yt=W=>{xe(De=>De.filter((Te,ke)=>ke!==W))},qt=W=>W<1024?`${W} B`:W<1024*1024?`${(W/1024).toFixed(1)} KB`:`${(W/(1024*1024)).toFixed(1)} MB`,Tt=async()=>{if(!v.trim()){fe("Recipient email is required");return}if(!L.trim()){fe("Subject is required");return}Se(!0),fe("");try{const W=await Promise.all(se.map(async ke=>{const Bt=await ke.arrayBuffer(),Ft=btoa(new Uint8Array(Bt).reduce((Ut,V)=>Ut+String.fromCharCode(V),""));return{filename:ke.name,content_type:ke.type||"application/octet-stream",data:Ft,size:ke.size}})),De=P.replace(/>\n+</g,"><").replace(/<p class="[^"]*"><\/p>/g,"<br>").trim(),Te={to:v.trim(),cc:k.trim()||void 0,bcc:T.trim()||void 0,subject:L.trim(),html:De,attachments:W,inReplyTo:n==null?void 0:n.messageId};console.log("[MailComposer] Sending email - to:",Te.to,"subject:",Te.subject,"attachmentsCount:",Te.attachments.length),Te.attachments.length>0&&Te.attachments.forEach((ke,Bt)=>{var Ft;console.log(`[MailComposer] Attachment ${Bt+1}:`,ke.filename,"size:",ke.size,"type:",ke.content_type,"data length:",((Ft=ke.data)==null?void 0:Ft.length)||0)}),await s(Te),S(""),j(""),B(""),R(""),Q(""),xe([])}catch(W){fe(W instanceof Error?W.message:"Failed to send email")}finally{Se(!1)}},Nt={width:"100%",padding:"8px 12px",fontSize:"14px",border:`1px solid ${b.inputBorder}`,borderRadius:"6px",background:b.inputBackground,color:b.text,outline:"none"},ut={display:"block",fontSize:"12px",fontWeight:500,color:b.textSecondary,marginBottom:"4px",textTransform:"uppercase"},yt=(W,De=!1)=>({padding:"10px 20px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",cursor:De?"not-allowed":"pointer",opacity:De?.6:1,background:W?b.buttonPrimary:b.buttonSecondary,color:W?"#ffffff":b.text,display:"flex",alignItems:"center",gap:"8px"});return g.jsxs("div",{className:p,style:{display:"flex",flexDirection:"column",gap:"16px",padding:"16px",background:b.background},children:[he&&g.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:"6px",color:"#dc2626",fontSize:"14px"},children:he}),g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"To"}),g.jsx("input",{type:"email",value:v,onChange:W=>S(W.target.value),placeholder:"recipient@example.com",disabled:d||oe,style:Nt})]}),!pe&&g.jsx("button",{type:"button",onClick:()=>ge(!0),disabled:d||oe,style:{background:"none",border:"none",padding:0,fontSize:"12px",color:b.primary,cursor:"pointer",textAlign:"left"},children:"+ Add CC/BCC"}),pe&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"CC"}),g.jsx("input",{type:"email",value:k,onChange:W=>j(W.target.value),placeholder:"cc@example.com",disabled:d||oe,style:Nt})]}),g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"BCC"}),g.jsx("input",{type:"email",value:T,onChange:W=>B(W.target.value),placeholder:"bcc@example.com",disabled:d||oe,style:Nt})]})]}),g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"Subject"}),g.jsx("input",{type:"text",value:L,onChange:W=>R(W.target.value),placeholder:"Email subject",disabled:d||oe,style:Nt})]}),g.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:g.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:g.jsx(su,{value:P,onChange:Re,placeholder:h,replyTo:n,theme:b,disabled:d||oe,minHeight:m,externalUpdate:Ae?a:void 0,insertText:l,insertTextTrigger:u,onAiRestructure:x,onAiProofread:E,onAiRewrite:_,renderAboveToolbar:A})})}),g.jsxs("div",{children:[g.jsx("label",{style:{...ut,marginBottom:"8px"},children:"Attachments"}),g.jsx("input",{ref:ce,type:"file",multiple:!0,onChange:kt,style:{display:"none"}}),g.jsxs("div",{onClick:()=>{var W;return(W=ce.current)==null?void 0:W.click()},onDragOver:zt,onDragLeave:nt,onDrop:mt,style:{width:"100%",padding:"24px 16px",border:`2px dashed ${je?b.primary:b.border}`,borderRadius:"8px",background:je?`${b.primary}10`:"transparent",color:je?b.primary:b.textSecondary,cursor:d||oe?"not-allowed":"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s",marginBottom:se.length>0?"12px":0},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"24px"},children:je?"file_download":"attach_file"}),g.jsx("span",{style:{fontSize:"14px"},children:je?"Drop files here":"Drop files or click to add"})]}),se.length>0&&g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:se.map((W,De)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:b.attachmentBackground,borderRadius:"8px"},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b.textSecondary},children:ft(W)}),g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:b.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W.name}),g.jsx("div",{style:{fontSize:"12px",color:b.textSecondary},children:qt(W.size)})]}),g.jsx("button",{type:"button",onClick:()=>Yt(De),disabled:d||oe,style:{background:"none",border:"none",padding:"4px",cursor:"pointer",color:b.textSecondary,display:"flex",borderRadius:"4px"},children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px"},children:"close"})})]},`${W.name}-${De}`))})]}),g.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"12px"},children:[!D&&i&&g.jsx("button",{type:"button",onClick:i,disabled:d||oe,style:yt(!1,d||oe),children:"Cancel"}),g.jsxs("button",{type:"button",onClick:Tt,disabled:d||oe||!v.trim()||!L.trim(),style:yt(!0,d||oe||!v.trim()||!L.trim()),children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",animation:oe?"spin 1s linear infinite":"none"},children:oe?"sync":"send"}),oe?"Sending...":y]})]}),g.jsx("style",{children:`
178
+ `;return p.jsxs("div",{className:o,style:{border:`1px solid ${v.border}`,borderRadius:"8px",background:v.background,overflow:"hidden",display:"flex",flexDirection:"column",height:"100%",minHeight:l},children:[p.jsx("style",{children:Z}),x,p.jsxs(Oh,{initialConfig:H,children:[p.jsx(bg,{theme:v,disabled:i,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:T,aiProcessingAction:M,onAiAction:R,hasContent:O}),p.jsx("div",{style:{position:"relative",flex:1,display:"flex",flexDirection:"column"},children:p.jsx(wp,{contentEditable:p.jsx(kp,{className:"mail-editor-content",style:{outline:"none",flex:1,minHeight:"100px",padding:"16px",fontSize:"14px",lineHeight:1.6,color:v.text}}),placeholder:p.jsx("div",{className:"mail-editor-placeholder",children:t}),ErrorBoundary:zp})}),p.jsx(Jp,{}),p.jsx(rg,{}),p.jsx(Lp,{}),p.jsx(Op,{onChange:U}),p.jsx(_g,{html:_?D:r,isExternalUpdate:_,onImportComplete:L}),p.jsx(vg,{text:u,trigger:c})]}),n&&p.jsx(wg,{replyTo:n,theme:v})]})}const Cg={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6",inputBackground:"#ffffff",inputBorder:"#d1d5db",inputFocus:"#3b82f6",buttonPrimary:"#3b82f6",buttonPrimaryHover:"#2563eb",buttonSecondary:"#f3f4f6",buttonSecondaryHover:"#e5e7eb",attachmentBackground:"#f9fafb",attachmentBorder:"#e5e7eb"};function Sg({to:r="",subject:e="",body:t="",replyTo:n,onSend:s,onCancel:i,onBodyChange:o,externalUpdate:l,insertText:a,insertTextTrigger:u,theme:c={},disabled:d=!1,showCcBcc:f=!1,placeholder:h="Write your message...",className:g="",minHeight:m="200px",sendButtonText:x="Send",hideCancelButton:v=!1,onAiRestructure:_,onAiProofread:C,onAiRewrite:S,renderAboveToolbar:D}){const w={...Cg,...c},[y,k]=b.useState(r),[B,F]=b.useState(""),[T,M]=b.useState(""),[L,E]=b.useState(e),[N,R]=b.useState(t),[O,H]=b.useState([]),[U,Z]=b.useState(!1),[q,K]=b.useState(""),[$,re]=b.useState(f),[ae,le]=b.useState(!1),ce=b.useRef(void 0);b.useEffect(()=>{l!==void 0&&l!==ce.current&&(ce.current=l,R(t),le(!0))},[l,t]);const ve=X=>{R(X),le(!1),o==null||o(X)},pe=b.useRef(null),[Fe,et]=b.useState(!1),ct=X=>{const Be=X.target.files;if(Be){const Me=Array.from(Be);console.log("[MailComposer] Files selected:",Me.map(Re=>({name:Re.name,size:Re.size,type:Re.type}))),H(Re=>[...Re,...Me])}pe.current&&(pe.current.value="")},kt=X=>{X.preventDefault(),X.stopPropagation(),et(!0)},tt=X=>{X.preventDefault(),X.stopPropagation(),et(!1)},xt=X=>{if(X.preventDefault(),X.stopPropagation(),et(!1),X.dataTransfer.files&&X.dataTransfer.files.length>0){const Be=Array.from(X.dataTransfer.files);console.log("[MailComposer] Files dropped:",Be.map(Me=>({name:Me.name,size:Me.size,type:Me.type}))),H(Me=>[...Me,...Be])}else console.log("[MailComposer] Drop event but no files:",X.dataTransfer.types)},dt=X=>X.type.startsWith("image/")?"image":X.type==="application/pdf"?"picture_as_pdf":X.type.includes("spreadsheet")||X.type.includes("excel")?"table_chart":X.type.includes("document")||X.type.includes("word")?"description":"attach_file",It=X=>{H(Be=>Be.filter((Me,Re)=>Re!==X))},ue=X=>X<1024?`${X} B`:X<1024*1024?`${(X/1024).toFixed(1)} KB`:`${(X/(1024*1024)).toFixed(1)} MB`,_e=async()=>{if(!y.trim()){K("Recipient email is required");return}if(!L.trim()){K("Subject is required");return}Z(!0),K("");try{const X=await Promise.all(O.map(async Re=>{const zt=await Re.arrayBuffer(),$t=btoa(new Uint8Array(zt).reduce((Jt,ee)=>Jt+String.fromCharCode(ee),""));return{filename:Re.name,content_type:Re.type||"application/octet-stream",data:$t,size:Re.size}})),Be=N.replace(/>\n+</g,"><").replace(/<p class="[^"]*"><\/p>/g,"<br>").trim(),Me={to:y.trim(),cc:B.trim()||void 0,bcc:T.trim()||void 0,subject:L.trim(),html:Be,attachments:X,inReplyTo:n==null?void 0:n.messageId};console.log("[MailComposer] Sending email - to:",Me.to,"subject:",Me.subject,"attachmentsCount:",Me.attachments.length),Me.attachments.length>0&&Me.attachments.forEach((Re,zt)=>{var $t;console.log(`[MailComposer] Attachment ${zt+1}:`,Re.filename,"size:",Re.size,"type:",Re.content_type,"data length:",(($t=Re.data)==null?void 0:$t.length)||0)}),await s(Me),k(""),F(""),M(""),E(""),R(""),H([])}catch(X){K(X instanceof Error?X.message:"Failed to send email")}finally{Z(!1)}},Te={width:"100%",padding:"8px 12px",fontSize:"14px",border:`1px solid ${w.inputBorder}`,borderRadius:"6px",background:w.inputBackground,color:w.text,outline:"none"},it={display:"block",fontSize:"12px",fontWeight:500,color:w.textSecondary,marginBottom:"4px",textTransform:"uppercase"},Je=(X,Be=!1)=>({padding:"10px 20px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",cursor:Be?"not-allowed":"pointer",opacity:Be?.6:1,background:X?w.buttonPrimary:w.buttonSecondary,color:X?"#ffffff":w.text,display:"flex",alignItems:"center",gap:"8px"});return p.jsxs("div",{className:g,style:{display:"flex",flexDirection:"column",gap:"16px",padding:"16px",background:w.background},children:[q&&p.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:"6px",color:"#dc2626",fontSize:"14px"},children:q}),p.jsxs("div",{children:[p.jsx("label",{style:it,children:"To"}),p.jsx("input",{type:"email",value:y,onChange:X=>k(X.target.value),placeholder:"recipient@example.com",disabled:d||U,style:Te})]}),!$&&p.jsx("button",{type:"button",onClick:()=>re(!0),disabled:d||U,style:{background:"none",border:"none",padding:0,fontSize:"12px",color:w.primary,cursor:"pointer",textAlign:"left"},children:"+ Add CC/BCC"}),$&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{children:[p.jsx("label",{style:it,children:"CC"}),p.jsx("input",{type:"email",value:B,onChange:X=>F(X.target.value),placeholder:"cc@example.com",disabled:d||U,style:Te})]}),p.jsxs("div",{children:[p.jsx("label",{style:it,children:"BCC"}),p.jsx("input",{type:"email",value:T,onChange:X=>M(X.target.value),placeholder:"bcc@example.com",disabled:d||U,style:Te})]})]}),p.jsxs("div",{children:[p.jsx("label",{style:it,children:"Subject"}),p.jsx("input",{type:"text",value:L,onChange:X=>E(X.target.value),placeholder:"Email subject",disabled:d||U,style:Te})]}),p.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:p.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:p.jsx(Vc,{value:N,onChange:ve,placeholder:h,replyTo:n,theme:w,disabled:d||U,minHeight:m,externalUpdate:ae?l:void 0,insertText:a,insertTextTrigger:u,onAiRestructure:_,onAiProofread:C,onAiRewrite:S,renderAboveToolbar:D})})}),p.jsxs("div",{children:[p.jsx("label",{style:{...it,marginBottom:"8px"},children:"Attachments"}),p.jsx("input",{ref:pe,type:"file",multiple:!0,onChange:ct,style:{display:"none"}}),p.jsxs("div",{onClick:()=>{var X;return(X=pe.current)==null?void 0:X.click()},onDragOver:kt,onDragLeave:tt,onDrop:xt,style:{width:"100%",padding:"24px 16px",border:`2px dashed ${Fe?w.primary:w.border}`,borderRadius:"8px",background:Fe?`${w.primary}10`:"transparent",color:Fe?w.primary:w.textSecondary,cursor:d||U?"not-allowed":"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s",marginBottom:O.length>0?"12px":0},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"24px"},children:Fe?"file_download":"attach_file"}),p.jsx("span",{style:{fontSize:"14px"},children:Fe?"Drop files here":"Drop files or click to add"})]}),O.length>0&&p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:O.map((X,Be)=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:w.attachmentBackground,borderRadius:"8px"},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:w.textSecondary},children:dt(X)}),p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:w.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:X.name}),p.jsx("div",{style:{fontSize:"12px",color:w.textSecondary},children:ue(X.size)})]}),p.jsx("button",{type:"button",onClick:()=>It(Be),disabled:d||U,style:{background:"none",border:"none",padding:"4px",cursor:"pointer",color:w.textSecondary,display:"flex",borderRadius:"4px"},children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px"},children:"close"})})]},`${X.name}-${Be}`))})]}),p.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"12px"},children:[!v&&i&&p.jsx("button",{type:"button",onClick:i,disabled:d||U,style:Je(!1,d||U),children:"Cancel"}),p.jsxs("button",{type:"button",onClick:_e,disabled:d||U||!y.trim()||!L.trim(),style:Je(!0,d||U||!y.trim()||!L.trim()),children:[p.jsx("span",{className:"material-icons",style:{fontSize:"18px",animation:U?"spin 1s linear infinite":"none"},children:U?"sync":"send"}),U?"Sending...":x]})]}),p.jsx("style",{children:`
157
179
  @keyframes spin {
158
180
  from { transform: rotate(0deg); }
159
181
  to { transform: rotate(360deg); }
160
182
  }
161
- `})]})}const Hf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",chipBackground:"#f3f4f6",chipText:"#374151",hoverBackground:"#f9fafb"};function Qf({options:r,value:e,onChange:t,placeholder:n="Search or select...",allowCreate:s=!0,onCreate:i,allowDelete:o=!1,onDelete:a,label:l,disabled:u=!1,max:c=0,theme:d={},className:f=""}){const h={...Hf,...d},[p,m]=w.useState(!1),[y,D]=w.useState(""),x=w.useRef(null),E=w.useRef(null);w.useEffect(()=>{function T(B){x.current&&!x.current.contains(B.target)&&(m(!1),D(""))}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const _=r.filter(T=>{var B;return((B=T.label)==null?void 0:B.toLowerCase().includes(y.toLowerCase()))&&!e.includes(T.id)}),A=s&&y.trim()&&!r.some(T=>{var B;return((B=T.label)==null?void 0:B.toLowerCase())===y.toLowerCase()}),b=e.map(T=>r.find(B=>B.id===T)).filter(Boolean),v=w.useCallback(T=>{var B;c>0&&e.length>=c||(t([...e,T]),D(""),c===1?m(!1):(B=E.current)==null||B.focus())},[e,t,c]),S=w.useCallback(T=>{t(e.filter(B=>B!==T))},[e,t]),k=w.useCallback(async()=>{if(!A)return;const T=await(i==null?void 0:i(y.trim()));T&&v(T.id),D("")},[A,y,i,v]),j=w.useCallback(T=>{T.key==="Enter"?(T.preventDefault(),A?k():_.length>0&&v(_[0].id)):T.key==="Backspace"&&!y&&e.length>0?S(e[e.length-1]):T.key==="Escape"&&(m(!1),D(""))},[A,_,y,e,k,v,S]);return g.jsxs("div",{ref:x,className:f,style:{position:"relative"},children:[l&&g.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:l}),g.jsxs("div",{onClick:()=>!u&&m(!0),style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 12px",border:`1px solid ${p?h.primary:h.border}`,borderRadius:"8px",background:u?h.hoverBackground:h.background,cursor:u?"not-allowed":"text",minHeight:"42px",alignItems:"center"},children:[b.map(T=>g.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"4px",fontSize:"13px",background:T.color||h.chipBackground,color:T.color?"#fff":h.chipText},children:[T.label,!u&&g.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),S(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 2px",fontSize:"14px",color:"inherit",opacity:.7},children:"×"})]},T.id)),g.jsx("input",{ref:E,type:"text",value:y,onChange:T=>{D(T.target.value),p||m(!0)},onFocus:()=>m(!0),onKeyDown:j,placeholder:b.length===0?n:"",disabled:u||c>0&&e.length>=c,style:{flex:1,minWidth:"60px",border:"none",outline:"none",fontSize:"14px",background:"transparent",color:h.text}})]}),p&&!u&&g.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",background:h.background,border:`1px solid ${h.border}`,borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",maxHeight:"200px",overflowY:"auto",zIndex:50},children:_.length===0&&!A?g.jsx("div",{style:{padding:"12px",fontSize:"14px",color:h.textSecondary,textAlign:"center"},children:y?"No matches":"No options available"}):g.jsxs(g.Fragment,{children:[_.map(T=>g.jsxs("div",{onClick:()=>v(T.id),style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.text,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseEnter:B=>{B.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:B=>{B.currentTarget.style.background=""},children:[T.label,o&&a&&g.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),a(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",fontSize:"14px",color:h.textSecondary,opacity:.5},onMouseEnter:B=>{B.currentTarget.style.opacity="1",B.currentTarget.style.color="#ef4444"},onMouseLeave:B=>{B.currentTarget.style.opacity="0.5",B.currentTarget.style.color=h.textSecondary||""},children:"×"})]},T.id)),A&&g.jsxs("div",{onClick:k,style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.primary,borderTop:_.length>0?`1px solid ${h.border}`:"none"},onMouseEnter:T=>{T.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:T=>{T.currentTarget.style.background=""},children:['+ Create "',y.trim(),'"']})]})})]})}const Jf={background:"#ffffff",cardBackground:"#f9fafb",cardHover:"#f3f4f6",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6"};function Yf({options:r,type:e,placeholder:t="Search...",onItemClick:n,onCreate:s,maxHeight:i=300,className:o="",theme:a={}}){const l={...Jf,...a},[u,c]=w.useState(""),[d,f]=w.useState(!1),h=w.useRef(null),p=w.useRef(null),m=w.useMemo(()=>{if(!u.trim())return r;const _=u.toLowerCase();return r.filter(A=>{var b,v;return((b=A.label)==null?void 0:b.toLowerCase().includes(_))||((v=A.notes)==null?void 0:v.toLowerCase().includes(_))})},[r,u]);w.useEffect(()=>{const _=A=>{h.current&&!h.current.contains(A.target)&&f(!1)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[]);const y=_=>{n&&n(_),f(!1),c("")},D=()=>{s&&s(),f(!1)},x=()=>{f(!0)},E=_=>{c(_.target.value),d||f(!0)};return g.jsxs("div",{ref:h,className:`combostack ${o}`,style:{position:"relative",width:"100%"},children:[g.jsxs("div",{style:{display:"flex",gap:"8px"},children:[g.jsxs("div",{style:{flex:1,position:"relative"},children:[g.jsx("span",{style:{position:"absolute",left:"12px",top:"50%",transform:"translateY(-50%)",color:l.textSecondary,fontSize:"14px",pointerEvents:"none"},children:"🔍"}),g.jsx("input",{ref:p,type:"text",value:u,onChange:E,onFocus:x,placeholder:t,style:{width:"100%",padding:"8px 12px 8px 36px",fontSize:"14px",border:`1px solid ${d?l.primary:l.border}`,borderRadius:"6px",background:l.background,color:l.text,outline:"none",boxSizing:"border-box",transition:"border-color 0.15s"}})]}),s&&g.jsx("button",{onClick:D,style:{width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${l.border}`,borderRadius:"6px",background:l.background,color:l.primary,cursor:"pointer",fontSize:"18px",fontWeight:"bold",transition:"background 0.15s"},onMouseEnter:_=>{_.currentTarget.style.background=l.cardHover||"#f3f4f6"},onMouseLeave:_=>{_.currentTarget.style.background=l.background||"#ffffff"},title:`Create ${e||"item"}`,children:"+"})]}),d&&g.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",maxHeight:typeof i=="number"?`${i}px`:i,overflowY:"auto",border:`1px solid ${l.border}`,borderRadius:"8px",background:l.background,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",zIndex:50},children:m.length===0?g.jsx("div",{style:{padding:"16px",textAlign:"center",color:l.textSecondary,fontSize:"14px"},children:u?`No results for "${u}"`:"No items"}):m.map((_,A)=>g.jsxs("div",{onClick:()=>y(_),style:{padding:"10px 14px",cursor:"pointer",borderBottom:A<m.length-1?`1px solid ${l.border}`:"none",background:l.cardBackground,transition:"background 0.15s"},onMouseEnter:b=>{b.currentTarget.style.background=l.cardHover||"#f3f4f6"},onMouseLeave:b=>{b.currentTarget.style.background=l.cardBackground||"#f9fafb"},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:_.color||l.text,marginBottom:_.notes?"2px":0},children:_.label}),_.notes&&g.jsx("div",{style:{fontSize:"12px",color:l.textSecondary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:_.notes})]},_.id))})]})}function Xf({items:r,columns:e,getItemId:t,getItemColumn:n,getItemOrder:s,renderItem:i,onItemMove:o,onItemReorder:a,onItemClick:l,renderColumnHeader:u,renderColumnFooter:c,className:d="",columnClassName:f="",itemClassName:h=""}){const[p,m]=w.useState(null),[y,D]=w.useState(null),[x,E]=w.useState(null),_=w.useRef(null),A=e.reduce((B,L)=>{let R=r.filter(P=>n(P)===L.id);return s&&(R=R.sort((P,Q)=>s(P)-s(Q))),B[L.id]=R,B},{}),b=w.useCallback((B,L)=>{const R=t(L),P=n(L);m(R),_.current=P,B.dataTransfer.effectAllowed="move",B.dataTransfer.setData("text/plain",R),requestAnimationFrame(()=>{const Q=B.target;Q.style.opacity="0.5"})},[t,n]),v=w.useCallback(B=>{const L=B.target;L.style.opacity="1",m(null),D(null),E(null),_.current=null},[]),S=w.useCallback((B,L,R)=>{B.preventDefault(),B.dataTransfer.dropEffect="move",D(L),E(R)},[]),k=w.useCallback(B=>{const L=B.relatedTarget;L!=null&&L.closest("[data-kanban-column]")||(D(null),E(null))},[]),j=w.useCallback((B,L,R)=>{if(B.preventDefault(),!p)return;const P=_.current;P===L?a==null||a(p,L,R):P&&o(p,P,L,R),m(null),D(null),E(null),_.current=null},[p,o,a]),T=(B,L)=>g.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[B.color&&g.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:B.color}}),g.jsx("span",{className:"font-medium text-sm text-neutral-700",children:B.label})]}),g.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:L})]});return g.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${d}`,style:{minHeight:"400px"},children:e.map(B=>{const L=A[B.id]||[],R=y===B.id;return g.jsxs("div",{"data-kanban-column":B.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,onDragOver:P=>{P.preventDefault(),p&&!R&&D(B.id)},onDragLeave:k,onDrop:P=>j(P,B.id,x??L.length),children:[g.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:u?u(B,L.length):T(B,L.length)}),g.jsxs("div",{className:`flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${R?"bg-blue-50":""}`,children:[L.map((P,Q)=>{const se=t(P),xe=p===se,oe=R&&x===Q&&!xe;return g.jsxs("div",{children:[oe&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mb-2 mx-1"}),g.jsx("div",{draggable:!0,onDragStart:Se=>b(Se,P),onDragEnd:v,onDragOver:Se=>S(Se,B.id,Q),onClick:()=>l==null?void 0:l(P),className:`cursor-grab active:cursor-grabbing transition-all ${xe?"opacity-50 scale-95":""} ${h}`,children:i(P,xe)})]},se)}),g.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:P=>{P.preventDefault(),S(P,B.id,L.length)},children:R&&x===L.length&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),L.length===0&&R&&g.jsx("div",{className:"h-20 border-2 border-dashed border-blue-300 rounded-lg bg-blue-50/50 flex items-center justify-center",children:g.jsx("span",{className:"text-sm text-blue-400",children:"Drop here"})})]}),c&&g.jsx("div",{className:"flex-shrink-0 border-t border-neutral-200 p-2",children:c(B)})]},B.id)})})}const Zf={background:"#ffffff",hourLineColor:"#e5e7eb",halfHourLineColor:"#f3f4f6",hourTextColor:"#9ca3af",currentTimeColor:"#ef4444",allDayBackground:"#f9fafb",allDayBorder:"#e5e7eb"};function eh(r){const e=r.match(/^(\d{1,2}):(\d{2})$/);return e?{hours:parseInt(e[1],10),minutes:parseInt(e[2],10)}:null}function th(r){const e=r%12||12,t=r<12?"AM":"PM";return`${e} ${t}`}function rh(r){const e=new Date;return r.getDate()===e.getDate()&&r.getMonth()===e.getMonth()&&r.getFullYear()===e.getFullYear()}function nh({items:r,date:e,startHour:t=7,endHour:n=22,hourHeight:s=60,getItemTime:i,getItemDuration:o,getItemIsAllDay:a,getItemId:l,renderItem:u,onItemClick:c,onTimeSlotClick:d,showCurrentTime:f=!0,className:h="",theme:p={}}){const m={...Zf,...p},{allDayItems:y,timedItems:D}=w.useMemo(()=>{const v=[],S=[];for(const k of r)a(k)?v.push(k):S.push(k);return{allDayItems:v,timedItems:S}},[r,a]),x=w.useMemo(()=>{const v=[];for(let S=t;S<=n;S++)v.push(S);return v},[t,n]),E=(n-t+1)*s,_=w.useCallback(v=>{const S=i(v);if(!S)return null;const k=eh(S);if(!k)return null;const{hours:j,minutes:T}=k,B=Math.max(t,Math.min(n,j)),L=j<t?0:T,R=(B-t)*s+L/60*s,P=o(v),Q=Math.max(20,P/60*s);return{top:R,height:Q}},[i,o,t,n,s]),A=w.useMemo(()=>{if(!f||!rh(e))return null;const v=new Date,S=v.getHours(),k=v.getMinutes();return S<t||S>n?null:(S-t)*s+k/60*s},[e,f,t,n,s]),b=w.useCallback(v=>{if(!d)return;const S=v.currentTarget.getBoundingClientRect(),j=(v.clientY-S.top)/s*60,T=Math.floor(j/60)+t,B=Math.round(j%60/15)*15,L=Math.min(n,Math.max(t,T)),R=B>=60?0:B,P=`${L.toString().padStart(2,"0")}:${R.toString().padStart(2,"0")}`;d(P)},[d,s,t,n]);return g.jsxs("div",{className:h,style:{background:m.background},children:[y.length>0&&g.jsxs("div",{style:{padding:"8px 0 8px 60px",borderBottom:`1px solid ${m.allDayBorder}`,background:m.allDayBackground},children:[g.jsx("div",{style:{fontSize:"11px",color:m.hourTextColor,marginBottom:"4px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"All Day"}),g.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:y.map(v=>g.jsx("div",{onClick:()=>c==null?void 0:c(v),style:{cursor:c?"pointer":"default"},children:u(v)},l(v)))})]}),g.jsxs("div",{style:{position:"relative",height:E},children:[x.map((v,S)=>g.jsxs("div",{style:{position:"absolute",top:S*s,left:0,right:0},children:[g.jsx("div",{style:{position:"absolute",left:0,top:-8,width:"50px",textAlign:"right",paddingRight:"10px",fontSize:"11px",color:m.hourTextColor},children:th(v)}),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),S<x.length-1&&g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},v)),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:d?"pointer":"default"},onClick:b}),A!==null&&g.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:A,zIndex:20,pointerEvents:"none"},children:[g.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:m.currentTimeColor,marginLeft:"-5px",marginTop:"-5px",position:"absolute"}}),g.jsx("div",{style:{marginLeft:"5px",height:"2px",background:m.currentTimeColor}})]}),D.map(v=>{const S=_(v);return S?g.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:S.top,height:S.height,zIndex:10,cursor:c?"pointer":"default"},onClick:k=>{k.stopPropagation(),c==null||c(v)},children:u(v)},l(v)):null})]})]})}function sh({onComplete:r,onCancel:e,onTranscribe:t,onTranscriptionComplete:n,variant:s="widget",hideSaveButton:i=!1,maxDuration:o=180}){const a=s==="widget",[l,u]=w.useState("idle"),[c,d]=w.useState(0),[f,h]=w.useState(0),[p,m]=w.useState(!1),[y,D]=w.useState(0),[x,E]=w.useState(null),[_,A]=w.useState(!1),[b,v]=w.useState(null),[S,k]=w.useState(!0),[j,T]=w.useState([]),[B,L]=w.useState({completed:0,total:0}),R=w.useRef(!1),P=w.useRef(!0);w.useEffect(()=>{P.current=S},[S]);const Q=w.useRef(null),se=w.useRef(null),xe=w.useRef(null),oe=w.useRef(null),Se=w.useRef(null),he=w.useRef([]),fe=w.useRef(null),pe=w.useRef(null),ge=w.useRef(null),Ae=w.useRef(null),be=w.useRef(!1),we=w.useRef([]),Re=w.useRef(null),ce=w.useRef(null),je=w.useRef([]),at=w.useRef([]),kt=w.useRef("insert"),zt=w.useRef(!1),nt=w.useRef(0),mt=w.useRef(0),ft=w.useRef(0),Yt=q=>{const N=Math.floor(q/60),H=Math.floor(q%60);return`${N.toString().padStart(2,"0")}:${H.toString().padStart(2,"0")}`},qt=async q=>{const N=await q.arrayBuffer(),H=new AudioContext,Y=await H.decodeAudioData(N);return await H.close(),Y},Tt=q=>{const N=q.numberOfChannels,H=q.sampleRate,Y=1,I=16,re=I/8,Z=N*re,ee=H*Z,me=q.length*Z,Ee=new ArrayBuffer(44+me),te=new DataView(Ee),ne=(Be,ve)=>{for(let Je=0;Je<ve.length;Je++)te.setUint8(Be+Je,ve.charCodeAt(Je))};ne(0,"RIFF"),te.setUint32(4,36+me,!0),ne(8,"WAVE"),ne(12,"fmt "),te.setUint32(16,16,!0),te.setUint16(20,Y,!0),te.setUint16(22,N,!0),te.setUint32(24,H,!0),te.setUint32(28,ee,!0),te.setUint16(32,Z,!0),te.setUint16(34,I,!0),ne(36,"data"),te.setUint32(40,me,!0);const ze=[];for(let Be=0;Be<N;Be++)ze.push(q.getChannelData(Be));let We=44;for(let Be=0;Be<q.length;Be++)for(let ve=0;ve<N;ve++){const Je=Math.max(-1,Math.min(1,ze[ve][Be])),Ye=Je<0?Je*32768:Je*32767;te.setInt16(We,Ye,!0),We+=2}return new Blob([Ee],{type:"audio/wav"})},Nt=async(q,N,H,Y)=>{const I=new AudioContext,re=q.sampleRate,Z=Math.max(q.numberOfChannels,N.numberOfChannels),ee=Math.min(H,q.length),me=Math.max(0,q.length-H),Ee=Y==="insert"?ee+N.length+me:ee+N.length,te=I.createBuffer(Z,Ee,re);for(let ne=0;ne<Z;ne++){const ze=te.getChannelData(ne),We=ne<q.numberOfChannels?q.getChannelData(ne):q.getChannelData(0);for(let ve=0;ve<ee;ve++)ze[ve]=We[ve];const Be=ne<N.numberOfChannels?N.getChannelData(ne):N.getChannelData(0);for(let ve=0;ve<N.length;ve++)ze[ee+ve]=Be[ve];if(Y==="insert")for(let ve=0;ve<me;ve++)ze[ee+N.length+ve]=We[H+ve]}return await I.close(),te},ut=w.useCallback(()=>{const q=Q.current;if(!q)return;const N=q.getContext("2d");if(!N)return;const H=q.getBoundingClientRect(),Y=H.width,I=H.height,re=we.current,Z=f||c||1,ee=l==="recording"?c:y;N.fillStyle="#2d3b35",N.fillRect(0,0,Y,I);const me=8,Ee="rgba(0, 0, 0, 0.4)",te=N.createLinearGradient(0,0,0,me);te.addColorStop(0,Ee),te.addColorStop(1,"transparent"),N.fillStyle=te,N.fillRect(0,0,Y,me);const ne=N.createLinearGradient(0,I-me,0,I);ne.addColorStop(0,"transparent"),ne.addColorStop(1,Ee),N.fillStyle=ne,N.fillRect(0,I-me,Y,me);const ze=N.createLinearGradient(0,0,me,0);ze.addColorStop(0,Ee),ze.addColorStop(1,"transparent"),N.fillStyle=ze,N.fillRect(0,0,me,I);const We=N.createLinearGradient(Y-me,0,Y,0);We.addColorStop(0,"transparent"),We.addColorStop(1,Ee),N.fillStyle=We,N.fillRect(Y-me,0,me,I),N.strokeStyle="#5a6b62",N.lineWidth=1,N.beginPath(),N.moveTo(0,I/2),N.lineTo(Y,I/2),N.stroke();const Be=Y/2;if(re.length>0)if(l==="recording")for(let Ye=0;Ye<re.length;Ye++){const ht=re.length-1-Ye,Wt=Be-ht*4;if(Wt<-3||Wt>Y)continue;const bt=re[Ye]*(I/2-12),C=I/2-bt;N.fillStyle="#10b981",N.fillRect(Wt,C,3,bt*2)}else{const Ye=Z>0?ee/Z*re.length:0;for(let ht=0;ht<re.length;ht++){const Wt=Ye-ht,bt=Be-Wt*4;if(bt<-3||bt>Y)continue;const C=re[ht]*(I/2-12),M=I/2-C;N.fillStyle=ht<=Ye?"#10b981":"#4b5563",N.fillRect(bt,M,3,C*2)}}N.strokeStyle="#ef4444",N.lineWidth=1,N.beginPath(),N.moveTo(Be,0),N.lineTo(Be,I),N.stroke(),N.fillStyle="#fff",N.font="bold 18px monospace",N.textAlign="center",N.fillText(Yt(ee),Be,I-6),l==="recording"&&(N.fillStyle="#ef4444",N.beginPath(),N.arc(20,20,8,0,Math.PI*2),N.fill(),N.fillStyle="#fff",N.font="10px sans-serif",N.textAlign="left",N.fillText("REC",34,24)),N.textAlign="left"},[l,y,c,f]),yt=()=>{const q=Se.current;if(!q||!be.current)return;const N=q.frequencyBinCount,H=new Uint8Array(N);q.getByteTimeDomainData(H);let Y=0;for(let Z=0;Z<N;Z++){const ee=(H[Z]-128)/128;Y+=ee*ee}const I=Math.sqrt(Y/N),re=Math.min(1,I*3);we.current.push(re),ut(),be.current&&(pe.current=requestAnimationFrame(yt))},W=async()=>{try{E(null),A(!1),Re.current===null&&(we.current=[]);const q=await navigator.mediaDevices.getUserMedia({audio:!0});xe.current=q;const N=new AudioContext;oe.current=N;const H=N.createAnalyser();H.fftSize=2048,Se.current=H,N.createMediaStreamSource(q).connect(H);const I=new MediaRecorder(q);se.current=I,he.current=[],I.ondataavailable=re=>{re.data.size>0&&he.current.push(re.data)},I.onstop=async()=>{try{if(be.current=!1,he.current.length===0){E("No audio was recorded. Please try again."),u("idle"),q.getTracks().forEach(te=>te.stop());return}const re=new Blob(he.current,{type:"audio/webm"});let Z,ee;if(Re.current!==null&&ce.current)try{const te=await qt(re),ne=ce.current.sampleRate,ze=Math.floor(Re.current*ne),We=await Nt(ce.current,te,ze,kt.current);Z=Tt(We),ee=We.length/We.sampleRate,kt.current==="insert"&&(we.current=[...we.current,...at.current]),Re.current=null,ce.current=null,je.current=[],at.current=[]}catch{Z=re,ee=nt.current>0?nt.current:1}else Z=re,ee=nt.current>0?nt.current:1;if(Ae.current=Z,q.getTracks().forEach(te=>te.stop()),P.current&&t){T(te=>[...te,Z]),L(te=>({...te,total:te.total+1})),Ae.current=null,we.current=[],D(0),h(0),d(0),u("idle");return}const me=URL.createObjectURL(Z),Ee=new Audio(me);Ee.ontimeupdate=()=>{D(Ee.currentTime)},Ee.onended=()=>{m(!1)},ge.current=Ee,h(ee),D(ee),u("editing")}catch{E("Failed to process recording"),u("idle")}},I.start(100),be.current=!0,u("recording"),d(0),nt.current=0,fe.current=setInterval(()=>{nt.current+=1,d(nt.current),nt.current>=o&&(se.current&&se.current.state!=="inactive"&&se.current.stop(),be.current=!1,v(null),fe.current&&(clearInterval(fe.current),fe.current=null),pe.current&&(cancelAnimationFrame(pe.current),pe.current=null),setTimeout(()=>{alert(`Maximum recording time of ${Math.floor(o/60)} minutes reached.`)},100))},1e3)}catch{E("Could not access microphone. Please allow microphone access.")}},De=()=>{be.current=!1,A(!1),v(null),pe.current&&(cancelAnimationFrame(pe.current),pe.current=null),fe.current&&(clearInterval(fe.current),fe.current=null),se.current&&se.current.state!=="inactive"&&se.current.stop()},Te=q=>{const N=Q.current;if(!N)return;const H=f||c;if(H<=0)return;const Y=we.current;if(Y.length===0)return;const I=N.getBoundingClientRect(),re=q-mt.current,Z=4,ee=I.width/N.width,me=Y.length/H*Z,Ee=-re/(me*ee),te=ft.current+Ee,ne=Math.max(0,Math.min(te,H));ge.current&&(ge.current.currentTime=ne),D(ne)},ke=()=>{ge.current&&(ge.current.currentTime=0),D(0)},Bt=()=>{const q=f||c;ge.current&&(ge.current.currentTime=q),D(q)},Ft=()=>{const q=ge.current;q&&(p?(q.pause(),D(q.currentTime),m(!1)):(q.currentTime=y,q.play().catch(()=>{}),m(!0)))},Ut=async q=>{if(!Ae.current){W();return}try{ge.current&&(ge.current.pause(),m(!1)),kt.current=q,ce.current=await qt(Ae.current);const N=f||c;Re.current=y;const H=N>0?y/N:0,Y=Math.floor(H*we.current.length);je.current=we.current.slice(0,Y),at.current=we.current.slice(Y),we.current=[...je.current],W()}catch{E("Failed to prepare recording. Please try again.")}},V=()=>{ge.current&&(ge.current.pause(),ge.current=null),Ae.current=null,ce.current=null,Re.current=null,je.current=[],m(!1),D(0),h(0),d(0),W()},J=()=>{Ae.current?r(Ae.current,f||c):alert("No audio recorded yet!")};w.useEffect(()=>{l==="recording"&&Q.current&&Se.current&&be.current&&(pe.current=requestAnimationFrame(yt))},[l]),w.useEffect(()=>{const q=Q.current;if(!q)return;const N=()=>{const H=window.devicePixelRatio||1,Y=q.getBoundingClientRect();q.width=Y.width*H,q.height=Y.height*H;const I=q.getContext("2d");I&&I.scale(H,H)};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]),w.useEffect(()=>{if(l==="idle"){const q=Q.current;if(!q)return;const N=q.getContext("2d");if(!N)return;const H=q.getBoundingClientRect(),Y=H.width,I=H.height;N.fillStyle="#2d3b35",N.fillRect(0,0,Y,I);const re=8,Z="rgba(0, 0, 0, 0.4)",ee=N.createLinearGradient(0,0,0,re);ee.addColorStop(0,Z),ee.addColorStop(1,"transparent"),N.fillStyle=ee,N.fillRect(0,0,Y,re);const me=N.createLinearGradient(0,I-re,0,I);me.addColorStop(0,"transparent"),me.addColorStop(1,Z),N.fillStyle=me,N.fillRect(0,I-re,Y,re);const Ee=N.createLinearGradient(0,0,re,0);Ee.addColorStop(0,Z),Ee.addColorStop(1,"transparent"),N.fillStyle=Ee,N.fillRect(0,0,re,I);const te=N.createLinearGradient(Y-re,0,Y,0);te.addColorStop(0,"transparent"),te.addColorStop(1,Z),N.fillStyle=te,N.fillRect(Y-re,0,re,I),N.strokeStyle="#5a6b62",N.lineWidth=1,N.beginPath(),N.moveTo(0,I/2),N.lineTo(Y,I/2),N.stroke();const ne=Y/2;N.strokeStyle="#ef4444",N.lineWidth=1,N.beginPath(),N.moveTo(ne,0),N.lineTo(ne,I),N.stroke(),N.fillStyle="#fff",N.font="bold 18px monospace",N.textAlign="center",N.fillText("00:00",ne,I-6)}},[l]);const Ne=w.useCallback(q=>{T(N=>[...N,q]),L(N=>({...N,total:N.total+1}))},[]);if(w.useEffect(()=>{(async()=>{if(R.current||j.length===0||!t)return;R.current=!0;const N=j[0];try{const H=await t(N);H&&n&&n(H)}catch(H){console.error("Transcription failed:",H)}finally{T(H=>H.slice(1)),L(H=>({...H,completed:H.completed+1})),R.current=!1}})()},[j,t,n]),w.useEffect(()=>()=>{be.current=!1,fe.current&&clearInterval(fe.current),pe.current&&cancelAnimationFrame(pe.current),xe.current&&xe.current.getTracks().forEach(q=>q.stop()),oe.current&&oe.current.state!=="closed"&&oe.current.close()},[]),w.useEffect(()=>{if(l==="editing"&&p){let q;const N=()=>{const H=ge.current;if(H&&p){const Y=Q.current;if(Y){const I=Y.getContext("2d");if(I){const re=Y.getBoundingClientRect(),Z=re.width,ee=re.height,me=we.current,Ee=f||c||1,te=H.currentTime;I.fillStyle="#2d3b35",I.fillRect(0,0,Z,ee);const ne=8,ze="rgba(0, 0, 0, 0.4)",We=I.createLinearGradient(0,0,0,ne);We.addColorStop(0,ze),We.addColorStop(1,"transparent"),I.fillStyle=We,I.fillRect(0,0,Z,ne);const Be=I.createLinearGradient(0,ee-ne,0,ee);Be.addColorStop(0,"transparent"),Be.addColorStop(1,ze),I.fillStyle=Be,I.fillRect(0,ee-ne,Z,ne);const ve=I.createLinearGradient(0,0,ne,0);ve.addColorStop(0,ze),ve.addColorStop(1,"transparent"),I.fillStyle=ve,I.fillRect(0,0,ne,ee);const Je=I.createLinearGradient(Z-ne,0,Z,0);Je.addColorStop(0,"transparent"),Je.addColorStop(1,ze),I.fillStyle=Je,I.fillRect(Z-ne,0,ne,ee),I.strokeStyle="#5a6b62",I.lineWidth=1,I.beginPath(),I.moveTo(0,ee/2),I.lineTo(Z,ee/2),I.stroke();const Ye=Z/2,ht=3,Wt=4,bt=Ee>0?te/Ee*me.length:0;for(let U=0;U<me.length;U++){const X=bt-U,ue=Ye-X*Wt;if(ue<-ht||ue>Z)continue;const _e=me[U]*(ee/2-12),le=ee/2-_e;I.fillStyle=U<=bt?"#10b981":"#4b5563",I.fillRect(ue,le,ht,_e*2)}I.strokeStyle="#ef4444",I.lineWidth=1,I.beginPath(),I.moveTo(Ye,0),I.lineTo(Ye,ee),I.stroke(),I.fillStyle="#fff",I.font="bold 18px monospace",I.textAlign="center";const C=Math.floor(te/60),M=Math.floor(te%60);I.fillText(`${C.toString().padStart(2,"0")}:${M.toString().padStart(2,"0")}`,Ye,ee-6),I.textAlign="left"}}q=requestAnimationFrame(N)}};return q=requestAnimationFrame(N),()=>cancelAnimationFrame(q)}},[l,p,f,c]),w.useEffect(()=>{l==="editing"&&!p&&ut()},[l,y,p,ut]),x)return g.jsxs("div",{style:{border:"1px solid #fecaca",borderRadius:"12px",padding:"16px",background:"#fef2f2"},children:[g.jsx("p",{style:{fontSize:"14px",color:"#dc2626",marginBottom:"12px"},children:x}),g.jsx("button",{onClick:()=>{E(null),W()},style:{padding:"8px 16px",fontSize:"14px",background:"#171717",color:"white",borderRadius:"8px",border:"none",cursor:"pointer"},children:"Try Again"})]});const Oe={padding:"8px",borderRadius:"8px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},Ie={...Oe,opacity:.3,cursor:"not-allowed"},xt=a?{border:"1px solid #e5e5e5",borderRadius:"12px",overflow:"hidden",background:"white"}:{overflow:"hidden",background:"white",flexShrink:0};return g.jsxs("div",{style:xt,children:[g.jsx("canvas",{ref:Q,style:{width:"100%",height:"32px",cursor:"pointer",flexShrink:0},onMouseDown:q=>{if(l==="editing"){zt.current=!0,mt.current=q.clientX,ft.current=y;const N=Y=>{zt.current&&Te(Y.clientX)},H=()=>{zt.current=!1,window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",H)};window.addEventListener("mousemove",N),window.addEventListener("mouseup",H)}}}),g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:a?"6px 8px":"4px",borderTop:"1px solid #d4d4d4",background:"linear-gradient(to bottom, #e0e0e0 0%, #c8c8c8 100%)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(0,0,0,0.1)",flexShrink:0},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[g.jsx("button",{onClick:ke,disabled:l==="idle"||l==="recording",style:l==="idle"||l==="recording"?Ie:Oe,title:"Go to start",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"first_page"})}),g.jsx("button",{onClick:()=>{if(l==="recording"){const q=se.current;q&&(q.state==="recording"?(q.pause(),A(!0)):q.state==="paused"&&(q.resume(),A(!1)))}else Ft()},disabled:l==="idle",style:l==="idle"?Ie:Oe,title:p||l==="recording"&&!_?"Pause":"Play",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:p||l==="recording"&&!_?"pause":"play_arrow"})}),g.jsx("button",{onClick:Bt,disabled:l==="idle"||l==="recording",style:l==="idle"||l==="recording"?Ie:Oe,title:"Go to end",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"last_page"})}),g.jsx("div",{style:{width:"1px",height:"24px",margin:"0 4px",background:"linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(0,0,0,0.15))"}}),g.jsx("button",{onClick:()=>{b==="insert"?De():l==="idle"?(v("insert"),W()):l==="editing"&&(v("insert"),Ut("insert"))},disabled:l==="recording"&&b!=="insert"||p,style:l==="recording"&&b!=="insert"||p?Ie:Oe,title:b==="insert"?"Stop recording":"Insert recording",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="insert"?"#ef4444":"#171717"},children:"add"})}),g.jsx("button",{onClick:()=>{P.current||(b==="mic"?De():l==="idle"?(v("mic"),W()):l==="editing"&&(v("mic"),Ut("replace")))},onMouseDown:()=>{P.current&&l==="idle"&&!p&&(v("mic"),W())},onMouseUp:()=>{P.current&&l==="recording"&&b==="mic"&&De()},onMouseLeave:()=>{P.current&&l==="recording"&&b==="mic"&&De()},onTouchStart:()=>{P.current&&l==="idle"&&!p&&(v("mic"),W())},onTouchEnd:()=>{P.current&&l==="recording"&&b==="mic"&&De()},disabled:l==="recording"&&b!=="mic"||p,style:l==="recording"&&b!=="mic"||p?Ie:Oe,title:S?"Hold to record (walkie-talkie)":b==="mic"?"Stop recording":"Record",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="mic"?"#ef4444":"#171717"},children:"mic"})}),g.jsx("button",{onClick:()=>{b==="startover"?De():l==="editing"&&(v("startover"),V())},disabled:l==="idle"||l==="recording"&&b!=="startover"||p,style:l==="idle"||l==="recording"&&b!=="startover"||p?Ie:Oe,title:b==="startover"?"Stop recording":"Start over",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="startover"?"#ef4444":"#171717"},children:"refresh"})})]}),g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[B.total>0&&B.completed<B.total&&g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",background:"rgba(16, 185, 129, 0.1)",borderRadius:"4px",fontSize:"11px",color:"#10b981"},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"14px",animation:"spin 1s linear infinite"},children:"sync"}),B.completed,"/",B.total]}),t&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginRight:"4px"},children:[g.jsx("button",{onClick:()=>k(!S),style:{width:"28px",height:"16px",borderRadius:"8px",border:"none",background:S?"#10b981":"#9ca3af",cursor:"pointer",position:"relative",transition:"background 0.2s",padding:0},title:S?"Auto-transcribe ON":"Auto-transcribe OFF",children:g.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",background:"white",position:"absolute",top:"2px",left:S?"14px":"2px",transition:"left 0.2s",boxShadow:"0 1px 2px rgba(0,0,0,0.2)"}})}),g.jsx("span",{style:{fontSize:"10px",color:"#666"},children:"auto"})]}),g.jsx("button",{onClick:()=>{l==="editing"&&Ae.current&&Ne(Ae.current)},disabled:l!=="editing",style:l!=="editing"?Ie:Oe,title:"Transcribe audio",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:S?"#10b981":"#171717"},children:"subtitles"})})]}),!i&&g.jsx("button",{onClick:J,disabled:l!=="editing",style:l!=="editing"?Ie:Oe,title:"Save recording",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"save"})})]})]}),B.total>0&&B.completed<B.total&&g.jsx("div",{style:{height:"3px",background:"#e5e5e5",overflow:"hidden"},children:g.jsx("div",{style:{height:"100%",background:"#10b981",width:`${B.completed/B.total*100}%`,transition:"width 0.3s ease"}})})]})}exports.$createQRCodeNode=Qi;exports.$isQRCodeNode=If;exports.AnimatedCardFlip=Ou;exports.ApiClient=wl;exports.AudioEditor=sh;exports.AuthManager=Cl;exports.Card=Mu;exports.ComboBox=Qf;exports.ComboStack=Yf;exports.DataOperations=$n;exports.Detail=Pu;exports.GraphClient=cu;exports.KanbanBoard=Xf;exports.Mail=$u;exports.MailClient=vl;exports.MailComposer=Kf;exports.MailEditor=su;exports.QRCodeNode=Ur;exports.SelectableList=zu;exports.Stack=Lu;exports.Timeline=nh;exports.getApiClient=xi;exports.initializeApiClient=Nu;exports.useMutation=Bu;exports.useQuery=Dl;
183
+ `})]})}const Eg={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",chipBackground:"#f3f4f6",chipText:"#374151",hoverBackground:"#f9fafb"};function kg({options:r,value:e,onChange:t,placeholder:n="Search or select...",allowCreate:s=!0,onCreate:i,allowDelete:o=!1,onDelete:l,label:a,disabled:u=!1,max:c=0,theme:d={},className:f=""}){const h={...Eg,...d},[g,m]=b.useState(!1),[x,v]=b.useState(""),_=b.useRef(null),C=b.useRef(null);b.useEffect(()=>{function T(M){_.current&&!_.current.contains(M.target)&&(m(!1),v(""))}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const S=r.filter(T=>{var M;return((M=T.label)==null?void 0:M.toLowerCase().includes(x.toLowerCase()))&&!e.includes(T.id)}),D=s&&x.trim()&&!r.some(T=>{var M;return((M=T.label)==null?void 0:M.toLowerCase())===x.toLowerCase()}),w=e.map(T=>r.find(M=>M.id===T)).filter(Boolean),y=b.useCallback(T=>{var M;c>0&&e.length>=c||(t([...e,T]),v(""),c===1?m(!1):(M=C.current)==null||M.focus())},[e,t,c]),k=b.useCallback(T=>{t(e.filter(M=>M!==T))},[e,t]),B=b.useCallback(async()=>{if(!D)return;const T=await(i==null?void 0:i(x.trim()));T&&y(T.id),v("")},[D,x,i,y]),F=b.useCallback(T=>{T.key==="Enter"?(T.preventDefault(),D?B():S.length>0&&y(S[0].id)):T.key==="Backspace"&&!x&&e.length>0?k(e[e.length-1]):T.key==="Escape"&&(m(!1),v(""))},[D,S,x,e,B,y,k]);return p.jsxs("div",{ref:_,className:f,style:{position:"relative"},children:[a&&p.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:a}),p.jsxs("div",{onClick:()=>!u&&m(!0),style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 12px",border:`1px solid ${g?h.primary:h.border}`,borderRadius:"8px",background:u?h.hoverBackground:h.background,cursor:u?"not-allowed":"text",minHeight:"42px",alignItems:"center"},children:[w.map(T=>p.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"4px",fontSize:"13px",background:T.color||h.chipBackground,color:T.color?"#fff":h.chipText},children:[T.label,!u&&p.jsx("button",{type:"button",onClick:M=>{M.stopPropagation(),k(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 2px",fontSize:"14px",color:"inherit",opacity:.7},children:"×"})]},T.id)),p.jsx("input",{ref:C,type:"text",value:x,onChange:T=>{v(T.target.value),g||m(!0)},onFocus:()=>m(!0),onKeyDown:F,placeholder:w.length===0?n:"",disabled:u||c>0&&e.length>=c,style:{flex:1,minWidth:"60px",border:"none",outline:"none",fontSize:"14px",background:"transparent",color:h.text}})]}),g&&!u&&p.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",background:h.background,border:`1px solid ${h.border}`,borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",maxHeight:"200px",overflowY:"auto",zIndex:50},children:S.length===0&&!D?p.jsx("div",{style:{padding:"12px",fontSize:"14px",color:h.textSecondary,textAlign:"center"},children:x?"No matches":"No options available"}):p.jsxs(p.Fragment,{children:[S.map(T=>p.jsxs("div",{onClick:()=>y(T.id),style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.text,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseEnter:M=>{M.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:M=>{M.currentTarget.style.background=""},children:[T.label,o&&l&&p.jsx("button",{type:"button",onClick:M=>{M.stopPropagation(),l(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",fontSize:"14px",color:h.textSecondary,opacity:.5},onMouseEnter:M=>{M.currentTarget.style.opacity="1",M.currentTarget.style.color="#ef4444"},onMouseLeave:M=>{M.currentTarget.style.opacity="0.5",M.currentTarget.style.color=h.textSecondary||""},children:"×"})]},T.id)),D&&p.jsxs("div",{onClick:B,style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.primary,borderTop:S.length>0?`1px solid ${h.border}`:"none"},onMouseEnter:T=>{T.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:T=>{T.currentTarget.style.background=""},children:['+ Create "',x.trim(),'"']})]})})]})}const Dg={background:"#ffffff",cardBackground:"#f9fafb",cardHover:"#f3f4f6",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6"};function Ag({options:r,value:e,type:t,placeholder:n="Search...",onItemClick:s,onClear:i,onCreate:o,maxHeight:l=300,className:a="",theme:u={}}){const c={...Dg,...u},[d,f]=b.useState(""),[h,g]=b.useState(!1),m=b.useRef(null),x=b.useRef(null),v=b.useMemo(()=>e&&r.find(y=>y.id===e)||null,[e,r]),_=b.useMemo(()=>{if(!d.trim())return r;const y=d.toLowerCase();return r.filter(k=>{var B,F;return((B=k.label)==null?void 0:B.toLowerCase().includes(y))||((F=k.notes)==null?void 0:F.toLowerCase().includes(y))})},[r,d]);b.useEffect(()=>{const y=k=>{m.current&&!m.current.contains(k.target)&&g(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[]);const C=y=>{s&&s(y),g(!1),f("")},S=()=>{o&&o(),g(!1)},D=()=>{g(!0)},w=y=>{f(y.target.value),h||g(!0)};return p.jsxs("div",{ref:m,className:`combostack ${a}`,style:{position:"relative",width:"100%"},children:[p.jsxs("div",{style:{display:"flex",gap:"8px"},children:[p.jsx("div",{style:{flex:1,position:"relative"},children:v&&!h?p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 10px",fontSize:"14px",border:`1px solid ${c.border}`,borderRadius:"6px",background:c.cardBackground,color:c.text,cursor:"pointer",minHeight:"36px",boxSizing:"border-box"},onClick:()=>g(!0),children:[p.jsxs("div",{style:{overflow:"hidden"},children:[p.jsx("div",{style:{fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:v.label}),v.notes&&p.jsx("div",{style:{fontSize:"11px",color:c.textSecondary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:v.notes})]}),i&&p.jsx("button",{onClick:y=>{y.stopPropagation(),i()},style:{marginLeft:"8px",padding:"2px",background:"none",border:"none",cursor:"pointer",color:c.textSecondary,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",flexShrink:0},title:"Clear selection",children:p.jsx("span",{className:"material-icons",style:{fontSize:"16px"},children:"close"})})]}):p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"material-icons",style:{position:"absolute",left:"10px",top:"50%",transform:"translateY(-50%)",color:c.textSecondary,fontSize:"18px",pointerEvents:"none"},children:"search"}),p.jsx("input",{ref:x,type:"text",value:d,onChange:w,onFocus:D,placeholder:n,style:{width:"100%",padding:"8px 12px 8px 36px",fontSize:"14px",border:`1px solid ${h?c.primary:c.border}`,borderRadius:"6px",background:c.background,color:c.text,outline:"none",boxSizing:"border-box",transition:"border-color 0.15s"}})]})}),o&&p.jsx("button",{onClick:S,style:{width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${c.border}`,borderRadius:"6px",background:c.background,color:c.primary,cursor:"pointer",fontSize:"18px",fontWeight:"bold",transition:"background 0.15s",flexShrink:0},onMouseEnter:y=>{y.currentTarget.style.background=c.cardHover||"#f3f4f6"},onMouseLeave:y=>{y.currentTarget.style.background=c.background||"#ffffff"},title:`Create ${t||"item"}`,children:"+"})]}),h&&p.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",maxHeight:typeof l=="number"?`${l}px`:l,overflowY:"auto",border:`1px solid ${c.border}`,borderRadius:"8px",background:c.background,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",zIndex:50},children:_.length===0?p.jsx("div",{style:{padding:"16px",textAlign:"center",color:c.textSecondary,fontSize:"14px"},children:d?`No results for "${d}"`:"No items"}):_.map((y,k)=>p.jsxs("div",{onClick:()=>C(y),style:{padding:"10px 14px",cursor:"pointer",borderBottom:k<_.length-1?`1px solid ${c.border}`:"none",background:c.cardBackground,transition:"background 0.15s"},onMouseEnter:B=>{B.currentTarget.style.background=c.cardHover||"#f3f4f6"},onMouseLeave:B=>{B.currentTarget.style.background=c.cardBackground||"#f9fafb"},children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:y.color||c.text,marginBottom:y.notes?"2px":0},children:y.label}),y.notes&&p.jsx("div",{style:{fontSize:"12px",color:c.textSecondary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:y.notes})]},y.id))})]})}function Tg({items:r,columns:e,getItemId:t,getItemColumn:n,getItemOrder:s,renderItem:i,onItemMove:o,onItemReorder:l,onItemClick:a,renderColumnHeader:u,renderColumnFooter:c,className:d="",columnClassName:f="",itemClassName:h=""}){const[g,m]=b.useState(null),[x,v]=b.useState(null),[_,C]=b.useState(null),S=b.useRef(null),D=e.reduce((M,L)=>{let E=r.filter(N=>n(N)===L.id);return s&&(E=E.sort((N,R)=>s(N)-s(R))),M[L.id]=E,M},{}),w=b.useCallback((M,L)=>{const E=t(L),N=n(L);m(E),S.current=N,M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",E),requestAnimationFrame(()=>{const R=M.target;R.style.opacity="0.5"})},[t,n]),y=b.useCallback(M=>{const L=M.target;L.style.opacity="1",m(null),v(null),C(null),S.current=null},[]),k=b.useCallback((M,L,E)=>{M.preventDefault(),M.dataTransfer.dropEffect="move",v(L),C(E)},[]),B=b.useCallback(M=>{const L=M.relatedTarget;L!=null&&L.closest("[data-kanban-column]")||(v(null),C(null))},[]),F=b.useCallback((M,L,E)=>{if(M.preventDefault(),!g)return;const N=S.current;N===L?l==null||l(g,L,E):N&&o(g,N,L,E),m(null),v(null),C(null),S.current=null},[g,o,l]),T=(M,L)=>p.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[M.color&&p.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:M.color}}),p.jsx("span",{className:"font-medium text-sm text-neutral-700",children:M.label})]}),p.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:L})]});return p.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${d}`,style:{minHeight:"400px"},children:e.map(M=>{const L=D[M.id]||[],E=x===M.id;return p.jsxs("div",{"data-kanban-column":M.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,onDragOver:N=>{N.preventDefault(),g&&!E&&v(M.id)},onDragLeave:B,onDrop:N=>F(N,M.id,_??L.length),children:[p.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:u?u(M,L.length):T(M,L.length)}),p.jsxs("div",{className:`flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${E?"bg-blue-50":""}`,children:[L.map((N,R)=>{const O=t(N),H=g===O,U=E&&_===R&&!H;return p.jsxs("div",{children:[U&&p.jsx("div",{className:"h-1 bg-blue-500 rounded-full mb-2 mx-1"}),p.jsx("div",{draggable:!0,onDragStart:Z=>w(Z,N),onDragEnd:y,onDragOver:Z=>k(Z,M.id,R),onClick:()=>a==null?void 0:a(N),className:`cursor-grab active:cursor-grabbing transition-all ${H?"opacity-50 scale-95":""} ${h}`,children:i(N,H)})]},O)}),p.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:N=>{N.preventDefault(),k(N,M.id,L.length)},children:E&&_===L.length&&p.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),L.length===0&&E&&p.jsx("div",{className:"h-20 border-2 border-dashed border-blue-300 rounded-lg bg-blue-50/50 flex items-center justify-center",children:p.jsx("span",{className:"text-sm text-blue-400",children:"Drop here"})})]}),c&&p.jsx("div",{className:"flex-shrink-0 border-t border-neutral-200 p-2",children:c(M)})]},M.id)})})}const Bg={background:"#ffffff",hourLineColor:"#e5e7eb",halfHourLineColor:"#f3f4f6",hourTextColor:"#9ca3af",currentTimeColor:"#ef4444",allDayBackground:"#f9fafb",allDayBorder:"#e5e7eb"};function Ng(r){const e=r.match(/^(\d{1,2}):(\d{2})$/);return e?{hours:parseInt(e[1],10),minutes:parseInt(e[2],10)}:null}function Fg(r){const e=r%12||12,t=r<12?"AM":"PM";return`${e} ${t}`}function Rg(r){const e=new Date;return r.getDate()===e.getDate()&&r.getMonth()===e.getMonth()&&r.getFullYear()===e.getFullYear()}function Mg({items:r,date:e,startHour:t=7,endHour:n=22,hourHeight:s=60,getItemTime:i,getItemDuration:o,getItemIsAllDay:l,getItemId:a,renderItem:u,onItemClick:c,onTimeSlotClick:d,showCurrentTime:f=!0,className:h="",theme:g={}}){const m={...Bg,...g},{allDayItems:x,timedItems:v}=b.useMemo(()=>{const y=[],k=[];for(const B of r)l(B)?y.push(B):k.push(B);return{allDayItems:y,timedItems:k}},[r,l]),_=b.useMemo(()=>{const y=[];for(let k=t;k<=n;k++)y.push(k);return y},[t,n]),C=(n-t+1)*s,S=b.useCallback(y=>{const k=i(y);if(!k)return null;const B=Ng(k);if(!B)return null;const{hours:F,minutes:T}=B,M=Math.max(t,Math.min(n,F)),L=F<t?0:T,E=(M-t)*s+L/60*s,N=o(y),R=Math.max(20,N/60*s);return{top:E,height:R}},[i,o,t,n,s]),D=b.useMemo(()=>{if(!f||!Rg(e))return null;const y=new Date,k=y.getHours(),B=y.getMinutes();return k<t||k>n?null:(k-t)*s+B/60*s},[e,f,t,n,s]),w=b.useCallback(y=>{if(!d)return;const k=y.currentTarget.getBoundingClientRect(),F=(y.clientY-k.top)/s*60,T=Math.floor(F/60)+t,M=Math.round(F%60/15)*15,L=Math.min(n,Math.max(t,T)),E=M>=60?0:M,N=`${L.toString().padStart(2,"0")}:${E.toString().padStart(2,"0")}`;d(N)},[d,s,t,n]);return p.jsxs("div",{className:h,style:{background:m.background},children:[x.length>0&&p.jsxs("div",{style:{padding:"8px 0 8px 60px",borderBottom:`1px solid ${m.allDayBorder}`,background:m.allDayBackground},children:[p.jsx("div",{style:{fontSize:"11px",color:m.hourTextColor,marginBottom:"4px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"All Day"}),p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:x.map(y=>p.jsx("div",{onClick:()=>c==null?void 0:c(y),style:{cursor:c?"pointer":"default"},children:u(y)},a(y)))})]}),p.jsxs("div",{style:{position:"relative",height:C},children:[_.map((y,k)=>p.jsxs("div",{style:{position:"absolute",top:k*s,left:0,right:0},children:[p.jsx("div",{style:{position:"absolute",left:0,top:-8,width:"50px",textAlign:"right",paddingRight:"10px",fontSize:"11px",color:m.hourTextColor},children:Fg(y)}),p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),k<_.length-1&&p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},y)),p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:d?"pointer":"default"},onClick:w}),D!==null&&p.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:D,zIndex:20,pointerEvents:"none"},children:[p.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:m.currentTimeColor,marginLeft:"-5px",marginTop:"-5px",position:"absolute"}}),p.jsx("div",{style:{marginLeft:"5px",height:"2px",background:m.currentTimeColor}})]}),v.map(y=>{const k=S(y);return k?p.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:k.top,height:k.height,zIndex:10,cursor:c?"pointer":"default"},onClick:B=>{B.stopPropagation(),c==null||c(y)},children:u(y)},a(y)):null})]})]})}function jg({onComplete:r,onCancel:e,onTranscribe:t,onTranscriptionComplete:n,variant:s="widget",hideSaveButton:i=!1,maxDuration:o=180}){const l=s==="widget",[a,u]=b.useState("idle"),[c,d]=b.useState(0),[f,h]=b.useState(0),[g,m]=b.useState(!1),[x,v]=b.useState(0),[_,C]=b.useState(null),[S,D]=b.useState(!1),[w,y]=b.useState(null),[k,B]=b.useState(!0),[F,T]=b.useState([]),[M,L]=b.useState({completed:0,total:0}),E=b.useRef(!1),N=b.useRef(!0);b.useEffect(()=>{N.current=k},[k]);const R=b.useRef(null),O=b.useRef(null),H=b.useRef(null),U=b.useRef(null),Z=b.useRef(null),q=b.useRef([]),K=b.useRef(null),$=b.useRef(null),re=b.useRef(null),ae=b.useRef(null),le=b.useRef(!1),ce=b.useRef([]),ve=b.useRef(null),pe=b.useRef(null),Fe=b.useRef([]),et=b.useRef([]),ct=b.useRef("insert"),kt=b.useRef(!1),tt=b.useRef(0),xt=b.useRef(0),dt=b.useRef(0),It=Y=>{const j=Math.floor(Y/60),ne=Math.floor(Y%60);return`${j.toString().padStart(2,"0")}:${ne.toString().padStart(2,"0")}`},ue=async Y=>{const j=await Y.arrayBuffer(),ne=new AudioContext,ie=await ne.decodeAudioData(j);return await ne.close(),ie},_e=Y=>{const j=Y.numberOfChannels,ne=Y.sampleRate,ie=1,W=16,ge=W/8,de=j*ge,fe=ne*de,Se=Y.length*de,Ne=new ArrayBuffer(44+Se),he=new DataView(Ne),me=(Le,De)=>{for(let rt=0;rt<De.length;rt++)he.setUint8(Le+rt,De.charCodeAt(rt))};me(0,"RIFF"),he.setUint32(4,36+Se,!0),me(8,"WAVE"),me(12,"fmt "),he.setUint32(16,16,!0),he.setUint16(20,ie,!0),he.setUint16(22,j,!0),he.setUint32(24,ne,!0),he.setUint32(28,fe,!0),he.setUint16(32,de,!0),he.setUint16(34,W,!0),me(36,"data"),he.setUint32(40,Se,!0);const We=[];for(let Le=0;Le<j;Le++)We.push(Y.getChannelData(Le));let Ge=44;for(let Le=0;Le<Y.length;Le++)for(let De=0;De<j;De++){const rt=Math.max(-1,Math.min(1,We[De][Le])),nt=rt<0?rt*32768:rt*32767;he.setInt16(Ge,nt,!0),Ge+=2}return new Blob([Ne],{type:"audio/wav"})},Te=async(Y,j,ne,ie)=>{const W=new AudioContext,ge=Y.sampleRate,de=Math.max(Y.numberOfChannels,j.numberOfChannels),fe=Math.min(ne,Y.length),Se=Math.max(0,Y.length-ne),Ne=ie==="insert"?fe+j.length+Se:fe+j.length,he=W.createBuffer(de,Ne,ge);for(let me=0;me<de;me++){const We=he.getChannelData(me),Ge=me<Y.numberOfChannels?Y.getChannelData(me):Y.getChannelData(0);for(let De=0;De<fe;De++)We[De]=Ge[De];const Le=me<j.numberOfChannels?j.getChannelData(me):j.getChannelData(0);for(let De=0;De<j.length;De++)We[fe+De]=Le[De];if(ie==="insert")for(let De=0;De<Se;De++)We[fe+j.length+De]=Ge[ne+De]}return await W.close(),he},it=b.useCallback(()=>{const Y=R.current;if(!Y)return;const j=Y.getContext("2d");if(!j)return;const ne=Y.getBoundingClientRect(),ie=ne.width,W=ne.height,ge=ce.current,de=f||c||1,fe=a==="recording"?c:x;j.fillStyle="#2d3b35",j.fillRect(0,0,ie,W);const Se=8,Ne="rgba(0, 0, 0, 0.4)",he=j.createLinearGradient(0,0,0,Se);he.addColorStop(0,Ne),he.addColorStop(1,"transparent"),j.fillStyle=he,j.fillRect(0,0,ie,Se);const me=j.createLinearGradient(0,W-Se,0,W);me.addColorStop(0,"transparent"),me.addColorStop(1,Ne),j.fillStyle=me,j.fillRect(0,W-Se,ie,Se);const We=j.createLinearGradient(0,0,Se,0);We.addColorStop(0,Ne),We.addColorStop(1,"transparent"),j.fillStyle=We,j.fillRect(0,0,Se,W);const Ge=j.createLinearGradient(ie-Se,0,ie,0);Ge.addColorStop(0,"transparent"),Ge.addColorStop(1,Ne),j.fillStyle=Ge,j.fillRect(ie-Se,0,Se,W),j.strokeStyle="#5a6b62",j.lineWidth=1,j.beginPath(),j.moveTo(0,W/2),j.lineTo(ie,W/2),j.stroke();const Le=ie/2;if(ge.length>0)if(a==="recording")for(let nt=0;nt<ge.length;nt++){const wt=ge.length-1-nt,Zt=Le-wt*4;if(Zt<-3||Zt>ie)continue;const At=ge[nt]*(W/2-12),A=W/2-At;j.fillStyle="#10b981",j.fillRect(Zt,A,3,At*2)}else{const nt=de>0?fe/de*ge.length:0;for(let wt=0;wt<ge.length;wt++){const Zt=nt-wt,At=Le-Zt*4;if(At<-3||At>ie)continue;const A=ge[wt]*(W/2-12),I=W/2-A;j.fillStyle=wt<=nt?"#10b981":"#4b5563",j.fillRect(At,I,3,A*2)}}j.strokeStyle="#ef4444",j.lineWidth=1,j.beginPath(),j.moveTo(Le,0),j.lineTo(Le,W),j.stroke(),j.fillStyle="#fff",j.font="bold 18px monospace",j.textAlign="center",j.fillText(It(fe),Le,W-6),a==="recording"&&(j.fillStyle="#ef4444",j.beginPath(),j.arc(20,20,8,0,Math.PI*2),j.fill(),j.fillStyle="#fff",j.font="10px sans-serif",j.textAlign="left",j.fillText("REC",34,24)),j.textAlign="left"},[a,x,c,f]),Je=()=>{const Y=Z.current;if(!Y||!le.current)return;const j=Y.frequencyBinCount,ne=new Uint8Array(j);Y.getByteTimeDomainData(ne);let ie=0;for(let de=0;de<j;de++){const fe=(ne[de]-128)/128;ie+=fe*fe}const W=Math.sqrt(ie/j),ge=Math.min(1,W*3);ce.current.push(ge),it(),le.current&&($.current=requestAnimationFrame(Je))},X=async()=>{try{C(null),D(!1),ve.current===null&&(ce.current=[]);const Y=await navigator.mediaDevices.getUserMedia({audio:!0});H.current=Y;const j=new AudioContext;U.current=j;const ne=j.createAnalyser();ne.fftSize=2048,Z.current=ne,j.createMediaStreamSource(Y).connect(ne);const W=new MediaRecorder(Y);O.current=W,q.current=[],W.ondataavailable=ge=>{ge.data.size>0&&q.current.push(ge.data)},W.onstop=async()=>{try{if(le.current=!1,q.current.length===0){C("No audio was recorded. Please try again."),u("idle"),Y.getTracks().forEach(he=>he.stop());return}const ge=new Blob(q.current,{type:"audio/webm"});let de,fe;if(ve.current!==null&&pe.current)try{const he=await ue(ge),me=pe.current.sampleRate,We=Math.floor(ve.current*me),Ge=await Te(pe.current,he,We,ct.current);de=_e(Ge),fe=Ge.length/Ge.sampleRate,ct.current==="insert"&&(ce.current=[...ce.current,...et.current]),ve.current=null,pe.current=null,Fe.current=[],et.current=[]}catch{de=ge,fe=tt.current>0?tt.current:1}else de=ge,fe=tt.current>0?tt.current:1;if(ae.current=de,Y.getTracks().forEach(he=>he.stop()),N.current&&t){T(he=>[...he,de]),L(he=>({...he,total:he.total+1})),ae.current=null,ce.current=[],v(0),h(0),d(0),u("idle");return}const Se=URL.createObjectURL(de),Ne=new Audio(Se);Ne.ontimeupdate=()=>{v(Ne.currentTime)},Ne.onended=()=>{m(!1)},re.current=Ne,h(fe),v(fe),u("editing")}catch{C("Failed to process recording"),u("idle")}},W.start(100),le.current=!0,u("recording"),d(0),tt.current=0,K.current=setInterval(()=>{tt.current+=1,d(tt.current),tt.current>=o&&(O.current&&O.current.state!=="inactive"&&O.current.stop(),le.current=!1,y(null),K.current&&(clearInterval(K.current),K.current=null),$.current&&(cancelAnimationFrame($.current),$.current=null),setTimeout(()=>{alert(`Maximum recording time of ${Math.floor(o/60)} minutes reached.`)},100))},1e3)}catch{C("Could not access microphone. Please allow microphone access.")}},Be=()=>{le.current=!1,D(!1),y(null),$.current&&(cancelAnimationFrame($.current),$.current=null),K.current&&(clearInterval(K.current),K.current=null),O.current&&O.current.state!=="inactive"&&O.current.stop()},Me=Y=>{const j=R.current;if(!j)return;const ne=f||c;if(ne<=0)return;const ie=ce.current;if(ie.length===0)return;const W=j.getBoundingClientRect(),ge=Y-xt.current,de=4,fe=W.width/j.width,Se=ie.length/ne*de,Ne=-ge/(Se*fe),he=dt.current+Ne,me=Math.max(0,Math.min(he,ne));re.current&&(re.current.currentTime=me),v(me)},Re=()=>{re.current&&(re.current.currentTime=0),v(0)},zt=()=>{const Y=f||c;re.current&&(re.current.currentTime=Y),v(Y)},$t=()=>{const Y=re.current;Y&&(g?(Y.pause(),v(Y.currentTime),m(!1)):(Y.currentTime=x,Y.play().catch(()=>{}),m(!0)))},Jt=async Y=>{if(!ae.current){X();return}try{re.current&&(re.current.pause(),m(!1)),ct.current=Y,pe.current=await ue(ae.current);const j=f||c;ve.current=x;const ne=j>0?x/j:0,ie=Math.floor(ne*ce.current.length);Fe.current=ce.current.slice(0,ie),et.current=ce.current.slice(ie),ce.current=[...Fe.current],X()}catch{C("Failed to prepare recording. Please try again.")}},ee=()=>{re.current&&(re.current.pause(),re.current=null),ae.current=null,pe.current=null,ve.current=null,Fe.current=[],m(!1),v(0),h(0),d(0),X()},se=()=>{ae.current?r(ae.current,f||c):alert("No audio recorded yet!")};b.useEffect(()=>{a==="recording"&&R.current&&Z.current&&le.current&&($.current=requestAnimationFrame(Je))},[a]),b.useEffect(()=>{const Y=R.current;if(!Y)return;const j=()=>{const ne=window.devicePixelRatio||1,ie=Y.getBoundingClientRect();Y.width=ie.width*ne,Y.height=ie.height*ne;const W=Y.getContext("2d");W&&W.scale(ne,ne)};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[]),b.useEffect(()=>{if(a==="idle"){const Y=R.current;if(!Y)return;const j=Y.getContext("2d");if(!j)return;const ne=Y.getBoundingClientRect(),ie=ne.width,W=ne.height;j.fillStyle="#2d3b35",j.fillRect(0,0,ie,W);const ge=8,de="rgba(0, 0, 0, 0.4)",fe=j.createLinearGradient(0,0,0,ge);fe.addColorStop(0,de),fe.addColorStop(1,"transparent"),j.fillStyle=fe,j.fillRect(0,0,ie,ge);const Se=j.createLinearGradient(0,W-ge,0,W);Se.addColorStop(0,"transparent"),Se.addColorStop(1,de),j.fillStyle=Se,j.fillRect(0,W-ge,ie,ge);const Ne=j.createLinearGradient(0,0,ge,0);Ne.addColorStop(0,de),Ne.addColorStop(1,"transparent"),j.fillStyle=Ne,j.fillRect(0,0,ge,W);const he=j.createLinearGradient(ie-ge,0,ie,0);he.addColorStop(0,"transparent"),he.addColorStop(1,de),j.fillStyle=he,j.fillRect(ie-ge,0,ge,W),j.strokeStyle="#5a6b62",j.lineWidth=1,j.beginPath(),j.moveTo(0,W/2),j.lineTo(ie,W/2),j.stroke();const me=ie/2;j.strokeStyle="#ef4444",j.lineWidth=1,j.beginPath(),j.moveTo(me,0),j.lineTo(me,W),j.stroke(),j.fillStyle="#fff",j.font="bold 18px monospace",j.textAlign="center",j.fillText("00:00",me,W-6)}},[a]);const je=b.useCallback(Y=>{T(j=>[...j,Y]),L(j=>({...j,total:j.total+1}))},[]);if(b.useEffect(()=>{(async()=>{if(E.current||F.length===0||!t)return;E.current=!0;const j=F[0];try{const ne=await t(j);ne&&n&&n(ne)}catch(ne){console.error("Transcription failed:",ne)}finally{T(ne=>ne.slice(1)),L(ne=>({...ne,completed:ne.completed+1})),E.current=!1}})()},[F,t,n]),b.useEffect(()=>()=>{le.current=!1,K.current&&clearInterval(K.current),$.current&&cancelAnimationFrame($.current),H.current&&H.current.getTracks().forEach(Y=>Y.stop()),U.current&&U.current.state!=="closed"&&U.current.close()},[]),b.useEffect(()=>{if(a==="editing"&&g){let Y;const j=()=>{const ne=re.current;if(ne&&g){const ie=R.current;if(ie){const W=ie.getContext("2d");if(W){const ge=ie.getBoundingClientRect(),de=ge.width,fe=ge.height,Se=ce.current,Ne=f||c||1,he=ne.currentTime;W.fillStyle="#2d3b35",W.fillRect(0,0,de,fe);const me=8,We="rgba(0, 0, 0, 0.4)",Ge=W.createLinearGradient(0,0,0,me);Ge.addColorStop(0,We),Ge.addColorStop(1,"transparent"),W.fillStyle=Ge,W.fillRect(0,0,de,me);const Le=W.createLinearGradient(0,fe-me,0,fe);Le.addColorStop(0,"transparent"),Le.addColorStop(1,We),W.fillStyle=Le,W.fillRect(0,fe-me,de,me);const De=W.createLinearGradient(0,0,me,0);De.addColorStop(0,We),De.addColorStop(1,"transparent"),W.fillStyle=De,W.fillRect(0,0,me,fe);const rt=W.createLinearGradient(de-me,0,de,0);rt.addColorStop(0,"transparent"),rt.addColorStop(1,We),W.fillStyle=rt,W.fillRect(de-me,0,me,fe),W.strokeStyle="#5a6b62",W.lineWidth=1,W.beginPath(),W.moveTo(0,fe/2),W.lineTo(de,fe/2),W.stroke();const nt=de/2,wt=3,Zt=4,At=Ne>0?he/Ne*Se.length:0;for(let Q=0;Q<Se.length;Q++){const oe=At-Q,we=nt-oe*Zt;if(we<-wt||we>de)continue;const ke=Se[Q]*(fe/2-12),xe=fe/2-ke;W.fillStyle=Q<=At?"#10b981":"#4b5563",W.fillRect(we,xe,wt,ke*2)}W.strokeStyle="#ef4444",W.lineWidth=1,W.beginPath(),W.moveTo(nt,0),W.lineTo(nt,fe),W.stroke(),W.fillStyle="#fff",W.font="bold 18px monospace",W.textAlign="center";const A=Math.floor(he/60),I=Math.floor(he%60);W.fillText(`${A.toString().padStart(2,"0")}:${I.toString().padStart(2,"0")}`,nt,fe-6),W.textAlign="left"}}Y=requestAnimationFrame(j)}};return Y=requestAnimationFrame(j),()=>cancelAnimationFrame(Y)}},[a,g,f,c]),b.useEffect(()=>{a==="editing"&&!g&&it()},[a,x,g,it]),_)return p.jsxs("div",{style:{border:"1px solid #fecaca",borderRadius:"12px",padding:"16px",background:"#fef2f2"},children:[p.jsx("p",{style:{fontSize:"14px",color:"#dc2626",marginBottom:"12px"},children:_}),p.jsx("button",{onClick:()=>{C(null),X()},style:{padding:"8px 16px",fontSize:"14px",background:"#171717",color:"white",borderRadius:"8px",border:"none",cursor:"pointer"},children:"Try Again"})]});const $e={padding:"8px",borderRadius:"8px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},qe={...$e,opacity:.3,cursor:"not-allowed"},Dt=l?{border:"1px solid #e5e5e5",borderRadius:"12px",overflow:"hidden",background:"white"}:{overflow:"hidden",background:"white",flexShrink:0};return p.jsxs("div",{style:Dt,children:[p.jsx("canvas",{ref:R,style:{width:"100%",height:"32px",cursor:"pointer",flexShrink:0},onMouseDown:Y=>{if(a==="editing"){kt.current=!0,xt.current=Y.clientX,dt.current=x;const j=ie=>{kt.current&&Me(ie.clientX)},ne=()=>{kt.current=!1,window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",ne)};window.addEventListener("mousemove",j),window.addEventListener("mouseup",ne)}}}),p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:l?"6px 8px":"4px",borderTop:"1px solid #d4d4d4",background:"linear-gradient(to bottom, #e0e0e0 0%, #c8c8c8 100%)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(0,0,0,0.1)",flexShrink:0},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[p.jsx("button",{onClick:Re,disabled:a==="idle"||a==="recording",style:a==="idle"||a==="recording"?qe:$e,title:"Go to start",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"first_page"})}),p.jsx("button",{onClick:()=>{if(a==="recording"){const Y=O.current;Y&&(Y.state==="recording"?(Y.pause(),D(!0)):Y.state==="paused"&&(Y.resume(),D(!1)))}else $t()},disabled:a==="idle",style:a==="idle"?qe:$e,title:g||a==="recording"&&!S?"Pause":"Play",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:g||a==="recording"&&!S?"pause":"play_arrow"})}),p.jsx("button",{onClick:zt,disabled:a==="idle"||a==="recording",style:a==="idle"||a==="recording"?qe:$e,title:"Go to end",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"last_page"})}),p.jsx("div",{style:{width:"1px",height:"24px",margin:"0 4px",background:"linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(0,0,0,0.15))"}}),p.jsx("button",{onClick:()=>{w==="insert"?Be():a==="idle"?(y("insert"),X()):a==="editing"&&(y("insert"),Jt("insert"))},disabled:a==="recording"&&w!=="insert"||g,style:a==="recording"&&w!=="insert"||g?qe:$e,title:w==="insert"?"Stop recording":"Insert recording",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:w==="insert"?"#ef4444":"#171717"},children:"add"})}),p.jsx("button",{onClick:()=>{N.current||(w==="mic"?Be():a==="idle"?(y("mic"),X()):a==="editing"&&(y("mic"),Jt("replace")))},onMouseDown:()=>{N.current&&a==="idle"&&!g&&(y("mic"),X())},onMouseUp:()=>{N.current&&a==="recording"&&w==="mic"&&Be()},onMouseLeave:()=>{N.current&&a==="recording"&&w==="mic"&&Be()},onTouchStart:()=>{N.current&&a==="idle"&&!g&&(y("mic"),X())},onTouchEnd:()=>{N.current&&a==="recording"&&w==="mic"&&Be()},disabled:a==="recording"&&w!=="mic"||g,style:a==="recording"&&w!=="mic"||g?qe:$e,title:k?"Hold to record (walkie-talkie)":w==="mic"?"Stop recording":"Record",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:w==="mic"?"#ef4444":"#171717"},children:"mic"})}),p.jsx("button",{onClick:()=>{w==="startover"?Be():a==="editing"&&(y("startover"),ee())},disabled:a==="idle"||a==="recording"&&w!=="startover"||g,style:a==="idle"||a==="recording"&&w!=="startover"||g?qe:$e,title:w==="startover"?"Stop recording":"Start over",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:w==="startover"?"#ef4444":"#171717"},children:"refresh"})})]}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[M.total>0&&M.completed<M.total&&p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",background:"rgba(16, 185, 129, 0.1)",borderRadius:"4px",fontSize:"11px",color:"#10b981"},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"14px",animation:"spin 1s linear infinite"},children:"sync"}),M.completed,"/",M.total]}),t&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginRight:"4px"},children:[p.jsx("button",{onClick:()=>B(!k),style:{width:"28px",height:"16px",borderRadius:"8px",border:"none",background:k?"#10b981":"#9ca3af",cursor:"pointer",position:"relative",transition:"background 0.2s",padding:0},title:k?"Auto-transcribe ON":"Auto-transcribe OFF",children:p.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",background:"white",position:"absolute",top:"2px",left:k?"14px":"2px",transition:"left 0.2s",boxShadow:"0 1px 2px rgba(0,0,0,0.2)"}})}),p.jsx("span",{style:{fontSize:"10px",color:"#666"},children:"auto"})]}),p.jsx("button",{onClick:()=>{a==="editing"&&ae.current&&je(ae.current)},disabled:a!=="editing",style:a!=="editing"?qe:$e,title:"Transcribe audio",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:k?"#10b981":"#171717"},children:"subtitles"})})]}),!i&&p.jsx("button",{onClick:se,disabled:a!=="editing",style:a!=="editing"?qe:$e,title:"Save recording",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"save"})})]})]}),M.total>0&&M.completed<M.total&&p.jsx("div",{style:{height:"3px",background:"#e5e5e5",overflow:"hidden"},children:p.jsx("div",{style:{height:"100%",background:"#10b981",width:`${M.completed/M.total*100}%`,transition:"width 0.3s ease"}})})]})}var Lg={value:()=>{}};function ua(){for(var r=0,e=arguments.length,t={},n;r<e;++r){if(!(n=arguments[r]+"")||n in t||/[\s.]/.test(n))throw new Error("illegal type: "+n);t[n]=[]}return new Cs(t)}function Cs(r){this._=r}function Pg(r,e){return r.trim().split(/^|\s+/).map(function(t){var n="",s=t.indexOf(".");if(s>=0&&(n=t.slice(s+1),t=t.slice(0,s)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}Cs.prototype=ua.prototype={constructor:Cs,on:function(r,e){var t=this._,n=Pg(r+"",t),s,i=-1,o=n.length;if(arguments.length<2){for(;++i<o;)if((s=(r=n[i]).type)&&(s=Og(t[s],r.name)))return s;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<o;)if(s=(r=n[i]).type)t[s]=Ol(t[s],r.name,e);else if(e==null)for(s in t)t[s]=Ol(t[s],r.name,null);return this},copy:function(){var r={},e=this._;for(var t in e)r[t]=e[t].slice();return new Cs(r)},call:function(r,e){if((s=arguments.length-2)>0)for(var t=new Array(s),n=0,s,i;n<s;++n)t[n]=arguments[n+2];if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(i=this._[r],n=0,s=i.length;n<s;++n)i[n].value.apply(e,t)},apply:function(r,e,t){if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(var n=this._[r],s=0,i=n.length;s<i;++s)n[s].value.apply(e,t)}};function Og(r,e){for(var t=0,n=r.length,s;t<n;++t)if((s=r[t]).name===e)return s.value}function Ol(r,e,t){for(var n=0,s=r.length;n<s;++n)if(r[n].name===e){r[n]=Lg,r=r.slice(0,n).concat(r.slice(n+1));break}return t!=null&&r.push({name:e,value:t}),r}var bo="http://www.w3.org/1999/xhtml";const Il={svg:"http://www.w3.org/2000/svg",xhtml:bo,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function vi(r){var e=r+="",t=e.indexOf(":");return t>=0&&(e=r.slice(0,t))!=="xmlns"&&(r=r.slice(t+1)),Il.hasOwnProperty(e)?{space:Il[e],local:r}:r}function Ig(r){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===bo&&e.documentElement.namespaceURI===bo?e.createElement(r):e.createElementNS(t,r)}}function zg(r){return function(){return this.ownerDocument.createElementNS(r.space,r.local)}}function Hc(r){var e=vi(r);return(e.local?zg:Ig)(e)}function $g(){}function ca(r){return r==null?$g:function(){return this.querySelector(r)}}function qg(r){typeof r!="function"&&(r=ca(r));for(var e=this._groups,t=e.length,n=new Array(t),s=0;s<t;++s)for(var i=e[s],o=i.length,l=n[s]=new Array(o),a,u,c=0;c<o;++c)(a=i[c])&&(u=r.call(a,a.__data__,c,i))&&("__data__"in a&&(u.__data__=a.__data__),l[c]=u);return new vt(n,this._parents)}function Ug(r){return r==null?[]:Array.isArray(r)?r:Array.from(r)}function Wg(){return[]}function Gc(r){return r==null?Wg:function(){return this.querySelectorAll(r)}}function Vg(r){return function(){return Ug(r.apply(this,arguments))}}function Hg(r){typeof r=="function"?r=Vg(r):r=Gc(r);for(var e=this._groups,t=e.length,n=[],s=[],i=0;i<t;++i)for(var o=e[i],l=o.length,a,u=0;u<l;++u)(a=o[u])&&(n.push(r.call(a,a.__data__,u,o)),s.push(a));return new vt(n,s)}function Kc(r){return function(){return this.matches(r)}}function Yc(r){return function(e){return e.matches(r)}}var Gg=Array.prototype.find;function Kg(r){return function(){return Gg.call(this.children,r)}}function Yg(){return this.firstElementChild}function Qg(r){return this.select(r==null?Yg:Kg(typeof r=="function"?r:Yc(r)))}var Xg=Array.prototype.filter;function Jg(){return Array.from(this.children)}function Zg(r){return function(){return Xg.call(this.children,r)}}function e0(r){return this.selectAll(r==null?Jg:Zg(typeof r=="function"?r:Yc(r)))}function t0(r){typeof r!="function"&&(r=Kc(r));for(var e=this._groups,t=e.length,n=new Array(t),s=0;s<t;++s)for(var i=e[s],o=i.length,l=n[s]=[],a,u=0;u<o;++u)(a=i[u])&&r.call(a,a.__data__,u,i)&&l.push(a);return new vt(n,this._parents)}function Qc(r){return new Array(r.length)}function r0(){return new vt(this._enter||this._groups.map(Qc),this._parents)}function Qs(r,e){this.ownerDocument=r.ownerDocument,this.namespaceURI=r.namespaceURI,this._next=null,this._parent=r,this.__data__=e}Qs.prototype={constructor:Qs,appendChild:function(r){return this._parent.insertBefore(r,this._next)},insertBefore:function(r,e){return this._parent.insertBefore(r,e)},querySelector:function(r){return this._parent.querySelector(r)},querySelectorAll:function(r){return this._parent.querySelectorAll(r)}};function n0(r){return function(){return r}}function s0(r,e,t,n,s,i){for(var o=0,l,a=e.length,u=i.length;o<u;++o)(l=e[o])?(l.__data__=i[o],n[o]=l):t[o]=new Qs(r,i[o]);for(;o<a;++o)(l=e[o])&&(s[o]=l)}function i0(r,e,t,n,s,i,o){var l,a,u=new Map,c=e.length,d=i.length,f=new Array(c),h;for(l=0;l<c;++l)(a=e[l])&&(f[l]=h=o.call(a,a.__data__,l,e)+"",u.has(h)?s[l]=a:u.set(h,a));for(l=0;l<d;++l)h=o.call(r,i[l],l,i)+"",(a=u.get(h))?(n[l]=a,a.__data__=i[l],u.delete(h)):t[l]=new Qs(r,i[l]);for(l=0;l<c;++l)(a=e[l])&&u.get(f[l])===a&&(s[l]=a)}function o0(r){return r.__data__}function a0(r,e){if(!arguments.length)return Array.from(this,o0);var t=e?i0:s0,n=this._parents,s=this._groups;typeof r!="function"&&(r=n0(r));for(var i=s.length,o=new Array(i),l=new Array(i),a=new Array(i),u=0;u<i;++u){var c=n[u],d=s[u],f=d.length,h=l0(r.call(c,c&&c.__data__,u,n)),g=h.length,m=l[u]=new Array(g),x=o[u]=new Array(g),v=a[u]=new Array(f);t(c,d,m,x,v,h,e);for(var _=0,C=0,S,D;_<g;++_)if(S=m[_]){for(_>=C&&(C=_+1);!(D=x[C])&&++C<g;);S._next=D||null}}return o=new vt(o,n),o._enter=l,o._exit=a,o}function l0(r){return typeof r=="object"&&"length"in r?r:Array.from(r)}function u0(){return new vt(this._exit||this._groups.map(Qc),this._parents)}function c0(r,e,t){var n=this.enter(),s=this,i=this.exit();return typeof r=="function"?(n=r(n),n&&(n=n.selection())):n=n.append(r+""),e!=null&&(s=e(s),s&&(s=s.selection())),t==null?i.remove():t(i),n&&s?n.merge(s).order():s}function d0(r){for(var e=r.selection?r.selection():r,t=this._groups,n=e._groups,s=t.length,i=n.length,o=Math.min(s,i),l=new Array(s),a=0;a<o;++a)for(var u=t[a],c=n[a],d=u.length,f=l[a]=new Array(d),h,g=0;g<d;++g)(h=u[g]||c[g])&&(f[g]=h);for(;a<s;++a)l[a]=t[a];return new vt(l,this._parents)}function f0(){for(var r=this._groups,e=-1,t=r.length;++e<t;)for(var n=r[e],s=n.length-1,i=n[s],o;--s>=0;)(o=n[s])&&(i&&o.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(o,i),i=o);return this}function h0(r){r||(r=p0);function e(d,f){return d&&f?r(d.__data__,f.__data__):!d-!f}for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i){for(var o=t[i],l=o.length,a=s[i]=new Array(l),u,c=0;c<l;++c)(u=o[c])&&(a[c]=u);a.sort(e)}return new vt(s,this._parents).order()}function p0(r,e){return r<e?-1:r>e?1:r>=e?0:NaN}function g0(){var r=arguments[0];return arguments[0]=this,r.apply(null,arguments),this}function m0(){return Array.from(this)}function y0(){for(var r=this._groups,e=0,t=r.length;e<t;++e)for(var n=r[e],s=0,i=n.length;s<i;++s){var o=n[s];if(o)return o}return null}function x0(){let r=0;for(const e of this)++r;return r}function b0(){return!this.node()}function _0(r){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],i=0,o=s.length,l;i<o;++i)(l=s[i])&&r.call(l,l.__data__,i,s);return this}function v0(r){return function(){this.removeAttribute(r)}}function w0(r){return function(){this.removeAttributeNS(r.space,r.local)}}function C0(r,e){return function(){this.setAttribute(r,e)}}function S0(r,e){return function(){this.setAttributeNS(r.space,r.local,e)}}function E0(r,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(r):this.setAttribute(r,t)}}function k0(r,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttributeNS(r.space,r.local):this.setAttributeNS(r.space,r.local,t)}}function D0(r,e){var t=vi(r);if(arguments.length<2){var n=this.node();return t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}return this.each((e==null?t.local?w0:v0:typeof e=="function"?t.local?k0:E0:t.local?S0:C0)(t,e))}function Xc(r){return r.ownerDocument&&r.ownerDocument.defaultView||r.document&&r||r.defaultView}function A0(r){return function(){this.style.removeProperty(r)}}function T0(r,e,t){return function(){this.style.setProperty(r,e,t)}}function B0(r,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(r):this.style.setProperty(r,n,t)}}function N0(r,e,t){return arguments.length>1?this.each((e==null?A0:typeof e=="function"?B0:T0)(r,e,t??"")):rn(this.node(),r)}function rn(r,e){return r.style.getPropertyValue(e)||Xc(r).getComputedStyle(r,null).getPropertyValue(e)}function F0(r){return function(){delete this[r]}}function R0(r,e){return function(){this[r]=e}}function M0(r,e){return function(){var t=e.apply(this,arguments);t==null?delete this[r]:this[r]=t}}function j0(r,e){return arguments.length>1?this.each((e==null?F0:typeof e=="function"?M0:R0)(r,e)):this.node()[r]}function Jc(r){return r.trim().split(/^|\s+/)}function da(r){return r.classList||new Zc(r)}function Zc(r){this._node=r,this._names=Jc(r.getAttribute("class")||"")}Zc.prototype={add:function(r){var e=this._names.indexOf(r);e<0&&(this._names.push(r),this._node.setAttribute("class",this._names.join(" ")))},remove:function(r){var e=this._names.indexOf(r);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(r){return this._names.indexOf(r)>=0}};function ed(r,e){for(var t=da(r),n=-1,s=e.length;++n<s;)t.add(e[n])}function td(r,e){for(var t=da(r),n=-1,s=e.length;++n<s;)t.remove(e[n])}function L0(r){return function(){ed(this,r)}}function P0(r){return function(){td(this,r)}}function O0(r,e){return function(){(e.apply(this,arguments)?ed:td)(this,r)}}function I0(r,e){var t=Jc(r+"");if(arguments.length<2){for(var n=da(this.node()),s=-1,i=t.length;++s<i;)if(!n.contains(t[s]))return!1;return!0}return this.each((typeof e=="function"?O0:e?L0:P0)(t,e))}function z0(){this.textContent=""}function $0(r){return function(){this.textContent=r}}function q0(r){return function(){var e=r.apply(this,arguments);this.textContent=e??""}}function U0(r){return arguments.length?this.each(r==null?z0:(typeof r=="function"?q0:$0)(r)):this.node().textContent}function W0(){this.innerHTML=""}function V0(r){return function(){this.innerHTML=r}}function H0(r){return function(){var e=r.apply(this,arguments);this.innerHTML=e??""}}function G0(r){return arguments.length?this.each(r==null?W0:(typeof r=="function"?H0:V0)(r)):this.node().innerHTML}function K0(){this.nextSibling&&this.parentNode.appendChild(this)}function Y0(){return this.each(K0)}function Q0(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function X0(){return this.each(Q0)}function J0(r){var e=typeof r=="function"?r:Hc(r);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Z0(){return null}function em(r,e){var t=typeof r=="function"?r:Hc(r),n=e==null?Z0:typeof e=="function"?e:ca(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function tm(){var r=this.parentNode;r&&r.removeChild(this)}function rm(){return this.each(tm)}function nm(){var r=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(r,this.nextSibling):r}function sm(){var r=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(r,this.nextSibling):r}function im(r){return this.select(r?sm:nm)}function om(r){return arguments.length?this.property("__data__",r):this.node().__data__}function am(r){return function(e){r.call(this,e,this.__data__)}}function lm(r){return r.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function um(r){return function(){var e=this.__on;if(e){for(var t=0,n=-1,s=e.length,i;t<s;++t)i=e[t],(!r.type||i.type===r.type)&&i.name===r.name?this.removeEventListener(i.type,i.listener,i.options):e[++n]=i;++n?e.length=n:delete this.__on}}}function cm(r,e,t){return function(){var n=this.__on,s,i=am(e);if(n){for(var o=0,l=n.length;o<l;++o)if((s=n[o]).type===r.type&&s.name===r.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=t),s.value=e;return}}this.addEventListener(r.type,i,t),s={type:r.type,name:r.name,value:e,listener:i,options:t},n?n.push(s):this.__on=[s]}}function dm(r,e,t){var n=lm(r+""),s,i=n.length,o;if(arguments.length<2){var l=this.node().__on;if(l){for(var a=0,u=l.length,c;a<u;++a)for(s=0,c=l[a];s<i;++s)if((o=n[s]).type===c.type&&o.name===c.name)return c.value}return}for(l=e?cm:um,s=0;s<i;++s)this.each(l(n[s],e,t));return this}function rd(r,e,t){var n=Xc(r),s=n.CustomEvent;typeof s=="function"?s=new s(e,t):(s=n.document.createEvent("Event"),t?(s.initEvent(e,t.bubbles,t.cancelable),s.detail=t.detail):s.initEvent(e,!1,!1)),r.dispatchEvent(s)}function fm(r,e){return function(){return rd(this,r,e)}}function hm(r,e){return function(){return rd(this,r,e.apply(this,arguments))}}function pm(r,e){return this.each((typeof e=="function"?hm:fm)(r,e))}function*gm(){for(var r=this._groups,e=0,t=r.length;e<t;++e)for(var n=r[e],s=0,i=n.length,o;s<i;++s)(o=n[s])&&(yield o)}var nd=[null];function vt(r,e){this._groups=r,this._parents=e}function is(){return new vt([[document.documentElement]],nd)}function mm(){return this}vt.prototype=is.prototype={constructor:vt,select:qg,selectAll:Hg,selectChild:Qg,selectChildren:e0,filter:t0,data:a0,enter:r0,exit:u0,join:c0,merge:d0,selection:mm,order:f0,sort:h0,call:g0,nodes:m0,node:y0,size:x0,empty:b0,each:_0,attr:D0,style:N0,property:j0,classed:I0,text:U0,html:G0,raise:Y0,lower:X0,append:J0,insert:em,remove:rm,clone:im,datum:om,on:dm,dispatch:pm,[Symbol.iterator]:gm};function Ft(r){return typeof r=="string"?new vt([[document.querySelector(r)]],[document.documentElement]):new vt([[r]],nd)}function ym(r){let e;for(;e=r.sourceEvent;)r=e;return r}function wr(r,e){if(r=ym(r),e===void 0&&(e=r.currentTarget),e){var t=e.ownerSVGElement||e;if(t.createSVGPoint){var n=t.createSVGPoint();return n.x=r.clientX,n.y=r.clientY,n=n.matrixTransform(e.getScreenCTM().inverse()),[n.x,n.y]}if(e.getBoundingClientRect){var s=e.getBoundingClientRect();return[r.clientX-s.left-e.clientLeft,r.clientY-s.top-e.clientTop]}}return[r.pageX,r.pageY]}const _o={capture:!0,passive:!1};function vo(r){r.preventDefault(),r.stopImmediatePropagation()}function xm(r){var e=r.document.documentElement,t=Ft(r).on("dragstart.drag",vo,_o);"onselectstart"in e?t.on("selectstart.drag",vo,_o):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function bm(r,e){var t=r.document.documentElement,n=Ft(r).on("dragstart.drag",null);e&&(n.on("click.drag",vo,_o),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in t?n.on("selectstart.drag",null):(t.style.MozUserSelect=t.__noselect,delete t.__noselect)}function fa(r,e,t){r.prototype=e.prototype=t,t.constructor=r}function sd(r,e){var t=Object.create(r.prototype);for(var n in e)t[n]=e[n];return t}function os(){}var $n=.7,Xs=1/$n,Xr="\\s*([+-]?\\d+)\\s*",qn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ht="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_m=/^#([0-9a-f]{3,8})$/,vm=new RegExp(`^rgb\\(${Xr},${Xr},${Xr}\\)$`),wm=new RegExp(`^rgb\\(${Ht},${Ht},${Ht}\\)$`),Cm=new RegExp(`^rgba\\(${Xr},${Xr},${Xr},${qn}\\)$`),Sm=new RegExp(`^rgba\\(${Ht},${Ht},${Ht},${qn}\\)$`),Em=new RegExp(`^hsl\\(${qn},${Ht},${Ht}\\)$`),km=new RegExp(`^hsla\\(${qn},${Ht},${Ht},${qn}\\)$`),zl={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};fa(os,Un,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:$l,formatHex:$l,formatHex8:Dm,formatHsl:Am,formatRgb:ql,toString:ql});function $l(){return this.rgb().formatHex()}function Dm(){return this.rgb().formatHex8()}function Am(){return id(this).formatHsl()}function ql(){return this.rgb().formatRgb()}function Un(r){var e,t;return r=(r+"").trim().toLowerCase(),(e=_m.exec(r))?(t=e[1].length,e=parseInt(e[1],16),t===6?Ul(e):t===3?new gt(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?ms(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?ms(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=vm.exec(r))?new gt(e[1],e[2],e[3],1):(e=wm.exec(r))?new gt(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Cm.exec(r))?ms(e[1],e[2],e[3],e[4]):(e=Sm.exec(r))?ms(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Em.exec(r))?Hl(e[1],e[2]/100,e[3]/100,1):(e=km.exec(r))?Hl(e[1],e[2]/100,e[3]/100,e[4]):zl.hasOwnProperty(r)?Ul(zl[r]):r==="transparent"?new gt(NaN,NaN,NaN,0):null}function Ul(r){return new gt(r>>16&255,r>>8&255,r&255,1)}function ms(r,e,t,n){return n<=0&&(r=e=t=NaN),new gt(r,e,t,n)}function Tm(r){return r instanceof os||(r=Un(r)),r?(r=r.rgb(),new gt(r.r,r.g,r.b,r.opacity)):new gt}function wo(r,e,t,n){return arguments.length===1?Tm(r):new gt(r,e,t,n??1)}function gt(r,e,t,n){this.r=+r,this.g=+e,this.b=+t,this.opacity=+n}fa(gt,wo,sd(os,{brighter(r){return r=r==null?Xs:Math.pow(Xs,r),new gt(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?$n:Math.pow($n,r),new gt(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new gt(Tr(this.r),Tr(this.g),Tr(this.b),Js(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Wl,formatHex:Wl,formatHex8:Bm,formatRgb:Vl,toString:Vl}));function Wl(){return`#${Sr(this.r)}${Sr(this.g)}${Sr(this.b)}`}function Bm(){return`#${Sr(this.r)}${Sr(this.g)}${Sr(this.b)}${Sr((isNaN(this.opacity)?1:this.opacity)*255)}`}function Vl(){const r=Js(this.opacity);return`${r===1?"rgb(":"rgba("}${Tr(this.r)}, ${Tr(this.g)}, ${Tr(this.b)}${r===1?")":`, ${r})`}`}function Js(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function Tr(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function Sr(r){return r=Tr(r),(r<16?"0":"")+r.toString(16)}function Hl(r,e,t,n){return n<=0?r=e=t=NaN:t<=0||t>=1?r=e=NaN:e<=0&&(r=NaN),new Rt(r,e,t,n)}function id(r){if(r instanceof Rt)return new Rt(r.h,r.s,r.l,r.opacity);if(r instanceof os||(r=Un(r)),!r)return new Rt;if(r instanceof Rt)return r;r=r.rgb();var e=r.r/255,t=r.g/255,n=r.b/255,s=Math.min(e,t,n),i=Math.max(e,t,n),o=NaN,l=i-s,a=(i+s)/2;return l?(e===i?o=(t-n)/l+(t<n)*6:t===i?o=(n-e)/l+2:o=(e-t)/l+4,l/=a<.5?i+s:2-i-s,o*=60):l=a>0&&a<1?0:o,new Rt(o,l,a,r.opacity)}function Nm(r,e,t,n){return arguments.length===1?id(r):new Rt(r,e,t,n??1)}function Rt(r,e,t,n){this.h=+r,this.s=+e,this.l=+t,this.opacity=+n}fa(Rt,Nm,sd(os,{brighter(r){return r=r==null?Xs:Math.pow(Xs,r),new Rt(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?$n:Math.pow($n,r),new Rt(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,e=isNaN(r)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,s=2*t-n;return new gt(qi(r>=240?r-240:r+120,s,n),qi(r,s,n),qi(r<120?r+240:r-120,s,n),this.opacity)},clamp(){return new Rt(Gl(this.h),ys(this.s),ys(this.l),Js(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=Js(this.opacity);return`${r===1?"hsl(":"hsla("}${Gl(this.h)}, ${ys(this.s)*100}%, ${ys(this.l)*100}%${r===1?")":`, ${r})`}`}}));function Gl(r){return r=(r||0)%360,r<0?r+360:r}function ys(r){return Math.max(0,Math.min(1,r||0))}function qi(r,e,t){return(r<60?e+(t-e)*r/60:r<180?t:r<240?e+(t-e)*(240-r)/60:e)*255}const od=r=>()=>r;function Fm(r,e){return function(t){return r+t*e}}function Rm(r,e,t){return r=Math.pow(r,t),e=Math.pow(e,t)-r,t=1/t,function(n){return Math.pow(r+n*e,t)}}function Mm(r){return(r=+r)==1?ad:function(e,t){return t-e?Rm(e,t,r):od(isNaN(e)?t:e)}}function ad(r,e){var t=e-r;return t?Fm(r,t):od(isNaN(r)?e:r)}const Kl=function r(e){var t=Mm(e);function n(s,i){var o=t((s=wo(s)).r,(i=wo(i)).r),l=t(s.g,i.g),a=t(s.b,i.b),u=ad(s.opacity,i.opacity);return function(c){return s.r=o(c),s.g=l(c),s.b=a(c),s.opacity=u(c),s+""}}return n.gamma=r,n}(1);function fr(r,e){return r=+r,e=+e,function(t){return r*(1-t)+e*t}}var Co=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ui=new RegExp(Co.source,"g");function jm(r){return function(){return r}}function Lm(r){return function(e){return r(e)+""}}function Pm(r,e){var t=Co.lastIndex=Ui.lastIndex=0,n,s,i,o=-1,l=[],a=[];for(r=r+"",e=e+"";(n=Co.exec(r))&&(s=Ui.exec(e));)(i=s.index)>t&&(i=e.slice(t,i),l[o]?l[o]+=i:l[++o]=i),(n=n[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,a.push({i:o,x:fr(n,s)})),t=Ui.lastIndex;return t<e.length&&(i=e.slice(t),l[o]?l[o]+=i:l[++o]=i),l.length<2?a[0]?Lm(a[0].x):jm(e):(e=a.length,function(u){for(var c=0,d;c<e;++c)l[(d=a[c]).i]=d.x(u);return l.join("")})}var Yl=180/Math.PI,So={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ld(r,e,t,n,s,i){var o,l,a;return(o=Math.sqrt(r*r+e*e))&&(r/=o,e/=o),(a=r*t+e*n)&&(t-=r*a,n-=e*a),(l=Math.sqrt(t*t+n*n))&&(t/=l,n/=l,a/=l),r*n<e*t&&(r=-r,e=-e,a=-a,o=-o),{translateX:s,translateY:i,rotate:Math.atan2(e,r)*Yl,skewX:Math.atan(a)*Yl,scaleX:o,scaleY:l}}var xs;function Om(r){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(r+"");return e.isIdentity?So:ld(e.a,e.b,e.c,e.d,e.e,e.f)}function Im(r){return r==null||(xs||(xs=document.createElementNS("http://www.w3.org/2000/svg","g")),xs.setAttribute("transform",r),!(r=xs.transform.baseVal.consolidate()))?So:(r=r.matrix,ld(r.a,r.b,r.c,r.d,r.e,r.f))}function ud(r,e,t,n){function s(u){return u.length?u.pop()+" ":""}function i(u,c,d,f,h,g){if(u!==d||c!==f){var m=h.push("translate(",null,e,null,t);g.push({i:m-4,x:fr(u,d)},{i:m-2,x:fr(c,f)})}else(d||f)&&h.push("translate("+d+e+f+t)}function o(u,c,d,f){u!==c?(u-c>180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(s(d)+"rotate(",null,n)-2,x:fr(u,c)})):c&&d.push(s(d)+"rotate("+c+n)}function l(u,c,d,f){u!==c?f.push({i:d.push(s(d)+"skewX(",null,n)-2,x:fr(u,c)}):c&&d.push(s(d)+"skewX("+c+n)}function a(u,c,d,f,h,g){if(u!==d||c!==f){var m=h.push(s(h)+"scale(",null,",",null,")");g.push({i:m-4,x:fr(u,d)},{i:m-2,x:fr(c,f)})}else(d!==1||f!==1)&&h.push(s(h)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=r(u),c=r(c),i(u.translateX,u.translateY,c.translateX,c.translateY,d,f),o(u.rotate,c.rotate,d,f),l(u.skewX,c.skewX,d,f),a(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(h){for(var g=-1,m=f.length,x;++g<m;)d[(x=f[g]).i]=x.x(h);return d.join("")}}}var zm=ud(Om,"px, ","px)","deg)"),$m=ud(Im,", ",")",")"),qm=1e-12;function Ql(r){return((r=Math.exp(r))+1/r)/2}function Um(r){return((r=Math.exp(r))-1/r)/2}function Wm(r){return((r=Math.exp(2*r))-1)/(r+1)}const Vm=function r(e,t,n){function s(i,o){var l=i[0],a=i[1],u=i[2],c=o[0],d=o[1],f=o[2],h=c-l,g=d-a,m=h*h+g*g,x,v;if(m<qm)v=Math.log(f/u)/e,x=function(y){return[l+y*h,a+y*g,u*Math.exp(e*y*v)]};else{var _=Math.sqrt(m),C=(f*f-u*u+n*m)/(2*u*t*_),S=(f*f-u*u-n*m)/(2*f*t*_),D=Math.log(Math.sqrt(C*C+1)-C),w=Math.log(Math.sqrt(S*S+1)-S);v=(w-D)/e,x=function(y){var k=y*v,B=Ql(D),F=u/(t*_)*(B*Wm(e*k+D)-Um(D));return[l+F*h,a+F*g,u*B/Ql(e*k+D)]}}return x.duration=v*1e3*e/Math.SQRT2,x}return s.rho=function(i){var o=Math.max(.001,+i),l=o*o,a=l*l;return r(o,l,a)},s}(Math.SQRT2,2,4);var nn=0,Cn=0,yn=0,cd=1e3,Zs,Sn,ei=0,Lr=0,wi=0,Wn=typeof performance=="object"&&performance.now?performance:Date,dd=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function ha(){return Lr||(dd(Hm),Lr=Wn.now()+wi)}function Hm(){Lr=0}function ti(){this._call=this._time=this._next=null}ti.prototype=fd.prototype={constructor:ti,restart:function(r,e,t){if(typeof r!="function")throw new TypeError("callback is not a function");t=(t==null?ha():+t)+(e==null?0:+e),!this._next&&Sn!==this&&(Sn?Sn._next=this:Zs=this,Sn=this),this._call=r,this._time=t,Eo()},stop:function(){this._call&&(this._call=null,this._time=1/0,Eo())}};function fd(r,e,t){var n=new ti;return n.restart(r,e,t),n}function Gm(){ha(),++nn;for(var r=Zs,e;r;)(e=Lr-r._time)>=0&&r._call.call(void 0,e),r=r._next;--nn}function Xl(){Lr=(ei=Wn.now())+wi,nn=Cn=0;try{Gm()}finally{nn=0,Ym(),Lr=0}}function Km(){var r=Wn.now(),e=r-ei;e>cd&&(wi-=e,ei=r)}function Ym(){for(var r,e=Zs,t,n=1/0;e;)e._call?(n>e._time&&(n=e._time),r=e,e=e._next):(t=e._next,e._next=null,e=r?r._next=t:Zs=t);Sn=r,Eo(n)}function Eo(r){if(!nn){Cn&&(Cn=clearTimeout(Cn));var e=r-Lr;e>24?(r<1/0&&(Cn=setTimeout(Xl,r-Wn.now()-wi)),yn&&(yn=clearInterval(yn))):(yn||(ei=Wn.now(),yn=setInterval(Km,cd)),nn=1,dd(Xl))}}function Jl(r,e,t){var n=new ti;return e=e==null?0:+e,n.restart(s=>{n.stop(),r(s+e)},e,t),n}var Qm=ua("start","end","cancel","interrupt"),Xm=[],hd=0,Zl=1,ko=2,Ss=3,eu=4,Do=5,Es=6;function Ci(r,e,t,n,s,i){var o=r.__transition;if(!o)r.__transition={};else if(t in o)return;Jm(r,t,{name:e,index:n,group:s,on:Qm,tween:Xm,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:hd})}function pa(r,e){var t=Ot(r,e);if(t.state>hd)throw new Error("too late; already scheduled");return t}function Xt(r,e){var t=Ot(r,e);if(t.state>Ss)throw new Error("too late; already running");return t}function Ot(r,e){var t=r.__transition;if(!t||!(t=t[e]))throw new Error("transition not found");return t}function Jm(r,e,t){var n=r.__transition,s;n[e]=t,t.timer=fd(i,0,t.time);function i(u){t.state=Zl,t.timer.restart(o,t.delay,t.time),t.delay<=u&&o(u-t.delay)}function o(u){var c,d,f,h;if(t.state!==Zl)return a();for(c in n)if(h=n[c],h.name===t.name){if(h.state===Ss)return Jl(o);h.state===eu?(h.state=Es,h.timer.stop(),h.on.call("interrupt",r,r.__data__,h.index,h.group),delete n[c]):+c<e&&(h.state=Es,h.timer.stop(),h.on.call("cancel",r,r.__data__,h.index,h.group),delete n[c])}if(Jl(function(){t.state===Ss&&(t.state=eu,t.timer.restart(l,t.delay,t.time),l(u))}),t.state=ko,t.on.call("start",r,r.__data__,t.index,t.group),t.state===ko){for(t.state=Ss,s=new Array(f=t.tween.length),c=0,d=-1;c<f;++c)(h=t.tween[c].value.call(r,r.__data__,t.index,t.group))&&(s[++d]=h);s.length=d+1}}function l(u){for(var c=u<t.duration?t.ease.call(null,u/t.duration):(t.timer.restart(a),t.state=Do,1),d=-1,f=s.length;++d<f;)s[d].call(r,c);t.state===Do&&(t.on.call("end",r,r.__data__,t.index,t.group),a())}function a(){t.state=Es,t.timer.stop(),delete n[e];for(var u in n)return;delete r.__transition}}function ks(r,e){var t=r.__transition,n,s,i=!0,o;if(t){e=e==null?null:e+"";for(o in t){if((n=t[o]).name!==e){i=!1;continue}s=n.state>ko&&n.state<Do,n.state=Es,n.timer.stop(),n.on.call(s?"interrupt":"cancel",r,r.__data__,n.index,n.group),delete t[o]}i&&delete r.__transition}}function Zm(r){return this.each(function(){ks(this,r)})}function e2(r,e){var t,n;return function(){var s=Xt(this,r),i=s.tween;if(i!==t){n=t=i;for(var o=0,l=n.length;o<l;++o)if(n[o].name===e){n=n.slice(),n.splice(o,1);break}}s.tween=n}}function t2(r,e,t){var n,s;if(typeof t!="function")throw new Error;return function(){var i=Xt(this,r),o=i.tween;if(o!==n){s=(n=o).slice();for(var l={name:e,value:t},a=0,u=s.length;a<u;++a)if(s[a].name===e){s[a]=l;break}a===u&&s.push(l)}i.tween=s}}function r2(r,e){var t=this._id;if(r+="",arguments.length<2){for(var n=Ot(this.node(),t).tween,s=0,i=n.length,o;s<i;++s)if((o=n[s]).name===r)return o.value;return null}return this.each((e==null?e2:t2)(t,r,e))}function ga(r,e,t){var n=r._id;return r.each(function(){var s=Xt(this,n);(s.value||(s.value={}))[e]=t.apply(this,arguments)}),function(s){return Ot(s,n).value[e]}}function pd(r,e){var t;return(typeof e=="number"?fr:e instanceof Un?Kl:(t=Un(e))?(e=t,Kl):Pm)(r,e)}function n2(r){return function(){this.removeAttribute(r)}}function s2(r){return function(){this.removeAttributeNS(r.space,r.local)}}function i2(r,e,t){var n,s=t+"",i;return function(){var o=this.getAttribute(r);return o===s?null:o===n?i:i=e(n=o,t)}}function o2(r,e,t){var n,s=t+"",i;return function(){var o=this.getAttributeNS(r.space,r.local);return o===s?null:o===n?i:i=e(n=o,t)}}function a2(r,e,t){var n,s,i;return function(){var o,l=t(this),a;return l==null?void this.removeAttribute(r):(o=this.getAttribute(r),a=l+"",o===a?null:o===n&&a===s?i:(s=a,i=e(n=o,l)))}}function l2(r,e,t){var n,s,i;return function(){var o,l=t(this),a;return l==null?void this.removeAttributeNS(r.space,r.local):(o=this.getAttributeNS(r.space,r.local),a=l+"",o===a?null:o===n&&a===s?i:(s=a,i=e(n=o,l)))}}function u2(r,e){var t=vi(r),n=t==="transform"?$m:pd;return this.attrTween(r,typeof e=="function"?(t.local?l2:a2)(t,n,ga(this,"attr."+r,e)):e==null?(t.local?s2:n2)(t):(t.local?o2:i2)(t,n,e))}function c2(r,e){return function(t){this.setAttribute(r,e.call(this,t))}}function d2(r,e){return function(t){this.setAttributeNS(r.space,r.local,e.call(this,t))}}function f2(r,e){var t,n;function s(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&d2(r,i)),t}return s._value=e,s}function h2(r,e){var t,n;function s(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&c2(r,i)),t}return s._value=e,s}function p2(r,e){var t="attr."+r;if(arguments.length<2)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;var n=vi(r);return this.tween(t,(n.local?f2:h2)(n,e))}function g2(r,e){return function(){pa(this,r).delay=+e.apply(this,arguments)}}function m2(r,e){return e=+e,function(){pa(this,r).delay=e}}function y2(r){var e=this._id;return arguments.length?this.each((typeof r=="function"?g2:m2)(e,r)):Ot(this.node(),e).delay}function x2(r,e){return function(){Xt(this,r).duration=+e.apply(this,arguments)}}function b2(r,e){return e=+e,function(){Xt(this,r).duration=e}}function _2(r){var e=this._id;return arguments.length?this.each((typeof r=="function"?x2:b2)(e,r)):Ot(this.node(),e).duration}function v2(r,e){if(typeof e!="function")throw new Error;return function(){Xt(this,r).ease=e}}function w2(r){var e=this._id;return arguments.length?this.each(v2(e,r)):Ot(this.node(),e).ease}function C2(r,e){return function(){var t=e.apply(this,arguments);if(typeof t!="function")throw new Error;Xt(this,r).ease=t}}function S2(r){if(typeof r!="function")throw new Error;return this.each(C2(this._id,r))}function E2(r){typeof r!="function"&&(r=Kc(r));for(var e=this._groups,t=e.length,n=new Array(t),s=0;s<t;++s)for(var i=e[s],o=i.length,l=n[s]=[],a,u=0;u<o;++u)(a=i[u])&&r.call(a,a.__data__,u,i)&&l.push(a);return new ir(n,this._parents,this._name,this._id)}function k2(r){if(r._id!==this._id)throw new Error;for(var e=this._groups,t=r._groups,n=e.length,s=t.length,i=Math.min(n,s),o=new Array(n),l=0;l<i;++l)for(var a=e[l],u=t[l],c=a.length,d=o[l]=new Array(c),f,h=0;h<c;++h)(f=a[h]||u[h])&&(d[h]=f);for(;l<n;++l)o[l]=e[l];return new ir(o,this._parents,this._name,this._id)}function D2(r){return(r+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||e==="start"})}function A2(r,e,t){var n,s,i=D2(e)?pa:Xt;return function(){var o=i(this,r),l=o.on;l!==n&&(s=(n=l).copy()).on(e,t),o.on=s}}function T2(r,e){var t=this._id;return arguments.length<2?Ot(this.node(),t).on.on(r):this.each(A2(t,r,e))}function B2(r){return function(){var e=this.parentNode;for(var t in this.__transition)if(+t!==r)return;e&&e.removeChild(this)}}function N2(){return this.on("end.remove",B2(this._id))}function F2(r){var e=this._name,t=this._id;typeof r!="function"&&(r=ca(r));for(var n=this._groups,s=n.length,i=new Array(s),o=0;o<s;++o)for(var l=n[o],a=l.length,u=i[o]=new Array(a),c,d,f=0;f<a;++f)(c=l[f])&&(d=r.call(c,c.__data__,f,l))&&("__data__"in c&&(d.__data__=c.__data__),u[f]=d,Ci(u[f],e,t,f,u,Ot(c,t)));return new ir(i,this._parents,e,t)}function R2(r){var e=this._name,t=this._id;typeof r!="function"&&(r=Gc(r));for(var n=this._groups,s=n.length,i=[],o=[],l=0;l<s;++l)for(var a=n[l],u=a.length,c,d=0;d<u;++d)if(c=a[d]){for(var f=r.call(c,c.__data__,d,a),h,g=Ot(c,t),m=0,x=f.length;m<x;++m)(h=f[m])&&Ci(h,e,t,m,f,g);i.push(f),o.push(c)}return new ir(i,o,e,t)}var M2=is.prototype.constructor;function j2(){return new M2(this._groups,this._parents)}function L2(r,e){var t,n,s;return function(){var i=rn(this,r),o=(this.style.removeProperty(r),rn(this,r));return i===o?null:i===t&&o===n?s:s=e(t=i,n=o)}}function gd(r){return function(){this.style.removeProperty(r)}}function P2(r,e,t){var n,s=t+"",i;return function(){var o=rn(this,r);return o===s?null:o===n?i:i=e(n=o,t)}}function O2(r,e,t){var n,s,i;return function(){var o=rn(this,r),l=t(this),a=l+"";return l==null&&(a=l=(this.style.removeProperty(r),rn(this,r))),o===a?null:o===n&&a===s?i:(s=a,i=e(n=o,l))}}function I2(r,e){var t,n,s,i="style."+e,o="end."+i,l;return function(){var a=Xt(this,r),u=a.on,c=a.value[i]==null?l||(l=gd(e)):void 0;(u!==t||s!==c)&&(n=(t=u).copy()).on(o,s=c),a.on=n}}function z2(r,e,t){var n=(r+="")=="transform"?zm:pd;return e==null?this.styleTween(r,L2(r,n)).on("end.style."+r,gd(r)):typeof e=="function"?this.styleTween(r,O2(r,n,ga(this,"style."+r,e))).each(I2(this._id,r)):this.styleTween(r,P2(r,n,e),t).on("end.style."+r,null)}function $2(r,e,t){return function(n){this.style.setProperty(r,e.call(this,n),t)}}function q2(r,e,t){var n,s;function i(){var o=e.apply(this,arguments);return o!==s&&(n=(s=o)&&$2(r,o,t)),n}return i._value=e,i}function U2(r,e,t){var n="style."+(r+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,q2(r,e,t??""))}function W2(r){return function(){this.textContent=r}}function V2(r){return function(){var e=r(this);this.textContent=e??""}}function H2(r){return this.tween("text",typeof r=="function"?V2(ga(this,"text",r)):W2(r==null?"":r+""))}function G2(r){return function(e){this.textContent=r.call(this,e)}}function K2(r){var e,t;function n(){var s=r.apply(this,arguments);return s!==t&&(e=(t=s)&&G2(s)),e}return n._value=r,n}function Y2(r){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(r==null)return this.tween(e,null);if(typeof r!="function")throw new Error;return this.tween(e,K2(r))}function Q2(){for(var r=this._name,e=this._id,t=md(),n=this._groups,s=n.length,i=0;i<s;++i)for(var o=n[i],l=o.length,a,u=0;u<l;++u)if(a=o[u]){var c=Ot(a,e);Ci(a,r,t,u,o,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new ir(n,this._parents,r,t)}function X2(){var r,e,t=this,n=t._id,s=t.size();return new Promise(function(i,o){var l={value:o},a={value:function(){--s===0&&i()}};t.each(function(){var u=Xt(this,n),c=u.on;c!==r&&(e=(r=c).copy(),e._.cancel.push(l),e._.interrupt.push(l),e._.end.push(a)),u.on=e}),s===0&&i()})}var J2=0;function ir(r,e,t,n){this._groups=r,this._parents=e,this._name=t,this._id=n}function md(){return++J2}var tr=is.prototype;ir.prototype={constructor:ir,select:F2,selectAll:R2,selectChild:tr.selectChild,selectChildren:tr.selectChildren,filter:E2,merge:k2,selection:j2,transition:Q2,call:tr.call,nodes:tr.nodes,node:tr.node,size:tr.size,empty:tr.empty,each:tr.each,on:T2,attr:u2,attrTween:p2,style:z2,styleTween:U2,text:H2,textTween:Y2,remove:N2,tween:r2,delay:y2,duration:_2,ease:w2,easeVarying:S2,end:X2,[Symbol.iterator]:tr[Symbol.iterator]};function Z2(r){return((r*=2)<=1?r*r*r:(r-=2)*r*r+2)/2}var ey={time:null,delay:0,duration:250,ease:Z2};function ty(r,e){for(var t;!(t=r.__transition)||!(t=t[e]);)if(!(r=r.parentNode))throw new Error(`transition ${e} not found`);return t}function ry(r){var e,t;r instanceof ir?(e=r._id,r=r._name):(e=md(),(t=ey).time=ha(),r=r==null?null:r+"");for(var n=this._groups,s=n.length,i=0;i<s;++i)for(var o=n[i],l=o.length,a,u=0;u<l;++u)(a=o[u])&&Ci(a,r,e,u,o,t||ty(a,e));return new ir(n,this._parents,r,e)}is.prototype.interrupt=Zm;is.prototype.transition=ry;const bs=r=>()=>r;function ny(r,{sourceEvent:e,target:t,transform:n,dispatch:s}){Object.defineProperties(this,{type:{value:r,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:t,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:s}})}function nr(r,e,t){this.k=r,this.x=e,this.y=t}nr.prototype={constructor:nr,scale:function(r){return r===1?this:new nr(this.k*r,this.x,this.y)},translate:function(r,e){return r===0&e===0?this:new nr(this.k,this.x+this.k*r,this.y+this.k*e)},apply:function(r){return[r[0]*this.k+this.x,r[1]*this.k+this.y]},applyX:function(r){return r*this.k+this.x},applyY:function(r){return r*this.k+this.y},invert:function(r){return[(r[0]-this.x)/this.k,(r[1]-this.y)/this.k]},invertX:function(r){return(r-this.x)/this.k},invertY:function(r){return(r-this.y)/this.k},rescaleX:function(r){return r.copy().domain(r.range().map(this.invertX,this).map(r.invert,r))},rescaleY:function(r){return r.copy().domain(r.range().map(this.invertY,this).map(r.invert,r))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ri=new nr(1,0,0);nr.prototype;function Wi(r){r.stopImmediatePropagation()}function xn(r){r.preventDefault(),r.stopImmediatePropagation()}function sy(r){return(!r.ctrlKey||r.type==="wheel")&&!r.button}function iy(){var r=this;return r instanceof SVGElement?(r=r.ownerSVGElement||r,r.hasAttribute("viewBox")?(r=r.viewBox.baseVal,[[r.x,r.y],[r.x+r.width,r.y+r.height]]):[[0,0],[r.width.baseVal.value,r.height.baseVal.value]]):[[0,0],[r.clientWidth,r.clientHeight]]}function tu(){return this.__zoom||ri}function oy(r){return-r.deltaY*(r.deltaMode===1?.05:r.deltaMode?1:.002)*(r.ctrlKey?10:1)}function ay(){return navigator.maxTouchPoints||"ontouchstart"in this}function ly(r,e,t){var n=r.invertX(e[0][0])-t[0][0],s=r.invertX(e[1][0])-t[1][0],i=r.invertY(e[0][1])-t[0][1],o=r.invertY(e[1][1])-t[1][1];return r.translate(s>n?(n+s)/2:Math.min(0,n)||Math.max(0,s),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function uy(){var r=sy,e=iy,t=ly,n=oy,s=ay,i=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,a=Vm,u=ua("start","zoom","end"),c,d,f,h=500,g=150,m=0,x=10;function v(E){E.property("__zoom",tu).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",B).on("dblclick.zoom",F).filter(s).on("touchstart.zoom",T).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(E,N,R,O){var H=E.selection?E.selection():E;H.property("__zoom",tu),E!==H?D(E,N,R,O):H.interrupt().each(function(){w(this,arguments).event(O).start().zoom(null,typeof N=="function"?N.apply(this,arguments):N).end()})},v.scaleBy=function(E,N,R,O){v.scaleTo(E,function(){var H=this.__zoom.k,U=typeof N=="function"?N.apply(this,arguments):N;return H*U},R,O)},v.scaleTo=function(E,N,R,O){v.transform(E,function(){var H=e.apply(this,arguments),U=this.__zoom,Z=R==null?S(H):typeof R=="function"?R.apply(this,arguments):R,q=U.invert(Z),K=typeof N=="function"?N.apply(this,arguments):N;return t(C(_(U,K),Z,q),H,o)},R,O)},v.translateBy=function(E,N,R,O){v.transform(E,function(){return t(this.__zoom.translate(typeof N=="function"?N.apply(this,arguments):N,typeof R=="function"?R.apply(this,arguments):R),e.apply(this,arguments),o)},null,O)},v.translateTo=function(E,N,R,O,H){v.transform(E,function(){var U=e.apply(this,arguments),Z=this.__zoom,q=O==null?S(U):typeof O=="function"?O.apply(this,arguments):O;return t(ri.translate(q[0],q[1]).scale(Z.k).translate(typeof N=="function"?-N.apply(this,arguments):-N,typeof R=="function"?-R.apply(this,arguments):-R),U,o)},O,H)};function _(E,N){return N=Math.max(i[0],Math.min(i[1],N)),N===E.k?E:new nr(N,E.x,E.y)}function C(E,N,R){var O=N[0]-R[0]*E.k,H=N[1]-R[1]*E.k;return O===E.x&&H===E.y?E:new nr(E.k,O,H)}function S(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function D(E,N,R,O){E.on("start.zoom",function(){w(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(O).end()}).tween("zoom",function(){var H=this,U=arguments,Z=w(H,U).event(O),q=e.apply(H,U),K=R==null?S(q):typeof R=="function"?R.apply(H,U):R,$=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),re=H.__zoom,ae=typeof N=="function"?N.apply(H,U):N,le=a(re.invert(K).concat($/re.k),ae.invert(K).concat($/ae.k));return function(ce){if(ce===1)ce=ae;else{var ve=le(ce),pe=$/ve[2];ce=new nr(pe,K[0]-ve[0]*pe,K[1]-ve[1]*pe)}Z.zoom(null,ce)}})}function w(E,N,R){return!R&&E.__zooming||new y(E,N)}function y(E,N){this.that=E,this.args=N,this.active=0,this.sourceEvent=null,this.extent=e.apply(E,N),this.taps=0}y.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,N){return this.mouse&&E!=="mouse"&&(this.mouse[1]=N.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=N.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=N.invert(this.touch1[0])),this.that.__zoom=N,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var N=Ft(this.that).datum();u.call(E,this.that,new ny(E,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:u}),N)}};function k(E,...N){if(!r.apply(this,arguments))return;var R=w(this,N).event(E),O=this.__zoom,H=Math.max(i[0],Math.min(i[1],O.k*Math.pow(2,n.apply(this,arguments)))),U=wr(E);if(R.wheel)(R.mouse[0][0]!==U[0]||R.mouse[0][1]!==U[1])&&(R.mouse[1]=O.invert(R.mouse[0]=U)),clearTimeout(R.wheel);else{if(O.k===H)return;R.mouse=[U,O.invert(U)],ks(this),R.start()}xn(E),R.wheel=setTimeout(Z,g),R.zoom("mouse",t(C(_(O,H),R.mouse[0],R.mouse[1]),R.extent,o));function Z(){R.wheel=null,R.end()}}function B(E,...N){if(f||!r.apply(this,arguments))return;var R=E.currentTarget,O=w(this,N,!0).event(E),H=Ft(E.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",$,!0),U=wr(E,R),Z=E.clientX,q=E.clientY;xm(E.view),Wi(E),O.mouse=[U,this.__zoom.invert(U)],ks(this),O.start();function K(re){if(xn(re),!O.moved){var ae=re.clientX-Z,le=re.clientY-q;O.moved=ae*ae+le*le>m}O.event(re).zoom("mouse",t(C(O.that.__zoom,O.mouse[0]=wr(re,R),O.mouse[1]),O.extent,o))}function $(re){H.on("mousemove.zoom mouseup.zoom",null),bm(re.view,O.moved),xn(re),O.event(re).end()}}function F(E,...N){if(r.apply(this,arguments)){var R=this.__zoom,O=wr(E.changedTouches?E.changedTouches[0]:E,this),H=R.invert(O),U=R.k*(E.shiftKey?.5:2),Z=t(C(_(R,U),O,H),e.apply(this,N),o);xn(E),l>0?Ft(this).transition().duration(l).call(D,Z,O,E):Ft(this).call(v.transform,Z,O,E)}}function T(E,...N){if(r.apply(this,arguments)){var R=E.touches,O=R.length,H=w(this,N,E.changedTouches.length===O).event(E),U,Z,q,K;for(Wi(E),Z=0;Z<O;++Z)q=R[Z],K=wr(q,this),K=[K,this.__zoom.invert(K),q.identifier],H.touch0?!H.touch1&&H.touch0[2]!==K[2]&&(H.touch1=K,H.taps=0):(H.touch0=K,U=!0,H.taps=1+!!c);c&&(c=clearTimeout(c)),U&&(H.taps<2&&(d=K[0],c=setTimeout(function(){c=null},h)),ks(this),H.start())}}function M(E,...N){if(this.__zooming){var R=w(this,N).event(E),O=E.changedTouches,H=O.length,U,Z,q,K;for(xn(E),U=0;U<H;++U)Z=O[U],q=wr(Z,this),R.touch0&&R.touch0[2]===Z.identifier?R.touch0[0]=q:R.touch1&&R.touch1[2]===Z.identifier&&(R.touch1[0]=q);if(Z=R.that.__zoom,R.touch1){var $=R.touch0[0],re=R.touch0[1],ae=R.touch1[0],le=R.touch1[1],ce=(ce=ae[0]-$[0])*ce+(ce=ae[1]-$[1])*ce,ve=(ve=le[0]-re[0])*ve+(ve=le[1]-re[1])*ve;Z=_(Z,Math.sqrt(ce/ve)),q=[($[0]+ae[0])/2,($[1]+ae[1])/2],K=[(re[0]+le[0])/2,(re[1]+le[1])/2]}else if(R.touch0)q=R.touch0[0],K=R.touch0[1];else return;R.zoom("touch",t(C(Z,q,K),R.extent,o))}}function L(E,...N){if(this.__zooming){var R=w(this,N).event(E),O=E.changedTouches,H=O.length,U,Z;for(Wi(E),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),U=0;U<H;++U)Z=O[U],R.touch0&&R.touch0[2]===Z.identifier?delete R.touch0:R.touch1&&R.touch1[2]===Z.identifier&&delete R.touch1;if(R.touch1&&!R.touch0&&(R.touch0=R.touch1,delete R.touch1),R.touch0)R.touch0[1]=this.__zoom.invert(R.touch0[0]);else if(R.end(),R.taps===2&&(Z=wr(Z,this),Math.hypot(d[0]-Z[0],d[1]-Z[1])<x)){var q=Ft(this).on("dblclick.zoom");q&&q.apply(this,arguments)}}}return v.wheelDelta=function(E){return arguments.length?(n=typeof E=="function"?E:bs(+E),v):n},v.filter=function(E){return arguments.length?(r=typeof E=="function"?E:bs(!!E),v):r},v.touchable=function(E){return arguments.length?(s=typeof E=="function"?E:bs(!!E),v):s},v.extent=function(E){return arguments.length?(e=typeof E=="function"?E:bs([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),v):e},v.scaleExtent=function(E){return arguments.length?(i[0]=+E[0],i[1]=+E[1],v):[i[0],i[1]]},v.translateExtent=function(E){return arguments.length?(o[0][0]=+E[0][0],o[1][0]=+E[1][0],o[0][1]=+E[0][1],o[1][1]=+E[1][1],v):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},v.constrain=function(E){return arguments.length?(t=E,v):t},v.duration=function(E){return arguments.length?(l=+E,v):l},v.interpolate=function(E){return arguments.length?(a=E,v):a},v.on=function(){var E=u.on.apply(u,arguments);return E===u?v:E},v.clickDistance=function(E){return arguments.length?(m=(E=+E)*E,v):Math.sqrt(m)},v.tapDistance=function(E){return arguments.length?(x=+E,v):x},v}function yd(r={}){const{minZoom:e=.1,maxZoom:t=4,initialTransform:n,zoomable:s=!0,pannable:i=!0,onTransformChange:o}=r,l=b.useRef(null),a=b.useRef(),[u,c]=b.useState(n||{x:0,y:0,k:1});b.useEffect(()=>{if(!l.current)return;const x=uy().scaleExtent([e,t]).filter(_=>!s&&_.type==="wheel"||!i&&(_.type==="mousedown"||_.type==="touchstart")?!1:_.type==="wheel"?s:_.type==="mousedown"||_.type==="touchstart"?_.target.closest("[data-qmap-node]")?!1:i:!0).on("zoom",_=>{const C={x:_.transform.x,y:_.transform.y,k:_.transform.k};c(C),o==null||o(C)});a.current=x;const v=Ft(l.current);return v.call(x),v.on("dblclick.zoom",null),n&&v.call(x.transform,ri.translate(n.x,n.y).scale(n.k)),()=>{v.on(".zoom",null)}},[e,t,s,i]),b.useEffect(()=>{a.current&&a.current.on("zoom",x=>{const v={x:x.transform.x,y:x.transform.y,k:x.transform.k};c(v),o==null||o(v)})},[o]);const d=b.useCallback((x,v,_,C=!0)=>{if(!l.current||!a.current)return;const S=Ft(l.current),D=ri.translate(x,v).scale(_);S.call(a.current.transform,D)},[]),f=b.useCallback(()=>{!l.current||!a.current||Ft(l.current).call(a.current.scaleBy,1.3)},[]),h=b.useCallback(()=>{!l.current||!a.current||Ft(l.current).call(a.current.scaleBy,.7)},[]),g=b.useCallback(()=>{d(0,0,1,!0)},[d]),m=b.useCallback((x,v=50)=>{if(!l.current||!a.current||x.length===0)return;const C=l.current.getBoundingClientRect();let S=1/0,D=1/0,w=-1/0,y=-1/0;for(const O of x){const H=O.width||200,U=O.height||100;S=Math.min(S,O.x),D=Math.min(D,O.y),w=Math.max(w,O.x+H),y=Math.max(y,O.y+U)}const k=w-S,B=y-D,F=(C.width-v*2)/k,T=(C.height-v*2)/B,M=Math.min(F,T,t),L=(S+w)/2,E=(D+y)/2,N=C.width/2-L*M,R=C.height/2-E*M;d(N,R,M,!0)},[t,d]);return{transform:u,containerRef:l,zoomTo:d,zoomIn:f,zoomOut:h,resetZoom:g,fitToContent:m}}function xd(r){const{transform:e,onDragStart:t,onDragMove:n,onDragEnd:s,disabled:i=!1}=r,[o,l]=b.useState(null),[a,u]=b.useState(!1),[c,d]=b.useState({x:0,y:0}),f=b.useRef(null),h=b.useRef({x:0,y:0}),g=b.useRef(e);b.useEffect(()=>{g.current=e},[e]);const m=b.useCallback((C,S)=>{const D=g.current;return{x:(C-D.x)/D.k,y:(S-D.y)/D.k}},[]),x=b.useCallback((C,S)=>{if(i)return;S.preventDefault(),S.stopPropagation();const D=S.currentTarget,w=parseFloat(D.dataset.x||"0"),y=parseFloat(D.dataset.y||"0");f.current={x:S.clientX,y:S.clientY,nodeX:w,nodeY:y},h.current={x:w,y},l(C),u(!0),d({x:0,y:0}),t==null||t(C)},[i,m,t]),v=b.useCallback(C=>{if(!a||!o||!f.current)return;const S=g.current,D=f.current,w=C.clientX-D.x,y=C.clientY-D.y,k=w/S.k,B=y/S.k,F=D.nodeX+k,T=D.nodeY+B;h.current={x:F,y:T},d({x:k,y:B}),n==null||n(o,F,T,k,B)},[a,o,n]),_=b.useCallback(()=>{if(!a||!o)return;const C=h.current;s==null||s(o,C.x,C.y),l(null),u(!1),d({x:0,y:0}),f.current=null},[a,o,s]);return b.useEffect(()=>{if(!a)return;const C=D=>{v(D)},S=()=>{_()};return window.addEventListener("mousemove",C),window.addEventListener("mouseup",S),()=>{window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",S)}},[a,v,_]),{draggedNodeId:o,isDragging:a,dragOffset:c,startDrag:x,updateDrag:v,endDrag:_}}function bd(r){const{transform:e,nodePositions:t,disabled:n=!1,onSelectionChange:s}=r,[i,o]=b.useState(new Set),[l,a]=b.useState(null),[u,c]=b.useState(!1),d=b.useRef(null),f=b.useRef(e),h=b.useRef(t);b.useEffect(()=>{f.current=e},[e]),b.useEffect(()=>{h.current=t},[t]);const g=b.useCallback((w,y)=>{const k=f.current;return{x:(w-k.x)/k.k,y:(y-k.y)/k.k}},[]),m=b.useCallback((w,y)=>{const k=h.current.get(w);if(!k)return!1;const B=k.width||200,F=k.height||100;return k.x<y.x+y.width&&k.x+B>y.x&&k.y<y.y+y.height&&k.y+F>y.y},[]),x=b.useCallback(w=>{if(n||w.target.closest("[data-qmap-node]"))return;w.preventDefault();const k=g(w.clientX,w.clientY);d.current=k,a({x:k.x,y:k.y,width:0,height:0}),c(!0),w.shiftKey||o(new Set)},[n,g]),v=b.useCallback(w=>{if(!u||!d.current)return;const y=d.current,k=g(w.clientX,w.clientY),B={x:Math.min(y.x,k.x),y:Math.min(y.y,k.y),width:Math.abs(k.x-y.x),height:Math.abs(k.y-y.y)};a(B);const F=new Set;for(const[T]of h.current)m(T,B)&&F.add(T);o(F)},[u,g,m]),_=b.useCallback(()=>{u&&(s==null||s(Array.from(i)),c(!1),a(null),d.current=null)},[u,i,s]);b.useEffect(()=>{if(!u)return;const w=k=>{v(k)},y=()=>{_()};return window.addEventListener("mousemove",w),window.addEventListener("mouseup",y),()=>{window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",y)}},[u,v,_]);const C=b.useCallback((w,y=!1)=>{o(k=>{const B=new Set(y?k:[]);return k.has(w)&&y?B.delete(w):B.add(w),s==null||s(Array.from(B)),B})},[s]),S=b.useCallback(()=>{const w=new Set(h.current.keys());o(w),s==null||s(Array.from(w))},[s]),D=b.useCallback(()=>{o(new Set),s==null||s([])},[s]);return{selectedIds:i,setSelectedIds:o,selectionBox:l,isSelecting:u,startSelection:x,updateSelection:v,endSelection:_,toggleSelect:C,selectAll:S,clearSelection:D}}const _d=b.memo(function({nodeId:e,position:t,isSelected:n,isDragging:s,draggable:i,onDragStart:o,onClick:l,onDoubleClick:a,onContextMenu:u,children:c}){const d=b.useCallback(_=>{i&&_.button===0&&o(e,_)},[e,i,o]),f=b.useCallback(_=>{s||l==null||l(_)},[s,l]),h=b.useCallback(_=>{_.stopPropagation(),a==null||a(_)},[a]),g=b.useCallback(_=>{_.preventDefault(),_.stopPropagation(),u==null||u(_)},[u]),m=t.width||200,x=t.height||100,v=t.rotation||0;return p.jsx("div",{"data-qmap-node":e,"data-x":t.x,"data-y":t.y,style:{position:"absolute",left:t.x,top:t.y,width:m,height:x,transform:v!==0?`rotate(${v}deg)`:void 0,transformOrigin:"center center",cursor:i?s?"grabbing":"grab":"pointer",userSelect:"none",outline:n?"2px solid #3b82f6":void 0,outlineOffset:"2px",opacity:s?.8:1,zIndex:s?1e3:n?100:1,WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},onMouseDown:d,onClick:f,onDoubleClick:h,onContextMenu:g,children:c})},(r,e)=>r.nodeId===e.nodeId&&r.position.x===e.position.x&&r.position.y===e.position.y&&r.position.width===e.position.width&&r.position.height===e.position.height&&r.position.rotation===e.position.rotation&&r.isSelected===e.isSelected&&r.isDragging===e.isDragging&&r.draggable===e.draggable&&r.children===e.children);function vd(r,e,t="bezier"){const n=Vn(r),s=Vn(e),i=Ao(r,s),o=Ao(e,n);switch(t){case"straight":return`M ${i.x} ${i.y} L ${o.x} ${o.y}`;case"orthogonal":return dy(i,o);case"bezier":default:return cy(i,o)}}function cy(r,e){const t=e.x-r.x,n=e.y-r.y,s=Math.sqrt(t*t+n*n),i=Math.min(s*.4,150),o=Math.abs(t)>Math.abs(n);let l,a,u,c;return o?(l=r.x+i*Math.sign(t),a=r.y,u=e.x-i*Math.sign(t),c=e.y):(l=r.x,a=r.y+i*Math.sign(n),u=e.x,c=e.y-i*Math.sign(n)),`M ${r.x} ${r.y} C ${l} ${a}, ${u} ${c}, ${e.x} ${e.y}`}function dy(r,e){const t=e.x-r.x,n=e.y-r.y;if(Math.abs(t)>Math.abs(n)){const i=r.x+t/2;return`M ${r.x} ${r.y} H ${i} V ${e.y} H ${e.x}`}else{const i=r.y+n/2;return`M ${r.x} ${r.y} V ${i} H ${e.x} V ${e.y}`}}function Vn(r){const e=r.width||200,t=r.height||100;return{x:r.x+e/2,y:r.y+t/2}}function Ao(r,e){const t=r.width||200,n=r.height||100,s=Vn(r),i=e.x-s.x,o=e.y-s.y;if(i===0&&o===0)return s;const l=t/2,a=n/2,u=Math.abs(o/(i||.001)),c=a/l;let d,f;return u<c?(d=s.x+(i>0?l:-l),f=s.y+o*l/Math.abs(i)):(f=s.y+(o>0?a:-a),d=s.x+i*a/Math.abs(o)),{x:d,y:f}}function fy(r,e){const t=r.width||200,n=r.height||100;switch(e){case"left":return{x:r.x,y:r.y+n/2};case"right":return{x:r.x+t,y:r.y+n/2};case"top":return{x:r.x+t/2,y:r.y};case"bottom":return{x:r.x+t/2,y:r.y+n};case"center":default:return Vn(r)}}function hy(r,e){return r.x>=e.x&&r.x<=e.x+e.width&&r.y>=e.y&&r.y<=e.y+e.height}function py(r,e){return r.x<e.x+e.width&&r.x+r.width>e.x&&r.y<e.y+e.height&&r.y+r.height>e.y}function gy(r){if(r.length===0)return null;let e=1/0,t=1/0,n=-1/0,s=-1/0;for(const i of r){const o=i.width||200,l=i.height||100;e=Math.min(e,i.x),t=Math.min(t,i.y),n=Math.max(n,i.x+o),s=Math.max(s,i.y+l)}return{x:e,y:t,width:n-e,height:s-t}}function my(r,e){const t=e.x-r.x,n=e.y-r.y;return Math.sqrt(t*t+n*n)}function yy(r,e){const t=e.x-r.x,n=e.y-r.y;return t*t+n*n}const wd=b.memo(function({edge:e,sourcePosition:t,targetPosition:n,style:s,color:i,width:o,onClick:l}){const[a,u]=b.useState(!1),c=b.useMemo(()=>vd(t,n,s),[t,n,s]),d=b.useCallback(x=>{x.stopPropagation(),l==null||l(e,x)},[e,l]),f=b.useCallback(()=>{u(!0)},[]),h=b.useCallback(()=>{u(!1)},[]),g=e.color||i,m=e.width||o;return p.jsxs("g",{children:[p.jsx("path",{d:c,fill:"none",stroke:"transparent",strokeWidth:Math.max(m*3,10),style:{cursor:l?"pointer":"default",pointerEvents:"stroke"},onClick:d,onMouseEnter:f,onMouseLeave:h}),p.jsx("path",{d:c,fill:"none",stroke:g,strokeWidth:a?m*1.5:m,strokeLinecap:"round",strokeLinejoin:"round",style:{pointerEvents:"none",transition:"stroke-width 0.15s ease"}}),e.label&&p.jsx(xy,{pathD:c,label:e.label,color:g})]})},(r,e)=>r.edge.id===e.edge.id&&r.sourcePosition.x===e.sourcePosition.x&&r.sourcePosition.y===e.sourcePosition.y&&r.sourcePosition.width===e.sourcePosition.width&&r.sourcePosition.height===e.sourcePosition.height&&r.targetPosition.x===e.targetPosition.x&&r.targetPosition.y===e.targetPosition.y&&r.targetPosition.width===e.targetPosition.width&&r.targetPosition.height===e.targetPosition.height&&r.style===e.style&&r.color===e.color&&r.width===e.width&&r.edge.label===e.edge.label&&r.edge.color===e.edge.color&&r.edge.width===e.edge.width);function xy({pathD:r,label:e,color:t}){const n=b.useMemo(()=>`edge-label-${Math.random().toString(36).substr(2,9)}`,[]);return p.jsxs(p.Fragment,{children:[p.jsx("defs",{children:p.jsx("path",{id:n,d:r})}),p.jsx("text",{fill:t,fontSize:"12",fontFamily:"system-ui, sans-serif",style:{pointerEvents:"none"},children:p.jsx("textPath",{href:`#${n}`,startOffset:"50%",textAnchor:"middle",children:e})})]})}const Cd=b.memo(function({edges:e,nodePositions:t,defaultStyle:n,defaultColor:s,defaultWidth:i,onEdgeClick:o}){const l=b.useMemo(()=>e.filter(u=>t.has(u.source)&&t.has(u.target)),[e,t]),a=b.useMemo(()=>{if(t.size===0)return"0 0 1000 1000";let u=1/0,c=1/0,d=-1/0,f=-1/0;for(const h of t.values()){const g=h.width||200,m=h.height||100;u=Math.min(u,h.x-100),c=Math.min(c,h.y-100),d=Math.max(d,h.x+g+100),f=Math.max(f,h.y+m+100)}return u-=1e3,c-=1e3,d+=1e3,f+=1e3,`${u} ${c} ${d-u} ${f-c}`},[t]);return p.jsx("svg",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},viewBox:a,preserveAspectRatio:"none",children:p.jsx("g",{style:{pointerEvents:"auto"},children:l.map(u=>{const c=t.get(u.source),d=t.get(u.target);return p.jsx(wd,{edge:u,sourcePosition:c,targetPosition:d,style:u.style||n,color:u.color||s,width:u.width||i,onClick:o},u.id)})})})},(r,e)=>!(r.edges!==e.edges||r.nodePositions!==e.nodePositions||r.defaultStyle!==e.defaultStyle||r.defaultColor!==e.defaultColor||r.defaultWidth!==e.defaultWidth)),Sd=b.memo(function({box:e,transform:t}){const n=b.useMemo(()=>({x:e.x*t.k+t.x,y:e.y*t.k+t.y,width:e.width*t.k,height:e.height*t.k}),[e,t]);return p.jsx("div",{style:{position:"absolute",left:n.x,top:n.y,width:n.width,height:n.height,backgroundColor:"rgba(59, 130, 246, 0.1)",border:"1px solid rgba(59, 130, 246, 0.5)",borderRadius:2,pointerEvents:"none",zIndex:9999}})}),by=200,_y=100,vy="bezier",wy="#94a3b8",Cy=2,Sy=.1,Ey=4;function ky({viewNode:r,nodes:e,edges:t,renderNode:n,defaultNodeWidth:s=by,defaultNodeHeight:i=_y,onNodeMove:o,onNodeClick:l,onNodeDoubleClick:a,onNodeContextMenu:u,onSelectionChange:c,onEdgeClick:d,onViewChange:f,onTransformChange:h,minZoom:g=Sy,maxZoom:m=Ey,initialTransform:x,defaultEdgeStyle:v=vy,defaultEdgeColor:_=wy,defaultEdgeWidth:C=Cy,draggable:S=!0,selectable:D=!0,zoomable:w=!0,pannable:y=!0,className:k="",style:B,background:F="#f8fafc",showGrid:T=!1,gridSize:M=20}){const L=r.data||{positions:{}},E=L.positions||{},N=b.useMemo(()=>{const ue=new Map;for(const _e of e){const Te=E[_e._id]||{x:0,y:0};ue.set(_e._id,{x:Te.x,y:Te.y,width:Te.width||s,height:Te.height||i,rotation:Te.rotation||0})}return ue},[e,E,s,i]),{transform:R,containerRef:O,zoomIn:H,zoomOut:U,resetZoom:Z,fitToContent:q}=yd({minZoom:g,maxZoom:m,initialTransform:x||L.transform,zoomable:w,pannable:y,onTransformChange:ue=>{h==null||h(ue);const _e={...L,transform:ue};f==null||f(_e)}}),[K,$]=b.useState(new Map),{draggedNodeId:re,startDrag:ae}=xd({transform:R,disabled:!S,onDragStart:ue=>{const _e=N.get(ue);_e&&$(new Map([[ue,{x:_e.x,y:_e.y}]]))},onDragMove:(ue,_e,Te)=>{$(new Map([[ue,{x:_e,y:Te}]]))},onDragEnd:(ue,_e,Te)=>{$(new Map),o==null||o(ue,_e,Te)}}),{selectedIds:le,selectionBox:ce,isSelecting:ve,startSelection:pe,toggleSelect:Fe,clearSelection:et}=bd({transform:R,nodePositions:N,disabled:!D,onSelectionChange:c}),ct=b.useCallback(ue=>{const _e=N.get(ue)||{x:0,y:0,width:s,height:i},Te=K.get(ue);return Te?{..._e,x:Te.x,y:Te.y}:_e},[N,K,s,i]),kt=b.useMemo(()=>{const ue=new Map;for(const _e of N.keys())ue.set(_e,ct(_e));return ue},[N,ct]),tt=b.useCallback((ue,_e)=>{Fe(ue._id,_e.shiftKey),l==null||l(ue,_e)},[Fe,l]),xt=b.useCallback(ue=>{ue.target.closest("[data-qmap-node]")||et()},[et]),dt=b.useCallback(ue=>{ue.button===0&&(ue.target.closest("[data-qmap-node]")||pe(ue))},[pe]),It=T?`
184
+ linear-gradient(to right, rgba(0,0,0,0.05) 1px, transparent 1px),
185
+ linear-gradient(to bottom, rgba(0,0,0,0.05) 1px, transparent 1px)
186
+ `:void 0;return p.jsxs("div",{ref:O,className:`qmap-container ${k}`,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",background:F,backgroundImage:It,backgroundSize:T?`${M}px ${M}px`:void 0,cursor:ve?"crosshair":y?"grab":"default",...B},onMouseDown:dt,onClick:xt,children:[p.jsxs("div",{className:"qmap-canvas",style:{position:"absolute",transformOrigin:"0 0",transform:`translate(${R.x}px, ${R.y}px) scale(${R.k})`,willChange:"transform"},children:[p.jsx(Cd,{edges:t,nodePositions:kt,defaultStyle:v,defaultColor:_,defaultWidth:C,onEdgeClick:d}),e.map(ue=>{const _e=ct(ue._id),Te=le.has(ue._id),it=re===ue._id;return p.jsx(_d,{nodeId:ue._id,position:_e,isSelected:Te,isDragging:it,draggable:S,onDragStart:ae,onClick:Je=>tt(ue,Je),onDoubleClick:Je=>a==null?void 0:a(ue,Je),onContextMenu:Je=>u==null?void 0:u(ue,Je),children:n(ue,Te,_e)},ue._id)})]}),ce&&p.jsx(Sd,{box:ce,transform:R}),p.jsxs("div",{className:"qmap-controls",style:{position:"absolute",bottom:16,right:16,display:"flex",flexDirection:"column",gap:4,zIndex:100},children:[p.jsx("button",{onClick:H,style:{width:32,height:32,border:"1px solid #e2e8f0",borderRadius:4,background:"white",cursor:"pointer",fontSize:18,display:"flex",alignItems:"center",justifyContent:"center"},title:"Zoom in",children:"+"}),p.jsx("button",{onClick:U,style:{width:32,height:32,border:"1px solid #e2e8f0",borderRadius:4,background:"white",cursor:"pointer",fontSize:18,display:"flex",alignItems:"center",justifyContent:"center"},title:"Zoom out",children:"−"}),p.jsx("button",{onClick:Z,style:{width:32,height:32,border:"1px solid #e2e8f0",borderRadius:4,background:"white",cursor:"pointer",fontSize:12,display:"flex",alignItems:"center",justifyContent:"center"},title:"Reset zoom",children:"1:1"}),p.jsx("button",{onClick:()=>q(Array.from(N.values())),style:{width:32,height:32,border:"1px solid #e2e8f0",borderRadius:4,background:"white",cursor:"pointer",fontSize:12,display:"flex",alignItems:"center",justifyContent:"center"},title:"Fit to content",children:"⊡"})]})]})}exports.$createQRCodeNode=la;exports.$isQRCodeNode=mg;exports.AnimatedCardFlip=mf;exports.ApiClient=iu;exports.AudioEditor=jg;exports.AuthFlow=cu;exports.AuthFlowModal=cf;exports.AuthManager=ht;exports.AuthProvider=tf;exports.AuthService=To;exports.Card=hf;exports.ComboBox=kg;exports.ComboStack=Ag;exports.DataOperations=_s;exports.Detail=pf;exports.ForgotPasswordForm=lu;exports.GraphClient=Bd;exports.KanbanBoard=Tg;exports.LoginForm=No;exports.LoginModal=sf;exports.Mail=xf;exports.MailClient=su;exports.MailComposer=Sg;exports.MailEditor=Vc;exports.QMap=ky;exports.QMapEdgeComponent=wd;exports.QMapEdgeLayer=Cd;exports.QMapNode=_d;exports.QMapSelectionBox=Sd;exports.QRCodeNode=un;exports.RegisterForm=au;exports.ResetPasswordForm=uu;exports.SelectableList=bf;exports.Stack=ff;exports.Timeline=Mg;exports.VerifyCodeForm=Gi;exports.calculateBoundingBox=gy;exports.calculateEdgePath=vd;exports.distance=my;exports.distanceSquared=yy;exports.getApiClient=Bo;exports.getAuthService=Xd;exports.getConnectionPoint=Ao;exports.getNodeCenter=Vn;exports.getNodeSidePoint=fy;exports.initializeApiClient=Jd;exports.initializeAuthService=Qd;exports.pointInRect=hy;exports.rectsIntersect=py;exports.useAuth=rf;exports.useMutation=df;exports.useNodeDrag=xd;exports.useQuery=du;exports.useSelection=bd;exports.useZoomPan=yd;