@qwanyx/stack 0.2.29 → 0.2.30

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,8 +1,8 @@
1
- "use strict";var Ou=Object.defineProperty;var Mu=(r,e,t)=>e in r?Ou(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var hr=(r,e,t)=>Mu(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("react"),Ni=require("react-dom");function Ru(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 us=Ru(A);class $u{constructor(e){hr(this,"config");hr(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 i=await s.text();throw new Error(`API error (${s.status}): ${i}`)}const o=await s.json();if(!o.success&&o.error)throw new Error(o.error);return o}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 i=s.result.split(",")[1];t(i)},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 o=new Image,i=URL.createObjectURL(e);o.onload=()=>{if(URL.revokeObjectURL(i),o.width<=t&&o.height<=t){s(e);return}let l,u;o.width>o.height?(l=t,u=Math.round(o.height/o.width*t)):(u=t,l=Math.round(o.width/o.height*t));const a=document.createElement("canvas");a.width=l,a.height=u;const c=a.getContext("2d");if(!c){s(e);return}c.drawImage(o,0,0,l,u);const f=e.type==="image/png"?"image/png":"image/jpeg";a.toBlob(d=>{if(d){const h=new File([d],e.name,{type:f});s(h)}else s(e)},f,n)},o.onerror=()=>{URL.revokeObjectURL(i),s(e)},o.src=i}):e}async uploadFile(e,t,n,s={}){const o={...this.defaultUploadOptions,...s};try{let i=n;o.maxImageDimension>0&&n.type.startsWith("image/")&&(i=await this.resizeImage(n,o.maxImageDimension,o.imageQuality));const l=o.maxSizeMB*1024*1024;if(i.size>l)return{success:!1,error:`File too large (${(i.size/1024/1024).toFixed(1)} MB). Max: ${o.maxSizeMB} MB`};const u=await this.fileToBase64(i),a=await this.callGraph("upload_file",{node_id:e,filename:t,content:u});return a.success?{success:!0,path:a.path}:{success:!1,error:a.error||"Upload failed"}}catch(i){return{success:!1,error:i instanceof Error?i.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(o=>({filename:o.name,path:o.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 tr=new TextEncoder,Fi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vr=new Uint8Array(256);for(var on=0;on<Fi.length;on++)vr[Fi.charCodeAt(on)]=on;function ws(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),o=new Uint8Array(s);for(let i=0;i<t;i+=4){let l=vr[r.charCodeAt(i)],u=vr[r.charCodeAt(i+1)],a=vr[r.charCodeAt(i+2)],c=vr[r.charCodeAt(i+3)];o[n++]=l<<2|u>>4,o[n++]=(u&15)<<4|a>>2,o[n++]=(a&3)<<6|c&63}return s}function Er(r){r=r||"utf8";let e;try{e=new TextDecoder(r)}catch{e=new TextDecoder("windows-1252")}return e}async function $n(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 Li(r){return r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70?String.fromCharCode(r):!1}function Iu(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 o=tr.encode(t),i=[];for(let u=0,a=o.length;u<a;u++){let c=o[u];if(u<=a-2&&c===61){let f=Li(o[u+1]),d=Li(o[u+2]);if(f&&d){let h=parseInt(f+d,16);i.push(h),u+=2;continue}}i.push(c)}s=new ArrayBuffer(i.length);let l=new DataView(s);for(let u=0,a=i.length;u<a;u++)l.setUint8(u,i[u])}else e==="B"?s=ws(t.replace(/[^a-zA-Z0-9\+\/=]+/g,"")):s=tr.encode(t);return Er(r).decode(s)}function Ar(r){let e=!0;for(;;){let t=(r||"").toString().replace(/(=\?([^?]+)\?[Bb]\?([^?]*)\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g,(n,s,o,i,l)=>e&&o===l&&i.length%4===0&&!/=$/.test(i)?s+"__\0JOIN\0__":n).replace(/(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,(n,s,o,i)=>e&&o===i?s+"__\0JOIN\0__":n).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g,"").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g,"$1").replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,(n,s,o,i)=>Iu(s,o,i));if(e&&t.indexOf("�")>=0)e=!1;else return t}}function zu(r,e){e=e||"utf-8";let t=[];for(let o=0;o<r.length;o++){let i=r.charAt(o);if(i==="%"&&/^[a-f0-9]{2}/i.test(r.substr(o+1,2))){let l=r.substr(o+1,2);o+=2,t.push(parseInt(l,16))}else if(i.charCodeAt(0)>126){i=tr.encode(i);for(let l=0;l<i.length;l++)t.push(i[l])}else t.push(i.charCodeAt(0))}const n=new ArrayBuffer(t.length),s=new DataView(n);for(let o=0,i=t.length;o<i;o++)s.setUint8(o,t[o]);return Er(e).decode(n)}function qu(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(),o=Number(n[2])||0,i;e.has(s)?i=e.get(s):(i={charset:!1,values:[]},e.set(s,i));let l=r.params[t];o===0&&n[0].charAt(n[0].length-1)==="*"&&(n=l.match(/^([^']*)'[^']*'(.*)$/))&&(i.charset=n[1]||"utf-8",l=n[2]),i.values.push({nr:o,value:l}),delete r.params[t]}),e.forEach((t,n)=>{r.params[n]=zu(t.values.sort((s,o)=>s.nr-o.nr).map(s=>s.value).join(""),t.charset)})}class Uu{constructor(){this.chunks=[]}update(e){this.chunks.push(e),this.chunks.push(`
2
- `)}finalize(){return $n(new Blob(this.chunks,{type:"application/octet-stream"}))}}class Wu{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(ws(s))}}finalize(){return this.remainder&&!/^=+$/.test(this.remainder)&&this.chunks.push(ws(this.remainder)),$n(new Blob(this.chunks,{type:"application/octet-stream"}))}}const ji=/^=[a-f0-9]{2}$/i,Ku=/(?==[a-f0-9]{2})/i,Vu=/=\r?\n/g,Gu=/=[a-fA-F0-9]?$/;class Hu{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,o=e.length;s<o;s++)n.setUint8(s,parseInt(e[s],16));return t}decodeChunks(e){e=e.replace(Vu,"");let t=e.split(Ku),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){ji.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 o=s.substr(0,3);ji.test(o)?(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(Gu);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=""),$n(new Blob(this.chunks,{type:"application/octet-stream"}))}}class Pi{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 Wu:/quoted-printable/i.test(e)?this.contentDecoder=new Hu({decoder:Er(this.contentType.parsed.params.charset)}):this.contentDecoder=new Uu}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="",o="value",i=!1,l=!1,u;for(let a=0,c=e.length;a<c;a++)switch(u=e.charAt(a),o){case"key":if(u==="="){n=s.trim().toLowerCase(),o="value",s="";break}s+=u;break;case"value":if(l)s+=u;else if(u==="\\"){l=!0;continue}else i&&u===i?i=!1:!i&&u==='"'?i=u:!i&&u===";"?(n===!1?t.value=s.trim():t.params[n]=s.trim(),o="key",s=""):s+=u;l=!1;break}return s=s.trim(),o==="value"?n===!1?t.value=s:t.params[n]=s:s&&(t.params[s.toLowerCase()]=""),t.value&&(t.value=t.value.toLowerCase()),qu(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=Er(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(),o=n<0?"":t.substr(n+1).trim();switch(this.headers.push({key:s.toLowerCase(),originalKey:s,value:o}),s.toLowerCase()){case"content-type":this.contentType.default&&(this.contentType={value:o,parsed:{}});break;case"content-transfer-encoding":this.contentTransferEncoding={value:o,parsed:{}};break;case"content-disposition":this.contentDisposition={value:o,parsed:{}};break;case"content-id":this.contentId=o;break;case"content-description":this.contentDescription=o;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:tr.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(Er().decode(e));break;case"body":this.contentDecoder.update(e)}}}const Oi={"&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;":`
1
+ "use strict";var Ou=Object.defineProperty;var Mu=(r,e,t)=>e in r?Ou(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var gr=(r,e,t)=>Mu(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("react"),Ni=require("react-dom");function Ru(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 us=Ru(A);class $u{constructor(e){gr(this,"config");gr(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 i=await s.text();throw new Error(`API error (${s.status}): ${i}`)}const o=await s.json();if(!o.success&&o.error)throw new Error(o.error);return o}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 i=s.result.split(",")[1];t(i)},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 o=new Image,i=URL.createObjectURL(e);o.onload=()=>{if(URL.revokeObjectURL(i),o.width<=t&&o.height<=t){s(e);return}let l,u;o.width>o.height?(l=t,u=Math.round(o.height/o.width*t)):(u=t,l=Math.round(o.width/o.height*t));const a=document.createElement("canvas");a.width=l,a.height=u;const c=a.getContext("2d");if(!c){s(e);return}c.drawImage(o,0,0,l,u);const d=e.type==="image/png"?"image/png":"image/jpeg";a.toBlob(f=>{if(f){const h=new File([f],e.name,{type:d});s(h)}else s(e)},d,n)},o.onerror=()=>{URL.revokeObjectURL(i),s(e)},o.src=i}):e}async uploadFile(e,t,n,s={}){const o={...this.defaultUploadOptions,...s};try{let i=n;o.maxImageDimension>0&&n.type.startsWith("image/")&&(i=await this.resizeImage(n,o.maxImageDimension,o.imageQuality));const l=o.maxSizeMB*1024*1024;if(i.size>l)return{success:!1,error:`File too large (${(i.size/1024/1024).toFixed(1)} MB). Max: ${o.maxSizeMB} MB`};const u=await this.fileToBase64(i),a=await this.callGraph("upload_file",{node_id:e,filename:t,content:u});return a.success?{success:!0,path:a.path}:{success:!1,error:a.error||"Upload failed"}}catch(i){return{success:!1,error:i instanceof Error?i.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(o=>({filename:o.name,path:o.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 rr=new TextEncoder,Fi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cr=new Uint8Array(256);for(var ln=0;ln<Fi.length;ln++)Cr[Fi.charCodeAt(ln)]=ln;function ws(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),o=new Uint8Array(s);for(let i=0;i<t;i+=4){let l=Cr[r.charCodeAt(i)],u=Cr[r.charCodeAt(i+1)],a=Cr[r.charCodeAt(i+2)],c=Cr[r.charCodeAt(i+3)];o[n++]=l<<2|u>>4,o[n++]=(u&15)<<4|a>>2,o[n++]=(a&3)<<6|c&63}return s}function kr(r){r=r||"utf8";let e;try{e=new TextDecoder(r)}catch{e=new TextDecoder("windows-1252")}return e}async function In(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 Li(r){return r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70?String.fromCharCode(r):!1}function Iu(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 o=rr.encode(t),i=[];for(let u=0,a=o.length;u<a;u++){let c=o[u];if(u<=a-2&&c===61){let d=Li(o[u+1]),f=Li(o[u+2]);if(d&&f){let h=parseInt(d+f,16);i.push(h),u+=2;continue}}i.push(c)}s=new ArrayBuffer(i.length);let l=new DataView(s);for(let u=0,a=i.length;u<a;u++)l.setUint8(u,i[u])}else e==="B"?s=ws(t.replace(/[^a-zA-Z0-9\+\/=]+/g,"")):s=rr.encode(t);return kr(r).decode(s)}function Sr(r){let e=!0;for(;;){let t=(r||"").toString().replace(/(=\?([^?]+)\?[Bb]\?([^?]*)\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g,(n,s,o,i,l)=>e&&o===l&&i.length%4===0&&!/=$/.test(i)?s+"__\0JOIN\0__":n).replace(/(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,(n,s,o,i)=>e&&o===i?s+"__\0JOIN\0__":n).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g,"").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g,"$1").replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,(n,s,o,i)=>Iu(s,o,i));if(e&&t.indexOf("�")>=0)e=!1;else return t}}function zu(r,e){e=e||"utf-8";let t=[];for(let o=0;o<r.length;o++){let i=r.charAt(o);if(i==="%"&&/^[a-f0-9]{2}/i.test(r.substr(o+1,2))){let l=r.substr(o+1,2);o+=2,t.push(parseInt(l,16))}else if(i.charCodeAt(0)>126){i=rr.encode(i);for(let l=0;l<i.length;l++)t.push(i[l])}else t.push(i.charCodeAt(0))}const n=new ArrayBuffer(t.length),s=new DataView(n);for(let o=0,i=t.length;o<i;o++)s.setUint8(o,t[o]);return kr(e).decode(n)}function qu(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(),o=Number(n[2])||0,i;e.has(s)?i=e.get(s):(i={charset:!1,values:[]},e.set(s,i));let l=r.params[t];o===0&&n[0].charAt(n[0].length-1)==="*"&&(n=l.match(/^([^']*)'[^']*'(.*)$/))&&(i.charset=n[1]||"utf-8",l=n[2]),i.values.push({nr:o,value:l}),delete r.params[t]}),e.forEach((t,n)=>{r.params[n]=zu(t.values.sort((s,o)=>s.nr-o.nr).map(s=>s.value).join(""),t.charset)})}class Uu{constructor(){this.chunks=[]}update(e){this.chunks.push(e),this.chunks.push(`
2
+ `)}finalize(){return In(new Blob(this.chunks,{type:"application/octet-stream"}))}}class Wu{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(ws(s))}}finalize(){return this.remainder&&!/^=+$/.test(this.remainder)&&this.chunks.push(ws(this.remainder)),In(new Blob(this.chunks,{type:"application/octet-stream"}))}}const ji=/^=[a-f0-9]{2}$/i,Ku=/(?==[a-f0-9]{2})/i,Vu=/=\r?\n/g,Gu=/=[a-fA-F0-9]?$/;class Hu{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,o=e.length;s<o;s++)n.setUint8(s,parseInt(e[s],16));return t}decodeChunks(e){e=e.replace(Vu,"");let t=e.split(Ku),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){ji.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 o=s.substr(0,3);ji.test(o)?(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(Gu);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=""),In(new Blob(this.chunks,{type:"application/octet-stream"}))}}class Pi{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 Wu:/quoted-printable/i.test(e)?this.contentDecoder=new Hu({decoder:kr(this.contentType.parsed.params.charset)}):this.contentDecoder=new Uu}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="",o="value",i=!1,l=!1,u;for(let a=0,c=e.length;a<c;a++)switch(u=e.charAt(a),o){case"key":if(u==="="){n=s.trim().toLowerCase(),o="value",s="";break}s+=u;break;case"value":if(l)s+=u;else if(u==="\\"){l=!0;continue}else i&&u===i?i=!1:!i&&u==='"'?i=u:!i&&u===";"?(n===!1?t.value=s.trim():t.params[n]=s.trim(),o="key",s=""):s+=u;l=!1;break}return s=s.trim(),o==="value"?n===!1?t.value=s:t.params[n]=s:s&&(t.params[s.toLowerCase()]=""),t.value&&(t.value=t.value.toLowerCase()),qu(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=kr(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(),o=n<0?"":t.substr(n+1).trim();switch(this.headers.push({key:s.toLowerCase(),originalKey:s,value:o}),s.toLowerCase()){case"content-type":this.contentType.default&&(this.contentType={value:o,parsed:{}});break;case"content-transfer-encoding":this.contentTransferEncoding={value:o,parsed:{}};break;case"content-disposition":this.contentDisposition={value:o,parsed:{}};break;case"content-id":this.contentId=o;break;case"content-description":this.contentDescription=o;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:rr.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(kr().decode(e));break;case"body":this.contentDecoder.update(e)}}}const Oi={"&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
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 Ju(r){return r.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi,(e,t)=>{if(typeof Oi[e]=="string")return Oi[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 Nt(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 Qu(r){return"<div>"+Nt(r).replace(/\n/g,"<br />")+"</div>"}function Yu(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
 
@@ -14,18 +14,18 @@
14
14
  `).replace(/^\n+/,`
15
15
  `).replace(/\n+$/,`
16
16
  `),r=Ju(r),r}function Zo(r){return[].concat(r.name||[]).concat(r.name?`<${r.address}>`:r.address).join(" ")}function as(r){let e=[],t=(n,s)=>{if(s&&e.push(", "),n.group){let o=`${n.name}:`,i=";";e.push(o),n.group.forEach(t),e.push(i)}else e.push(Zo(n))};return r.forEach(t),e.join("")}function el(r){return`<a href="mailto:${Nt(r.address)}" class="postal-email-address">${Nt(r.name||`<${r.address}>`)}</a>`}function cs(r){let e=[],t=(n,s)=>{if(s&&e.push('<span class="postal-email-address-separator">, </span>'),n.group){let o=`<span class="postal-email-address-group">${Nt(n.name)}:</span>`,i='<span class="postal-email-address-group">;</span>';e.push(o),n.group.forEach(t),e.push(i)}else e.push(el(n))};return r.forEach(t),e.join(" ")}function Xu(r,e,t){r=(r||"").toString(),e=e||76;let n=0,s=r.length,o="",i,l;for(;n<s;){if(i=r.substr(n,e),i.length<e){o+=i;break}if(l=i.match(/^[^\n\r]*(\r?\n|\r)/)){i=l[0],o+=i,n+=i.length;continue}else(l=i.match(/(\s+)[^\s]*$/))&&l[0].length-(l[1]||"").length<i.length?i=i.substr(0,i.length-(l[0].length-(l[1]||"").length)):(l=r.substr(n+i.length).match(/^[^\s]+(\s*)/))&&(i=i+l[0].substr(0,l[0].length-0));o+=i,n+=i.length,n<s&&(o+=`\r
17
- `)}return o}function Mi(r){let e=[];if(r.from&&e.push({key:"From",val:Zo(r.from)}),r.subject&&e.push({key:"Subject",val:r.subject}),r.date){let i={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},l=typeof Intl>"u"?r.date:new Intl.DateTimeFormat("default",i).format(new Date(r.date));e.push({key:"Date",val:l})}r.to&&r.to.length&&e.push({key:"To",val:as(r.to)}),r.cc&&r.cc.length&&e.push({key:"Cc",val:as(r.cc)}),r.bcc&&r.bcc.length&&e.push({key:"Bcc",val:as(r.bcc)});let t=e.map(i=>i.key.length).reduce((i,l)=>l>i?l:i,0);e=e.flatMap(i=>{let l=t-i.key.length,u=`${i.key}: ${" ".repeat(l)}`,a=`${" ".repeat(i.key.length+1)} ${" ".repeat(l)}`;return Xu(i.val,80).split(/\r?\n/).map(f=>f.trim()).map((f,d)=>`${d?a:u}${f}`)});let n=e.map(i=>i.length).reduce((i,l)=>l>i?l:i,0),s="-".repeat(n);return`
17
+ `)}return o}function Mi(r){let e=[];if(r.from&&e.push({key:"From",val:Zo(r.from)}),r.subject&&e.push({key:"Subject",val:r.subject}),r.date){let i={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},l=typeof Intl>"u"?r.date:new Intl.DateTimeFormat("default",i).format(new Date(r.date));e.push({key:"Date",val:l})}r.to&&r.to.length&&e.push({key:"To",val:as(r.to)}),r.cc&&r.cc.length&&e.push({key:"Cc",val:as(r.cc)}),r.bcc&&r.bcc.length&&e.push({key:"Bcc",val:as(r.bcc)});let t=e.map(i=>i.key.length).reduce((i,l)=>l>i?l:i,0);e=e.flatMap(i=>{let l=t-i.key.length,u=`${i.key}: ${" ".repeat(l)}`,a=`${" ".repeat(i.key.length+1)} ${" ".repeat(l)}`;return Xu(i.val,80).split(/\r?\n/).map(d=>d.trim()).map((d,f)=>`${f?a:u}${d}`)});let n=e.map(i=>i.length).reduce((i,l)=>l>i?l:i,0),s="-".repeat(n);return`
18
18
  ${s}
19
19
  ${e.join(`
20
20
  `)}
21
21
  ${s}
22
22
  `}function Ri(r){let e=[];if(r.from&&e.push(`<div class="postal-email-header-key">From</div><div class="postal-email-header-value">${el(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">${Nt(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="${Nt(r.date)}">${Nt(s)}</div>`)}return r.to&&r.to.length&&e.push(`<div class="postal-email-header-key">To</div><div class="postal-email-header-value">${cs(r.to)}</div>`),r.cc&&r.cc.length&&e.push(`<div class="postal-email-header-key">Cc</div><div class="postal-email-header-value">${cs(r.cc)}</div>`),r.bcc&&r.bcc.length&&e.push(`<div class="postal-email-header-key">Bcc</div><div class="postal-email-header-value">${cs(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 Zu(r,e){let t=!1,n="text",s,o=[],i={address:[],comment:[],group:[],text:[],textWasQuoted:[]},l,u,a=!1;for(l=0,u=r.length;l<u;l++){let c=r[l],f=l?r[l-1]:null;if(c.type==="operator")switch(c.value){case"<":n="address",a=!1;break;case"(":n="comment",a=!1;break;case":":n="group",t=!0,a=!1;break;case'"':a=!a,n="text";break;default:n="text",a=!1;break}else c.value&&(n==="address"&&(c.value=c.value.replace(/^[^<]*<\s*/,"")),f&&f.noBreak&&i[n].length?(i[n][i[n].length-1]+=c.value,n==="text"&&a&&(i.textWasQuoted[i.textWasQuoted.length-1]=!0)):(i[n].push(c.value),n==="text"&&i.textWasQuoted.push(a)))}if(!i.text.length&&i.comment.length&&(i.text=i.comment,i.comment=[]),t){i.text=i.text.join(" ");let c=[];i.group.length&&kr(i.group.join(","),{_depth:e+1}).forEach(d=>{d.group?c=c.concat(d.group):c.push(d)}),o.push({name:Ar(i.text||s&&s.name),group:c})}else{if(!i.address.length&&i.text.length){for(l=i.text.length-1;l>=0;l--)if(!i.textWasQuoted[l]&&i.text[l].match(/^[^@\s]+@[^@\s]+$/)){i.address=i.text.splice(l,1),i.textWasQuoted.splice(l,1);break}let c=function(f){return i.address.length?f:(i.address=[f.trim()]," ")};if(!i.address.length)for(l=i.text.length-1;l>=0&&!(!i.textWasQuoted[l]&&(i.text[l]=i.text[l].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/,c).trim(),i.address.length));l--);}if(!i.text.length&&i.comment.length&&(i.text=i.comment,i.comment=[]),i.address.length>1&&(i.text=i.text.concat(i.address.splice(1))),i.text=i.text.join(" "),i.address=i.address.join(" "),!i.address&&/^=\?[^=]+?=$/.test(i.text.trim())){const c=kr(Ar(i.text));if(c&&c.length)return c}if(!i.address&&t)return[];s={address:i.address||i.text||"",name:Ar(i.text||i.address||"")},s.address===s.name&&((s.address||"").match(/@/)?s.name="":s.address=""),o.push(s)}return o}class ea{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),o=t<n-1?this.str.charAt(t+1):null;this.checkChar(s,o)}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",`
23
+ <div class="postal-email-header-row">`)}${e.length?"</div>":""}</div>`}function Zu(r,e){let t=!1,n="text",s,o=[],i={address:[],comment:[],group:[],text:[],textWasQuoted:[]},l,u,a=!1;for(l=0,u=r.length;l<u;l++){let c=r[l],d=l?r[l-1]:null;if(c.type==="operator")switch(c.value){case"<":n="address",a=!1;break;case"(":n="comment",a=!1;break;case":":n="group",t=!0,a=!1;break;case'"':a=!a,n="text";break;default:n="text",a=!1;break}else c.value&&(n==="address"&&(c.value=c.value.replace(/^[^<]*<\s*/,"")),d&&d.noBreak&&i[n].length?(i[n][i[n].length-1]+=c.value,n==="text"&&a&&(i.textWasQuoted[i.textWasQuoted.length-1]=!0)):(i[n].push(c.value),n==="text"&&i.textWasQuoted.push(a)))}if(!i.text.length&&i.comment.length&&(i.text=i.comment,i.comment=[]),t){i.text=i.text.join(" ");let c=[];i.group.length&&Tr(i.group.join(","),{_depth:e+1}).forEach(f=>{f.group?c=c.concat(f.group):c.push(f)}),o.push({name:Sr(i.text||s&&s.name),group:c})}else{if(!i.address.length&&i.text.length){for(l=i.text.length-1;l>=0;l--)if(!i.textWasQuoted[l]&&i.text[l].match(/^[^@\s]+@[^@\s]+$/)){i.address=i.text.splice(l,1),i.textWasQuoted.splice(l,1);break}let c=function(d){return i.address.length?d:(i.address=[d.trim()]," ")};if(!i.address.length)for(l=i.text.length-1;l>=0&&!(!i.textWasQuoted[l]&&(i.text[l]=i.text[l].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/,c).trim(),i.address.length));l--);}if(!i.text.length&&i.comment.length&&(i.text=i.comment,i.comment=[]),i.address.length>1&&(i.text=i.text.concat(i.address.splice(1))),i.text=i.text.join(" "),i.address=i.address.join(" "),!i.address&&/^=\?[^=]+?=$/.test(i.text.trim())){const c=Tr(Sr(i.text));if(c&&c.length)return c}if(!i.address&&t)return[];s={address:i.address||i.text||"",name:Sr(i.text||i.address||"")},s.address===s.name&&((s.address||"").match(/@/)?s.name="":s.address=""),o.push(s)}return o}class ea{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),o=t<n-1?this.str.charAt(t+1):null;this.checkChar(s,o)}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 ta=50;function kr(r,e){e=e||{};let t=e._depth||0;if(t>ta)return[];let s=new ea(r).tokenize(),o=[],i=[],l=[];if(s.forEach(u=>{u.type==="operator"&&(u.value===","||u.value===";")?(i.length&&o.push(i),i=[]):i.push(u)}),i.length&&o.push(i),o.forEach(u=>{u=Zu(u,t),u.length&&(l=l.concat(u))}),e.flatten){let u=[],a=c=>{c.forEach(f=>{if(f.group)return a(f.group);u.push(f)})};return a(l),u}return l}function ra(r){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(r),s=n.byteLength,o=s%3,i=s-o,l,u,a,c,f,d=0;d<i;d=d+3)f=n[d]<<16|n[d+1]<<8|n[d+2],l=(f&16515072)>>18,u=(f&258048)>>12,a=(f&4032)>>6,c=f&63,e+=t[l]+t[u]+t[a]+t[c];return o==1?(f=n[i],l=(f&252)>>2,u=(f&3)<<4,e+=t[l]+t[u]+"=="):o==2&&(f=n[i]<<8|n[i+1],l=(f&64512)>>10,u=(f&1008)>>4,a=(f&15)<<2,e+=t[l]+t[u]+t[a]+"="),e}const na=256,sa=2*1024*1024;class xn{static parse(e,t){return new xn(t).parse(e)}constructor(e){this.options=e||{},this.mimeOptions={maxNestingDepth:this.options.maxNestingDepth||na,maxHeadersSize:this.options.maxHeadersSize||sa},this.root=this.currentNode=new Pi({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 o=n[s];if(e.length!==o.value.length+2&&e.length!==o.value.length+4)continue;let i=e.length===o.value.length+4;if(i&&(e[e.length-2]!==45||e[e.length-1]!==45))continue;let l=!0;for(let u=0;u<o.value.length;u++)if(e[u+2]!==o.value[u]){l=!1;break}if(l)return i?(await o.node.finalize(),this.currentNode=o.node.parentNode||this.root):(await o.node.finalizeChildNodes(),this.currentNode=new Pi({postalMime:this,parentNode:o.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(),o=async(i,l,u)=>{if(l=l||!1,u=u||!1,i.contentType.multipart)i.contentType.multipart==="alternative"?l=i:i.contentType.multipart==="related"&&(u=i);else if(this.isInlineMessageRfc822(i)&&!s){const a=new xn;i.subMessage=await a.parse(i.content),n.has(i)||n.set(i,{});let c=n.get(i);(i.subMessage.text||!i.subMessage.html)&&(c.plain=c.plain||[],c.plain.push({type:"subMessage",value:i.subMessage}),t.add("plain")),i.subMessage.html&&(c.html=c.html||[],c.html.push({type:"subMessage",value:i.subMessage}),t.add("html")),a.textMap&&a.textMap.forEach((f,d)=>{n.set(d,f)});for(let f of i.subMessage.attachments||[])this.attachments.push(f)}else if(this.isInlineTextNode(i)){let a=i.contentType.parsed.value.substr(i.contentType.parsed.value.indexOf("/")+1),c=l||i;n.has(c)||n.set(c,{});let f=n.get(c);f[a]=f[a]||[],f[a].push({type:"text",value:i.getTextContent()}),t.add(a)}else if(i.content){const a=i.contentDisposition.parsed.params.filename||i.contentType.parsed.params.name||null,c={filename:a?Ar(a):null,mimeType:i.contentType.parsed.value,disposition:i.contentDisposition.parsed.value||null};switch(u&&i.contentId&&(c.related=!0),i.contentDescription&&(c.description=i.contentDescription),i.contentId&&(c.contentId=i.contentId),i.contentType.parsed.value){case"text/calendar":case"application/ics":{i.contentType.parsed.params.method&&(c.method=i.contentType.parsed.params.method.toString().toUpperCase().trim());const f=i.getTextContent().replace(/\r?\n/g,`
25
+ `&&(e=" "),(e.charCodeAt(0)>=33||[" "," "].includes(e))&&(this.node.value+=e),this.escaped=!1}}const ta=50;function Tr(r,e){e=e||{};let t=e._depth||0;if(t>ta)return[];let s=new ea(r).tokenize(),o=[],i=[],l=[];if(s.forEach(u=>{u.type==="operator"&&(u.value===","||u.value===";")?(i.length&&o.push(i),i=[]):i.push(u)}),i.length&&o.push(i),o.forEach(u=>{u=Zu(u,t),u.length&&(l=l.concat(u))}),e.flatten){let u=[],a=c=>{c.forEach(d=>{if(d.group)return a(d.group);u.push(d)})};return a(l),u}return l}function ra(r){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(r),s=n.byteLength,o=s%3,i=s-o,l,u,a,c,d,f=0;f<i;f=f+3)d=n[f]<<16|n[f+1]<<8|n[f+2],l=(d&16515072)>>18,u=(d&258048)>>12,a=(d&4032)>>6,c=d&63,e+=t[l]+t[u]+t[a]+t[c];return o==1?(d=n[i],l=(d&252)>>2,u=(d&3)<<4,e+=t[l]+t[u]+"=="):o==2&&(d=n[i]<<8|n[i+1],l=(d&64512)>>10,u=(d&1008)>>4,a=(d&15)<<2,e+=t[l]+t[u]+t[a]+"="),e}const na=256,sa=2*1024*1024;class _n{static parse(e,t){return new _n(t).parse(e)}constructor(e){this.options=e||{},this.mimeOptions={maxNestingDepth:this.options.maxNestingDepth||na,maxHeadersSize:this.options.maxHeadersSize||sa},this.root=this.currentNode=new Pi({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 o=n[s];if(e.length!==o.value.length+2&&e.length!==o.value.length+4)continue;let i=e.length===o.value.length+4;if(i&&(e[e.length-2]!==45||e[e.length-1]!==45))continue;let l=!0;for(let u=0;u<o.value.length;u++)if(e[u+2]!==o.value[u]){l=!1;break}if(l)return i?(await o.node.finalize(),this.currentNode=o.node.parentNode||this.root):(await o.node.finalizeChildNodes(),this.currentNode=new Pi({postalMime:this,parentNode:o.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(),o=async(i,l,u)=>{if(l=l||!1,u=u||!1,i.contentType.multipart)i.contentType.multipart==="alternative"?l=i:i.contentType.multipart==="related"&&(u=i);else if(this.isInlineMessageRfc822(i)&&!s){const a=new _n;i.subMessage=await a.parse(i.content),n.has(i)||n.set(i,{});let c=n.get(i);(i.subMessage.text||!i.subMessage.html)&&(c.plain=c.plain||[],c.plain.push({type:"subMessage",value:i.subMessage}),t.add("plain")),i.subMessage.html&&(c.html=c.html||[],c.html.push({type:"subMessage",value:i.subMessage}),t.add("html")),a.textMap&&a.textMap.forEach((d,f)=>{n.set(f,d)});for(let d of i.subMessage.attachments||[])this.attachments.push(d)}else if(this.isInlineTextNode(i)){let a=i.contentType.parsed.value.substr(i.contentType.parsed.value.indexOf("/")+1),c=l||i;n.has(c)||n.set(c,{});let d=n.get(c);d[a]=d[a]||[],d[a].push({type:"text",value:i.getTextContent()}),t.add(a)}else if(i.content){const a=i.contentDisposition.parsed.params.filename||i.contentType.parsed.params.name||null,c={filename:a?Sr(a):null,mimeType:i.contentType.parsed.value,disposition:i.contentDisposition.parsed.value||null};switch(u&&i.contentId&&(c.related=!0),i.contentDescription&&(c.description=i.contentDescription),i.contentId&&(c.contentId=i.contentId),i.contentType.parsed.value){case"text/calendar":case"application/ics":{i.contentType.parsed.params.method&&(c.method=i.contentType.parsed.params.method.toString().toUpperCase().trim());const d=i.getTextContent().replace(/\r?\n/g,`
26
26
  `).replace(/\n*$/,`
27
- `);c.content=tr.encode(f);break}default:c.content=i.content}this.attachments.push(c)}for(let a of i.childNodes)await o(a,l,u)};await o(this.root,!1,[]),n.forEach(i=>{t.forEach(l=>{if(e[l]||(e[l]=[]),i[l])i[l].forEach(u=>{switch(u.type){case"text":e[l].push(u.value);break;case"subMessage":switch(l){case"html":e[l].push(Ri(u.value));break;case"plain":e[l].push(Mi(u.value));break}break}});else{let u;switch(l){case"html":u="plain";break;case"plain":u="html";break}(i[u]||[]).forEach(a=>{switch(a.type){case"text":switch(l){case"html":e[l].push(Qu(a.value));break;case"plain":e[l].push(Yu(a.value));break}break;case"subMessage":switch(l){case"html":e[l].push(Ri(a.value));break;case"plain":e[l].push(Mi(a.value));break}break}})}})}),Object.keys(e).forEach(i=>{e[i]=e[i].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:u}=await s.read();if(l)break;n.push(u),t+=u.length}const o=new Uint8Array(t);let i=0;for(let l of n)o.set(l,i),i+=l.length;return o}async parse(e){var s,o;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=tr.encode(e)),(e instanceof Blob||Object.prototype.toString.call(e)==="[object Blob]")&&(e=await $n(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 i=this.readLine();await this.processLine(i.bytes,i.done)}await this.processNodeTree();const t={headers:this.root.headers.map(i=>({key:i.key,value:i.value})).reverse()};for(const i of["from","sender"]){const l=this.root.headers.find(u=>u.key===i);if(l&&l.value){const u=kr(l.value);u&&u.length&&(t[i]=u[0])}}for(const i of["delivered-to","return-path"]){const l=this.root.headers.find(u=>u.key===i);if(l&&l.value){const u=kr(l.value);if(u&&u.length&&u[0].address){const a=i.replace(/\-(.)/g,(c,f)=>f.toUpperCase());t[a]=u[0].address}}}for(const i of["to","cc","bcc","reply-to"]){const l=this.root.headers.filter(a=>a.key===i);let u=[];if(l.filter(a=>a&&a.value).map(a=>kr(a.value)).forEach(a=>u=u.concat(a||[])),u&&u.length){const a=i.replace(/\-(.)/g,(c,f)=>f.toUpperCase());t[a]=u}}for(const i of["subject","message-id","in-reply-to","references"]){const l=this.root.headers.find(u=>u.key===i);if(l&&l.value){const u=i.replace(/\-(.)/g,(a,c)=>c.toUpperCase());t[u]=Ar(l.value)}}let n=this.root.headers.find(i=>i.key==="date");if(n){let i=new Date(n.value);!i||i.toString()==="Invalid Date"?i=n.value:i=i.toISOString(),t.date=i}switch((s=this.textContent)!=null&&s.html&&(t.html=this.textContent.html),(o=this.textContent)!=null&&o.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=ra(l.content),l.encoding="base64");break;case"utf8":let i=new TextDecoder("utf8");for(let l of t.attachments||[])l!=null&&l.content&&(l.content=i.decode(l.content),l.encoding="utf8");break;default:throw new Error("Unknwon attachment encoding")}return t}}class tl{constructor(e){hr(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 o=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(s)});if(!o.ok){const l=await o.text();throw new Error(`API error (${o.status}): ${l}`)}const i=await o.json();if(!i.success&&i.error)throw new Error(i.error);return i.result}catch(o){throw console.error("API call failed:",o),o}}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 o of s){const i=[`SELECT "${n}"`,...t.map(a=>`UID MOVE ${a} "${o}"`)],u=(await this.imapExec(e,i)).responses.filter(a=>a.ok&&a.command==="UID MOVE").length;if(u>0)return{success:!0,moved:u}}return{success:!1,moved:0}}async archiveEmails(e,t,n="INBOX"){const s=[`SELECT "${n}"`,...t.map(l=>`UID STORE ${l} +FLAGS (\\Deleted)`),"EXPUNGE"],i=(await this.imapExec(e,s)).responses.filter(l=>l.ok&&l.command==="UID STORE").length;return{success:i>0,archived:i}}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)"]),o=s.responses.find(h=>h.command==="SELECT");if(!(o!=null&&o.ok))throw new Error(`Failed to select folder: ${(o==null?void 0:o.error)||"Unknown error"}`);const i=s.responses.find(h=>h.command==="FETCH");if(!(i!=null&&i.ok)||!i.messages)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:o.exists||0},messages:[]};const u=[...i.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(u.length===0)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:o.exists||0},messages:[]};const c=(await this.imapExec(e,[`SELECT ${t}`,`UID FETCH ${u.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 f=new Map;for(const h of c.messages)h.uid&&f.set(h.uid,h);const d=u.map(h=>{var E,D,k,v,b;const p=f.get(h);if(!p)return null;const m=((E=p.flags)==null?void 0:E.some(w=>w.includes("Seen")))||!1,y=((k=(D=p.envelope)==null?void 0:D.from)==null?void 0:k.email)||"Unknown",C=((v=p.envelope)==null?void 0:v.subject)||"(No subject)",_=((b=p.envelope)==null?void 0:b.date)||"";return{uid:h,from:y,subject:C,date:_,seen:m}}).filter(Boolean);return{account:{id:e,label:"",email:""},mailbox:{name:t,total:o.exists||0},messages:d}}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,C,_,E;const o=(await this.imapExec(e,[`SELECT "${n}"`,`UID FETCH ${t} (FLAGS BODY[])`])).responses.find(D=>D.command==="UID FETCH");if(!(o!=null&&o.ok)||!((p=o.messages)!=null&&p[0]))return console.error("Failed to fetch raw email:",o==null?void 0:o.error),null;const i=o.messages[0],l=i.body||i.raw;if(!l)return console.error("No raw email content in response"),null;const a=await new xn().parse(l);console.log("[MailClient] Parsed email - attachments count:",((m=a.attachments)==null?void 0:m.length)||0),console.log("[MailClient] Parsed attachments:",(y=a.attachments)==null?void 0:y.map(D=>({filename:D.filename,mimeType:D.mimeType,contentId:D.contentId})));const c=new Map;for(const D of a.attachments||[])if(D.contentId){const k=this.contentToBase64(D.content),v=`data:${D.mimeType};base64,${k}`,b=D.contentId.replace(/^<|>$/g,"");c.set(b,v),c.set(`<${b}>`,v)}let f=a.html||"";f&&c.size>0&&(f=f.replace(/src=["']cid:([^"']+)["']/gi,(D,k)=>{const v=c.get(k)||c.get(`<${k}>`);return v?`src="${v}"`:D}));const d=((C=i.flags)==null?void 0:C.some(D=>D.toLowerCase().includes("seen")))||!1,h=((_=a.from)==null?void 0:_.address)||((E=a.from)==null?void 0:E.name)||"Unknown";return{uid:t,from:h,subject:a.subject||"(No subject)",date:a.date||"",body:f||a.text||"",html:f,text:a.text||"",seen:d,attachments:(a.attachments||[]).map(D=>({filename:D.filename||"attachment",mimeType:D.mimeType||"application/octet-stream",size:this.getContentSize(D.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 o=await this.getSettings(),i=((n=o.accounts)==null?void 0:n.find(a=>a.id===e))||((s=o.accounts)==null?void 0:s[0]);if(!(i!=null&&i.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:i.email,smtp_config:{host:i.smtp.host,port:parseInt(i.smtp.port,10)||587,username:i.smtp.user,password:i.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 u=await this.callEmail("send",l);return{success:(u==null?void 0:u.sent)??!1,message_id:u==null?void 0:u.message_id,error:u==null?void 0:u.error}}catch(o){return{success:!1,error:o instanceof Error?o.message:String(o)}}}}const ds="qwanyx_auth_token",fs="qwanyx_refresh_token";class rl{static setToken(e){typeof window<"u"&&localStorage.setItem(ds,e)}static getToken(){return typeof window<"u"?localStorage.getItem(ds):null}static clearToken(){typeof window<"u"&&(localStorage.removeItem(ds),localStorage.removeItem(fs))}static setRefreshToken(e){typeof window<"u"&&localStorage.setItem(fs,e)}static getRefreshToken(){return typeof window<"u"?localStorage.getItem(fs):null}static isAuthenticated(){return!!this.getToken()}static getAuthHeader(){const e=this.getToken();return e?{Authorization:`Bearer ${e}`}:{}}}class nl{constructor(e){hr(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,o])=>{o!=null&&t.append(s,String(o))});const n=t.toString();return n?`?${n}`:""}async request(e,t={}){const{method:n="GET",headers:s={},body:o,params:i}=t,l=`${this.config.baseUrl}/${e}${this.buildQueryString(i)}`,u={...this.config.headers,...rl.getAuthHeader(),...s},a={method:n,headers:u};o&&n!=="GET"&&(a.body=JSON.stringify(o));try{const c=new AbortController,f=setTimeout(()=>c.abort(),this.config.timeout),d=await fetch(l,{...a,signal:c.signal});if(clearTimeout(f),!d.ok){const h=await d.json().catch(()=>({message:d.statusText}));throw new Error(h.message||`HTTP ${d.status}`)}return await d.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 _n=null;function ia(r){return _n=new nl(r),_n}function Hs(){if(!_n)throw new Error("API client not initialized. Call initializeApiClient() first.");return _n}function sl(r,e,t={}){const{enabled:n=!0,refetchOnMount:s=!0,onSuccess:o,onError:i}=t,[l,u]=A.useState(null),[a,c]=A.useState(n),[f,d]=A.useState(null),h=A.useCallback(async()=>{if(n){c(!0),d(null);try{const m=await Hs().get(r,e);u(m),o==null||o(m)}catch(p){const m=p instanceof Error?p:new Error("Unknown error");d(m),i==null||i(m)}finally{c(!1)}}},[r,JSON.stringify(e),n,o,i]);return A.useEffect(()=>{s&&h()},[h,s]),{data:l,loading:a,error:f,refetch:h}}function oa(r,e="POST",t={}){const{onSuccess:n,onError:s}=t,[o,i]=A.useState(null),[l,u]=A.useState(!1),[a,c]=A.useState(null),f=A.useCallback(async h=>{u(!0),c(null);try{const p=Hs();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 i(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{u(!1)}},[r,e,n,s]),d=A.useCallback(()=>{i(null),c(null),u(!1)},[]);return{data:o,loading:l,error:a,mutate:f,reset:d}}var Es={exports:{}},pr={};/**
27
+ `);c.content=rr.encode(d);break}default:c.content=i.content}this.attachments.push(c)}for(let a of i.childNodes)await o(a,l,u)};await o(this.root,!1,[]),n.forEach(i=>{t.forEach(l=>{if(e[l]||(e[l]=[]),i[l])i[l].forEach(u=>{switch(u.type){case"text":e[l].push(u.value);break;case"subMessage":switch(l){case"html":e[l].push(Ri(u.value));break;case"plain":e[l].push(Mi(u.value));break}break}});else{let u;switch(l){case"html":u="plain";break;case"plain":u="html";break}(i[u]||[]).forEach(a=>{switch(a.type){case"text":switch(l){case"html":e[l].push(Qu(a.value));break;case"plain":e[l].push(Yu(a.value));break}break;case"subMessage":switch(l){case"html":e[l].push(Ri(a.value));break;case"plain":e[l].push(Mi(a.value));break}break}})}})}),Object.keys(e).forEach(i=>{e[i]=e[i].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:u}=await s.read();if(l)break;n.push(u),t+=u.length}const o=new Uint8Array(t);let i=0;for(let l of n)o.set(l,i),i+=l.length;return o}async parse(e){var s,o;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=rr.encode(e)),(e instanceof Blob||Object.prototype.toString.call(e)==="[object Blob]")&&(e=await In(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 i=this.readLine();await this.processLine(i.bytes,i.done)}await this.processNodeTree();const t={headers:this.root.headers.map(i=>({key:i.key,value:i.value})).reverse()};for(const i of["from","sender"]){const l=this.root.headers.find(u=>u.key===i);if(l&&l.value){const u=Tr(l.value);u&&u.length&&(t[i]=u[0])}}for(const i of["delivered-to","return-path"]){const l=this.root.headers.find(u=>u.key===i);if(l&&l.value){const u=Tr(l.value);if(u&&u.length&&u[0].address){const a=i.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[a]=u[0].address}}}for(const i of["to","cc","bcc","reply-to"]){const l=this.root.headers.filter(a=>a.key===i);let u=[];if(l.filter(a=>a&&a.value).map(a=>Tr(a.value)).forEach(a=>u=u.concat(a||[])),u&&u.length){const a=i.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[a]=u}}for(const i of["subject","message-id","in-reply-to","references"]){const l=this.root.headers.find(u=>u.key===i);if(l&&l.value){const u=i.replace(/\-(.)/g,(a,c)=>c.toUpperCase());t[u]=Sr(l.value)}}let n=this.root.headers.find(i=>i.key==="date");if(n){let i=new Date(n.value);!i||i.toString()==="Invalid Date"?i=n.value:i=i.toISOString(),t.date=i}switch((s=this.textContent)!=null&&s.html&&(t.html=this.textContent.html),(o=this.textContent)!=null&&o.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=ra(l.content),l.encoding="base64");break;case"utf8":let i=new TextDecoder("utf8");for(let l of t.attachments||[])l!=null&&l.content&&(l.content=i.decode(l.content),l.encoding="utf8");break;default:throw new Error("Unknwon attachment encoding")}return t}}class tl{constructor(e){gr(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 o=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(s)});if(!o.ok){const l=await o.text();throw new Error(`API error (${o.status}): ${l}`)}const i=await o.json();if(!i.success&&i.error)throw new Error(i.error);return i.result}catch(o){throw console.error("API call failed:",o),o}}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 o of s){const i=[`SELECT "${n}"`,...t.map(a=>`UID MOVE ${a} "${o}"`)],u=(await this.imapExec(e,i)).responses.filter(a=>a.ok&&a.command==="UID MOVE").length;if(u>0)return{success:!0,moved:u}}return{success:!1,moved:0}}async archiveEmails(e,t,n="INBOX"){const s=[`SELECT "${n}"`,...t.map(l=>`UID STORE ${l} +FLAGS (\\Deleted)`),"EXPUNGE"],i=(await this.imapExec(e,s)).responses.filter(l=>l.ok&&l.command==="UID STORE").length;return{success:i>0,archived:i}}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)"]),o=s.responses.find(h=>h.command==="SELECT");if(!(o!=null&&o.ok))throw new Error(`Failed to select folder: ${(o==null?void 0:o.error)||"Unknown error"}`);const i=s.responses.find(h=>h.command==="FETCH");if(!(i!=null&&i.ok)||!i.messages)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:o.exists||0},messages:[]};const u=[...i.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(u.length===0)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:o.exists||0},messages:[]};const c=(await this.imapExec(e,[`SELECT ${t}`,`UID FETCH ${u.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=u.map(h=>{var E,D,k,v,b;const p=d.get(h);if(!p)return null;const m=((E=p.flags)==null?void 0:E.some(w=>w.includes("Seen")))||!1,_=((k=(D=p.envelope)==null?void 0:D.from)==null?void 0:k.email)||"Unknown",C=((v=p.envelope)==null?void 0:v.subject)||"(No subject)",y=((b=p.envelope)==null?void 0:b.date)||"";return{uid:h,from:_,subject:C,date:y,seen:m}}).filter(Boolean);return{account:{id:e,label:"",email:""},mailbox:{name:t,total:o.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,_,C,y,E;const o=(await this.imapExec(e,[`SELECT "${n}"`,`UID FETCH ${t} (FLAGS BODY[])`])).responses.find(D=>D.command==="UID FETCH");if(!(o!=null&&o.ok)||!((p=o.messages)!=null&&p[0]))return console.error("Failed to fetch raw email:",o==null?void 0:o.error),null;const i=o.messages[0],l=i.body||i.raw;if(!l)return console.error("No raw email content in response"),null;const a=await new _n().parse(l);console.log("[MailClient] Parsed email - attachments count:",((m=a.attachments)==null?void 0:m.length)||0),console.log("[MailClient] Parsed attachments:",(_=a.attachments)==null?void 0:_.map(D=>({filename:D.filename,mimeType:D.mimeType,contentId:D.contentId})));const c=new Map;for(const D of a.attachments||[])if(D.contentId){const k=this.contentToBase64(D.content),v=`data:${D.mimeType};base64,${k}`,b=D.contentId.replace(/^<|>$/g,"");c.set(b,v),c.set(`<${b}>`,v)}let d=a.html||"";d&&c.size>0&&(d=d.replace(/src=["']cid:([^"']+)["']/gi,(D,k)=>{const v=c.get(k)||c.get(`<${k}>`);return v?`src="${v}"`:D}));const f=((C=i.flags)==null?void 0:C.some(D=>D.toLowerCase().includes("seen")))||!1,h=((y=a.from)==null?void 0:y.address)||((E=a.from)==null?void 0:E.name)||"Unknown";return{uid:t,from:h,subject:a.subject||"(No subject)",date:a.date||"",body:d||a.text||"",html:d,text:a.text||"",seen:f,attachments:(a.attachments||[]).map(D=>({filename:D.filename||"attachment",mimeType:D.mimeType||"application/octet-stream",size:this.getContentSize(D.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 o=await this.getSettings(),i=((n=o.accounts)==null?void 0:n.find(a=>a.id===e))||((s=o.accounts)==null?void 0:s[0]);if(!(i!=null&&i.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:i.email,smtp_config:{host:i.smtp.host,port:parseInt(i.smtp.port,10)||587,username:i.smtp.user,password:i.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 u=await this.callEmail("send",l);return{success:(u==null?void 0:u.sent)??!1,message_id:u==null?void 0:u.message_id,error:u==null?void 0:u.error}}catch(o){return{success:!1,error:o instanceof Error?o.message:String(o)}}}}const ds="qwanyx_auth_token",fs="qwanyx_refresh_token";class rl{static setToken(e){typeof window<"u"&&localStorage.setItem(ds,e)}static getToken(){return typeof window<"u"?localStorage.getItem(ds):null}static clearToken(){typeof window<"u"&&(localStorage.removeItem(ds),localStorage.removeItem(fs))}static setRefreshToken(e){typeof window<"u"&&localStorage.setItem(fs,e)}static getRefreshToken(){return typeof window<"u"?localStorage.getItem(fs):null}static isAuthenticated(){return!!this.getToken()}static getAuthHeader(){const e=this.getToken();return e?{Authorization:`Bearer ${e}`}:{}}}class nl{constructor(e){gr(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,o])=>{o!=null&&t.append(s,String(o))});const n=t.toString();return n?`?${n}`:""}async request(e,t={}){const{method:n="GET",headers:s={},body:o,params:i}=t,l=`${this.config.baseUrl}/${e}${this.buildQueryString(i)}`,u={...this.config.headers,...rl.getAuthHeader(),...s},a={method:n,headers:u};o&&n!=="GET"&&(a.body=JSON.stringify(o));try{const c=new AbortController,d=setTimeout(()=>c.abort(),this.config.timeout),f=await fetch(l,{...a,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 bn=null;function ia(r){return bn=new nl(r),bn}function Hs(){if(!bn)throw new Error("API client not initialized. Call initializeApiClient() first.");return bn}function sl(r,e,t={}){const{enabled:n=!0,refetchOnMount:s=!0,onSuccess:o,onError:i}=t,[l,u]=A.useState(null),[a,c]=A.useState(n),[d,f]=A.useState(null),h=A.useCallback(async()=>{if(n){c(!0),f(null);try{const m=await Hs().get(r,e);u(m),o==null||o(m)}catch(p){const m=p instanceof Error?p:new Error("Unknown error");f(m),i==null||i(m)}finally{c(!1)}}},[r,JSON.stringify(e),n,o,i]);return A.useEffect(()=>{s&&h()},[h,s]),{data:l,loading:a,error:d,refetch:h}}function oa(r,e="POST",t={}){const{onSuccess:n,onError:s}=t,[o,i]=A.useState(null),[l,u]=A.useState(!1),[a,c]=A.useState(null),d=A.useCallback(async h=>{u(!0),c(null);try{const p=Hs();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 i(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{u(!1)}},[r,e,n,s]),f=A.useCallback(()=>{i(null),c(null),u(!1)},[]);return{data:o,loading:l,error:a,mutate:d,reset:f}}var Es={exports:{}},mr={};/**
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 $i;function la(){if($i)return pr;$i=1;var r=A,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,o={key:!0,ref:!0,__self:!0,__source:!0};function i(l,u,a){var c,f={},d=null,h=null;a!==void 0&&(d=""+a),u.key!==void 0&&(d=""+u.key),u.ref!==void 0&&(h=u.ref);for(c in u)n.call(u,c)&&!o.hasOwnProperty(c)&&(f[c]=u[c]);if(l&&l.defaultProps)for(c in u=l.defaultProps,u)f[c]===void 0&&(f[c]=u[c]);return{$$typeof:e,type:l,key:d,ref:h,props:f,_owner:s.current}}return pr.Fragment=t,pr.jsx=i,pr.jsxs=i,pr}var gr={};/**
36
+ */var $i;function la(){if($i)return mr;$i=1;var r=A,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,o={key:!0,ref:!0,__self:!0,__source:!0};function i(l,u,a){var c,d={},f=null,h=null;a!==void 0&&(f=""+a),u.key!==void 0&&(f=""+u.key),u.ref!==void 0&&(h=u.ref);for(c in u)n.call(u,c)&&!o.hasOwnProperty(c)&&(d[c]=u[c]);if(l&&l.defaultProps)for(c in u=l.defaultProps,u)d[c]===void 0&&(d[c]=u[c]);return{$$typeof:e,type:l,key:f,ref:h,props:d,_owner:s.current}}return mr.Fragment=t,mr.jsx=i,mr.jsxs=i,mr}var yr={};/**
37
37
  * @license React
38
38
  * react-jsx-runtime.development.js
39
39
  *
@@ -41,40 +41,42 @@ ${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 Ii;function ua(){return Ii||(Ii=1,process.env.NODE_ENV!=="production"&&function(){var r=A,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),p=Symbol.iterator,m="@@iterator";function y(x){if(x===null||typeof x!="object")return null;var L=p&&x[p]||x[m];return typeof L=="function"?L:null}var C=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function _(x){{for(var L=arguments.length,z=new Array(L>1?L-1:0),V=1;V<L;V++)z[V-1]=arguments[V];E("error",x,z)}}function E(x,L,z){{var V=C.ReactDebugCurrentFrame,X=V.getStackAddendum();X!==""&&(L+="%s",z=z.concat([X]));var ee=z.map(function(J){return String(J)});ee.unshift("Warning: "+L),Function.prototype.apply.call(console[x],console,ee)}}var D=!1,k=!1,v=!1,b=!1,w=!1,S;S=Symbol.for("react.module.reference");function R(x){return!!(typeof x=="string"||typeof x=="function"||x===n||x===o||w||x===s||x===a||x===c||b||x===h||D||k||v||typeof x=="object"&&x!==null&&(x.$$typeof===d||x.$$typeof===f||x.$$typeof===i||x.$$typeof===l||x.$$typeof===u||x.$$typeof===S||x.getModuleId!==void 0))}function T(x,L,z){var V=x.displayName;if(V)return V;var X=L.displayName||L.name||"";return X!==""?z+"("+X+")":z}function N(x){return x.displayName||"Context"}function F(x){if(x==null)return null;if(typeof x.tag=="number"&&_("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof x=="function")return x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case n:return"Fragment";case t:return"Portal";case o:return"Profiler";case s:return"StrictMode";case a:return"Suspense";case c:return"SuspenseList"}if(typeof x=="object")switch(x.$$typeof){case l:var L=x;return N(L)+".Consumer";case i:var z=x;return N(z._context)+".Provider";case u:return T(x,x.render,"ForwardRef");case f:var V=x.displayName||null;return V!==null?V:F(x.type)||"Memo";case d:{var X=x,ee=X._payload,J=X._init;try{return F(J(ee))}catch{return null}}}return null}var j=Object.assign,$=0,G,de,fe,Oe,_e,qe,Qe;function Ee(){}Ee.__reactDisabledLog=!0;function Ae(){{if($===0){G=console.log,de=console.info,fe=console.warn,Oe=console.error,_e=console.group,qe=console.groupCollapsed,Qe=console.groupEnd;var x={configurable:!0,enumerable:!0,value:Ee,writable:!0};Object.defineProperties(console,{info:x,log:x,warn:x,error:x,group:x,groupCollapsed:x,groupEnd:x})}$++}}function Fe(){{if($--,$===0){var x={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},x,{value:G}),info:j({},x,{value:de}),warn:j({},x,{value:fe}),error:j({},x,{value:Oe}),group:j({},x,{value:_e}),groupCollapsed:j({},x,{value:qe}),groupEnd:j({},x,{value:Qe})})}$<0&&_("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var le=C.ReactCurrentDispatcher,Me;function be(x,L,z){{if(Me===void 0)try{throw Error()}catch(X){var V=X.stack.trim().match(/\n( *(at )?)/);Me=V&&V[1]||""}return`
45
- `+Me+x}}var te=!1,Re;{var Et=typeof WeakMap=="function"?WeakMap:Map;Re=new Et}function Ut(x,L){if(!x||te)return"";{var z=Re.get(x);if(z!==void 0)return z}var V;te=!0;var X=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ee;ee=le.current,le.current=null,Ae();try{if(L){var J=function(){throw Error()};if(Object.defineProperty(J.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(J,[])}catch(Se){V=Se}Reflect.construct(x,[],J)}else{try{J.call()}catch(Se){V=Se}x.call(J.prototype)}}else{try{throw Error()}catch(Se){V=Se}x()}}catch(Se){if(Se&&V&&typeof Se.stack=="string"){for(var H=Se.stack.split(`
46
- `),ve=V.stack.split(`
47
- `),oe=H.length-1,ue=ve.length-1;oe>=1&&ue>=0&&H[oe]!==ve[ue];)ue--;for(;oe>=1&&ue>=0;oe--,ue--)if(H[oe]!==ve[ue]){if(oe!==1||ue!==1)do if(oe--,ue--,ue<0||H[oe]!==ve[ue]){var Ie=`
48
- `+H[oe].replace(" at new "," at ");return x.displayName&&Ie.includes("<anonymous>")&&(Ie=Ie.replace("<anonymous>",x.displayName)),typeof x=="function"&&Re.set(x,Ie),Ie}while(oe>=1&&ue>=0);break}}}finally{te=!1,le.current=ee,Fe(),Error.prepareStackTrace=X}var Kt=x?x.displayName||x.name:"",St=Kt?be(Kt):"";return typeof x=="function"&&Re.set(x,St),St}function ar(x,L,z){return Ut(x,!1)}function pt(x){var L=x.prototype;return!!(L&&L.isReactComponent)}function Le(x,L,z){if(x==null)return"";if(typeof x=="function")return Ut(x,pt(x));if(typeof x=="string")return be(x);switch(x){case a:return be("Suspense");case c:return be("SuspenseList")}if(typeof x=="object")switch(x.$$typeof){case u:return ar(x.render);case f:return Le(x.type,L,z);case d:{var V=x,X=V._payload,ee=V._init;try{return Le(ee(X),L,z)}catch{}}}return""}var Ye=Object.prototype.hasOwnProperty,W={},ye=C.ReactDebugCurrentFrame;function ke(x){if(x){var L=x._owner,z=Le(x.type,x._source,L?L.type:null);ye.setExtraStackFrame(z)}else ye.setExtraStackFrame(null)}function At(x,L,z,V,X){{var ee=Function.call.bind(Ye);for(var J in x)if(ee(x,J)){var H=void 0;try{if(typeof x[J]!="function"){var ve=Error((V||"React class")+": "+z+" type `"+J+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof x[J]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ve.name="Invariant Violation",ve}H=x[J](L,J,V,z,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(oe){H=oe}H&&!(H instanceof Error)&&(ke(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).",V||"React class",z,J,typeof H),ke(null)),H instanceof Error&&!(H.message in W)&&(W[H.message]=!0,ke(X),_("Failed %s type: %s",z,H.message),ke(null))}}}var cr=Array.isArray;function kt(x){return cr(x)}function dr(x){{var L=typeof Symbol=="function"&&Symbol.toStringTag,z=L&&x[Symbol.toStringTag]||x.constructor.name||"Object";return z}}function rs(x){try{return en(x),!1}catch{return!0}}function en(x){return""+x}function tn(x){if(rs(x))return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",dr(x)),en(x)}var rn=C.ReactCurrentOwner,ns={key:!0,ref:!0,__self:!0,__source:!0},nn,U;function K(x){if(Ye.call(x,"ref")){var L=Object.getOwnPropertyDescriptor(x,"ref").get;if(L&&L.isReactWarning)return!1}return x.ref!==void 0}function ie(x){if(Ye.call(x,"key")){var L=Object.getOwnPropertyDescriptor(x,"key").get;if(L&&L.isReactWarning)return!1}return x.key!==void 0}function Ue(x,L){typeof x.ref=="string"&&rn.current}function $e(x,L){{var z=function(){nn||(nn=!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)",L))};z.isReactWarning=!0,Object.defineProperty(x,"key",{get:z,configurable:!0})}}function lt(x,L){{var z=function(){U||(U=!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)",L))};z.isReactWarning=!0,Object.defineProperty(x,"ref",{get:z,configurable:!0})}}var ss=function(x,L,z,V,X,ee,J){var H={$$typeof:e,type:x,key:L,ref:z,props:J,_owner:ee};return H._store={},Object.defineProperty(H._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(H,"_self",{configurable:!1,enumerable:!1,writable:!1,value:V}),Object.defineProperty(H,"_source",{configurable:!1,enumerable:!1,writable:!1,value:X}),Object.freeze&&(Object.freeze(H.props),Object.freeze(H)),H};function sn(x,L,z,V,X){{var ee,J={},H=null,ve=null;z!==void 0&&(tn(z),H=""+z),ie(L)&&(tn(L.key),H=""+L.key),K(L)&&(ve=L.ref,Ue(L,X));for(ee in L)Ye.call(L,ee)&&!ns.hasOwnProperty(ee)&&(J[ee]=L[ee]);if(x&&x.defaultProps){var oe=x.defaultProps;for(ee in oe)J[ee]===void 0&&(J[ee]=oe[ee])}if(H||ve){var ue=typeof x=="function"?x.displayName||x.name||"Unknown":x;H&&$e(J,ue),ve&&lt(J,ue)}return ss(x,H,ve,X,V,rn.current,J)}}var fr=C.ReactCurrentOwner,wi=C.ReactDebugCurrentFrame;function Wt(x){if(x){var L=x._owner,z=Le(x.type,x._source,L?L.type:null);wi.setExtraStackFrame(z)}else wi.setExtraStackFrame(null)}var is;is=!1;function os(x){return typeof x=="object"&&x!==null&&x.$$typeof===e}function Ei(){{if(fr.current){var x=F(fr.current.type);if(x)return`
44
+ */var Ii;function ua(){return Ii||(Ii=1,process.env.NODE_ENV!=="production"&&function(){var r=A,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),a=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 _(x){if(x===null||typeof x!="object")return null;var F=p&&x[p]||x[m];return typeof F=="function"?F:null}var C=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(x){{for(var F=arguments.length,z=new Array(F>1?F-1:0),V=1;V<F;V++)z[V-1]=arguments[V];E("error",x,z)}}function E(x,F,z){{var V=C.ReactDebugCurrentFrame,X=V.getStackAddendum();X!==""&&(F+="%s",z=z.concat([X]));var ee=z.map(function(J){return String(J)});ee.unshift("Warning: "+F),Function.prototype.apply.call(console[x],console,ee)}}var D=!1,k=!1,v=!1,b=!1,w=!1,S;S=Symbol.for("react.module.reference");function $(x){return!!(typeof x=="string"||typeof x=="function"||x===n||x===o||w||x===s||x===a||x===c||b||x===h||D||k||v||typeof x=="object"&&x!==null&&(x.$$typeof===f||x.$$typeof===d||x.$$typeof===i||x.$$typeof===l||x.$$typeof===u||x.$$typeof===S||x.getModuleId!==void 0))}function T(x,F,z){var V=x.displayName;if(V)return V;var X=F.displayName||F.name||"";return X!==""?z+"("+X+")":z}function N(x){return x.displayName||"Context"}function j(x){if(x==null)return null;if(typeof x.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof x=="function")return x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case n:return"Fragment";case t:return"Portal";case o:return"Profiler";case s:return"StrictMode";case a:return"Suspense";case c:return"SuspenseList"}if(typeof x=="object")switch(x.$$typeof){case l:var F=x;return N(F)+".Consumer";case i:var z=x;return N(z._context)+".Provider";case u:return T(x,x.render,"ForwardRef");case d:var V=x.displayName||null;return V!==null?V:j(x.type)||"Memo";case f:{var X=x,ee=X._payload,J=X._init;try{return j(J(ee))}catch{return null}}}return null}var L=Object.assign,O=0,G,he,oe,Ne,we,Ye,Ie;function je(){}je.__reactDisabledLog=!0;function Xe(){{if(O===0){G=console.log,he=console.info,oe=console.warn,Ne=console.error,we=console.group,Ye=console.groupCollapsed,Ie=console.groupEnd;var x={configurable:!0,enumerable:!0,value:je,writable:!0};Object.defineProperties(console,{info:x,log:x,warn:x,error:x,group:x,groupCollapsed:x,groupEnd:x})}O++}}function Ee(){{if(O--,O===0){var x={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},x,{value:G}),info:L({},x,{value:he}),warn:L({},x,{value:oe}),error:L({},x,{value:Ne}),group:L({},x,{value:we}),groupCollapsed:L({},x,{value:Ye}),groupEnd:L({},x,{value:Ie})})}O<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=C.ReactCurrentDispatcher,Ae;function xe(x,F,z){{if(Ae===void 0)try{throw Error()}catch(X){var V=X.stack.trim().match(/\n( *(at )?)/);Ae=V&&V[1]||""}return`
45
+ `+Ae+x}}var re=!1,Pe;{var At=typeof WeakMap=="function"?WeakMap:Map;Pe=new At}function Ut(x,F){if(!x||re)return"";{var z=Pe.get(x);if(z!==void 0)return z}var V;re=!0;var X=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ee;ee=te.current,te.current=null,Xe();try{if(F){var J=function(){throw Error()};if(Object.defineProperty(J.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(J,[])}catch(ke){V=ke}Reflect.construct(x,[],J)}else{try{J.call()}catch(ke){V=ke}x.call(J.prototype)}}else{try{throw Error()}catch(ke){V=ke}x()}}catch(ke){if(ke&&V&&typeof ke.stack=="string"){for(var H=ke.stack.split(`
46
+ `),be=V.stack.split(`
47
+ `),ue=H.length-1,ae=be.length-1;ue>=1&&ae>=0&&H[ue]!==be[ae];)ae--;for(;ue>=1&&ae>=0;ue--,ae--)if(H[ue]!==be[ae]){if(ue!==1||ae!==1)do if(ue--,ae--,ae<0||H[ue]!==be[ae]){var Re=`
48
+ `+H[ue].replace(" at new "," at ");return x.displayName&&Re.includes("<anonymous>")&&(Re=Re.replace("<anonymous>",x.displayName)),typeof x=="function"&&Pe.set(x,Re),Re}while(ue>=1&&ae>=0);break}}}finally{re=!1,te.current=ee,Ee(),Error.prepareStackTrace=X}var Vt=x?x.displayName||x.name:"",St=Vt?xe(Vt):"";return typeof x=="function"&&Pe.set(x,St),St}function cr(x,F,z){return Ut(x,!1)}function dr(x){var F=x.prototype;return!!(F&&F.isReactComponent)}function gt(x,F,z){if(x==null)return"";if(typeof x=="function")return Ut(x,dr(x));if(typeof x=="string")return xe(x);switch(x){case a:return xe("Suspense");case c:return xe("SuspenseList")}if(typeof x=="object")switch(x.$$typeof){case u:return cr(x.render);case d:return gt(x.type,F,z);case f:{var V=x,X=V._payload,ee=V._init;try{return gt(ee(X),F,z)}catch{}}}return""}var Oe=Object.prototype.hasOwnProperty,ze={},kt=C.ReactDebugCurrentFrame;function U(x){if(x){var F=x._owner,z=gt(x.type,x._source,F?F.type:null);kt.setExtraStackFrame(z)}else kt.setExtraStackFrame(null)}function _e(x,F,z,V,X){{var ee=Function.call.bind(Oe);for(var J in x)if(ee(x,J)){var H=void 0;try{if(typeof x[J]!="function"){var be=Error((V||"React class")+": "+z+" type `"+J+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof x[J]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw be.name="Invariant Violation",be}H=x[J](F,J,V,z,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ue){H=ue}H&&!(H instanceof Error)&&(U(X),y("%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).",V||"React class",z,J,typeof H),U(null)),H instanceof Error&&!(H.message in ze)&&(ze[H.message]=!0,U(X),y("Failed %s type: %s",z,H.message),U(null))}}}var qe=Array.isArray;function lt(x){return qe(x)}function fr(x){{var F=typeof Symbol=="function"&&Symbol.toStringTag,z=F&&x[Symbol.toStringTag]||x.constructor.name||"Object";return z}}function hr(x){try{return Wt(x),!1}catch{return!0}}function Wt(x){return""+x}function rn(x){if(hr(x))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",fr(x)),Wt(x)}var nn=C.ReactCurrentOwner,ns={key:!0,ref:!0,__self:!0,__source:!0},sn,W;function K(x){if(Oe.call(x,"ref")){var F=Object.getOwnPropertyDescriptor(x,"ref").get;if(F&&F.isReactWarning)return!1}return x.ref!==void 0}function le(x){if(Oe.call(x,"key")){var F=Object.getOwnPropertyDescriptor(x,"key").get;if(F&&F.isReactWarning)return!1}return x.key!==void 0}function Ue(x,F){typeof x.ref=="string"&&nn.current}function Me(x,F){{var z=function(){sn||(sn=!0,y("%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)",F))};z.isReactWarning=!0,Object.defineProperty(x,"key",{get:z,configurable:!0})}}function ut(x,F){{var z=function(){W||(W=!0,y("%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)",F))};z.isReactWarning=!0,Object.defineProperty(x,"ref",{get:z,configurable:!0})}}var ss=function(x,F,z,V,X,ee,J){var H={$$typeof:e,type:x,key:F,ref:z,props:J,_owner:ee};return H._store={},Object.defineProperty(H._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(H,"_self",{configurable:!1,enumerable:!1,writable:!1,value:V}),Object.defineProperty(H,"_source",{configurable:!1,enumerable:!1,writable:!1,value:X}),Object.freeze&&(Object.freeze(H.props),Object.freeze(H)),H};function on(x,F,z,V,X){{var ee,J={},H=null,be=null;z!==void 0&&(rn(z),H=""+z),le(F)&&(rn(F.key),H=""+F.key),K(F)&&(be=F.ref,Ue(F,X));for(ee in F)Oe.call(F,ee)&&!ns.hasOwnProperty(ee)&&(J[ee]=F[ee]);if(x&&x.defaultProps){var ue=x.defaultProps;for(ee in ue)J[ee]===void 0&&(J[ee]=ue[ee])}if(H||be){var ae=typeof x=="function"?x.displayName||x.name||"Unknown":x;H&&Me(J,ae),be&&ut(J,ae)}return ss(x,H,be,X,V,nn.current,J)}}var pr=C.ReactCurrentOwner,wi=C.ReactDebugCurrentFrame;function Kt(x){if(x){var F=x._owner,z=gt(x.type,x._source,F?F.type:null);wi.setExtraStackFrame(z)}else wi.setExtraStackFrame(null)}var is;is=!1;function os(x){return typeof x=="object"&&x!==null&&x.$$typeof===e}function Ei(){{if(pr.current){var x=j(pr.current.type);if(x)return`
49
49
 
50
- Check the render method of \``+x+"`."}return""}}function Au(x){return""}var Ai={};function ku(x){{var L=Ei();if(!L){var z=typeof x=="string"?x:x.displayName||x.name;z&&(L=`
50
+ Check the render method of \``+x+"`."}return""}}function Au(x){return""}var Ai={};function ku(x){{var F=Ei();if(!F){var z=typeof x=="string"?x:x.displayName||x.name;z&&(F=`
51
51
 
52
- Check the top-level render call using <`+z+">.")}return L}}function ki(x,L){{if(!x._store||x._store.validated||x.key!=null)return;x._store.validated=!0;var z=ku(L);if(Ai[z])return;Ai[z]=!0;var V="";x&&x._owner&&x._owner!==fr.current&&(V=" It was passed a child from "+F(x._owner.type)+"."),Wt(x),_('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',z,V),Wt(null)}}function Si(x,L){{if(typeof x!="object")return;if(kt(x))for(var z=0;z<x.length;z++){var V=x[z];os(V)&&ki(V,L)}else if(os(x))x._store&&(x._store.validated=!0);else if(x){var X=y(x);if(typeof X=="function"&&X!==x.entries)for(var ee=X.call(x),J;!(J=ee.next()).done;)os(J.value)&&ki(J.value,L)}}}function Su(x){{var L=x.type;if(L==null||typeof L=="string")return;var z;if(typeof L=="function")z=L.propTypes;else if(typeof L=="object"&&(L.$$typeof===u||L.$$typeof===f))z=L.propTypes;else return;if(z){var V=F(L);At(z,x.props,"prop",V,x)}else if(L.PropTypes!==void 0&&!is){is=!0;var X=F(L);_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",X||"Unknown")}typeof L.getDefaultProps=="function"&&!L.getDefaultProps.isReactClassApproved&&_("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Tu(x){{for(var L=Object.keys(x.props),z=0;z<L.length;z++){var V=L[z];if(V!=="children"&&V!=="key"){Wt(x),_("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",V),Wt(null);break}}x.ref!==null&&(Wt(x),_("Invalid attribute `ref` supplied to `React.Fragment`."),Wt(null))}}var Ti={};function Bi(x,L,z,V,X,ee){{var J=R(x);if(!J){var H="";(x===void 0||typeof x=="object"&&x!==null&&Object.keys(x).length===0)&&(H+=" 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 ve=Au();ve?H+=ve:H+=Ei();var oe;x===null?oe="null":kt(x)?oe="array":x!==void 0&&x.$$typeof===e?(oe="<"+(F(x.type)||"Unknown")+" />",H=" Did you accidentally export a JSX literal instead of a component?"):oe=typeof x,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",oe,H)}var ue=sn(x,L,z,X,ee);if(ue==null)return ue;if(J){var Ie=L.children;if(Ie!==void 0)if(V)if(kt(Ie)){for(var Kt=0;Kt<Ie.length;Kt++)Si(Ie[Kt],x);Object.freeze&&Object.freeze(Ie)}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 Si(Ie,x)}if(Ye.call(L,"key")){var St=F(x),Se=Object.keys(L).filter(function(Pu){return Pu!=="key"}),ls=Se.length>0?"{key: someKey, "+Se.join(": ..., ")+": ...}":"{key: someKey}";if(!Ti[St+ls]){var ju=Se.length>0?"{"+Se.join(": ..., ")+": ...}":"{}";_(`A props object containing a "key" prop is being spread into JSX:
52
+ Check the top-level render call using <`+z+">.")}return F}}function ki(x,F){{if(!x._store||x._store.validated||x.key!=null)return;x._store.validated=!0;var z=ku(F);if(Ai[z])return;Ai[z]=!0;var V="";x&&x._owner&&x._owner!==pr.current&&(V=" It was passed a child from "+j(x._owner.type)+"."),Kt(x),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',z,V),Kt(null)}}function Si(x,F){{if(typeof x!="object")return;if(lt(x))for(var z=0;z<x.length;z++){var V=x[z];os(V)&&ki(V,F)}else if(os(x))x._store&&(x._store.validated=!0);else if(x){var X=_(x);if(typeof X=="function"&&X!==x.entries)for(var ee=X.call(x),J;!(J=ee.next()).done;)os(J.value)&&ki(J.value,F)}}}function Su(x){{var F=x.type;if(F==null||typeof F=="string")return;var z;if(typeof F=="function")z=F.propTypes;else if(typeof F=="object"&&(F.$$typeof===u||F.$$typeof===d))z=F.propTypes;else return;if(z){var V=j(F);_e(z,x.props,"prop",V,x)}else if(F.PropTypes!==void 0&&!is){is=!0;var X=j(F);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",X||"Unknown")}typeof F.getDefaultProps=="function"&&!F.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Tu(x){{for(var F=Object.keys(x.props),z=0;z<F.length;z++){var V=F[z];if(V!=="children"&&V!=="key"){Kt(x),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",V),Kt(null);break}}x.ref!==null&&(Kt(x),y("Invalid attribute `ref` supplied to `React.Fragment`."),Kt(null))}}var Ti={};function Bi(x,F,z,V,X,ee){{var J=$(x);if(!J){var H="";(x===void 0||typeof x=="object"&&x!==null&&Object.keys(x).length===0)&&(H+=" 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 be=Au();be?H+=be:H+=Ei();var ue;x===null?ue="null":lt(x)?ue="array":x!==void 0&&x.$$typeof===e?(ue="<"+(j(x.type)||"Unknown")+" />",H=" Did you accidentally export a JSX literal instead of a component?"):ue=typeof x,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ue,H)}var ae=on(x,F,z,X,ee);if(ae==null)return ae;if(J){var Re=F.children;if(Re!==void 0)if(V)if(lt(Re)){for(var Vt=0;Vt<Re.length;Vt++)Si(Re[Vt],x);Object.freeze&&Object.freeze(Re)}else y("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 Si(Re,x)}if(Oe.call(F,"key")){var St=j(x),ke=Object.keys(F).filter(function(Pu){return Pu!=="key"}),ls=ke.length>0?"{key: someKey, "+ke.join(": ..., ")+": ...}":"{key: someKey}";if(!Ti[St+ls]){var ju=ke.length>0?"{"+ke.join(": ..., ")+": ...}":"{}";y(`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} />`,ls,St,ju,St),Ti[St+ls]=!0}}return x===n?Tu(ue):Su(ue),ue}}function Bu(x,L,z){return Bi(x,L,z,!0)}function Nu(x,L,z){return Bi(x,L,z,!1)}var Fu=Nu,Lu=Bu;gr.Fragment=n,gr.jsx=Fu,gr.jsxs=Lu}()),gr}process.env.NODE_ENV==="production"?Es.exports=la():Es.exports=ua();var g=Es.exports;class gn{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,o])=>n[s]===o))}static sort(e,t,n="asc"){return[...e].sort((s,o)=>{const i=s[t],l=o[t];if(i===l)return 0;let u=0;return i>l&&(u=1),i<l&&(u=-1),n==="asc"?u:-u})}static search(e,t,n){if(!t.trim())return e;const s=t.toLowerCase();return e.filter(o=>n.some(i=>{const l=o[i];return l==null?!1:String(l).toLowerCase().includes(s)}))}static paginate(e,t,n){const s=(t-1)*n,o=s+n;return{data:e.slice(s,o),total:e.length,page:t,totalPages:Math.ceil(e.length/n)}}static groupBy(e,t){return e.reduce((n,s)=>{const o=String(s[t]);return n[o]||(n[o]=[]),n[o].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 o=String(s[t]);return n[o]=(n[o]||0)+1,n},{})}static pipe(e,t){return t.reduce((n,s)=>s(n),e)}}function aa({endpoint:r,params:e,layout:t="list",title:n,emptyMessage:s="No items found",renderItem:o,keyExtractor:i=(m,y)=>m.id||m._id||String(y),searchable:l=!1,searchFields:u=[],searchPlaceholder:a="Search...",filters:c=[],pageSize:f=20,onItemClick:d,onRefresh:h,theme:p={}}){const{data:m,loading:y,error:C,refetch:_}=sl(r,e),[E,D]=A.useState(""),[k,v]=A.useState({}),[b,w]=A.useState(1),S=A.useMemo(()=>{if(!m)return{data:[],total:0,totalPages:0};let j=m;return l&&E&&u.length>0&&(j=gn.search(j,E,u)),Object.keys(k).length>0&&(j=gn.filterByFields(j,k)),gn.paginate(j,b,f)},[m,E,k,b,f,l,u]);A.useEffect(()=>{w(1)},[E,k]);const R=()=>{D(""),v({}),w(1),_(),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"},F=o||(j=>g.jsxs("div",{style:{padding:"16px",cursor:d?"pointer":"default"},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:T.text},children:j.title||j.name||j.label||"Untitled"}),j.description&&g.jsx("div",{style:{fontSize:"13px",color:T.textSecondary,marginTop:"4px"},children:j.description})]}));return y&&!m?g.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px",color:T.textSecondary},children:"Loading..."}):C?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:C.message}),g.jsx("button",{onClick:R,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||l||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:l||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:R,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${T.border}`,borderRadius:"6px",color:T.textSecondary,cursor:"pointer",fontSize:"13px"},children:"Refresh"})]}),l&&g.jsx("input",{type:"text",placeholder:a,value:E,onChange:j=>D(j.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:S.data.length===0?g.jsx("div",{style:{padding:"48px",textAlign:"center",color:T.textSecondary},children:s}):S.data.map((j,$)=>g.jsx("div",{onClick:()=>d==null?void 0:d(j),style:{background:T.cardBackground,borderRadius:t==="list"?"0":"8px",borderBottom:t==="list"?`1px solid ${T.border}`:"none",transition:"all 0.15s ease"},onMouseEnter:G=>{d&&(G.currentTarget.style.background=T.border)},onMouseLeave:G=>{G.currentTarget.style.background=T.cardBackground},children:F(j,$)},i(j,$)))}),S.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 ",b," of ",S.totalPages]}),g.jsxs("div",{style:{display:"flex",gap:"8px"},children:[g.jsx("button",{onClick:()=>w(j=>Math.max(1,j-1)),disabled:b===1,style:{padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:"6px",background:"white",cursor:b===1?"not-allowed":"pointer",opacity:b===1?.5:1},children:"Previous"}),g.jsx("button",{onClick:()=>w(j=>Math.min(S.totalPages,j+1)),disabled:b===S.totalPages,style:{padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:"6px",background:"white",cursor:b===S.totalPages?"not-allowed":"pointer",opacity:b===S.totalPages?.5:1},children:"Next"})]})]})]})}function ca({item:r,onClick:e,title:t=i=>i.title||i.name||i.label||"Untitled",subtitle:n=i=>i.description||i.subtitle||"",image:s=i=>i.image||i.thumbnail||i.photo,badge:o=i=>i.badge||i.tag||i.type}){const i=t(r),l=n(r),u=s(r),a=o(r);return g.jsxs("div",{onClick:e,className:`
57
+ <%s key={someKey} {...props} />`,ls,St,ju,St),Ti[St+ls]=!0}}return x===n?Tu(ae):Su(ae),ae}}function Bu(x,F,z){return Bi(x,F,z,!0)}function Nu(x,F,z){return Bi(x,F,z,!1)}var Fu=Nu,Lu=Bu;yr.Fragment=n,yr.jsx=Fu,yr.jsxs=Lu}()),yr}process.env.NODE_ENV==="production"?Es.exports=la():Es.exports=ua();var g=Es.exports;class mn{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,o])=>n[s]===o))}static sort(e,t,n="asc"){return[...e].sort((s,o)=>{const i=s[t],l=o[t];if(i===l)return 0;let u=0;return i>l&&(u=1),i<l&&(u=-1),n==="asc"?u:-u})}static search(e,t,n){if(!t.trim())return e;const s=t.toLowerCase();return e.filter(o=>n.some(i=>{const l=o[i];return l==null?!1:String(l).toLowerCase().includes(s)}))}static paginate(e,t,n){const s=(t-1)*n,o=s+n;return{data:e.slice(s,o),total:e.length,page:t,totalPages:Math.ceil(e.length/n)}}static groupBy(e,t){return e.reduce((n,s)=>{const o=String(s[t]);return n[o]||(n[o]=[]),n[o].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 o=String(s[t]);return n[o]=(n[o]||0)+1,n},{})}static pipe(e,t){return t.reduce((n,s)=>s(n),e)}}function aa({endpoint:r,params:e,layout:t="list",title:n,emptyMessage:s="No items found",renderItem:o,keyExtractor:i=(m,_)=>m.id||m._id||String(_),searchable:l=!1,searchFields:u=[],searchPlaceholder:a="Search...",filters:c=[],pageSize:d=20,onItemClick:f,onRefresh:h,theme:p={}}){const{data:m,loading:_,error:C,refetch:y}=sl(r,e),[E,D]=A.useState(""),[k,v]=A.useState({}),[b,w]=A.useState(1),S=A.useMemo(()=>{if(!m)return{data:[],total:0,totalPages:0};let L=m;return l&&E&&u.length>0&&(L=mn.search(L,E,u)),Object.keys(k).length>0&&(L=mn.filterByFields(L,k)),mn.paginate(L,b,d)},[m,E,k,b,d,l,u]);A.useEffect(()=>{w(1)},[E,k]);const $=()=>{D(""),v({}),w(1),y(),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"},j=o||(L=>g.jsxs("div",{style:{padding:"16px",cursor:f?"pointer":"default"},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:T.text},children:L.title||L.name||L.label||"Untitled"}),L.description&&g.jsx("div",{style:{fontSize:"13px",color:T.textSecondary,marginTop:"4px"},children:L.description})]}));return _&&!m?g.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px",color:T.textSecondary},children:"Loading..."}):C?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:C.message}),g.jsx("button",{onClick:$,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||l||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:l||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:$,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${T.border}`,borderRadius:"6px",color:T.textSecondary,cursor:"pointer",fontSize:"13px"},children:"Refresh"})]}),l&&g.jsx("input",{type:"text",placeholder:a,value:E,onChange:L=>D(L.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:S.data.length===0?g.jsx("div",{style:{padding:"48px",textAlign:"center",color:T.textSecondary},children:s}):S.data.map((L,O)=>g.jsx("div",{onClick:()=>f==null?void 0:f(L),style:{background:T.cardBackground,borderRadius:t==="list"?"0":"8px",borderBottom:t==="list"?`1px solid ${T.border}`:"none",transition:"all 0.15s ease"},onMouseEnter:G=>{f&&(G.currentTarget.style.background=T.border)},onMouseLeave:G=>{G.currentTarget.style.background=T.cardBackground},children:j(L,O)},i(L,O)))}),S.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 ",b," of ",S.totalPages]}),g.jsxs("div",{style:{display:"flex",gap:"8px"},children:[g.jsx("button",{onClick:()=>w(L=>Math.max(1,L-1)),disabled:b===1,style:{padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:"6px",background:"white",cursor:b===1?"not-allowed":"pointer",opacity:b===1?.5:1},children:"Previous"}),g.jsx("button",{onClick:()=>w(L=>Math.min(S.totalPages,L+1)),disabled:b===S.totalPages,style:{padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:"6px",background:"white",cursor:b===S.totalPages?"not-allowed":"pointer",opacity:b===S.totalPages?.5:1},children:"Next"})]})]})]})}function ca({item:r,onClick:e,title:t=i=>i.title||i.name||i.label||"Untitled",subtitle:n=i=>i.description||i.subtitle||"",image:s=i=>i.image||i.thumbnail||i.photo,badge:o=i=>i.badge||i.tag||i.type}){const i=t(r),l=n(r),u=s(r),a=o(r);return g.jsxs("div",{onClick:e,className:`
58
58
  flex items-center gap-4 p-4 border-b border-gray-200
59
59
  hover:bg-gray-50 transition-colors
60
60
  ${e?"cursor-pointer":""}
61
- `,children:[u&&g.jsx("div",{className:"flex-shrink-0",children:g.jsx("img",{src:u,alt:i,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:i}),a&&g.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:a})]}),l&&g.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:l})]}),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 da({item:r,onClose:e,title:t=o=>o.title||o.name||o.label||"Detail",image:n=o=>o.image||o.thumbnail||o.photo,fields:s=[]}){if(!r)return null;const o=t(r),i=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:o}),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:[i&&g.jsx("div",{className:"mb-6",children:g.jsx("img",{src:i,alt:o,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&g.jsx("div",{className:"space-y-4",children:s.map((l,u)=>{const a=l.value(r);return a==null||a===""?null:g.jsxs("div",{children:[g.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:l.label}),g.jsx("div",{className:"text-base text-gray-900",children:typeof a=="object"?JSON.stringify(a,null,2):String(a)})]},u)})}),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 fa={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function ha({nodes:r,cardCount:e=2,minInterval:t=1e3,maxInterval:n=3e3,onCardClick:s,cardSize:o="medium",className:i=""}){const l=Math.min(Math.max(e,1),5),[u,a]=A.useState([]),[c,f]=A.useState([]),[d,h]=A.useState(Array(l).fill(!1)),[p,m]=A.useState(Array(l).fill(!1)),y=A.useRef([]),C=A.useCallback(v=>{const b=r.filter(S=>!v.includes(S._id));if(b.length===0)return null;const w=Math.floor(Math.random()*b.length);return b[w]},[r]),_=A.useCallback(()=>Math.random()*(n-t)+t,[t,n]);A.useEffect(()=>{if(r.length===0){a([]),f([]);return}const v=[],b=[],w=[];for(let S=0;S<l&&S<r.length;S++){const R=C(w);R&&(v.push(R),w.push(R._id))}for(let S=0;S<v.length;S++){const R=[v[S]._id,...v.filter((N,F)=>F!==S).map(N=>N._id)],T=C(R);T?b.push(T):b.push(v[S])}a(v),f(b)},[r,l,C]);const E=A.useCallback(v=>{const b=_(),w=setTimeout(()=>{h(S=>{const R=[...S];return R[v]=!R[v],R}),setTimeout(()=>{m(S=>{const R=[...S];return R[v]=!R[v],R}),setTimeout(()=>{const S=!p[v];S&&a(R=>{const T=[...R];return T[v]=c[v],T}),f(R=>{const T=[...R],F=[(S?c[v]:u[v])._id,...u.filter(($,G)=>G!==v).map($=>$._id),...R.filter(($,G)=>G!==v).map($=>$._id)],j=C(F);return j&&(T[v]=j),T}),setTimeout(()=>{E(v)},150)},200)},150)},b);y.current[v]=w},[_,C,u,c,p]),D=A.useRef(!1);A.useEffect(()=>{if(!(u.length===0||r.length<=1)&&!D.current){D.current=!0;for(let v=0;v<u.length;v++)E(v);return()=>{y.current.forEach(v=>clearTimeout(v)),y.current=[],D.current=!1}}},[u.length,r.length]);const k=v=>{s&&s(v)};return r.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:g.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):u.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:g.jsx("p",{className:"text-gray-500",children:"Loading..."})}):g.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${i}`,children:u.map((v,b)=>{const w=c[b],S=p[b];return g.jsx("div",{className:`relative ${fa[o]}`,style:{perspective:"1000px"},onClick:()=>k(S?w:v),children:g.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${d[b]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[g.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:S?0:1},children:g.jsxs("div",{style:{transform:d[b]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:v.data.image,alt:v.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:v.title})})]})}),w&&g.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:S?1:0},children:g.jsxs("div",{style:{transform:d[b]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:w.data.image,alt:w.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:w.title})})]})})]})},`slot-${b}`)})})}function Vt(r){if(!r)return"";const e=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return r.replace(e,(t,n,s,o)=>{try{if(s.toUpperCase()==="B"){const i=atob(o);return decodeURIComponent(escape(i))}else if(s.toUpperCase()==="Q"){const i=o.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(l,u)=>String.fromCharCode(parseInt(u,16)));return decodeURIComponent(escape(i))}}catch(i){console.warn("MIME decode error:",i)}return t}).replace(/\s+/g," ").trim()}const pa={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function ga({baseUrl:r,systemId:e,accountId:t,limit:n=30,folder:s,selectable:o=!0,showDetail:i=!1,showSearch:l=!0,searchQuery:u,onSearchChange:a,emptyMessage:c="No emails",autoLoad:f=!0,onSelect:d,onSelectionChange:h,onDelete:p,onError:m,onLoad:y,renderItem:C,renderDetail:_,renderActions:E,renderEmpty:D,renderLoading:k,theme:v={}}){const b={...pa,...v},[w,S]=A.useState([]),[R,T]=A.useState(!1),[N,F]=A.useState(null),[j,$]=A.useState(new Set),[G,de]=A.useState(null),[fe,Oe]=A.useState(null),[_e,qe]=A.useState(null),[Qe,Ee]=A.useState(!1),[Ae,Fe]=A.useState(""),le=u!==void 0?u:Ae,Me=U=>{a?a(U):Fe(U)},be=A.useMemo(()=>{if(!le.trim())return w;const U=le.toLowerCase();return w.filter(K=>Vt(K.from).toLowerCase().includes(U)||Vt(K.subject).toLowerCase().includes(U))},[w,le]),te=A.useMemo(()=>e?new tl({baseUrl:r,system_id:e}):null,[r,e]),Re=A.useCallback(async()=>{if(te){T(!0),F(null);try{const U=await te.listEmails(t,n,s);U!=null&&U.messages&&(S(U.messages),y==null||y(U.messages))}catch(U){const K=U instanceof Error?U:new Error("Failed to fetch emails");F(K.message),m==null||m(K)}T(!1)}},[te,t,n,s,m,y]);A.useEffect(()=>{S([]),$(new Set),Oe(null),F(null),u===void 0&&Fe(""),f&&Re()},[s,f]);const Et=A.useCallback(async U=>{if(te){Oe(U),qe(null),Ee(!0);try{const K=await te.getEmailParsed(t,U.uid,s||"INBOX");K!=null&&K.body&&qe(K.body)}catch(K){console.error("Failed to fetch email body:",K)}Ee(!1)}},[te,t,s]),Ut=A.useCallback(U=>{d==null||d(U),i&&Et(U)},[d,i,Et]),ar=A.useCallback((U,K,ie)=>{if(!o){d==null||d(U),i&&Et(U);return}const Ue=U.uid;if(ie.shiftKey&&G!==null){const $e=Math.min(G,K),lt=Math.max(G,K),ss=w.slice($e,lt+1).map(fr=>fr.uid),sn=new Set(ss);$(sn),h==null||h(Array.from(sn))}else if(ie.ctrlKey||ie.metaKey)$($e=>{const lt=new Set($e);return lt.has(Ue)?lt.delete(Ue):lt.add(Ue),h==null||h(Array.from(lt)),lt}),de(K);else{const $e=new Set([Ue]);$($e),de(K),h==null||h(Array.from($e))}},[o,G,w,j,d,h,i]),pt=A.useCallback(async()=>{if(!te||j.size===0)return;const U=s||"INBOX";try{const K=await te.trashEmails(t,Array.from(j),U);if(console.log("Trash result:",K),K.success&&K.moved>0){S(Ue=>Ue.filter($e=>!j.has($e.uid)));const ie=Array.from(j);$(new Set),p==null||p(ie)}else F("Failed to move emails to trash")}catch(K){const ie=K instanceof Error?K:new Error("Trash failed");console.error("Trash error:",ie),F(ie.message),m==null||m(ie)}},[te,t,j,s,p,m]),Le=A.useCallback(async()=>{if(!te||j.size===0)return;const U=s||"INBOX";try{const K=await te.archiveEmails(t,Array.from(j),U);if(console.log("Archive result:",K),K.success&&K.archived>0){S(Ue=>Ue.filter($e=>!j.has($e.uid)));const ie=Array.from(j);$(new Set),p==null||p(ie)}else F("Failed to archive emails")}catch(K){const ie=K instanceof Error?K:new Error("Archive failed");console.error("Archive error:",ie),F(ie.message),m==null||m(ie)}},[te,t,j,s,p,m]),Ye=A.useCallback(()=>{if(j.size===w.length)$(new Set),h==null||h([]);else{const U=new Set(w.map(K=>K.uid));$(U),h==null||h(Array.from(U))}},[w,j.size,h]),W=A.useCallback(()=>{$(new Set),h==null||h([])},[h]),ye={delete:pt,archive:Le,refresh:Re,selectAll:Ye,clearSelection:W},ke=U=>{if(!U)return"";const K=new Date(U),ie=new Date;return K.toDateString()===ie.toDateString()?K.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):K.toLocaleDateString([],{month:"short",day:"numeric"})},At=(U,K)=>g.jsx("div",{style:{padding:"12px 16px",background:K?b.selectedBackground:U.seen?b.cardBackground:b.unreadBackground,borderBottom:`1px solid ${b.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:U.seen?400:600,color:b.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Vt(U.from).split("@")[0]}),g.jsx("div",{style:{fontSize:"14px",fontWeight:U.seen?400:500,color:U.seen?b.textSecondary:b.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Vt(U.subject)||"(No subject)"})]}),g.jsx("div",{style:{fontSize:"12px",color:b.textSecondary,flexShrink:0},children:ke(U.date)})]})}),cr=U=>g.jsxs("div",{style:{padding:"24px"},children:[g.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:b.text},children:Vt(U.subject)||"(No subject)"}),g.jsxs("div",{style:{fontSize:"14px",color:b.textSecondary,marginBottom:"16px"},children:["From: ",Vt(U.from)," • ",new Date(U.date).toLocaleString()]}),Qe?g.jsx("div",{style:{fontSize:"14px",color:b.textSecondary},children:"Loading..."}):_e?g.jsx("div",{style:{fontSize:"14px",color:b.text},dangerouslySetInnerHTML:{__html:_e}}):g.jsx("div",{style:{fontSize:"14px",color:b.textSecondary},children:"No content available"})]}),kt=(U,K)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:b.cardBackground,borderBottom:`1px solid ${b.border}`},children:[g.jsx("button",{onClick:K.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:b.text},children:U.length===w.length?"Deselect All":"Select All"}),U.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("span",{style:{fontSize:"13px",color:b.textSecondary},children:[U.length," selected"]}),g.jsx("button",{onClick:K.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",cursor:"pointer",color:b.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),g.jsx("button",{onClick:K.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",cursor:"pointer",color:b.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),g.jsx("div",{style:{flex:1}}),g.jsx("button",{onClick:K.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",cursor:"pointer",color:b.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),dr=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:b.textSecondary},children:c}),rs=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:b.textSecondary},children:"Loading..."}),en=C||At,tn=_||cr,rn=E||kt,ns=D||dr,nn=k||rs;return R&&w.length===0?g.jsx("div",{style:{background:b.background,width:"100%",height:"100%"},children:nn()}):g.jsxs("div",{style:{display:"flex",background:b.background,width:"100%",height:"100%"},children:[g.jsxs("div",{style:{flex:i&&fe?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:i&&fe?`1px solid ${b.border}`:"none",overflow:"hidden"},children:[o&&rn(Array.from(j),ye),l&&g.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${b.border}`,background:b.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:b.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:le,onChange:U=>Me(U.target.value),style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:"13px",color:b.text}}),le&&g.jsx("button",{onClick:()=>Me(""),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:b.textSecondary,strokeWidth:"2",children:g.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})}),N&&g.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:b.danger,fontSize:"14px",borderBottom:`1px solid ${b.border}`},children:N}),g.jsx("div",{style:{flex:1,overflowY:"auto"},children:be.length===0?ns():be.map((U,K)=>g.jsx("div",{onClick:ie=>ar(U,K,ie),onDoubleClick:()=>Ut(U),children:en(U,j.has(U.uid))},U.uid))})]}),i&&fe&&g.jsx("div",{style:{flex:1,overflowY:"auto"},children:tn(fe)})]})}function ma({items:r,renderItem:e,onSelectionChange:t,onCurrentChange:n,onAction:s,actions:o=[],emptyMessage:i="No items",showSelectAll:l=!0,className:u=""}){const[a,c]=A.useState(new Set),[f,d]=A.useState(-1),h=r.filter(D=>a.has(D.id)),p=f>=0&&f<h.length?h[f]:null,m=A.useCallback(D=>{c(k=>{const v=new Set(k);return v.has(D)?v.delete(D):v.add(D),t==null||t(Array.from(v)),v})},[t]),y=A.useCallback(()=>{if(a.size===r.length)c(new Set),d(-1),t==null||t([]);else{const D=new Set(r.map(k=>k.id));c(D),r.length>0&&(d(0),n==null||n(r[0],0)),t==null||t(r.map(k=>k.id))}},[r,a.size,t,n]),C=A.useCallback(()=>{if(h.length===0)return;const D=f<=0?h.length-1:f-1;d(D),n==null||n(h[D],D)},[h,f,n]),_=A.useCallback(()=>{if(h.length===0)return;const D=f>=h.length-1?0:f+1;d(D),n==null||n(h[D],D)},[h,f,n]),E=A.useCallback(D=>{s==null||s(D,h,p)},[s,h,p]);return A.useEffect(()=>{h.length===0?d(-1):f>=h.length?d(h.length-1):f<0&&h.length>0&&(d(0),n==null||n(h[0],0))},[h.length,f,n]),r.length===0?g.jsx("div",{className:`text-sm text-neutral-400 text-center py-4 ${u}`,children:i}):g.jsxs("div",{className:`space-y-2 ${u}`,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:[l&&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:a.size===r.length?"check_box":a.size>0?"indeterminate_check_box":"check_box_outline_blank"}),g.jsx("span",{children:a.size===r.length?"Deselect all":"Select all"})]}),a.size>0&&g.jsxs("span",{className:"text-neutral-400",children:["(",a.size," selected)"]})]}),h.length>1&&g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("button",{onClick:C,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:[f+1," / ",h.length]}),g.jsx("button",{onClick:_,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(D=>{const k=a.has(D.id),v=(p==null?void 0:p.id)===D.id;return g.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${v?"bg-blue-50 ring-1 ring-blue-200":k?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>m(D.id),children:[g.jsx("span",{className:`material-icons text-lg ${k?"text-blue-500":"text-neutral-300"}`,children:k?"check_box":"check_box_outline_blank"}),g.jsx("div",{className:"flex-1 min-w-0",children:e(D,k,v)})]},D.id)})}),o.length>0&&a.size>0&&g.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:o.map(D=>{var v;const k=((v=D.disabled)==null?void 0:v.call(D,h))??!1;return g.jsxs("button",{onClick:()=>E(D.id),disabled:k,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${k?"bg-neutral-100 text-neutral-400 cursor-not-allowed":"bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,children:[D.icon&&g.jsx("span",{className:"material-icons text-sm",children:D.icon}),D.label]},D.id)})})]})}function ya(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var xa=ya(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 il=A.createContext(null);function _a(r,e){return{getTheme:function(){return e??null}}}function it(){const r=A.useContext(il);return r==null&&xa(8),r}function zr(r){return{}}const Js={},ba={},ol={},Ft={},Xt={},jr={},Zt={},In={},As={},Pr={},Or={},Ge={},Qs={},Ys={},va={},ll={},Da={},ul={},Ca={},al={},cl={},bn={},wa={},dl={},fl={},hl={},Ea={},Aa={},ka={},zi={},pl={},Sa={},gl={},ml={},Ta={},zn={},Xs={},ks={},Ba={},Na={},ln={},un={},Fa={},La={},ja={},Je=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Pa=Je&&"documentMode"in document?document.documentMode:null,We=Je&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),vt=Je&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),vn=!(!Je||!("InputEvent"in window)||Pa)&&"getTargetRanges"in new window.InputEvent("input"),qn=Je&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),qr=Je&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Oa=Je&&/Android/.test(navigator.userAgent),yl=Je&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ma=Je&&Oa&&yl,Zs=Je&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!yl,Ur=1,Ct=3,Pt=0,xl=1,rr=2,Ra=0,$a=1,Ia=2,Dn=4,Cn=8,ei=128,za=112|(3|Dn|Cn)|ei,ti=1,ri=2,ni=3,si=4,ii=5,oi=6,Un=qn||qr||Zs?" ":"​",ct=`
61
+ `,children:[u&&g.jsx("div",{className:"flex-shrink-0",children:g.jsx("img",{src:u,alt:i,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:i}),a&&g.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:a})]}),l&&g.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:l})]}),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 da({item:r,onClose:e,title:t=o=>o.title||o.name||o.label||"Detail",image:n=o=>o.image||o.thumbnail||o.photo,fields:s=[]}){if(!r)return null;const o=t(r),i=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:o}),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:[i&&g.jsx("div",{className:"mb-6",children:g.jsx("img",{src:i,alt:o,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&g.jsx("div",{className:"space-y-4",children:s.map((l,u)=>{const a=l.value(r);return a==null||a===""?null:g.jsxs("div",{children:[g.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:l.label}),g.jsx("div",{className:"text-base text-gray-900",children:typeof a=="object"?JSON.stringify(a,null,2):String(a)})]},u)})}),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 fa={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function ha({nodes:r,cardCount:e=2,minInterval:t=1e3,maxInterval:n=3e3,onCardClick:s,cardSize:o="medium",className:i=""}){const l=Math.min(Math.max(e,1),5),[u,a]=A.useState([]),[c,d]=A.useState([]),[f,h]=A.useState(Array(l).fill(!1)),[p,m]=A.useState(Array(l).fill(!1)),_=A.useRef([]),C=A.useCallback(v=>{const b=r.filter(S=>!v.includes(S._id));if(b.length===0)return null;const w=Math.floor(Math.random()*b.length);return b[w]},[r]),y=A.useCallback(()=>Math.random()*(n-t)+t,[t,n]);A.useEffect(()=>{if(r.length===0){a([]),d([]);return}const v=[],b=[],w=[];for(let S=0;S<l&&S<r.length;S++){const $=C(w);$&&(v.push($),w.push($._id))}for(let S=0;S<v.length;S++){const $=[v[S]._id,...v.filter((N,j)=>j!==S).map(N=>N._id)],T=C($);T?b.push(T):b.push(v[S])}a(v),d(b)},[r,l,C]);const E=A.useCallback(v=>{const b=y(),w=setTimeout(()=>{h(S=>{const $=[...S];return $[v]=!$[v],$}),setTimeout(()=>{m(S=>{const $=[...S];return $[v]=!$[v],$}),setTimeout(()=>{const S=!p[v];S&&a($=>{const T=[...$];return T[v]=c[v],T}),d($=>{const T=[...$],j=[(S?c[v]:u[v])._id,...u.filter((O,G)=>G!==v).map(O=>O._id),...$.filter((O,G)=>G!==v).map(O=>O._id)],L=C(j);return L&&(T[v]=L),T}),setTimeout(()=>{E(v)},150)},200)},150)},b);_.current[v]=w},[y,C,u,c,p]),D=A.useRef(!1);A.useEffect(()=>{if(!(u.length===0||r.length<=1)&&!D.current){D.current=!0;for(let v=0;v<u.length;v++)E(v);return()=>{_.current.forEach(v=>clearTimeout(v)),_.current=[],D.current=!1}}},[u.length,r.length]);const k=v=>{s&&s(v)};return r.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:g.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):u.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:g.jsx("p",{className:"text-gray-500",children:"Loading..."})}):g.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${i}`,children:u.map((v,b)=>{const w=c[b],S=p[b];return g.jsx("div",{className:`relative ${fa[o]}`,style:{perspective:"1000px"},onClick:()=>k(S?w:v),children:g.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${f[b]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[g.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:S?0:1},children:g.jsxs("div",{style:{transform:f[b]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:v.data.image,alt:v.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:v.title})})]})}),w&&g.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:S?1:0},children:g.jsxs("div",{style:{transform:f[b]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:w.data.image,alt:w.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:w.title})})]})})]})},`slot-${b}`)})})}function Gt(r){if(!r)return"";const e=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return r.replace(e,(t,n,s,o)=>{try{if(s.toUpperCase()==="B"){const i=atob(o);return decodeURIComponent(escape(i))}else if(s.toUpperCase()==="Q"){const i=o.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(l,u)=>String.fromCharCode(parseInt(u,16)));return decodeURIComponent(escape(i))}}catch(i){console.warn("MIME decode error:",i)}return t}).replace(/\s+/g," ").trim()}const pa={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function ga({baseUrl:r,systemId:e,accountId:t,limit:n=30,folder:s,selectable:o=!0,showDetail:i=!1,showSearch:l=!0,searchQuery:u,onSearchChange:a,emptyMessage:c="No emails",autoLoad:d=!0,onSelect:f,onSelectionChange:h,onDelete:p,onError:m,onLoad:_,renderItem:C,renderDetail:y,renderActions:E,renderEmpty:D,renderLoading:k,theme:v={}}){const b={...pa,...v},[w,S]=A.useState([]),[$,T]=A.useState(!1),[N,j]=A.useState(null),[L,O]=A.useState(new Set),[G,he]=A.useState(null),[oe,Ne]=A.useState(null),[we,Ye]=A.useState(null),[Ie,je]=A.useState(!1),[Xe,Ee]=A.useState(""),te=u!==void 0?u:Xe,Ae=W=>{a?a(W):Ee(W)},xe=A.useMemo(()=>{if(!te.trim())return w;const W=te.toLowerCase();return w.filter(K=>Gt(K.from).toLowerCase().includes(W)||Gt(K.subject).toLowerCase().includes(W))},[w,te]),re=A.useMemo(()=>e?new tl({baseUrl:r,system_id:e}):null,[r,e]),Pe=A.useCallback(async()=>{if(re){T(!0),j(null);try{const W=await re.listEmails(t,n,s);W!=null&&W.messages&&(S(W.messages),_==null||_(W.messages))}catch(W){const K=W instanceof Error?W:new Error("Failed to fetch emails");j(K.message),m==null||m(K)}T(!1)}},[re,t,n,s,m,_]);A.useEffect(()=>{S([]),O(new Set),Ne(null),j(null),u===void 0&&Ee(""),d&&Pe()},[s,d]);const At=A.useCallback(async W=>{if(re){Ne(W),Ye(null),je(!0);try{const K=await re.getEmailParsed(t,W.uid,s||"INBOX");K!=null&&K.body&&Ye(K.body)}catch(K){console.error("Failed to fetch email body:",K)}je(!1)}},[re,t,s]),Ut=A.useCallback(W=>{f==null||f(W),i&&At(W)},[f,i,At]),cr=A.useCallback((W,K,le)=>{if(!o){f==null||f(W),i&&At(W);return}const Ue=W.uid;if(le.shiftKey&&G!==null){const Me=Math.min(G,K),ut=Math.max(G,K),ss=w.slice(Me,ut+1).map(pr=>pr.uid),on=new Set(ss);O(on),h==null||h(Array.from(on))}else if(le.ctrlKey||le.metaKey)O(Me=>{const ut=new Set(Me);return ut.has(Ue)?ut.delete(Ue):ut.add(Ue),h==null||h(Array.from(ut)),ut}),he(K);else{const Me=new Set([Ue]);O(Me),he(K),h==null||h(Array.from(Me))}},[o,G,w,L,f,h,i]),dr=A.useCallback(async()=>{if(!re||L.size===0)return;const W=s||"INBOX";try{const K=await re.trashEmails(t,Array.from(L),W);if(console.log("Trash result:",K),K.success&&K.moved>0){S(Ue=>Ue.filter(Me=>!L.has(Me.uid)));const le=Array.from(L);O(new Set),p==null||p(le)}else j("Failed to move emails to trash")}catch(K){const le=K instanceof Error?K:new Error("Trash failed");console.error("Trash error:",le),j(le.message),m==null||m(le)}},[re,t,L,s,p,m]),gt=A.useCallback(async()=>{if(!re||L.size===0)return;const W=s||"INBOX";try{const K=await re.archiveEmails(t,Array.from(L),W);if(console.log("Archive result:",K),K.success&&K.archived>0){S(Ue=>Ue.filter(Me=>!L.has(Me.uid)));const le=Array.from(L);O(new Set),p==null||p(le)}else j("Failed to archive emails")}catch(K){const le=K instanceof Error?K:new Error("Archive failed");console.error("Archive error:",le),j(le.message),m==null||m(le)}},[re,t,L,s,p,m]),Oe=A.useCallback(()=>{if(L.size===w.length)O(new Set),h==null||h([]);else{const W=new Set(w.map(K=>K.uid));O(W),h==null||h(Array.from(W))}},[w,L.size,h]),ze=A.useCallback(()=>{O(new Set),h==null||h([])},[h]),kt={delete:dr,archive:gt,refresh:Pe,selectAll:Oe,clearSelection:ze},U=W=>{if(!W)return"";const K=new Date(W),le=new Date;return K.toDateString()===le.toDateString()?K.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):K.toLocaleDateString([],{month:"short",day:"numeric"})},_e=(W,K)=>g.jsx("div",{style:{padding:"12px 16px",background:K?b.selectedBackground:W.seen?b.cardBackground:b.unreadBackground,borderBottom:`1px solid ${b.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:W.seen?400:600,color:b.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Gt(W.from).split("@")[0]}),g.jsx("div",{style:{fontSize:"14px",fontWeight:W.seen?400:500,color:W.seen?b.textSecondary:b.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Gt(W.subject)||"(No subject)"})]}),g.jsx("div",{style:{fontSize:"12px",color:b.textSecondary,flexShrink:0},children:U(W.date)})]})}),qe=W=>g.jsxs("div",{style:{padding:"24px"},children:[g.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:b.text},children:Gt(W.subject)||"(No subject)"}),g.jsxs("div",{style:{fontSize:"14px",color:b.textSecondary,marginBottom:"16px"},children:["From: ",Gt(W.from)," • ",new Date(W.date).toLocaleString()]}),Ie?g.jsx("div",{style:{fontSize:"14px",color:b.textSecondary},children:"Loading..."}):we?g.jsx("div",{style:{fontSize:"14px",color:b.text},dangerouslySetInnerHTML:{__html:we}}):g.jsx("div",{style:{fontSize:"14px",color:b.textSecondary},children:"No content available"})]}),lt=(W,K)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:b.cardBackground,borderBottom:`1px solid ${b.border}`},children:[g.jsx("button",{onClick:K.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:b.text},children:W.length===w.length?"Deselect All":"Select All"}),W.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("span",{style:{fontSize:"13px",color:b.textSecondary},children:[W.length," selected"]}),g.jsx("button",{onClick:K.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",cursor:"pointer",color:b.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),g.jsx("button",{onClick:K.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",cursor:"pointer",color:b.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),g.jsx("div",{style:{flex:1}}),g.jsx("button",{onClick:K.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${b.border}`,borderRadius:"6px",cursor:"pointer",color:b.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),fr=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:b.textSecondary},children:c}),hr=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:b.textSecondary},children:"Loading..."}),Wt=C||_e,rn=y||qe,nn=E||lt,ns=D||fr,sn=k||hr;return $&&w.length===0?g.jsx("div",{style:{background:b.background,width:"100%",height:"100%"},children:sn()}):g.jsxs("div",{style:{display:"flex",background:b.background,width:"100%",height:"100%"},children:[g.jsxs("div",{style:{flex:i&&oe?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:i&&oe?`1px solid ${b.border}`:"none",overflow:"hidden"},children:[o&&nn(Array.from(L),kt),l&&g.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${b.border}`,background:b.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:b.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:te,onChange:W=>Ae(W.target.value),style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:"13px",color:b.text}}),te&&g.jsx("button",{onClick:()=>Ae(""),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:b.textSecondary,strokeWidth:"2",children:g.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})}),N&&g.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:b.danger,fontSize:"14px",borderBottom:`1px solid ${b.border}`},children:N}),g.jsx("div",{style:{flex:1,overflowY:"auto"},children:xe.length===0?ns():xe.map((W,K)=>g.jsx("div",{onClick:le=>cr(W,K,le),onDoubleClick:()=>Ut(W),children:Wt(W,L.has(W.uid))},W.uid))})]}),i&&oe&&g.jsx("div",{style:{flex:1,overflowY:"auto"},children:rn(oe)})]})}function ma({items:r,renderItem:e,onSelectionChange:t,onCurrentChange:n,onAction:s,actions:o=[],emptyMessage:i="No items",showSelectAll:l=!0,className:u=""}){const[a,c]=A.useState(new Set),[d,f]=A.useState(-1),h=r.filter(D=>a.has(D.id)),p=d>=0&&d<h.length?h[d]:null,m=A.useCallback(D=>{c(k=>{const v=new Set(k);return v.has(D)?v.delete(D):v.add(D),t==null||t(Array.from(v)),v})},[t]),_=A.useCallback(()=>{if(a.size===r.length)c(new Set),f(-1),t==null||t([]);else{const D=new Set(r.map(k=>k.id));c(D),r.length>0&&(f(0),n==null||n(r[0],0)),t==null||t(r.map(k=>k.id))}},[r,a.size,t,n]),C=A.useCallback(()=>{if(h.length===0)return;const D=d<=0?h.length-1:d-1;f(D),n==null||n(h[D],D)},[h,d,n]),y=A.useCallback(()=>{if(h.length===0)return;const D=d>=h.length-1?0:d+1;f(D),n==null||n(h[D],D)},[h,d,n]),E=A.useCallback(D=>{s==null||s(D,h,p)},[s,h,p]);return A.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 ${u}`,children:i}):g.jsxs("div",{className:`space-y-2 ${u}`,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:[l&&g.jsxs("button",{onClick:_,className:"flex items-center gap-1 hover:text-neutral-700 transition-colors",children:[g.jsx("span",{className:"material-icons text-sm",children:a.size===r.length?"check_box":a.size>0?"indeterminate_check_box":"check_box_outline_blank"}),g.jsx("span",{children:a.size===r.length?"Deselect all":"Select all"})]}),a.size>0&&g.jsxs("span",{className:"text-neutral-400",children:["(",a.size," selected)"]})]}),h.length>1&&g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("button",{onClick:C,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:y,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(D=>{const k=a.has(D.id),v=(p==null?void 0:p.id)===D.id;return g.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${v?"bg-blue-50 ring-1 ring-blue-200":k?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>m(D.id),children:[g.jsx("span",{className:`material-icons text-lg ${k?"text-blue-500":"text-neutral-300"}`,children:k?"check_box":"check_box_outline_blank"}),g.jsx("div",{className:"flex-1 min-w-0",children:e(D,k,v)})]},D.id)})}),o.length>0&&a.size>0&&g.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:o.map(D=>{var v;const k=((v=D.disabled)==null?void 0:v.call(D,h))??!1;return g.jsxs("button",{onClick:()=>E(D.id),disabled:k,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${k?"bg-neutral-100 text-neutral-400 cursor-not-allowed":"bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,children:[D.icon&&g.jsx("span",{className:"material-icons text-sm",children:D.icon}),D.label]},D.id)})})]})}function ya(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var xa=ya(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 il=A.createContext(null);function _a(r,e){return{getTheme:function(){return e??null}}}function Je(){const r=A.useContext(il);return r==null&&xa(8),r}function Ur(r){return{}}const Js={},ba={},ol={},Ft={},Zt={},Or={},er={},zn={},As={},Mr={},Rr={},Ge={},Qs={},Ys={},va={},ll={},Da={},ul={},Ca={},al={},cl={},vn={},wa={},dl={},fl={},hl={},Ea={},Aa={},ka={},zi={},pl={},Sa={},gl={},ml={},Ta={},qn={},Xs={},ks={},Ba={},Na={},un={},an={},Fa={},La={},ja={},Qe=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Pa=Qe&&"documentMode"in document?document.documentMode:null,We=Qe&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Dt=Qe&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Dn=!(!Qe||!("InputEvent"in window)||Pa)&&"getTargetRanges"in new window.InputEvent("input"),Un=Qe&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Wr=Qe&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Oa=Qe&&/Android/.test(navigator.userAgent),yl=Qe&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ma=Qe&&Oa&&yl,Zs=Qe&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!yl,Kr=1,wt=3,Pt=0,xl=1,nr=2,Ra=0,$a=1,Ia=2,Cn=4,wn=8,ei=128,za=112|(3|Cn|wn)|ei,ti=1,ri=2,ni=3,si=4,ii=5,oi=6,Wn=Un||Wr||Zs?" ":"​",dt=`
62
62
 
63
- `,qa=vt?" ":Un,_l="֑-߿יִ-﷽ﹰ-ﻼ",bl="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Ua=new RegExp("^[^"+bl+"]*["+_l+"]"),Wa=new RegExp("^[^"+_l+"]*["+bl+"]"),Ot={bold:1,code:16,highlight:ei,italic:2,strikethrough:Dn,subscript:32,superscript:64,underline:Cn},Ka={directionless:1,unmergeable:2},qi={center:ri,end:oi,justify:si,left:ti,right:ni,start:ii},Va={[ri]:"center",[oi]:"end",[si]:"justify",[ti]:"left",[ni]:"right",[ii]:"start"},Ga={normal:0,segmented:2,token:1},Ha={[Ra]:"normal",[Ia]:"segmented",[$a]:"token"};function Ja(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var O=Ja(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 wn(...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 Qa=100;let Ss=!1,li=0;function Ya(r){li=r.timeStamp}function hs(r,e,t){const n=r.nodeName==="BR",s=e.__lexicalLineBreak;return s&&(r===s||n&&r.previousSibling===s)||n&&Kn(r,t)!==void 0}function Xa(r,e,t){const n=ze(t._window);let s=null,o=null;n!==null&&n.anchorNode===r&&(s=n.anchorOffset,o=n.focusOffset);const i=r.nodeValue;i!==null&&fi(e,i,s,o,!1)}function Za(r,e,t){if(P(r)){const n=r.anchor.getNode();if(n.is(t)&&r.format!==n.getFormat())return!1}return e.nodeType===Ct&&t.isAttached()}function ec(r,e,t,n){for(let s=r;s&&!hc(s);s=Kr(s)){const o=Kn(s,e);if(o!==void 0){const i=xe(o,t);if(i)return Z(i)?void 0:[s,i]}else if(s===n)return[n,Tl(t)]}}function vl(r,e,t){Ss=!0;const n=performance.now()-li>Qa;try{je(r,()=>{const s=q()||function(d){return d.getEditorState().read(()=>{const h=q();return h!==null?h.clone():null})}(r),o=new Map,i=r.getRootElement(),l=r._editorState,u=r._blockCursorElement;let a=!1,c="";for(let d=0;d<e.length;d++){const h=e[d],p=h.type,m=h.target,y=ec(m,r,l,i);if(!y)continue;const[C,_]=y;if(p==="characterData")n&&M(_)&&Za(s,m,_)&&Xa(m,_,r);else if(p==="childList"){a=!0;const E=h.addedNodes;for(let v=0;v<E.length;v++){const b=E[v],w=kl(b),S=b.parentNode;if(S!=null&&b!==u&&w===null&&!hs(b,S,r)){if(vt){const R=b.innerText||b.nodeValue;R&&(c+=R)}S.removeChild(b)}}const D=h.removedNodes,k=D.length;if(k>0){let v=0;for(let b=0;b<k;b++){const w=D[b];(hs(w,m,r)||u===w)&&(m.appendChild(w),v++)}k!==v&&o.set(C,_)}}}if(o.size>0)for(const[d,h]of o)h.reconcileObservedMutation(d,r);const f=t.takeRecords();if(f.length>0){for(let d=0;d<f.length;d++){const h=f[d],p=h.addedNodes,m=h.target;for(let y=0;y<p.length;y++){const C=p[y],_=C.parentNode;_==null||C.nodeName!=="BR"||hs(C,m,r)||_.removeChild(C)}}t.takeRecords()}s!==null&&(a&&(s.dirty=!0,rt(s)),vt&&Ll(r)&&s.insertRawText(c))})}finally{Ss=!1}}function Dl(r){const e=r._observer;e!==null&&vl(r,e.takeRecords(),e)}function Cl(r){(function(e){li===0&&Gn(e).addEventListener("textInput",Ya,!0)})(r),r._observer=new MutationObserver((e,t)=>{vl(r,e,t)})}function Ui(r,e){const t=r.__mode,n=r.__format,s=r.__style,o=e.__mode,i=e.__format,l=e.__style;return!(t!==null&&t!==o||n!==null&&n!==i||s!==null&&s!==l)}function Wi(r,e){const t=r.mergeWithSibling(e),n=ne()._normalizedNodes;return n.add(r.__key),n.add(e.__key),t}function Ki(r){let e,t,n=r;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&M(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Ui(e,n)){n=Wi(e,n);break}break}e.remove()}for(;(t=n.getNextSibling())!==null&&M(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Ui(n,t)){n=Wi(n,t);break}break}t.remove()}}else n.remove()}function wl(r){return Vi(r.anchor),Vi(r.focus),r}function Vi(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),M(n)){r.set(n.__key,s?n.getTextContentSize():0,"text");break}if(!B(n))break;r.set(n.__key,s?n.getChildrenSize():0,"element")}}let tc=1;const rc=typeof queueMicrotask=="function"?queueMicrotask:r=>{Promise.resolve().then(r)};function ui(r){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return Z(nr(r))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&Wn(e)==null)}function Wr(r,e,t){const n=r.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!ui(e)&&El(e)===r}catch{return!1}}function ai(r){return r instanceof Xn}function El(r){let e=r;for(;e!=null;){const t=Wn(e);if(ai(t))return t;e=Kr(e)}return null}function Wn(r){return r?r.__lexicalEditor:null}function Bt(r){return r.isToken()||r.isSegmented()}function nc(r){return r.nodeType===Ct}function En(r){let e=r;for(;e!=null;){if(nc(e))return e;e=e.firstChild}return null}function An(r,e,t){const n=Ot[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 Al(r){return M(r)||jt(r)||Z(r)}function sc(r,e){if(e!=null)return void(r.__key=e);Te(),eu();const t=ne(),n=ft(),s=""+tc++;n._nodeMap.set(s,r),B(r)?t._dirtyElements.set(s,!0):t._dirtyLeaves.add(s),t._cloneNotNeeded.add(s),t._dirtyType=xl,r.__key=s}function Lt(r){const e=r.getParent();if(e!==null){const t=r.getWritable(),n=e.getWritable(),s=r.getPreviousSibling(),o=r.getNextSibling();if(s===null)if(o!==null){const i=o.getWritable();n.__first=o.__key,i.__prev=null}else n.__first=null;else{const i=s.getWritable();if(o!==null){const l=o.getWritable();l.__prev=i.__key,i.__next=l.__key}else i.__next=null;t.__prev=null}if(o===null)if(s!==null){const i=s.getWritable();n.__last=s.__key,i.__next=null}else n.__last=null;else{const i=o.getWritable();if(s!==null){const l=s.getWritable();l.__next=i.__key,i.__prev=l.__key}else i.__prev=null;t.__next=null}n.__size--,t.__parent=null}}function kn(r){eu();const e=r.getLatest(),t=e.__parent,n=ft(),s=ne(),o=n._nodeMap,i=s._dirtyElements;t!==null&&function(u,a,c){let f=u;for(;f!==null;){if(c.has(f))return;const d=a.get(f);if(d===void 0)break;c.set(f,!1),f=d.__parent}}(t,o,i);const l=e.__key;s._dirtyType=xl,B(r)?i.set(l,!0):s._dirtyLeaves.add(l)}function me(r){Te();const e=ne(),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 xt(){return Qr()?null:ne()._compositionKey}function xe(r,e){const t=(e||ft())._nodeMap.get(r);return t===void 0?null:t}function kl(r,e){const t=Kn(r,ne());return t!==void 0?xe(t,e):null}function Kn(r,e){return r[`__lexicalKey_${e._key}`]}function nr(r,e){let t=r;for(;t!=null;){const n=kl(t,e);if(n!==null)return n;t=Kr(t)}return null}function Sl(r){const e=r._decorators,t=Object.assign({},e);return r._pendingDecorators=t,t}function Gi(r){return r.read(()=>se().getTextContent())}function se(){return Tl(ft())}function Tl(r){return r._nodeMap.get("root")}function rt(r){Te();const e=ft();r!==null&&(r.dirty=!0,r.setCachedNodes(null)),e._selection=r}function Qt(r){const e=ne(),t=function(n,s){let o=n;for(;o!=null;){const i=Kn(o,s);if(i!==void 0)return i;o=Kr(o)}return null}(r,e);return t===null?r===e.getRootElement()?xe("root"):null:xe(t)}function Hi(r,e){return e?r.getTextContentSize():0}function Bl(r){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(r)}function ci(r){const e=[];let t=r;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Nl(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Fl(r){return r.nodeType===Ct?r.nodeValue:null}function di(r,e,t){const n=ze(e._window);if(n===null)return;const s=n.anchorNode;let{anchorOffset:o,focusOffset:i}=n;if(s!==null){let l=Fl(s);const u=nr(s);if(l!==null&&M(u)){if(l===Un&&t){const a=t.length;l=t,o=a,i=a}l!==null&&fi(u,l,o,i,r)}}}function fi(r,e,t,n,s){let o=r;if(o.isAttached()&&(s||!o.isDirty())){const i=o.isComposing();let l=e;(i||s)&&e[e.length-1]===Un&&(l=e.slice(0,-1));const u=o.getTextContent();if(s||l!==u){if(l===""){if(me(null),qn||qr||Zs)o.remove();else{const m=ne();setTimeout(()=>{m.update(()=>{o.isAttached()&&o.remove()})},20)}return}const a=o.getParent(),c=Jr(),f=o.getTextContentSize(),d=xt(),h=o.getKey();if(o.isToken()||d!==null&&h===d&&!i||P(c)&&(a!==null&&!a.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===r.__key&&c.anchor.offset===0&&!o.canInsertTextBefore()&&!i||c.focus.key===r.__key&&c.focus.offset===f&&!o.canInsertTextAfter()&&!i))return void o.markDirty();const p=q();if(!P(p)||t===null||n===null)return void o.setTextContent(l);if(p.setTextNodeRange(o,t,o,n),o.isSegmented()){const m=he(o.getTextContent());o.replace(m),o=m}o.setTextContent(l)}}}function ic(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(o){const i=o.getPreviousSibling();return(M(i)||B(i)&&i.isInline())&&!i.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||s)}function Ji(r){return r==="ArrowLeft"}function Qi(r){return r==="ArrowRight"}function Dr(r,e){return We?r:e}function Yi(r){return r==="Enter"}function mr(r){return r==="Backspace"}function yr(r){return r==="Delete"}function Xi(r,e,t){return r.toLowerCase()==="a"&&Dr(e,t)}function oc(){const r=se();rt(wl(r.select(0,r.getChildrenSize())))}function Sr(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 o=wn(s);return t[e]=o,o}return s}function hi(r,e,t,n,s){if(t.size===0)return;const o=n.__type,i=n.__key,l=e.get(o);l===void 0&&O(33,o);const u=l.klass;let a=r.get(u);a===void 0&&(a=new Map,r.set(u,a));const c=a.get(i),f=c==="destroyed"&&s==="created";(c===void 0||f)&&a.set(i,f?"updated":s)}function Zi(r,e,t){const n=r.getParent();let s=t,o=r;return n!==null&&(e&&t===0?(s=o.getIndexWithinParent(),o=n):e||t!==o.getChildrenSize()||(s=o.getIndexWithinParent()+1,o=n)),o.getChildAtIndex(e?s-1:s)}function Mr(r,e){const t=r.offset;if(r.type==="element")return Zi(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?Zi(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):s}}return null}function Ll(r){const e=Gn(r).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function I(r,e,t){return nu(r,e,t)}function Vn(r){return!Ce(r)&&!r.isLastChild()&&!r.isInline()}function Sn(r,e){const t=r._keyToDOMMap.get(e);return t===void 0&&O(75,e),t}function Kr(r){const e=r.assignedSlot||r.parentElement;return e!==null&&e.nodeType===11?e.host:e}function Tr(r,e){let t=r.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Gn(r){const e=r._window;return e===null&&O(78),e}function lc(r){let e=r.getParentOrThrow();for(;e!==null;){if(nt(e))return e;e=e.getParentOrThrow()}return e}function nt(r){return Ce(r)||B(r)&&r.isShadowRoot()}function ot(r){const e=ne(),t=r.constructor.getType(),n=e._nodes.get(t);n===void 0&&O(200,r.constructor.name,t);const{replace:s,replaceWithKlass:o}=n;if(s!==null){const i=s(r),l=i.constructor;return o!==null?i instanceof o||O(201,o.name,o.getType(),l.name,l.getType(),r.constructor.name,t):i instanceof r.constructor&&l!==r.constructor||O(202,l.name,l.getType(),r.constructor.name,t),i.__key===r.__key&&O(203,r.constructor.name,t,l.name,l.getType()),i}return r}function ps(r,e){!Ce(r.getParent())||B(e)||Z(e)||O(99)}function gs(r){return(Z(r)||B(r)&&!r.canBeEmpty())&&!r.isInline()}function pi(r,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const n=r.parentElement;n!==null&&n.removeChild(r)}function uc(r,e,t){let n=r._blockCursorElement;if(P(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const s=t.anchor,o=s.getNode(),i=s.offset;let l=!1,u=null;if(i===o.getChildrenSize())gs(o.getChildAtIndex(i-1))&&(l=!0);else{const a=o.getChildAtIndex(i);if(a!==null&&gs(a)){const c=a.getPreviousSibling();(c===null||gs(c))&&(l=!0,u=r.getElementByKey(a.__key))}}if(l){const a=r.getElementByKey(o.__key);return n===null&&(r._blockCursorElement=n=function(c){const f=c.theme,d=document.createElement("div");d.contentEditable="false",d.setAttribute("data-lexical-cursor","true");let h=f.blockCursor;if(h!==void 0){if(typeof h=="string"){const p=wn(h);h=f.blockCursor=p}h!==void 0&&d.classList.add(...h)}return d}(r._config)),e.style.caretColor="transparent",void(u===null?a.appendChild(n):a.insertBefore(n,u))}}n!==null&&pi(n,r,e)}function ze(r){return Je?(r||window).getSelection():null}function ac(r){return dt(r)&&r.tagName==="A"}function dt(r){return r.nodeType===1}function eo(r){return r.nodeType===11}function Ts(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 Tn(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 mt(r){if(Z(r)&&!r.isInline())return!0;if(!B(r)||nt(r))return!1;const e=r.getFirstChild(),t=e===null||jt(e)||M(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function xr(r,e){let t=r;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function cc(){return ne()}const to=new WeakMap,dc=new Map;function fc(r){if(!r._readOnly&&r.isEmpty())return dc;r._readOnly||O(192);let e=to.get(r);if(!e){e=new Map,to.set(r,e);for(const[t,n]of r._nodeMap){const s=n.__type;let o=e.get(s);o||(o=new Map,e.set(s,o)),o.set(t,n)}}return e}function gi(r){const e=r.constructor.clone(r);return e.afterCloneFrom(r),e}function mi(r,e){const t=(parseInt(r.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function hc(r){return r.__lexicalUnmanaged===!0}function jl(r,e,t,n,s,o){let i=r.getFirstChild();for(;i!==null;){const l=i.__key;i.__parent===e&&(B(i)&&jl(i,l,t,n,s,o),t.has(l)||o.delete(l),s.push(l)),i=i.getNextSibling()}}let Dt,we,Rr,Hn,Bs,Ns,Mt,He,Fs,$r,ae="",De="",Xe=null,Ke="",at="",Pl=!1,Ir=!1,mn=null;function Bn(r,e){const t=Mt.get(r);if(e!==null){const n=Ps(r);n.parentNode===e&&e.removeChild(n)}if(He.has(r)||we._keyToDOMMap.delete(r),B(t)){const n=Fn(t,Mt);Ls(n,0,n.length-1,null)}t!==void 0&&hi($r,Rr,Hn,t,"destroyed")}function Ls(r,e,t,n){let s=e;for(;s<=t;++s){const o=r[s];o!==void 0&&Bn(o,n)}}function Tt(r,e){r.setProperty("text-align",e)}const pc="40px";function Ol(r,e){const t=Dt.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")||pc;r.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function Ml(r,e){const t=r.style;e===0?Tt(t,""):e===ti?Tt(t,"left"):e===ri?Tt(t,"center"):e===ni?Tt(t,"right"):e===si?Tt(t,"justify"):e===ii?Tt(t,"start"):e===oi&&Tt(t,"end")}function Nn(r,e){const t=He.get(r);t===void 0&&O(60);const n=t.createDOM(Dt,we);if(function(s,o,i){const l=i._keyToDOMMap;(function(u,a,c){u[`__lexicalKey_${a._key}`]=c})(o,i,s),l.set(s,o)}(r,n,we),M(t)?n.setAttribute("data-lexical-text","true"):Z(t)&&n.setAttribute("data-lexical-decorator","true"),B(t)){const s=t.__indent,o=t.__size;if(s!==0&&Ol(n,s),o!==0){const l=o-1;(function(u,a,c,f){const d=De;De="",js(u,c,0,a,c.getDOMSlot(f)),$l(c,f),De=d})(Fn(t,He),l,t,n)}const i=t.__format;i!==0&&Ml(n,i),t.isInline()||Rl(null,t,n),Vn(t)&&(ae+=ct,at+=ct)}else{const s=t.getTextContent();if(Z(t)){const o=t.decorate(we,Dt);o!==null&&Il(r,o),n.contentEditable="false"}else M(t)&&(t.isDirectionless()||(De+=s));ae+=s,at+=s}return e!==null&&e.insertChild(n),hi($r,Rr,Hn,t,"created"),n}function js(r,e,t,n,s){const o=ae;ae="";let i=t;for(;i<=n;++i){Nn(r[i],s);const l=He.get(r[i]);l!==null&&M(l)&&(Xe===null&&(Xe=l.getFormat()),Ke===""&&(Ke=l.getStyle()))}Vn(e)&&(ae+=ct),s.element.__lexicalTextContent=ae,ae=o+ae}function ro(r,e){if(r){const t=r.__last;if(t){const n=e.get(t);if(n)return jt(n)?"line-break":Z(n)&&n.isInline()?"decorator":null}return"empty"}return null}function Rl(r,e,t){const n=ro(r,Mt),s=ro(e,He);n!==s&&e.getDOMSlot(t).setManagedLineBreak(s)}function $l(r,e){const t=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(t!==De||n!==mn){const o=De==="",i=o?mn:(s=De,Ua.test(s)?"rtl":Wa.test(s)?"ltr":null);if(i!==n){const l=e.classList,u=Dt.theme;let a=n!==null?u[n]:void 0,c=i!==null?u[i]:void 0;if(a!==void 0){if(typeof a=="string"){const f=wn(a);a=u[n]=f}l.remove(...a)}if(i===null||o&&i==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){const f=wn(c);c=u[i]=f}c!==void 0&&l.add(...c)}e.dir=i}Ir||(r.getWritable().__dir=i)}mn=i,e.__lexicalDirTextContent=De,e.__lexicalDir=i}var s}function gc(r,e,t){const n=De;var s;De="",Xe=null,Ke="",function(o,i,l){const u=ae,a=o.__size,c=i.__size;ae="";const f=l.element;if(a===1&&c===1){const d=o.__first,h=i.__first;if(d===h)Cr(d,f);else{const m=Ps(d),y=Nn(h,null);try{f.replaceChild(y,m)}catch(C){if(typeof C=="object"&&C!=null){const _=`${C.toString()} Parent: ${f.tagName}, new child: {tag: ${y.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${d}}.`;throw new Error(_)}throw C}Bn(d,null)}const p=He.get(h);M(p)&&(Xe===null&&(Xe=p.getFormat()),Ke===""&&(Ke=p.getStyle()))}else{const d=Fn(o,Mt),h=Fn(i,He);if(d.length!==a&&O(227),h.length!==c&&O(228),a===0)c!==0&&js(h,i,0,c-1,l);else if(c===0){if(a!==0){const p=l.after==null&&l.before==null&&l.element.__lexicalLineBreak==null;Ls(d,0,a-1,p?null:f),p&&(f.textContent="")}}else(function(p,m,y,C,_,E){const D=C-1,k=_-1;let v,b,w=E.getFirstChild(),S=0,R=0;for(;S<=D&&R<=k;){const F=m[S],j=y[R];if(F===j)w=ms(Cr(j,E.element)),S++,R++;else{v===void 0&&(v=new Set(m)),b===void 0&&(b=new Set(y));const G=b.has(F),de=v.has(j);if(G)if(de){const fe=Sn(we,j);fe===w?w=ms(Cr(j,E.element)):(E.withBefore(w).insertChild(fe),Cr(j,E.element)),S++,R++}else Nn(j,E.withBefore(w)),R++;else w=ms(Ps(F)),Bn(F,E.element),S++}const $=He.get(j);$!==null&&M($)&&(Xe===null&&(Xe=$.getFormat()),Ke===""&&(Ke=$.getStyle()))}const T=S>D,N=R>k;if(T&&!N){const F=y[k+1],j=F===void 0?null:we.getElementByKey(F);js(y,p,R,k,E.withBefore(j))}else N&&!T&&Ls(m,S,D,E.element)})(i,d,h,a,c,l)}Vn(i)&&(ae+=ct),f.__lexicalTextContent=ae,ae=u+ae}(r,e,e.getDOMSlot(t)),$l(e,t),sr(s=e)&&Xe!=null&&Xe!==s.__textFormat&&!Ir&&(s.setTextFormat(Xe),s.setTextStyle(Ke)),function(o){sr(o)&&Ke!==""&&Ke!==o.__textStyle&&!Ir&&o.setTextStyle(Ke)}(e),De=n}function Fn(r,e){const t=[];let n=r.__first;for(;n!==null;){const s=e.get(n);s===void 0&&O(101),t.push(n),n=s.__next}return t}function Cr(r,e){const t=Mt.get(r);let n=He.get(r);t!==void 0&&n!==void 0||O(61);const s=Pl||Ns.has(r)||Bs.has(r),o=Sn(we,r);if(t===n&&!s){if(B(t)){const i=o.__lexicalTextContent;i!==void 0&&(ae+=i,at+=i);const l=o.__lexicalDirTextContent;l!==void 0&&(De+=l)}else{const i=t.getTextContent();M(t)&&!t.isDirectionless()&&(De+=i),at+=i,ae+=i}return o}if(t!==n&&s&&hi($r,Rr,Hn,n,"updated"),n.updateDOM(t,o,Dt)){const i=Nn(r,null);return e===null&&O(62),e.replaceChild(i,o),Bn(r,null),i}if(B(t)&&B(n)){const i=n.__indent;i!==t.__indent&&Ol(o,i);const l=n.__format;l!==t.__format&&Ml(o,l),s&&(gc(t,n,o),Ce(n)||n.isInline()||Rl(t,n,o)),Vn(n)&&(ae+=ct,at+=ct)}else{const i=n.getTextContent();if(Z(n)){const l=n.decorate(we,Dt);l!==null&&Il(r,l)}else M(n)&&!n.isDirectionless()&&(De+=i);ae+=i,at+=i}if(!Ir&&Ce(n)&&n.__cachedText!==at){const i=n.getWritable();i.__cachedText=at,n=i}return o}function Il(r,e){let t=we._pendingDecorators;const n=we._decorators;if(t===null){if(n[r]===e)return;t=Sl(we)}t[r]=e}function ms(r){let e=r.nextSibling;return e!==null&&e===we._blockCursorElement&&(e=e.nextSibling),e}function mc(r,e,t,n,s,o){ae="",at="",De="",Pl=n===rr,mn=null,we=t,Dt=t._config,Rr=t._nodes,Hn=we._listeners.mutation,Bs=s,Ns=o,Mt=r._nodeMap,He=e._nodeMap,Ir=e._readOnly,Fs=new Map(t._keyToDOMMap);const i=new Map;return $r=i,Cr("root",null),we=void 0,Rr=void 0,Bs=void 0,Ns=void 0,Mt=void 0,He=void 0,Dt=void 0,Fs=void 0,$r=void 0,i}function Ps(r){const e=Fs.get(r);return e===void 0&&O(75,r),e}const ut=Object.freeze({}),Os=30,Ms=[["keydown",function(r,e){if(Br=r.timeStamp,zl=r.key,e.isComposing())return;const{key:t,shiftKey:n,ctrlKey:s,metaKey:o,altKey:i}=r;if(!I(e,va,r)&&t!=null){if(function(l,u,a,c){return Qi(l)&&!u&&!c&&!a}(t,s,i,o))I(e,ll,r);else if(function(l,u,a,c,f){return Qi(l)&&!c&&!a&&(u||f)}(t,s,n,i,o))I(e,Da,r);else if(function(l,u,a,c){return Ji(l)&&!u&&!c&&!a}(t,s,i,o))I(e,ul,r);else if(function(l,u,a,c,f){return Ji(l)&&!c&&!a&&(u||f)}(t,s,n,i,o))I(e,Ca,r);else if(function(l,u,a){return function(c){return c==="ArrowUp"}(l)&&!u&&!a}(t,s,o))I(e,al,r);else if(function(l,u,a){return function(c){return c==="ArrowDown"}(l)&&!u&&!a}(t,s,o))I(e,cl,r);else if(function(l,u){return Yi(l)&&u}(t,n))Nr=!0,I(e,bn,r);else if(function(l){return l===" "}(t))I(e,wa,r);else if(function(l,u){return We&&u&&l.toLowerCase()==="o"}(t,s))r.preventDefault(),Nr=!0,I(e,Xt,!0);else if(function(l,u){return Yi(l)&&!u}(t,n))Nr=!1,I(e,bn,r);else if(function(l,u,a,c){return We?!u&&!a&&(mr(l)||l.toLowerCase()==="h"&&c):!(c||u||a)&&mr(l)}(t,i,o,s))mr(t)?I(e,dl,r):(r.preventDefault(),I(e,Ft,!0));else if(function(l){return l==="Escape"}(t))I(e,fl,r);else if(function(l,u,a,c,f){return We?!(a||c||f)&&(yr(l)||l.toLowerCase()==="d"&&u):!(u||c||f)&&yr(l)}(t,s,n,i,o))yr(t)?I(e,hl,r):(r.preventDefault(),I(e,Ft,!1));else if(function(l,u,a){return mr(l)&&(We?u:a)}(t,i,s))r.preventDefault(),I(e,Pr,!0);else if(function(l,u,a){return yr(l)&&(We?u:a)}(t,i,s))r.preventDefault(),I(e,Pr,!1);else if(function(l,u){return We&&u&&mr(l)}(t,o))r.preventDefault(),I(e,Or,!0);else if(function(l,u){return We&&u&&yr(l)}(t,o))r.preventDefault(),I(e,Or,!1);else if(function(l,u,a,c){return l.toLowerCase()==="b"&&!u&&Dr(a,c)}(t,i,o,s))r.preventDefault(),I(e,Ge,"bold");else if(function(l,u,a,c){return l.toLowerCase()==="u"&&!u&&Dr(a,c)}(t,i,o,s))r.preventDefault(),I(e,Ge,"underline");else if(function(l,u,a,c){return l.toLowerCase()==="i"&&!u&&Dr(a,c)}(t,i,o,s))r.preventDefault(),I(e,Ge,"italic");else if(function(l,u,a,c){return l==="Tab"&&!u&&!a&&!c}(t,i,s,o))I(e,Ea,r);else if(function(l,u,a,c){return l.toLowerCase()==="z"&&!u&&Dr(a,c)}(t,n,o,s))r.preventDefault(),I(e,Qs,void 0);else if(function(l,u,a,c){return We?l.toLowerCase()==="z"&&a&&u:l.toLowerCase()==="y"&&c||l.toLowerCase()==="z"&&c&&u}(t,n,o,s))r.preventDefault(),I(e,Ys,void 0);else{const l=e._editorState._selection;l===null||P(l)?!vt&&Xi(t,o,s)&&(r.preventDefault(),I(e,ks,r)):function(u,a,c,f){return!a&&u.toLowerCase()==="c"&&(We?c:f)}(t,n,o,s)?(r.preventDefault(),I(e,zn,r)):function(u,a,c,f){return!a&&u.toLowerCase()==="x"&&(We?c:f)}(t,n,o,s)?(r.preventDefault(),I(e,Xs,r)):Xi(t,o,s)&&(r.preventDefault(),I(e,ks,r))}(function(l,u,a,c){return l||u||a||c})(s,n,i,o)&&I(e,ja,r)}}],["pointerdown",function(r,e){const t=r.target,n=r.pointerType;t instanceof Node&&n!=="touch"&&je(e,()=>{Z(nr(t))||($s=!0)})}],["compositionstart",function(r,e){je(e,()=>{const t=q();if(P(t)&&!e.isComposing()){const n=t.anchor,s=t.anchor.getNode();me(n.key),(r.timeStamp<Br+Os||n.type==="element"||!t.isCollapsed()||s.getFormat()!==t.format||M(s)&&s.getStyle()!==t.style)&&I(e,Zt,qa)}})}],["compositionend",function(r,e){vt?_r=!0:je(e,()=>{ys(e,r.data)})}],["input",function(r,e){r.stopPropagation(),je(e,()=>{const t=q(),n=r.data,s=Kl(r);if(n!=null&&P(t)&&Wl(t,s,n,r.timeStamp,!1)){_r&&(ys(e,n),_r=!1);const o=t.anchor.getNode(),i=ze(e._window);if(i===null)return;const l=t.isBackward(),u=l?t.anchor.offset:t.focus.offset,a=l?t.focus.offset:t.anchor.offset;vn&&!t.isCollapsed()&&M(o)&&i.anchorNode!==null&&o.getTextContent().slice(0,u)+n+o.getTextContent().slice(u+a)===Fl(i.anchorNode)||I(e,Zt,n);const c=n.length;vt&&c>1&&r.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=c),qn||qr||Zs||!e.isComposing()||(Br=0,me(null))}else di(!1,e,n!==null?n:void 0),_r&&(ys(e,n||void 0),_r=!1);Te(),Dl(ne())}),Jt=null}],["click",function(r,e){je(e,()=>{const t=q(),n=ze(e._window),s=Jr();if(n){if(P(t)){const o=t.anchor,i=o.getNode();o.type==="element"&&o.offset===0&&t.isCollapsed()&&!Ce(i)&&se().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&s!==null&&t.is(s)?(n.removeAllRanges(),t.dirty=!0):r.detail===3&&!t.isCollapsed()&&i!==t.focus.getNode()&&(B(i)?i.select(0):i.getParentOrThrow().select(0))}else if(r.pointerType==="touch"){const o=n.anchorNode;if(o!==null){const i=o.nodeType;(i===Ur||i===Ct)&&rt(xi(s,n,e,r))}}}I(e,ol,r)})}],["cut",ut],["copy",ut],["dragstart",ut],["dragover",ut],["dragend",ut],["paste",ut],["focus",ut],["blur",ut],["drop",ut]];vn&&Ms.push(["beforeinput",(r,e)=>function(t,n){const s=t.inputType,o=Kl(t);s==="deleteCompositionText"||vt&&Ll(n)||s!=="insertCompositionText"&&je(n,()=>{const i=q();if(s==="deleteContentBackward"){if(i===null){const h=Jr();if(!P(h))return;rt(h.clone())}if(P(i)){const h=i.anchor.key===i.focus.key;if(l=t.timeStamp,zl==="MediaLast"&&l<Br+Os&&n.isComposing()&&h){if(me(null),Br=0,setTimeout(()=>{je(n,()=>{me(null)})},Os),P(i)){const p=i.anchor.getNode();p.markDirty(),i.format=p.getFormat(),M(p)||O(142),i.style=p.getStyle()}}else{me(null),t.preventDefault();const p=i.anchor.getNode(),m=p.getTextContent(),y=p.canInsertTextAfter(),C=i.anchor.offset===0&&i.focus.offset===m.length;Ma&&h&&!C&&y||I(n,Ft,!0)}return}}var l;if(!P(i))return;const u=t.data;Jt!==null&&di(!1,n,Jt),i.dirty&&Jt===null||!i.isCollapsed()||Ce(i.anchor.getNode())||o===null||i.applyDOMRange(o),Jt=null;const a=i.anchor,c=i.focus,f=a.getNode(),d=c.getNode();if(s!=="insertText"&&s!=="insertTranspose")switch(t.preventDefault(),s){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":I(n,Zt,t);break;case"insertFromComposition":me(null),I(n,Zt,t);break;case"insertLineBreak":me(null),I(n,Xt,!1);break;case"insertParagraph":me(null),Nr&&!qr?(Nr=!1,I(n,Xt,!1)):I(n,jr,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":I(n,In,t);break;case"deleteByComposition":(function(h,p){return h!==p||B(h)||B(p)||!h.isToken()||!p.isToken()})(f,d)&&I(n,As,t);break;case"deleteByDrag":case"deleteByCut":I(n,As,t);break;case"deleteContent":I(n,Ft,!1);break;case"deleteWordBackward":I(n,Pr,!0);break;case"deleteWordForward":I(n,Pr,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":I(n,Or,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":I(n,Or,!1);break;case"formatStrikeThrough":I(n,Ge,"strikethrough");break;case"formatBold":I(n,Ge,"bold");break;case"formatItalic":I(n,Ge,"italic");break;case"formatUnderline":I(n,Ge,"underline");break;case"historyUndo":I(n,Qs,void 0);break;case"historyRedo":I(n,Ys,void 0)}else{if(u===`
64
- `)t.preventDefault(),I(n,Xt,!1);else if(u===ct)t.preventDefault(),I(n,jr,void 0);else if(u==null&&t.dataTransfer){const h=t.dataTransfer.getData("text/plain");t.preventDefault(),i.insertRawText(h)}else u!=null&&Wl(i,o,u,t.timeStamp,!0)?(t.preventDefault(),I(n,Zt,u)):Jt=u;ql=t.timeStamp}})}(r,e)]);let Br=0,zl=null,ql=0,Jt=null;const Ln=new WeakMap;let Rs=!1,$s=!1,Nr=!1,_r=!1,Ul=[0,"",0,"root",0];function Wl(r,e,t,n,s){const o=r.anchor,i=r.focus,l=o.getNode(),u=ne(),a=ze(u._window),c=a!==null?a.anchorNode:null,f=o.key,d=u.getElementByKey(f),h=t.length;return f!==i.key||!M(l)||(!s&&(!vn||ql<n+50)||l.isDirty()&&h<2||Bl(t))&&o.offset!==i.offset&&!l.isComposing()||Bt(l)||l.isDirty()&&h>1||(s||!vn)&&d!==null&&!l.isComposing()&&c!==En(d)||a!==null&&e!==null&&(!e.collapsed||e.startContainer!==a.anchorNode||e.startOffset!==a.anchorOffset)||l.getFormat()!==r.format||l.getStyle()!==r.style||ic(r,l)}function no(r,e){return r!==null&&r.nodeValue!==null&&r.nodeType===Ct&&e!==0&&e!==r.nodeValue.length}function so(r,e,t){const{anchorNode:n,anchorOffset:s,focusNode:o,focusOffset:i}=r;Rs&&(Rs=!1,no(n,s)&&no(o,i))||je(e,()=>{if(!t)return void rt(null);if(!Wr(e,n,o))return;const l=q();if(P(l)){const u=l.anchor,a=u.getNode();if(l.isCollapsed()){r.type==="Range"&&r.anchorNode===r.focusNode&&(l.dirty=!0);const c=Gn(e).event,f=c?c.timeStamp:performance.now(),[d,h,p,m,y]=Ul,C=se(),_=e.isComposing()===!1&&C.getTextContent()==="";if(f<y+200&&u.offset===p&&u.key===m)l.format=d,l.style=h;else if(u.type==="text")M(a)||O(141),l.format=a.getFormat(),l.style=a.getStyle();else if(u.type==="element"&&!_){const E=u.getNode();l.style="",E instanceof or&&E.getChildrenSize()===0?(l.format=E.getTextFormat(),l.style=E.getTextStyle()):l.format=0}}else{const c=u.key,f=l.focus.key,d=l.getNodes(),h=d.length,p=l.isBackward(),m=p?i:s,y=p?s:i,C=p?f:c,_=p?c:f;let E=za,D=!1;for(let k=0;k<h;k++){const v=d[k],b=v.getTextContentSize();if(M(v)&&b!==0&&!(k===0&&v.__key===C&&m===b||k===h-1&&v.__key===_&&y===0)&&(D=!0,E&=v.getFormat(),E===0))break}l.format=D?E:0}}I(e,Js,void 0)})}function Kl(r){if(!r.getTargetRanges)return null;const e=r.getTargetRanges();return e.length===0?null:e[0]}function ys(r,e){const t=r._compositionKey;if(me(null),t!==null&&e!=null){if(e===""){const n=xe(t),s=En(r.getElementByKey(t));return void(s!==null&&s.nodeValue!==null&&M(n)&&fi(n,s.nodeValue,null,null,!0))}if(e[e.length-1]===`
65
- `){const n=q();if(P(n)){const s=n.focus;return n.anchor.set(s.key,s.offset,s.type),void I(r,bn,null)}}}di(!0,r,e)}function Vl(r){let e=r.__lexicalEventHandles;return e===void 0&&(e=[],r.__lexicalEventHandles=e),e}const er=new Map;function Gl(r){const e=r.target,t=ze(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const n=El(t.anchorNode);if(n===null)return;$s&&($s=!1,je(n,()=>{const a=Jr(),c=t.anchorNode;if(c===null)return;const f=c.nodeType;f!==Ur&&f!==Ct||rt(xi(a,t,n,r))}));const s=ci(n),o=s[s.length-1],i=o._key,l=er.get(i),u=l||o;u!==n&&so(t,u,!1),so(t,n,!0),n!==o?er.set(i,n):l&&er.delete(i)}function io(r){r._lexicalHandled=!0}function oo(r){return r._lexicalHandled===!0}function yc(r){const e=r.ownerDocument,t=Ln.get(e);t===void 0&&O(162);const n=t-1;n>=0||O(164),Ln.set(e,n),n===0&&e.removeEventListener("selectionchange",Gl);const s=Wn(r);ai(s)?(function(i){if(i._parentEditor!==null){const l=ci(i),u=l[l.length-1]._key;er.get(u)===i&&er.delete(u)}else er.delete(i._key)}(s),r.__lexicalEditor=null):s&&O(198);const o=Vl(r);for(let i=0;i<o.length;i++)o[i]();r.__lexicalEventHandles=[]}function Is(r,e,t){Te();const n=r.__key,s=r.getParent();if(s===null)return;const o=function(l){const u=q();if(!P(u)||!B(l))return u;const{anchor:a,focus:c}=u,f=a.getNode(),d=c.getNode();return Tr(f,l)&&a.set(l.__key,0,"element"),Tr(d,l)&&c.set(l.__key,0,"element"),u}(r);let i=!1;if(P(o)&&e){const l=o.anchor,u=o.focus;l.key===n&&(Pn(l,r,s,r.getPreviousSibling(),r.getNextSibling()),i=!0),u.key===n&&(Pn(u,r,s,r.getPreviousSibling(),r.getNextSibling()),i=!0)}else Ze(o)&&e&&r.isSelected()&&r.selectPrevious();if(P(o)&&e&&!i){const l=r.getIndexWithinParent();Lt(r),jn(o,s,l,-1)}else Lt(r);t||nt(s)||s.canBeEmpty()||!s.isEmpty()||Is(s,e),e&&Ce(s)&&s.isEmpty()&&s.selectEnd()}class Jn{static getType(){O(64,this.name)}static clone(e){O(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,sc(this,e)}getType(){return this.__type}isInline(){O(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||q();if(t==null)return!1;const n=t.getNodes().some(s=>s.__key===this.__key);if(M(this))return n;if(P(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const s=this.getParent();if(Z(this)&&this.isInline()&&s){const o=t.isBackward()?t.focus:t.anchor,i=o.getNode();if(o.offset===i.getChildrenSize()&&i.is(s)&&i.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&&O(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(nt(t))return B(e)||e===this&&Z(e)||O(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&O(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();B(this)&&t.unshift(this),B(e)&&n.unshift(e);const s=t.length,o=n.length;if(s===0||o===0||t[s-1]!==n[o-1])return null;const i=new Set(n);for(let l=0;l<s;l++){const u=t[l];if(i.has(u))return u}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,o=this;for(;;){const i=o.getParentOrThrow();if(i===t){n=o.getIndexWithinParent();break}o=i}for(o=e;;){const i=o.getParentOrThrow();if(i===t){s=o.getIndexWithinParent();break}o=i}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 o=this;for(;o!==null;){const i=o.__key;if(s.has(i)||(s.add(i),n.push(o)),o===e)break;const l=B(o)?t?o.getFirstChild():o.getLastChild():null;if(l!==null){o=l;continue}const u=t?o.getNextSibling():o.getPreviousSibling();if(u!==null){o=u;continue}const a=o.getParentOrThrow();if(s.has(a.__key)||n.push(a),a===e)break;let c=null,f=a;do{if(f===null&&O(68),c=t?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f===null)break;c!==null||s.has(f.__key)||n.push(f)}while(c===null);o=c}return t||n.reverse(),n}isDirty(){const e=ne()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=xe(this.__key);return e===null&&O(113),e}getWritable(){Te();const e=ft(),t=ne(),n=e._nodeMap,s=this.__key,o=this.getLatest(),i=t._cloneNotNeeded,l=q();if(l!==null&&l.setCachedNodes(null),i.has(s))return kn(o),o;const u=gi(o);return i.add(s),kn(u),n.set(s,u),u}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){O(70)}updateDOM(e,t,n){O(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){O(72)}static importJSON(e){O(18,this.name)}static transform(){return null}remove(e){Is(this,!0,e)}replace(e,t){Te();let n=q();n!==null&&(n=n.clone()),ps(this,e);const s=this.getLatest(),o=this.__key,i=e.__key,l=e.getWritable(),u=this.getParentOrThrow().getWritable(),a=u.__size;Lt(l);const c=s.getPreviousSibling(),f=s.getNextSibling(),d=s.__prev,h=s.__next,p=s.__parent;if(Is(s,!1,!0),c===null?u.__first=i:c.getWritable().__next=i,l.__prev=d,f===null?u.__last=i:f.getWritable().__prev=i,l.__next=h,l.__parent=p,u.__size=a,t&&(B(this)&&B(l)||O(139),this.getChildren().forEach(m=>{l.append(m)})),P(n)){rt(n);const m=n.anchor,y=n.focus;m.key===o&&co(m,l),y.key===o&&co(y,l)}return xt()===o&&me(i),l}insertAfter(e,t=!0){Te(),ps(this,e);const n=this.getWritable(),s=e.getWritable(),o=s.getParent(),i=q();let l=!1,u=!1;if(o!==null){const h=e.getIndexWithinParent();if(Lt(s),P(i)){const p=o.__key,m=i.anchor,y=i.focus;l=m.type==="element"&&m.key===p&&m.offset===h+1,u=y.type==="element"&&y.key===p&&y.offset===h+1}}const a=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),f=s.__key,d=n.__next;if(a===null?c.__last=f:a.getWritable().__prev=f,c.__size++,n.__next=f,s.__next=d,s.__prev=n.__key,s.__parent=n.__parent,t&&P(i)){const h=this.getIndexWithinParent();jn(i,c,h+1);const p=c.__key;l&&i.anchor.set(p,h+2,"element"),u&&i.focus.set(p,h+2,"element")}return e}insertBefore(e,t=!0){Te(),ps(this,e);const n=this.getWritable(),s=e.getWritable(),o=s.__key;Lt(s);const i=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),u=n.__prev,a=this.getIndexWithinParent();i===null?l.__first=o:i.getWritable().__next=o,l.__size++,n.__prev=o,s.__prev=u,s.__next=n.__key,s.__parent=n.__parent;const c=q();return t&&P(c)&&jn(c,this.getParentOrThrow(),a),e}isParentRequired(){return!1}createParentElementNode(){return ce()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Te();const n=this.getPreviousSibling(),s=this.getParentOrThrow();if(n===null)return s.select(0,0);if(B(n))return n.select();if(!M(n)){const o=n.getIndexWithinParent()+1;return s.select(o,o)}return n.select(e,t)}selectNext(e,t){Te();const n=this.getNextSibling(),s=this.getParentOrThrow();if(n===null)return s.select();if(B(n))return n.select(0,0);if(!M(n)){const o=n.getIndexWithinParent();return s.select(o,o)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class Vr extends Jn{static getType(){return"linebreak"}static clone(e){return new Vr(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&&Tn(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&an(s)){const o=n.lastChild;if(o===t||o.previousSibling===t&&an(o))return!0}}return!1}(e)||function(t){const n=t.parentElement;if(n!==null&&Tn(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&an(s))return!1;const o=n.lastChild;if(o===t||o.previousSibling===t&&an(o))return!0}return!1}(e)?null:{conversion:xc,priority:0}}}static importJSON(e){return Rt()}exportJSON(){return{type:"linebreak",version:1}}}function xc(r){return{node:Rt()}}function Rt(){return ot(new Vr)}function jt(r){return r instanceof Vr}function an(r){return r.nodeType===Ct&&/^( |\t|\r?\n)+$/.test(r.textContent||"")}function xs(r,e){return 16&e?"code":e&ei?"mark":32&e?"sub":64&e?"sup":null}function _s(r,e){return 1&e?"strong":2&e?"em":"span"}function Hl(r,e,t,n,s){const o=n.classList;let i=Sr(s,"base");i!==void 0&&o.add(...i),i=Sr(s,"underlineStrikethrough");let l=!1;const u=e&Cn&&e&Dn;i!==void 0&&(t&Cn&&t&Dn?(l=!0,u||o.add(...i)):u&&o.remove(...i));for(const a in Ot){const c=Ot[a];if(i=Sr(s,a),i!==void 0)if(t&c){if(l&&(a==="underline"||a==="strikethrough")){e&c&&o.remove(...i);continue}e&c&&(!u||a!=="underline")&&a!=="strikethrough"||o.add(...i)}else e&c&&o.remove(...i)}}function Jl(r,e,t){const n=e.firstChild,s=t.isComposing(),o=r+(s?Un:"");if(n==null)e.textContent=o;else{const i=n.nodeValue;if(i!==o)if(s||vt){const[l,u,a]=function(c,f){const d=c.length,h=f.length;let p=0,m=0;for(;p<d&&p<h&&c[p]===f[p];)p++;for(;m+p<d&&m+p<h&&c[d-m-1]===f[h-m-1];)m++;return[p,d-p-m,f.slice(p,h-m)]}(i,o);u!==0&&n.deleteData(l,u),n.insertData(l,a)}else n.nodeValue=o}}function lo(r,e,t,n,s,o){Jl(s,r,e);const i=o.theme.text;i!==void 0&&Hl(0,0,n,r,i)}function cn(r,e){const t=document.createElement(e);return t.appendChild(r),t}class ir extends Jn{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 Ha[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===xt()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=Ot[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return An(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const n=this.__format,s=xs(0,n),o=_s(0,n),i=s===null?o:s,l=document.createElement(i);let u=l;this.hasFormat("code")&&l.setAttribute("spellcheck","false"),s!==null&&(u=document.createElement(o),l.appendChild(u)),lo(u,this,0,n,this.__text,e);const a=this.__style;return a!==""&&(l.style.cssText=a),l}updateDOM(e,t,n){const s=this.__text,o=e.__format,i=this.__format,l=xs(0,o),u=xs(0,i),a=_s(0,o),c=_s(0,i);if((l===null?a:l)!==(u===null?c:u))return!0;if(l===u&&a!==c){const m=t.firstChild;m==null&&O(48);const y=document.createElement(c);return lo(y,this,0,i,s,n),t.replaceChild(y,m),!1}let f=t;u!==null&&l!==null&&(f=t.firstChild,f==null&&O(49)),Jl(s,f,this);const d=n.theme.text;d!==void 0&&o!==i&&Hl(0,o,i,f,d);const h=e.__style,p=this.__style;return h!==p&&(t.style.cssText=p),!1}static importDOM(){return{"#text":()=>({conversion:Dc,priority:0}),b:()=>({conversion:bc,priority:0}),code:()=>({conversion:gt,priority:0}),em:()=>({conversion:gt,priority:0}),i:()=>({conversion:gt,priority:0}),s:()=>({conversion:gt,priority:0}),span:()=>({conversion:_c,priority:0}),strong:()=>({conversion:gt,priority:0}),sub:()=>({conversion:gt,priority:0}),sup:()=>({conversion:gt,priority:0}),u:()=>({conversion:gt,priority:0})}}static importJSON(e){const t=he(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&&dt(t)||O(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=cn(t,"b")),this.hasFormat("italic")&&(t=cn(t,"i")),this.hasFormat("strikethrough")&&(t=cn(t,"s")),this.hasFormat("underline")&&(t=cn(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"?Ot[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?Ka[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=An(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=Ga[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){Te();let n=e,s=t;const o=q(),i=this.getTextContent(),l=this.__key;if(typeof i=="string"){const u=i.length;n===void 0&&(n=u),s===void 0&&(s=u)}else n=0,s=0;if(!P(o))return Xl(l,n,l,s,"text","text");{const u=xt();u!==o.anchor.key&&u!==o.focus.key||me(l),o.setTextNodeRange(this,n,this,s)}return o}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,s){const o=this.getWritable(),i=o.__text,l=n.length;let u=e;u<0&&(u=l+u,u<0&&(u=0));const a=q();if(s&&P(a)){const f=e+l;a.setTextNodeRange(o,f,o,f)}const c=i.slice(0,u)+n+i.slice(u+t);return o.__text=c,o}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Te();const t=this.getLatest(),n=t.getTextContent(),s=t.__key,o=xt(),i=new Set(e),l=[],u=n.length;let a="";for(let k=0;k<u;k++)a!==""&&i.has(k)&&(l.push(a),a=""),a+=n[k];a!==""&&l.push(a);const c=l.length;if(c===0)return[];if(l[0]===n)return[t];const f=l[0],d=t.getParent();let h;const p=t.getFormat(),m=t.getStyle(),y=t.__detail;let C=!1;t.isSegmented()?(h=he(f),h.__format=p,h.__style=m,h.__detail=y,C=!0):(h=t.getWritable(),h.__text=f);const _=q(),E=[h];let D=f.length;for(let k=1;k<c;k++){const v=l[k],b=v.length,w=he(v).getWritable();w.__format=p,w.__style=m,w.__detail=y;const S=w.__key,R=D+b;if(P(_)){const T=_.anchor,N=_.focus;T.key===s&&T.type==="text"&&T.offset>D&&T.offset<=R&&(T.key=S,T.offset-=D,_.dirty=!0),N.key===s&&N.type==="text"&&N.offset>D&&N.offset<=R&&(N.key=S,N.offset-=D,_.dirty=!0)}o===s&&me(S),D=R,E.push(w)}if(d!==null){(function(b){const w=b.getPreviousSibling(),S=b.getNextSibling();w!==null&&kn(w),S!==null&&kn(S)})(this);const k=d.getWritable(),v=this.getIndexWithinParent();C?(k.splice(v,0,E),this.remove()):k.splice(v,1,E),P(_)&&jn(_,d,v,c-1)}return E}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||O(50);const n=this.__key,s=e.__key,o=this.__text,i=o.length;xt()===s&&me(n);const l=q();if(P(l)){const f=l.anchor,d=l.focus;f!==null&&f.key===s&&(xo(f,t,n,e,i),l.dirty=!0),d!==null&&d.key===s&&(xo(d,t,n,e,i),l.dirty=!0)}const u=e.__text,a=t?u+o:o+u;this.setTextContent(a);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function _c(r){return{forChild:yi(r.style),node:null}}function bc(r){const e=r,t=e.style.fontWeight==="normal";return{forChild:yi(e.style,t?void 0:"bold"),node:null}}const uo=new WeakMap;function vc(r){return r.nodeName==="PRE"||r.nodeType===Ur&&r.style!==void 0&&r.style.whiteSpace!==void 0&&r.style.whiteSpace.startsWith("pre")}function Dc(r){const e=r;r.parentElement===null&&O(129);let t=e.textContent||"";if(function(n){let s,o=n.parentNode;const i=[n];for(;o!==null&&(s=uo.get(o))===void 0&&!vc(o);)i.push(o),o=o.parentNode;const l=s===void 0?o:s;for(let u=0;u<i.length;u++)uo.set(i[u],l);return l}(e)!==null){const n=t.split(/(\r?\n|\t)/),s=[],o=n.length;for(let i=0;i<o;i++){const l=n[i];l===`
63
+ `,qa=Dt?" ":Wn,_l="֑-߿יִ-﷽ﹰ-ﻼ",bl="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Ua=new RegExp("^[^"+bl+"]*["+_l+"]"),Wa=new RegExp("^[^"+_l+"]*["+bl+"]"),Ot={bold:1,code:16,highlight:ei,italic:2,strikethrough:Cn,subscript:32,superscript:64,underline:wn},Ka={directionless:1,unmergeable:2},qi={center:ri,end:oi,justify:si,left:ti,right:ni,start:ii},Va={[ri]:"center",[oi]:"end",[si]:"justify",[ti]:"left",[ni]:"right",[ii]:"start"},Ga={normal:0,segmented:2,token:1},Ha={[Ra]:"normal",[Ia]:"segmented",[$a]:"token"};function Ja(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var M=Ja(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 En(...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 Qa=100;let Ss=!1,li=0;function Ya(r){li=r.timeStamp}function hs(r,e,t){const n=r.nodeName==="BR",s=e.__lexicalLineBreak;return s&&(r===s||n&&r.previousSibling===s)||n&&Vn(r,t)!==void 0}function Xa(r,e,t){const n=$e(t._window);let s=null,o=null;n!==null&&n.anchorNode===r&&(s=n.anchorOffset,o=n.focusOffset);const i=r.nodeValue;i!==null&&fi(e,i,s,o,!1)}function Za(r,e,t){if(P(r)){const n=r.anchor.getNode();if(n.is(t)&&r.format!==n.getFormat())return!1}return e.nodeType===wt&&t.isAttached()}function ec(r,e,t,n){for(let s=r;s&&!hc(s);s=Gr(s)){const o=Vn(s,e);if(o!==void 0){const i=ye(o,t);if(i)return Z(i)?void 0:[s,i]}else if(s===n)return[n,Tl(t)]}}function vl(r,e,t){Ss=!0;const n=performance.now()-li>Qa;try{Fe(r,()=>{const s=q()||function(f){return f.getEditorState().read(()=>{const h=q();return h!==null?h.clone():null})}(r),o=new Map,i=r.getRootElement(),l=r._editorState,u=r._blockCursorElement;let a=!1,c="";for(let f=0;f<e.length;f++){const h=e[f],p=h.type,m=h.target,_=ec(m,r,l,i);if(!_)continue;const[C,y]=_;if(p==="characterData")n&&R(y)&&Za(s,m,y)&&Xa(m,y,r);else if(p==="childList"){a=!0;const E=h.addedNodes;for(let v=0;v<E.length;v++){const b=E[v],w=kl(b),S=b.parentNode;if(S!=null&&b!==u&&w===null&&!hs(b,S,r)){if(Dt){const $=b.innerText||b.nodeValue;$&&(c+=$)}S.removeChild(b)}}const D=h.removedNodes,k=D.length;if(k>0){let v=0;for(let b=0;b<k;b++){const w=D[b];(hs(w,m,r)||u===w)&&(m.appendChild(w),v++)}k!==v&&o.set(C,y)}}}if(o.size>0)for(const[f,h]of o)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 _=0;_<p.length;_++){const C=p[_],y=C.parentNode;y==null||C.nodeName!=="BR"||hs(C,m,r)||y.removeChild(C)}}t.takeRecords()}s!==null&&(a&&(s.dirty=!0,nt(s)),Dt&&Ll(r)&&s.insertRawText(c))})}finally{Ss=!1}}function Dl(r){const e=r._observer;e!==null&&vl(r,e.takeRecords(),e)}function Cl(r){(function(e){li===0&&Hn(e).addEventListener("textInput",Ya,!0)})(r),r._observer=new MutationObserver((e,t)=>{vl(r,e,t)})}function Ui(r,e){const t=r.__mode,n=r.__format,s=r.__style,o=e.__mode,i=e.__format,l=e.__style;return!(t!==null&&t!==o||n!==null&&n!==i||s!==null&&s!==l)}function Wi(r,e){const t=r.mergeWithSibling(e),n=ie()._normalizedNodes;return n.add(r.__key),n.add(e.__key),t}function Ki(r){let e,t,n=r;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&R(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Ui(e,n)){n=Wi(e,n);break}break}e.remove()}for(;(t=n.getNextSibling())!==null&&R(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Ui(n,t)){n=Wi(n,t);break}break}t.remove()}}else n.remove()}function wl(r){return Vi(r.anchor),Vi(r.focus),r}function Vi(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),R(n)){r.set(n.__key,s?n.getTextContentSize():0,"text");break}if(!B(n))break;r.set(n.__key,s?n.getChildrenSize():0,"element")}}let tc=1;const rc=typeof queueMicrotask=="function"?queueMicrotask:r=>{Promise.resolve().then(r)};function ui(r){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return Z(sr(r))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&Kn(e)==null)}function Vr(r,e,t){const n=r.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!ui(e)&&El(e)===r}catch{return!1}}function ai(r){return r instanceof Zn}function El(r){let e=r;for(;e!=null;){const t=Kn(e);if(ai(t))return t;e=Gr(e)}return null}function Kn(r){return r?r.__lexicalEditor:null}function Bt(r){return r.isToken()||r.isSegmented()}function nc(r){return r.nodeType===wt}function An(r){let e=r;for(;e!=null;){if(nc(e))return e;e=e.firstChild}return null}function kn(r,e,t){const n=Ot[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 Al(r){return R(r)||jt(r)||Z(r)}function sc(r,e){if(e!=null)return void(r.__key=e);Se(),eu();const t=ie(),n=ht(),s=""+tc++;n._nodeMap.set(s,r),B(r)?t._dirtyElements.set(s,!0):t._dirtyLeaves.add(s),t._cloneNotNeeded.add(s),t._dirtyType=xl,r.__key=s}function Lt(r){const e=r.getParent();if(e!==null){const t=r.getWritable(),n=e.getWritable(),s=r.getPreviousSibling(),o=r.getNextSibling();if(s===null)if(o!==null){const i=o.getWritable();n.__first=o.__key,i.__prev=null}else n.__first=null;else{const i=s.getWritable();if(o!==null){const l=o.getWritable();l.__prev=i.__key,i.__next=l.__key}else i.__next=null;t.__prev=null}if(o===null)if(s!==null){const i=s.getWritable();n.__last=s.__key,i.__next=null}else n.__last=null;else{const i=o.getWritable();if(s!==null){const l=s.getWritable();l.__next=i.__key,i.__prev=l.__key}else i.__prev=null;t.__next=null}n.__size--,t.__parent=null}}function Sn(r){eu();const e=r.getLatest(),t=e.__parent,n=ht(),s=ie(),o=n._nodeMap,i=s._dirtyElements;t!==null&&function(u,a,c){let d=u;for(;d!==null;){if(c.has(d))return;const f=a.get(d);if(f===void 0)break;c.set(d,!1),d=f.__parent}}(t,o,i);const l=e.__key;s._dirtyType=xl,B(r)?i.set(l,!0):s._dirtyLeaves.add(l)}function me(r){Se();const e=ie(),t=e._compositionKey;if(r!==t){if(e._compositionKey=r,t!==null){const n=ye(t);n!==null&&n.getWritable()}if(r!==null){const n=ye(r);n!==null&&n.getWritable()}}}function _t(){return Xr()?null:ie()._compositionKey}function ye(r,e){const t=(e||ht())._nodeMap.get(r);return t===void 0?null:t}function kl(r,e){const t=Vn(r,ie());return t!==void 0?ye(t,e):null}function Vn(r,e){return r[`__lexicalKey_${e._key}`]}function sr(r,e){let t=r;for(;t!=null;){const n=kl(t,e);if(n!==null)return n;t=Gr(t)}return null}function Sl(r){const e=r._decorators,t=Object.assign({},e);return r._pendingDecorators=t,t}function Gi(r){return r.read(()=>ne().getTextContent())}function ne(){return Tl(ht())}function Tl(r){return r._nodeMap.get("root")}function nt(r){Se();const e=ht();r!==null&&(r.dirty=!0,r.setCachedNodes(null)),e._selection=r}function Yt(r){const e=ie(),t=function(n,s){let o=n;for(;o!=null;){const i=Vn(o,s);if(i!==void 0)return i;o=Gr(o)}return null}(r,e);return t===null?r===e.getRootElement()?ye("root"):null:ye(t)}function Hi(r,e){return e?r.getTextContentSize():0}function Bl(r){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(r)}function ci(r){const e=[];let t=r;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Nl(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Fl(r){return r.nodeType===wt?r.nodeValue:null}function di(r,e,t){const n=$e(e._window);if(n===null)return;const s=n.anchorNode;let{anchorOffset:o,focusOffset:i}=n;if(s!==null){let l=Fl(s);const u=sr(s);if(l!==null&&R(u)){if(l===Wn&&t){const a=t.length;l=t,o=a,i=a}l!==null&&fi(u,l,o,i,r)}}}function fi(r,e,t,n,s){let o=r;if(o.isAttached()&&(s||!o.isDirty())){const i=o.isComposing();let l=e;(i||s)&&e[e.length-1]===Wn&&(l=e.slice(0,-1));const u=o.getTextContent();if(s||l!==u){if(l===""){if(me(null),Un||Wr||Zs)o.remove();else{const m=ie();setTimeout(()=>{m.update(()=>{o.isAttached()&&o.remove()})},20)}return}const a=o.getParent(),c=Yr(),d=o.getTextContentSize(),f=_t(),h=o.getKey();if(o.isToken()||f!==null&&h===f&&!i||P(c)&&(a!==null&&!a.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===r.__key&&c.anchor.offset===0&&!o.canInsertTextBefore()&&!i||c.focus.key===r.__key&&c.focus.offset===d&&!o.canInsertTextAfter()&&!i))return void o.markDirty();const p=q();if(!P(p)||t===null||n===null)return void o.setTextContent(l);if(p.setTextNodeRange(o,t,o,n),o.isSegmented()){const m=de(o.getTextContent());o.replace(m),o=m}o.setTextContent(l)}}}function ic(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(o){const i=o.getPreviousSibling();return(R(i)||B(i)&&i.isInline())&&!i.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||s)}function Ji(r){return r==="ArrowLeft"}function Qi(r){return r==="ArrowRight"}function wr(r,e){return We?r:e}function Yi(r){return r==="Enter"}function xr(r){return r==="Backspace"}function _r(r){return r==="Delete"}function Xi(r,e,t){return r.toLowerCase()==="a"&&wr(e,t)}function oc(){const r=ne();nt(wl(r.select(0,r.getChildrenSize())))}function Br(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 o=En(s);return t[e]=o,o}return s}function hi(r,e,t,n,s){if(t.size===0)return;const o=n.__type,i=n.__key,l=e.get(o);l===void 0&&M(33,o);const u=l.klass;let a=r.get(u);a===void 0&&(a=new Map,r.set(u,a));const c=a.get(i),d=c==="destroyed"&&s==="created";(c===void 0||d)&&a.set(i,d?"updated":s)}function Zi(r,e,t){const n=r.getParent();let s=t,o=r;return n!==null&&(e&&t===0?(s=o.getIndexWithinParent(),o=n):e||t!==o.getChildrenSize()||(s=o.getIndexWithinParent()+1,o=n)),o.getChildAtIndex(e?s-1:s)}function $r(r,e){const t=r.offset;if(r.type==="element")return Zi(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?Zi(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):s}}return null}function Ll(r){const e=Hn(r).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function I(r,e,t){return nu(r,e,t)}function Gn(r){return!De(r)&&!r.isLastChild()&&!r.isInline()}function Tn(r,e){const t=r._keyToDOMMap.get(e);return t===void 0&&M(75,e),t}function Gr(r){const e=r.assignedSlot||r.parentElement;return e!==null&&e.nodeType===11?e.host:e}function Nr(r,e){let t=r.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Hn(r){const e=r._window;return e===null&&M(78),e}function lc(r){let e=r.getParentOrThrow();for(;e!==null;){if(st(e))return e;e=e.getParentOrThrow()}return e}function st(r){return De(r)||B(r)&&r.isShadowRoot()}function ot(r){const e=ie(),t=r.constructor.getType(),n=e._nodes.get(t);n===void 0&&M(200,r.constructor.name,t);const{replace:s,replaceWithKlass:o}=n;if(s!==null){const i=s(r),l=i.constructor;return o!==null?i instanceof o||M(201,o.name,o.getType(),l.name,l.getType(),r.constructor.name,t):i instanceof r.constructor&&l!==r.constructor||M(202,l.name,l.getType(),r.constructor.name,t),i.__key===r.__key&&M(203,r.constructor.name,t,l.name,l.getType()),i}return r}function ps(r,e){!De(r.getParent())||B(e)||Z(e)||M(99)}function gs(r){return(Z(r)||B(r)&&!r.canBeEmpty())&&!r.isInline()}function pi(r,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const n=r.parentElement;n!==null&&n.removeChild(r)}function uc(r,e,t){let n=r._blockCursorElement;if(P(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const s=t.anchor,o=s.getNode(),i=s.offset;let l=!1,u=null;if(i===o.getChildrenSize())gs(o.getChildAtIndex(i-1))&&(l=!0);else{const a=o.getChildAtIndex(i);if(a!==null&&gs(a)){const c=a.getPreviousSibling();(c===null||gs(c))&&(l=!0,u=r.getElementByKey(a.__key))}}if(l){const a=r.getElementByKey(o.__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=En(h);h=d.blockCursor=p}h!==void 0&&f.classList.add(...h)}return f}(r._config)),e.style.caretColor="transparent",void(u===null?a.appendChild(n):a.insertBefore(n,u))}}n!==null&&pi(n,r,e)}function $e(r){return Qe?(r||window).getSelection():null}function ac(r){return ft(r)&&r.tagName==="A"}function ft(r){return r.nodeType===1}function eo(r){return r.nodeType===11}function Ts(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 Bn(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 yt(r){if(Z(r)&&!r.isInline())return!0;if(!B(r)||st(r))return!1;const e=r.getFirstChild(),t=e===null||jt(e)||R(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function br(r,e){let t=r;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function cc(){return ie()}const to=new WeakMap,dc=new Map;function fc(r){if(!r._readOnly&&r.isEmpty())return dc;r._readOnly||M(192);let e=to.get(r);if(!e){e=new Map,to.set(r,e);for(const[t,n]of r._nodeMap){const s=n.__type;let o=e.get(s);o||(o=new Map,e.set(s,o)),o.set(t,n)}}return e}function gi(r){const e=r.constructor.clone(r);return e.afterCloneFrom(r),e}function mi(r,e){const t=(parseInt(r.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function hc(r){return r.__lexicalUnmanaged===!0}function jl(r,e,t,n,s,o){let i=r.getFirstChild();for(;i!==null;){const l=i.__key;i.__parent===e&&(B(i)&&jl(i,l,t,n,s,o),t.has(l)||o.delete(l),s.push(l)),i=i.getNextSibling()}}let Ct,Ce,Ir,Jn,Bs,Ns,Mt,He,Fs,zr,fe="",ve="",Ze=null,Ke="",ct="",Pl=!1,qr=!1,yn=null;function Nn(r,e){const t=Mt.get(r);if(e!==null){const n=Ps(r);n.parentNode===e&&e.removeChild(n)}if(He.has(r)||Ce._keyToDOMMap.delete(r),B(t)){const n=Ln(t,Mt);Ls(n,0,n.length-1,null)}t!==void 0&&hi(zr,Ir,Jn,t,"destroyed")}function Ls(r,e,t,n){let s=e;for(;s<=t;++s){const o=r[s];o!==void 0&&Nn(o,n)}}function Tt(r,e){r.setProperty("text-align",e)}const pc="40px";function Ol(r,e){const t=Ct.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")||pc;r.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function Ml(r,e){const t=r.style;e===0?Tt(t,""):e===ti?Tt(t,"left"):e===ri?Tt(t,"center"):e===ni?Tt(t,"right"):e===si?Tt(t,"justify"):e===ii?Tt(t,"start"):e===oi&&Tt(t,"end")}function Fn(r,e){const t=He.get(r);t===void 0&&M(60);const n=t.createDOM(Ct,Ce);if(function(s,o,i){const l=i._keyToDOMMap;(function(u,a,c){u[`__lexicalKey_${a._key}`]=c})(o,i,s),l.set(s,o)}(r,n,Ce),R(t)?n.setAttribute("data-lexical-text","true"):Z(t)&&n.setAttribute("data-lexical-decorator","true"),B(t)){const s=t.__indent,o=t.__size;if(s!==0&&Ol(n,s),o!==0){const l=o-1;(function(u,a,c,d){const f=ve;ve="",js(u,c,0,a,c.getDOMSlot(d)),$l(c,d),ve=f})(Ln(t,He),l,t,n)}const i=t.__format;i!==0&&Ml(n,i),t.isInline()||Rl(null,t,n),Gn(t)&&(fe+=dt,ct+=dt)}else{const s=t.getTextContent();if(Z(t)){const o=t.decorate(Ce,Ct);o!==null&&Il(r,o),n.contentEditable="false"}else R(t)&&(t.isDirectionless()||(ve+=s));fe+=s,ct+=s}return e!==null&&e.insertChild(n),hi(zr,Ir,Jn,t,"created"),n}function js(r,e,t,n,s){const o=fe;fe="";let i=t;for(;i<=n;++i){Fn(r[i],s);const l=He.get(r[i]);l!==null&&R(l)&&(Ze===null&&(Ze=l.getFormat()),Ke===""&&(Ke=l.getStyle()))}Gn(e)&&(fe+=dt),s.element.__lexicalTextContent=fe,fe=o+fe}function ro(r,e){if(r){const t=r.__last;if(t){const n=e.get(t);if(n)return jt(n)?"line-break":Z(n)&&n.isInline()?"decorator":null}return"empty"}return null}function Rl(r,e,t){const n=ro(r,Mt),s=ro(e,He);n!==s&&e.getDOMSlot(t).setManagedLineBreak(s)}function $l(r,e){const t=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(t!==ve||n!==yn){const o=ve==="",i=o?yn:(s=ve,Ua.test(s)?"rtl":Wa.test(s)?"ltr":null);if(i!==n){const l=e.classList,u=Ct.theme;let a=n!==null?u[n]:void 0,c=i!==null?u[i]:void 0;if(a!==void 0){if(typeof a=="string"){const d=En(a);a=u[n]=d}l.remove(...a)}if(i===null||o&&i==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){const d=En(c);c=u[i]=d}c!==void 0&&l.add(...c)}e.dir=i}qr||(r.getWritable().__dir=i)}yn=i,e.__lexicalDirTextContent=ve,e.__lexicalDir=i}var s}function gc(r,e,t){const n=ve;var s;ve="",Ze=null,Ke="",function(o,i,l){const u=fe,a=o.__size,c=i.__size;fe="";const d=l.element;if(a===1&&c===1){const f=o.__first,h=i.__first;if(f===h)Er(f,d);else{const m=Ps(f),_=Fn(h,null);try{d.replaceChild(_,m)}catch(C){if(typeof C=="object"&&C!=null){const y=`${C.toString()} Parent: ${d.tagName}, new child: {tag: ${_.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${f}}.`;throw new Error(y)}throw C}Nn(f,null)}const p=He.get(h);R(p)&&(Ze===null&&(Ze=p.getFormat()),Ke===""&&(Ke=p.getStyle()))}else{const f=Ln(o,Mt),h=Ln(i,He);if(f.length!==a&&M(227),h.length!==c&&M(228),a===0)c!==0&&js(h,i,0,c-1,l);else if(c===0){if(a!==0){const p=l.after==null&&l.before==null&&l.element.__lexicalLineBreak==null;Ls(f,0,a-1,p?null:d),p&&(d.textContent="")}}else(function(p,m,_,C,y,E){const D=C-1,k=y-1;let v,b,w=E.getFirstChild(),S=0,$=0;for(;S<=D&&$<=k;){const j=m[S],L=_[$];if(j===L)w=ms(Er(L,E.element)),S++,$++;else{v===void 0&&(v=new Set(m)),b===void 0&&(b=new Set(_));const G=b.has(j),he=v.has(L);if(G)if(he){const oe=Tn(Ce,L);oe===w?w=ms(Er(L,E.element)):(E.withBefore(w).insertChild(oe),Er(L,E.element)),S++,$++}else Fn(L,E.withBefore(w)),$++;else w=ms(Ps(j)),Nn(j,E.element),S++}const O=He.get(L);O!==null&&R(O)&&(Ze===null&&(Ze=O.getFormat()),Ke===""&&(Ke=O.getStyle()))}const T=S>D,N=$>k;if(T&&!N){const j=_[k+1],L=j===void 0?null:Ce.getElementByKey(j);js(_,p,$,k,E.withBefore(L))}else N&&!T&&Ls(m,S,D,E.element)})(i,f,h,a,c,l)}Gn(i)&&(fe+=dt),d.__lexicalTextContent=fe,fe=u+fe}(r,e,e.getDOMSlot(t)),$l(e,t),ir(s=e)&&Ze!=null&&Ze!==s.__textFormat&&!qr&&(s.setTextFormat(Ze),s.setTextStyle(Ke)),function(o){ir(o)&&Ke!==""&&Ke!==o.__textStyle&&!qr&&o.setTextStyle(Ke)}(e),ve=n}function Ln(r,e){const t=[];let n=r.__first;for(;n!==null;){const s=e.get(n);s===void 0&&M(101),t.push(n),n=s.__next}return t}function Er(r,e){const t=Mt.get(r);let n=He.get(r);t!==void 0&&n!==void 0||M(61);const s=Pl||Ns.has(r)||Bs.has(r),o=Tn(Ce,r);if(t===n&&!s){if(B(t)){const i=o.__lexicalTextContent;i!==void 0&&(fe+=i,ct+=i);const l=o.__lexicalDirTextContent;l!==void 0&&(ve+=l)}else{const i=t.getTextContent();R(t)&&!t.isDirectionless()&&(ve+=i),ct+=i,fe+=i}return o}if(t!==n&&s&&hi(zr,Ir,Jn,n,"updated"),n.updateDOM(t,o,Ct)){const i=Fn(r,null);return e===null&&M(62),e.replaceChild(i,o),Nn(r,null),i}if(B(t)&&B(n)){const i=n.__indent;i!==t.__indent&&Ol(o,i);const l=n.__format;l!==t.__format&&Ml(o,l),s&&(gc(t,n,o),De(n)||n.isInline()||Rl(t,n,o)),Gn(n)&&(fe+=dt,ct+=dt)}else{const i=n.getTextContent();if(Z(n)){const l=n.decorate(Ce,Ct);l!==null&&Il(r,l)}else R(n)&&!n.isDirectionless()&&(ve+=i);fe+=i,ct+=i}if(!qr&&De(n)&&n.__cachedText!==ct){const i=n.getWritable();i.__cachedText=ct,n=i}return o}function Il(r,e){let t=Ce._pendingDecorators;const n=Ce._decorators;if(t===null){if(n[r]===e)return;t=Sl(Ce)}t[r]=e}function ms(r){let e=r.nextSibling;return e!==null&&e===Ce._blockCursorElement&&(e=e.nextSibling),e}function mc(r,e,t,n,s,o){fe="",ct="",ve="",Pl=n===nr,yn=null,Ce=t,Ct=t._config,Ir=t._nodes,Jn=Ce._listeners.mutation,Bs=s,Ns=o,Mt=r._nodeMap,He=e._nodeMap,qr=e._readOnly,Fs=new Map(t._keyToDOMMap);const i=new Map;return zr=i,Er("root",null),Ce=void 0,Ir=void 0,Bs=void 0,Ns=void 0,Mt=void 0,He=void 0,Ct=void 0,Fs=void 0,zr=void 0,i}function Ps(r){const e=Fs.get(r);return e===void 0&&M(75,r),e}const at=Object.freeze({}),Os=30,Ms=[["keydown",function(r,e){if(Fr=r.timeStamp,zl=r.key,e.isComposing())return;const{key:t,shiftKey:n,ctrlKey:s,metaKey:o,altKey:i}=r;if(!I(e,va,r)&&t!=null){if(function(l,u,a,c){return Qi(l)&&!u&&!c&&!a}(t,s,i,o))I(e,ll,r);else if(function(l,u,a,c,d){return Qi(l)&&!c&&!a&&(u||d)}(t,s,n,i,o))I(e,Da,r);else if(function(l,u,a,c){return Ji(l)&&!u&&!c&&!a}(t,s,i,o))I(e,ul,r);else if(function(l,u,a,c,d){return Ji(l)&&!c&&!a&&(u||d)}(t,s,n,i,o))I(e,Ca,r);else if(function(l,u,a){return function(c){return c==="ArrowUp"}(l)&&!u&&!a}(t,s,o))I(e,al,r);else if(function(l,u,a){return function(c){return c==="ArrowDown"}(l)&&!u&&!a}(t,s,o))I(e,cl,r);else if(function(l,u){return Yi(l)&&u}(t,n))Lr=!0,I(e,vn,r);else if(function(l){return l===" "}(t))I(e,wa,r);else if(function(l,u){return We&&u&&l.toLowerCase()==="o"}(t,s))r.preventDefault(),Lr=!0,I(e,Zt,!0);else if(function(l,u){return Yi(l)&&!u}(t,n))Lr=!1,I(e,vn,r);else if(function(l,u,a,c){return We?!u&&!a&&(xr(l)||l.toLowerCase()==="h"&&c):!(c||u||a)&&xr(l)}(t,i,o,s))xr(t)?I(e,dl,r):(r.preventDefault(),I(e,Ft,!0));else if(function(l){return l==="Escape"}(t))I(e,fl,r);else if(function(l,u,a,c,d){return We?!(a||c||d)&&(_r(l)||l.toLowerCase()==="d"&&u):!(u||c||d)&&_r(l)}(t,s,n,i,o))_r(t)?I(e,hl,r):(r.preventDefault(),I(e,Ft,!1));else if(function(l,u,a){return xr(l)&&(We?u:a)}(t,i,s))r.preventDefault(),I(e,Mr,!0);else if(function(l,u,a){return _r(l)&&(We?u:a)}(t,i,s))r.preventDefault(),I(e,Mr,!1);else if(function(l,u){return We&&u&&xr(l)}(t,o))r.preventDefault(),I(e,Rr,!0);else if(function(l,u){return We&&u&&_r(l)}(t,o))r.preventDefault(),I(e,Rr,!1);else if(function(l,u,a,c){return l.toLowerCase()==="b"&&!u&&wr(a,c)}(t,i,o,s))r.preventDefault(),I(e,Ge,"bold");else if(function(l,u,a,c){return l.toLowerCase()==="u"&&!u&&wr(a,c)}(t,i,o,s))r.preventDefault(),I(e,Ge,"underline");else if(function(l,u,a,c){return l.toLowerCase()==="i"&&!u&&wr(a,c)}(t,i,o,s))r.preventDefault(),I(e,Ge,"italic");else if(function(l,u,a,c){return l==="Tab"&&!u&&!a&&!c}(t,i,s,o))I(e,Ea,r);else if(function(l,u,a,c){return l.toLowerCase()==="z"&&!u&&wr(a,c)}(t,n,o,s))r.preventDefault(),I(e,Qs,void 0);else if(function(l,u,a,c){return We?l.toLowerCase()==="z"&&a&&u:l.toLowerCase()==="y"&&c||l.toLowerCase()==="z"&&c&&u}(t,n,o,s))r.preventDefault(),I(e,Ys,void 0);else{const l=e._editorState._selection;l===null||P(l)?!Dt&&Xi(t,o,s)&&(r.preventDefault(),I(e,ks,r)):function(u,a,c,d){return!a&&u.toLowerCase()==="c"&&(We?c:d)}(t,n,o,s)?(r.preventDefault(),I(e,qn,r)):function(u,a,c,d){return!a&&u.toLowerCase()==="x"&&(We?c:d)}(t,n,o,s)?(r.preventDefault(),I(e,Xs,r)):Xi(t,o,s)&&(r.preventDefault(),I(e,ks,r))}(function(l,u,a,c){return l||u||a||c})(s,n,i,o)&&I(e,ja,r)}}],["pointerdown",function(r,e){const t=r.target,n=r.pointerType;t instanceof Node&&n!=="touch"&&Fe(e,()=>{Z(sr(t))||($s=!0)})}],["compositionstart",function(r,e){Fe(e,()=>{const t=q();if(P(t)&&!e.isComposing()){const n=t.anchor,s=t.anchor.getNode();me(n.key),(r.timeStamp<Fr+Os||n.type==="element"||!t.isCollapsed()||s.getFormat()!==t.format||R(s)&&s.getStyle()!==t.style)&&I(e,er,qa)}})}],["compositionend",function(r,e){Dt?vr=!0:Fe(e,()=>{ys(e,r.data)})}],["input",function(r,e){r.stopPropagation(),Fe(e,()=>{const t=q(),n=r.data,s=Kl(r);if(n!=null&&P(t)&&Wl(t,s,n,r.timeStamp,!1)){vr&&(ys(e,n),vr=!1);const o=t.anchor.getNode(),i=$e(e._window);if(i===null)return;const l=t.isBackward(),u=l?t.anchor.offset:t.focus.offset,a=l?t.focus.offset:t.anchor.offset;Dn&&!t.isCollapsed()&&R(o)&&i.anchorNode!==null&&o.getTextContent().slice(0,u)+n+o.getTextContent().slice(u+a)===Fl(i.anchorNode)||I(e,er,n);const c=n.length;Dt&&c>1&&r.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=c),Un||Wr||Zs||!e.isComposing()||(Fr=0,me(null))}else di(!1,e,n!==null?n:void 0),vr&&(ys(e,n||void 0),vr=!1);Se(),Dl(ie())}),Qt=null}],["click",function(r,e){Fe(e,()=>{const t=q(),n=$e(e._window),s=Yr();if(n){if(P(t)){const o=t.anchor,i=o.getNode();o.type==="element"&&o.offset===0&&t.isCollapsed()&&!De(i)&&ne().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&s!==null&&t.is(s)?(n.removeAllRanges(),t.dirty=!0):r.detail===3&&!t.isCollapsed()&&i!==t.focus.getNode()&&(B(i)?i.select(0):i.getParentOrThrow().select(0))}else if(r.pointerType==="touch"){const o=n.anchorNode;if(o!==null){const i=o.nodeType;(i===Kr||i===wt)&&nt(xi(s,n,e,r))}}}I(e,ol,r)})}],["cut",at],["copy",at],["dragstart",at],["dragover",at],["dragend",at],["paste",at],["focus",at],["blur",at],["drop",at]];Dn&&Ms.push(["beforeinput",(r,e)=>function(t,n){const s=t.inputType,o=Kl(t);s==="deleteCompositionText"||Dt&&Ll(n)||s!=="insertCompositionText"&&Fe(n,()=>{const i=q();if(s==="deleteContentBackward"){if(i===null){const h=Yr();if(!P(h))return;nt(h.clone())}if(P(i)){const h=i.anchor.key===i.focus.key;if(l=t.timeStamp,zl==="MediaLast"&&l<Fr+Os&&n.isComposing()&&h){if(me(null),Fr=0,setTimeout(()=>{Fe(n,()=>{me(null)})},Os),P(i)){const p=i.anchor.getNode();p.markDirty(),i.format=p.getFormat(),R(p)||M(142),i.style=p.getStyle()}}else{me(null),t.preventDefault();const p=i.anchor.getNode(),m=p.getTextContent(),_=p.canInsertTextAfter(),C=i.anchor.offset===0&&i.focus.offset===m.length;Ma&&h&&!C&&_||I(n,Ft,!0)}return}}var l;if(!P(i))return;const u=t.data;Qt!==null&&di(!1,n,Qt),i.dirty&&Qt===null||!i.isCollapsed()||De(i.anchor.getNode())||o===null||i.applyDOMRange(o),Qt=null;const a=i.anchor,c=i.focus,d=a.getNode(),f=c.getNode();if(s!=="insertText"&&s!=="insertTranspose")switch(t.preventDefault(),s){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":I(n,er,t);break;case"insertFromComposition":me(null),I(n,er,t);break;case"insertLineBreak":me(null),I(n,Zt,!1);break;case"insertParagraph":me(null),Lr&&!Wr?(Lr=!1,I(n,Zt,!1)):I(n,Or,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":I(n,zn,t);break;case"deleteByComposition":(function(h,p){return h!==p||B(h)||B(p)||!h.isToken()||!p.isToken()})(d,f)&&I(n,As,t);break;case"deleteByDrag":case"deleteByCut":I(n,As,t);break;case"deleteContent":I(n,Ft,!1);break;case"deleteWordBackward":I(n,Mr,!0);break;case"deleteWordForward":I(n,Mr,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":I(n,Rr,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":I(n,Rr,!1);break;case"formatStrikeThrough":I(n,Ge,"strikethrough");break;case"formatBold":I(n,Ge,"bold");break;case"formatItalic":I(n,Ge,"italic");break;case"formatUnderline":I(n,Ge,"underline");break;case"historyUndo":I(n,Qs,void 0);break;case"historyRedo":I(n,Ys,void 0)}else{if(u===`
64
+ `)t.preventDefault(),I(n,Zt,!1);else if(u===dt)t.preventDefault(),I(n,Or,void 0);else if(u==null&&t.dataTransfer){const h=t.dataTransfer.getData("text/plain");t.preventDefault(),i.insertRawText(h)}else u!=null&&Wl(i,o,u,t.timeStamp,!0)?(t.preventDefault(),I(n,er,u)):Qt=u;ql=t.timeStamp}})}(r,e)]);let Fr=0,zl=null,ql=0,Qt=null;const jn=new WeakMap;let Rs=!1,$s=!1,Lr=!1,vr=!1,Ul=[0,"",0,"root",0];function Wl(r,e,t,n,s){const o=r.anchor,i=r.focus,l=o.getNode(),u=ie(),a=$e(u._window),c=a!==null?a.anchorNode:null,d=o.key,f=u.getElementByKey(d),h=t.length;return d!==i.key||!R(l)||(!s&&(!Dn||ql<n+50)||l.isDirty()&&h<2||Bl(t))&&o.offset!==i.offset&&!l.isComposing()||Bt(l)||l.isDirty()&&h>1||(s||!Dn)&&f!==null&&!l.isComposing()&&c!==An(f)||a!==null&&e!==null&&(!e.collapsed||e.startContainer!==a.anchorNode||e.startOffset!==a.anchorOffset)||l.getFormat()!==r.format||l.getStyle()!==r.style||ic(r,l)}function no(r,e){return r!==null&&r.nodeValue!==null&&r.nodeType===wt&&e!==0&&e!==r.nodeValue.length}function so(r,e,t){const{anchorNode:n,anchorOffset:s,focusNode:o,focusOffset:i}=r;Rs&&(Rs=!1,no(n,s)&&no(o,i))||Fe(e,()=>{if(!t)return void nt(null);if(!Vr(e,n,o))return;const l=q();if(P(l)){const u=l.anchor,a=u.getNode();if(l.isCollapsed()){r.type==="Range"&&r.anchorNode===r.focusNode&&(l.dirty=!0);const c=Hn(e).event,d=c?c.timeStamp:performance.now(),[f,h,p,m,_]=Ul,C=ne(),y=e.isComposing()===!1&&C.getTextContent()==="";if(d<_+200&&u.offset===p&&u.key===m)l.format=f,l.style=h;else if(u.type==="text")R(a)||M(141),l.format=a.getFormat(),l.style=a.getStyle();else if(u.type==="element"&&!y){const E=u.getNode();l.style="",E instanceof lr&&E.getChildrenSize()===0?(l.format=E.getTextFormat(),l.style=E.getTextStyle()):l.format=0}}else{const c=u.key,d=l.focus.key,f=l.getNodes(),h=f.length,p=l.isBackward(),m=p?i:s,_=p?s:i,C=p?d:c,y=p?c:d;let E=za,D=!1;for(let k=0;k<h;k++){const v=f[k],b=v.getTextContentSize();if(R(v)&&b!==0&&!(k===0&&v.__key===C&&m===b||k===h-1&&v.__key===y&&_===0)&&(D=!0,E&=v.getFormat(),E===0))break}l.format=D?E:0}}I(e,Js,void 0)})}function Kl(r){if(!r.getTargetRanges)return null;const e=r.getTargetRanges();return e.length===0?null:e[0]}function ys(r,e){const t=r._compositionKey;if(me(null),t!==null&&e!=null){if(e===""){const n=ye(t),s=An(r.getElementByKey(t));return void(s!==null&&s.nodeValue!==null&&R(n)&&fi(n,s.nodeValue,null,null,!0))}if(e[e.length-1]===`
65
+ `){const n=q();if(P(n)){const s=n.focus;return n.anchor.set(s.key,s.offset,s.type),void I(r,vn,null)}}}di(!0,r,e)}function Vl(r){let e=r.__lexicalEventHandles;return e===void 0&&(e=[],r.__lexicalEventHandles=e),e}const tr=new Map;function Gl(r){const e=r.target,t=$e(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const n=El(t.anchorNode);if(n===null)return;$s&&($s=!1,Fe(n,()=>{const a=Yr(),c=t.anchorNode;if(c===null)return;const d=c.nodeType;d!==Kr&&d!==wt||nt(xi(a,t,n,r))}));const s=ci(n),o=s[s.length-1],i=o._key,l=tr.get(i),u=l||o;u!==n&&so(t,u,!1),so(t,n,!0),n!==o?tr.set(i,n):l&&tr.delete(i)}function io(r){r._lexicalHandled=!0}function oo(r){return r._lexicalHandled===!0}function yc(r){const e=r.ownerDocument,t=jn.get(e);t===void 0&&M(162);const n=t-1;n>=0||M(164),jn.set(e,n),n===0&&e.removeEventListener("selectionchange",Gl);const s=Kn(r);ai(s)?(function(i){if(i._parentEditor!==null){const l=ci(i),u=l[l.length-1]._key;tr.get(u)===i&&tr.delete(u)}else tr.delete(i._key)}(s),r.__lexicalEditor=null):s&&M(198);const o=Vl(r);for(let i=0;i<o.length;i++)o[i]();r.__lexicalEventHandles=[]}function Is(r,e,t){Se();const n=r.__key,s=r.getParent();if(s===null)return;const o=function(l){const u=q();if(!P(u)||!B(l))return u;const{anchor:a,focus:c}=u,d=a.getNode(),f=c.getNode();return Nr(d,l)&&a.set(l.__key,0,"element"),Nr(f,l)&&c.set(l.__key,0,"element"),u}(r);let i=!1;if(P(o)&&e){const l=o.anchor,u=o.focus;l.key===n&&(On(l,r,s,r.getPreviousSibling(),r.getNextSibling()),i=!0),u.key===n&&(On(u,r,s,r.getPreviousSibling(),r.getNextSibling()),i=!0)}else et(o)&&e&&r.isSelected()&&r.selectPrevious();if(P(o)&&e&&!i){const l=r.getIndexWithinParent();Lt(r),Pn(o,s,l,-1)}else Lt(r);t||st(s)||s.canBeEmpty()||!s.isEmpty()||Is(s,e),e&&De(s)&&s.isEmpty()&&s.selectEnd()}class Qn{static getType(){M(64,this.name)}static clone(e){M(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,sc(this,e)}getType(){return this.__type}isInline(){M(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=ye(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||q();if(t==null)return!1;const n=t.getNodes().some(s=>s.__key===this.__key);if(R(this))return n;if(P(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const s=this.getParent();if(Z(this)&&this.isInline()&&s){const o=t.isBackward()?t.focus:t.anchor,i=o.getNode();if(o.offset===i.getChildrenSize()&&i.is(s)&&i.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:ye(e)}getParentOrThrow(){const e=this.getParent();return e===null&&M(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(st(t))return B(e)||e===this&&Z(e)||M(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&M(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:ye(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:ye(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();B(this)&&t.unshift(this),B(e)&&n.unshift(e);const s=t.length,o=n.length;if(s===0||o===0||t[s-1]!==n[o-1])return null;const i=new Set(n);for(let l=0;l<s;l++){const u=t[l];if(i.has(u))return u}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,o=this;for(;;){const i=o.getParentOrThrow();if(i===t){n=o.getIndexWithinParent();break}o=i}for(o=e;;){const i=o.getParentOrThrow();if(i===t){s=o.getIndexWithinParent();break}o=i}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 o=this;for(;o!==null;){const i=o.__key;if(s.has(i)||(s.add(i),n.push(o)),o===e)break;const l=B(o)?t?o.getFirstChild():o.getLastChild():null;if(l!==null){o=l;continue}const u=t?o.getNextSibling():o.getPreviousSibling();if(u!==null){o=u;continue}const a=o.getParentOrThrow();if(s.has(a.__key)||n.push(a),a===e)break;let c=null,d=a;do{if(d===null&&M(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);o=c}return t||n.reverse(),n}isDirty(){const e=ie()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=ye(this.__key);return e===null&&M(113),e}getWritable(){Se();const e=ht(),t=ie(),n=e._nodeMap,s=this.__key,o=this.getLatest(),i=t._cloneNotNeeded,l=q();if(l!==null&&l.setCachedNodes(null),i.has(s))return Sn(o),o;const u=gi(o);return i.add(s),Sn(u),n.set(s,u),u}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){M(70)}updateDOM(e,t,n){M(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){M(72)}static importJSON(e){M(18,this.name)}static transform(){return null}remove(e){Is(this,!0,e)}replace(e,t){Se();let n=q();n!==null&&(n=n.clone()),ps(this,e);const s=this.getLatest(),o=this.__key,i=e.__key,l=e.getWritable(),u=this.getParentOrThrow().getWritable(),a=u.__size;Lt(l);const c=s.getPreviousSibling(),d=s.getNextSibling(),f=s.__prev,h=s.__next,p=s.__parent;if(Is(s,!1,!0),c===null?u.__first=i:c.getWritable().__next=i,l.__prev=f,d===null?u.__last=i:d.getWritable().__prev=i,l.__next=h,l.__parent=p,u.__size=a,t&&(B(this)&&B(l)||M(139),this.getChildren().forEach(m=>{l.append(m)})),P(n)){nt(n);const m=n.anchor,_=n.focus;m.key===o&&co(m,l),_.key===o&&co(_,l)}return _t()===o&&me(i),l}insertAfter(e,t=!0){Se(),ps(this,e);const n=this.getWritable(),s=e.getWritable(),o=s.getParent(),i=q();let l=!1,u=!1;if(o!==null){const h=e.getIndexWithinParent();if(Lt(s),P(i)){const p=o.__key,m=i.anchor,_=i.focus;l=m.type==="element"&&m.key===p&&m.offset===h+1,u=_.type==="element"&&_.key===p&&_.offset===h+1}}const a=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),d=s.__key,f=n.__next;if(a===null?c.__last=d:a.getWritable().__prev=d,c.__size++,n.__next=d,s.__next=f,s.__prev=n.__key,s.__parent=n.__parent,t&&P(i)){const h=this.getIndexWithinParent();Pn(i,c,h+1);const p=c.__key;l&&i.anchor.set(p,h+2,"element"),u&&i.focus.set(p,h+2,"element")}return e}insertBefore(e,t=!0){Se(),ps(this,e);const n=this.getWritable(),s=e.getWritable(),o=s.__key;Lt(s);const i=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),u=n.__prev,a=this.getIndexWithinParent();i===null?l.__first=o:i.getWritable().__next=o,l.__size++,n.__prev=o,s.__prev=u,s.__next=n.__key,s.__parent=n.__parent;const c=q();return t&&P(c)&&Pn(c,this.getParentOrThrow(),a),e}isParentRequired(){return!1}createParentElementNode(){return ce()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Se();const n=this.getPreviousSibling(),s=this.getParentOrThrow();if(n===null)return s.select(0,0);if(B(n))return n.select();if(!R(n)){const o=n.getIndexWithinParent()+1;return s.select(o,o)}return n.select(e,t)}selectNext(e,t){Se();const n=this.getNextSibling(),s=this.getParentOrThrow();if(n===null)return s.select();if(B(n))return n.select(0,0);if(!R(n)){const o=n.getIndexWithinParent();return s.select(o,o)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class Hr extends Qn{static getType(){return"linebreak"}static clone(e){return new Hr(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&&Bn(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&cn(s)){const o=n.lastChild;if(o===t||o.previousSibling===t&&cn(o))return!0}}return!1}(e)||function(t){const n=t.parentElement;if(n!==null&&Bn(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&cn(s))return!1;const o=n.lastChild;if(o===t||o.previousSibling===t&&cn(o))return!0}return!1}(e)?null:{conversion:xc,priority:0}}}static importJSON(e){return Rt()}exportJSON(){return{type:"linebreak",version:1}}}function xc(r){return{node:Rt()}}function Rt(){return ot(new Hr)}function jt(r){return r instanceof Hr}function cn(r){return r.nodeType===wt&&/^( |\t|\r?\n)+$/.test(r.textContent||"")}function xs(r,e){return 16&e?"code":e&ei?"mark":32&e?"sub":64&e?"sup":null}function _s(r,e){return 1&e?"strong":2&e?"em":"span"}function Hl(r,e,t,n,s){const o=n.classList;let i=Br(s,"base");i!==void 0&&o.add(...i),i=Br(s,"underlineStrikethrough");let l=!1;const u=e&wn&&e&Cn;i!==void 0&&(t&wn&&t&Cn?(l=!0,u||o.add(...i)):u&&o.remove(...i));for(const a in Ot){const c=Ot[a];if(i=Br(s,a),i!==void 0)if(t&c){if(l&&(a==="underline"||a==="strikethrough")){e&c&&o.remove(...i);continue}e&c&&(!u||a!=="underline")&&a!=="strikethrough"||o.add(...i)}else e&c&&o.remove(...i)}}function Jl(r,e,t){const n=e.firstChild,s=t.isComposing(),o=r+(s?Wn:"");if(n==null)e.textContent=o;else{const i=n.nodeValue;if(i!==o)if(s||Dt){const[l,u,a]=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)]}(i,o);u!==0&&n.deleteData(l,u),n.insertData(l,a)}else n.nodeValue=o}}function lo(r,e,t,n,s,o){Jl(s,r,e);const i=o.theme.text;i!==void 0&&Hl(0,0,n,r,i)}function dn(r,e){const t=document.createElement(e);return t.appendChild(r),t}class or extends Qn{static getType(){return"text"}static clone(e){return new or(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 Ha[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===_t()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=Ot[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return kn(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const n=this.__format,s=xs(0,n),o=_s(0,n),i=s===null?o:s,l=document.createElement(i);let u=l;this.hasFormat("code")&&l.setAttribute("spellcheck","false"),s!==null&&(u=document.createElement(o),l.appendChild(u)),lo(u,this,0,n,this.__text,e);const a=this.__style;return a!==""&&(l.style.cssText=a),l}updateDOM(e,t,n){const s=this.__text,o=e.__format,i=this.__format,l=xs(0,o),u=xs(0,i),a=_s(0,o),c=_s(0,i);if((l===null?a:l)!==(u===null?c:u))return!0;if(l===u&&a!==c){const m=t.firstChild;m==null&&M(48);const _=document.createElement(c);return lo(_,this,0,i,s,n),t.replaceChild(_,m),!1}let d=t;u!==null&&l!==null&&(d=t.firstChild,d==null&&M(49)),Jl(s,d,this);const f=n.theme.text;f!==void 0&&o!==i&&Hl(0,o,i,d,f);const h=e.__style,p=this.__style;return h!==p&&(t.style.cssText=p),!1}static importDOM(){return{"#text":()=>({conversion:Dc,priority:0}),b:()=>({conversion:bc,priority:0}),code:()=>({conversion:mt,priority:0}),em:()=>({conversion:mt,priority:0}),i:()=>({conversion:mt,priority:0}),s:()=>({conversion:mt,priority:0}),span:()=>({conversion:_c,priority:0}),strong:()=>({conversion:mt,priority:0}),sub:()=>({conversion:mt,priority:0}),sup:()=>({conversion:mt,priority:0}),u:()=>({conversion:mt,priority:0})}}static importJSON(e){const t=de(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&&ft(t)||M(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=dn(t,"b")),this.hasFormat("italic")&&(t=dn(t,"i")),this.hasFormat("strikethrough")&&(t=dn(t,"s")),this.hasFormat("underline")&&(t=dn(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"?Ot[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?Ka[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=kn(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=Ga[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){Se();let n=e,s=t;const o=q(),i=this.getTextContent(),l=this.__key;if(typeof i=="string"){const u=i.length;n===void 0&&(n=u),s===void 0&&(s=u)}else n=0,s=0;if(!P(o))return Xl(l,n,l,s,"text","text");{const u=_t();u!==o.anchor.key&&u!==o.focus.key||me(l),o.setTextNodeRange(this,n,this,s)}return o}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,s){const o=this.getWritable(),i=o.__text,l=n.length;let u=e;u<0&&(u=l+u,u<0&&(u=0));const a=q();if(s&&P(a)){const d=e+l;a.setTextNodeRange(o,d,o,d)}const c=i.slice(0,u)+n+i.slice(u+t);return o.__text=c,o}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Se();const t=this.getLatest(),n=t.getTextContent(),s=t.__key,o=_t(),i=new Set(e),l=[],u=n.length;let a="";for(let k=0;k<u;k++)a!==""&&i.has(k)&&(l.push(a),a=""),a+=n[k];a!==""&&l.push(a);const c=l.length;if(c===0)return[];if(l[0]===n)return[t];const d=l[0],f=t.getParent();let h;const p=t.getFormat(),m=t.getStyle(),_=t.__detail;let C=!1;t.isSegmented()?(h=de(d),h.__format=p,h.__style=m,h.__detail=_,C=!0):(h=t.getWritable(),h.__text=d);const y=q(),E=[h];let D=d.length;for(let k=1;k<c;k++){const v=l[k],b=v.length,w=de(v).getWritable();w.__format=p,w.__style=m,w.__detail=_;const S=w.__key,$=D+b;if(P(y)){const T=y.anchor,N=y.focus;T.key===s&&T.type==="text"&&T.offset>D&&T.offset<=$&&(T.key=S,T.offset-=D,y.dirty=!0),N.key===s&&N.type==="text"&&N.offset>D&&N.offset<=$&&(N.key=S,N.offset-=D,y.dirty=!0)}o===s&&me(S),D=$,E.push(w)}if(f!==null){(function(b){const w=b.getPreviousSibling(),S=b.getNextSibling();w!==null&&Sn(w),S!==null&&Sn(S)})(this);const k=f.getWritable(),v=this.getIndexWithinParent();C?(k.splice(v,0,E),this.remove()):k.splice(v,1,E),P(y)&&Pn(y,f,v,c-1)}return E}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||M(50);const n=this.__key,s=e.__key,o=this.__text,i=o.length;_t()===s&&me(n);const l=q();if(P(l)){const d=l.anchor,f=l.focus;d!==null&&d.key===s&&(xo(d,t,n,e,i),l.dirty=!0),f!==null&&f.key===s&&(xo(f,t,n,e,i),l.dirty=!0)}const u=e.__text,a=t?u+o:o+u;this.setTextContent(a);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function _c(r){return{forChild:yi(r.style),node:null}}function bc(r){const e=r,t=e.style.fontWeight==="normal";return{forChild:yi(e.style,t?void 0:"bold"),node:null}}const uo=new WeakMap;function vc(r){return r.nodeName==="PRE"||r.nodeType===Kr&&r.style!==void 0&&r.style.whiteSpace!==void 0&&r.style.whiteSpace.startsWith("pre")}function Dc(r){const e=r;r.parentElement===null&&M(129);let t=e.textContent||"";if(function(n){let s,o=n.parentNode;const i=[n];for(;o!==null&&(s=uo.get(o))===void 0&&!vc(o);)i.push(o),o=o.parentNode;const l=s===void 0?o:s;for(let u=0;u<i.length;u++)uo.set(i[u],l);return l}(e)!==null){const n=t.split(/(\r?\n|\t)/),s=[],o=n.length;for(let i=0;i<o;i++){const l=n[i];l===`
67
67
  `||l===`\r
68
- `?s.push(Rt()):l===" "?s.push(Hr()):l!==""&&s.push(he(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=ao(n,!1))!==null;){const o=n.textContent||"";if(o.length>0){/[ \t\n]$/.test(o)&&(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=ao(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:he(t)}}function ao(r,e){let t=r;for(;;){let n;for(;(n=e?t.nextSibling:t.previousSibling)===null;){const o=t.parentElement;if(o===null)return null;t=o}if(t=n,t.nodeType===Ur){const o=t.style.display;if(o===""&&!Ts(t)||o!==""&&!o.startsWith("inline"))return null}let s=t;for(;(s=e?t.firstChild:t.lastChild)!==null;)t=s;if(t.nodeType===Ct)return t;if(t.nodeName==="BR")return null}}const Cc={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function gt(r){const e=Cc[r.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:yi(r.style,e),node:null}}function he(r=""){return ot(new ir(r))}function M(r){return r instanceof ir}function yi(r,e){const t=r.fontWeight,n=r.textDecoration.split(" "),s=t==="700"||t==="bold",o=n.includes("line-through"),i=r.fontStyle==="italic",l=n.includes("underline"),u=r.verticalAlign;return a=>(M(a)&&(s&&!a.hasFormat("bold")&&a.toggleFormat("bold"),o&&!a.hasFormat("strikethrough")&&a.toggleFormat("strikethrough"),i&&!a.hasFormat("italic")&&a.toggleFormat("italic"),l&&!a.hasFormat("underline")&&a.toggleFormat("underline"),u!=="sub"||a.hasFormat("subscript")||a.toggleFormat("subscript"),u!=="super"||a.hasFormat("superscript")||a.toggleFormat("superscript"),e&&!a.hasFormat(e)&&a.toggleFormat(e)),a)}class Gr extends ir{static getType(){return"tab"}static clone(e){return new Gr(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=Hr();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){O(126)}setDetail(e){O(127)}setMode(e){O(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Hr(){return ot(new Gr)}function wc(r){return r instanceof Gr}class Ec{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,o=e.offset;if(B(t)){const i=t.getDescendantByIndex(s);t=i??t}if(B(n)){const i=n.getDescendantByIndex(o);n=i??n}return t===n?s<o:t.isBefore(n)}getNode(){const e=xe(this.key);return e===null&&O(20),e}set(e,t,n){const s=this._selection,o=this.key;this.key=e,this.offset=t,this.type=n,Qr()||(xt()===o&&me(e),s!==null&&(s.setCachedNodes(null),s.dirty=!0))}}function st(r,e,t){return new Ec(r,e,t)}function bs(r,e){let t=e.__key,n=r.offset,s="element";if(M(e)){s="text";const o=e.getTextContentSize();n>o&&(n=o)}else if(!B(e)){const o=e.getNextSibling();if(M(o))t=o.__key,n=0,s="text";else{const i=e.getParent();i&&(t=i.__key,n=e.getIndexWithinParent()+1)}}r.set(t,n,s)}function co(r,e){if(B(e)){const t=e.getLastDescendant();B(t)||M(t)?bs(r,t):bs(r,e)}else bs(r,e)}function yt(r,e,t,n){r.key=e,r.offset=t,r.type=n}class Qn{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Ze(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 Qn(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 o;if(M(s))o=s.select();else{const i=s.getIndexWithinParent()+1;o=s.getParentOrThrow().select(i,i)}o.insertNodes(e);for(let i=0;i<n;i++)t[i].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,n=[];for(const s of t){const o=xe(s);o!==null&&n.push(o)}return Qr()||(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 P(r){return r instanceof wt}class wt{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!!P(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),o=s?t:n,i=s?n:t;let l=o.getNode(),u=i.getNode();const a=o.offset,c=i.offset;if(B(l)){const d=l.getDescendantByIndex(a);l=d??l}if(B(u)){let d=u.getDescendantByIndex(c);d!==null&&d!==l&&u.getChildAtIndex(c)===d&&(d=d.getPreviousSibling()),u=d??u}let f;return f=l.is(u)?B(l)&&l.getChildrenSize()>0?[]:[l]:l.getNodesBetween(u),Qr()||(this._cachedNodes=f),f}setTextNodeRange(e,t,n,s){yt(this.anchor,e.__key,t,"text"),yt(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,o=this.focus,i=s.isBefore(o),[l,u]=zs(this);let a="",c=!0;for(let f=0;f<e.length;f++){const d=e[f];if(B(d)&&!d.isInline())c||(a+=`
69
- `),c=!d.isEmpty();else if(c=!1,M(d)){let h=d.getTextContent();d===t?d===n?s.type==="element"&&o.type==="element"&&o.offset!==s.offset||(h=l<u?h.slice(l,u):h.slice(u,l)):h=i?h.slice(l):h.slice(u):d===n&&(h=i?h.slice(0,u):h.slice(0,l)),a+=h}else!Z(d)&&!jt(d)||d===n&&this.isCollapsed()||(a+=d.getTextContent())}return a}applyDOMRange(e){const t=ne(),n=t.getEditorState()._selection,s=Yl(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(s===null)return;const[o,i]=s;yt(this.anchor,o.key,o.offset,o.type),yt(this.focus,i.key,i.offset,i.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new wt(st(e.key,e.offset,e.type),st(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=An(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=Ot[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],s=t.length;for(let o=0;o<s;o++){const i=t[o];i===`
68
+ `?s.push(Rt()):l===" "?s.push(Qr()):l!==""&&s.push(de(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=ao(n,!1))!==null;){const o=n.textContent||"";if(o.length>0){/[ \t\n]$/.test(o)&&(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=ao(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:de(t)}}function ao(r,e){let t=r;for(;;){let n;for(;(n=e?t.nextSibling:t.previousSibling)===null;){const o=t.parentElement;if(o===null)return null;t=o}if(t=n,t.nodeType===Kr){const o=t.style.display;if(o===""&&!Ts(t)||o!==""&&!o.startsWith("inline"))return null}let s=t;for(;(s=e?t.firstChild:t.lastChild)!==null;)t=s;if(t.nodeType===wt)return t;if(t.nodeName==="BR")return null}}const Cc={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function mt(r){const e=Cc[r.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:yi(r.style,e),node:null}}function de(r=""){return ot(new or(r))}function R(r){return r instanceof or}function yi(r,e){const t=r.fontWeight,n=r.textDecoration.split(" "),s=t==="700"||t==="bold",o=n.includes("line-through"),i=r.fontStyle==="italic",l=n.includes("underline"),u=r.verticalAlign;return a=>(R(a)&&(s&&!a.hasFormat("bold")&&a.toggleFormat("bold"),o&&!a.hasFormat("strikethrough")&&a.toggleFormat("strikethrough"),i&&!a.hasFormat("italic")&&a.toggleFormat("italic"),l&&!a.hasFormat("underline")&&a.toggleFormat("underline"),u!=="sub"||a.hasFormat("subscript")||a.toggleFormat("subscript"),u!=="super"||a.hasFormat("superscript")||a.toggleFormat("superscript"),e&&!a.hasFormat(e)&&a.toggleFormat(e)),a)}class Jr extends or{static getType(){return"tab"}static clone(e){return new Jr(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=Qr();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){M(126)}setDetail(e){M(127)}setMode(e){M(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Qr(){return ot(new Jr)}function wc(r){return r instanceof Jr}class Ec{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,o=e.offset;if(B(t)){const i=t.getDescendantByIndex(s);t=i??t}if(B(n)){const i=n.getDescendantByIndex(o);n=i??n}return t===n?s<o:t.isBefore(n)}getNode(){const e=ye(this.key);return e===null&&M(20),e}set(e,t,n){const s=this._selection,o=this.key;this.key=e,this.offset=t,this.type=n,Xr()||(_t()===o&&me(e),s!==null&&(s.setCachedNodes(null),s.dirty=!0))}}function it(r,e,t){return new Ec(r,e,t)}function bs(r,e){let t=e.__key,n=r.offset,s="element";if(R(e)){s="text";const o=e.getTextContentSize();n>o&&(n=o)}else if(!B(e)){const o=e.getNextSibling();if(R(o))t=o.__key,n=0,s="text";else{const i=e.getParent();i&&(t=i.__key,n=e.getIndexWithinParent()+1)}}r.set(t,n,s)}function co(r,e){if(B(e)){const t=e.getLastDescendant();B(t)||R(t)?bs(r,t):bs(r,e)}else bs(r,e)}function xt(r,e,t,n){r.key=e,r.offset=t,r.type=n}class Yn{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!et(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 Yn(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 o;if(R(s))o=s.select();else{const i=s.getIndexWithinParent()+1;o=s.getParentOrThrow().select(i,i)}o.insertNodes(e);for(let i=0;i<n;i++)t[i].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,n=[];for(const s of t){const o=ye(s);o!==null&&n.push(o)}return Xr()||(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 P(r){return r instanceof Et}class Et{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!!P(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),o=s?t:n,i=s?n:t;let l=o.getNode(),u=i.getNode();const a=o.offset,c=i.offset;if(B(l)){const f=l.getDescendantByIndex(a);l=f??l}if(B(u)){let f=u.getDescendantByIndex(c);f!==null&&f!==l&&u.getChildAtIndex(c)===f&&(f=f.getPreviousSibling()),u=f??u}let d;return d=l.is(u)?B(l)&&l.getChildrenSize()>0?[]:[l]:l.getNodesBetween(u),Xr()||(this._cachedNodes=d),d}setTextNodeRange(e,t,n,s){xt(this.anchor,e.__key,t,"text"),xt(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,o=this.focus,i=s.isBefore(o),[l,u]=zs(this);let a="",c=!0;for(let d=0;d<e.length;d++){const f=e[d];if(B(f)&&!f.isInline())c||(a+=`
69
+ `),c=!f.isEmpty();else if(c=!1,R(f)){let h=f.getTextContent();f===t?f===n?s.type==="element"&&o.type==="element"&&o.offset!==s.offset||(h=l<u?h.slice(l,u):h.slice(u,l)):h=i?h.slice(l):h.slice(u):f===n&&(h=i?h.slice(0,u):h.slice(0,l)),a+=h}else!Z(f)&&!jt(f)||f===n&&this.isCollapsed()||(a+=f.getTextContent())}return a}applyDOMRange(e){const t=ie(),n=t.getEditorState()._selection,s=Yl(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(s===null)return;const[o,i]=s;xt(this.anchor,o.key,o.offset,o.type),xt(this.focus,i.key,i.offset,i.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new Et(it(e.key,e.offset,e.type),it(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=kn(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=Ot[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],s=t.length;for(let o=0;o<s;o++){const i=t[o];i===`
70
70
  `||i===`\r
71
- `?n.push(Rt()):i===" "?n.push(Hr()):n.push(he(i))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,s=this.format,o=this.style;let i=t,l=n;!this.isCollapsed()&&n.isBefore(t)&&(i=n,l=t),i.type==="element"&&function(y,C,_,E){const D=y.getNode(),k=D.getChildAtIndex(y.offset),v=he(),b=Ce(D)?ce().append(v):v;v.setFormat(_),v.setStyle(E),k===null?D.append(b):k.insertBefore(b),y.is(C)&&C.set(v.__key,0,"text"),y.set(v.__key,0,"text")}(i,l,s,o);const u=i.offset;let a=l.offset;const c=this.getNodes(),f=c.length;let d=c[0];M(d)||O(26);const h=d.getTextContent().length,p=d.getParentOrThrow();let m=c[f-1];if(f===1&&l.type==="element"&&(a=h,l.set(i.key,a,"text")),this.isCollapsed()&&u===h&&(d.isSegmented()||d.isToken()||!d.canInsertTextAfter()||!p.canInsertTextAfter()&&d.getNextSibling()===null)){let y=d.getNextSibling();if(M(y)&&y.canInsertTextBefore()&&!Bt(y)||(y=he(),y.setFormat(s),y.setStyle(o),p.canInsertTextAfter()?d.insertAfter(y):p.insertAfter(y)),y.select(0,0),d=y,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&u===0&&(d.isSegmented()||d.isToken()||!d.canInsertTextBefore()||!p.canInsertTextBefore()&&d.getPreviousSibling()===null)){let y=d.getPreviousSibling();if(M(y)&&!Bt(y)||(y=he(),y.setFormat(s),p.canInsertTextBefore()?d.insertBefore(y):p.insertBefore(y)),y.select(),d=y,e!=="")return void this.insertText(e)}else if(d.isSegmented()&&u!==h){const y=he(d.getTextContent());y.setFormat(s),d.replace(y),d=y}else if(!this.isCollapsed()&&e!==""){const y=m.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||B(y)&&(!y.canInsertTextBefore()||!y.canInsertTextAfter()))return this.insertText(""),Ql(this.anchor,this.focus,null),void this.insertText(e)}if(f===1){if(d.isToken()){const E=he(e);return E.select(),void d.replace(E)}const y=d.getFormat(),C=d.getStyle();if(u!==a||y===s&&C===o){if(wc(d)){const E=he(e);return E.setFormat(s),E.setStyle(o),E.select(),void d.replace(E)}}else{if(d.getTextContent()!==""){const E=he(e);if(E.setFormat(s),E.setStyle(o),E.select(),u===0)d.insertBefore(E,!1);else{const[D]=d.splitText(u);D.insertAfter(E,!1)}return void(E.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}d.setFormat(s),d.setStyle(o)}const _=a-u;d=d.spliceText(u,_,e,!0),d.getTextContent()===""?d.remove():this.anchor.type==="text"&&(d.isComposing()?this.anchor.offset-=e.length:(this.format=y,this.style=C))}else{const y=new Set([...d.getParentKeys(),...m.getParentKeys()]),C=B(d)?d:d.getParentOrThrow();let _=B(m)?m:m.getParentOrThrow(),E=m;if(!C.is(_)&&_.isInline())do E=_,_=_.getParentOrThrow();while(_.isInline());if(l.type==="text"&&(a!==0||m.getTextContent()==="")||l.type==="element"&&m.getIndexWithinParent()<a)if(M(m)&&!m.isToken()&&a!==m.getTextContentSize()){if(m.isSegmented()){const w=he(m.getTextContent());m.replace(w),m=w}Ce(l.getNode())||l.type!=="text"||(m=m.spliceText(0,a,"")),y.add(m.__key)}else{const w=m.getParentOrThrow();w.canBeEmpty()||w.getChildrenSize()!==1?m.remove():w.remove()}else y.add(m.__key);const D=_.getChildren(),k=new Set(c),v=C.is(_),b=C.isInline()&&d.getNextSibling()===null?C:d;for(let w=D.length-1;w>=0;w--){const S=D[w];if(S.is(d)||B(S)&&S.isParentOf(d))break;S.isAttached()&&(!k.has(S)||S.is(E)?v||b.insertAfter(S,!1):S.remove())}if(!v){let w=_,S=null;for(;w!==null;){const R=w.getChildren(),T=R.length;(T===0||R[T-1].is(S))&&(y.delete(w.__key),S=w),w=w.getParent()}}if(d.isToken())if(u===h)d.select();else{const w=he(e);w.select(),d.replace(w)}else d=d.spliceText(u,h-u,e,!0),d.getTextContent()===""?d.remove():d.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let w=1;w<f;w++){const S=c[w],R=S.__key;y.has(R)||S.remove()}}}removeText(){if(this.isCollapsed())return;const{anchor:e,focus:t}=this,n=this.getNodes(),s=this.isBackward()?t:e,o=this.isBackward()?e:t;let i=s.getNode(),l=o.getNode();const u=xr(i,mt),a=xr(l,mt);M(i)&&i.isToken()&&s.offset<i.getTextContentSize()&&(s.offset=0),o.offset>0&&M(l)&&l.isToken()&&(o.offset=l.getTextContentSize()),n.forEach(f=>{Tr(i,f)||Tr(l,f)||f.getKey()===i.getKey()||f.getKey()===l.getKey()||f.remove()});const c=(f,d)=>{if(f.getTextContent()==="")f.remove();else if(d!==0&&Bt(f)){const h=he(f.getTextContent());return h.setFormat(f.getFormat()),h.setStyle(f.getStyle()),f.replace(h)}};if(i===l&&M(i)){const f=Math.abs(t.offset-e.offset);return i.spliceText(s.offset,f,"",!0),void c(i,f)}if(M(i)){const f=i.getTextContentSize()-s.offset;i.spliceText(s.offset,f,""),i=c(i,f)||i}M(l)&&(l.spliceText(0,o.offset,""),l=c(l,o.offset)||l),i.isAttached()&&M(i)?i.selectEnd():l.isAttached()&&M(l)&&l.selectStart(),B(u)&&B(a)&&u!==a&&(u.append(...a.getChildren()),a.remove(),o.set(s.key,s.offset,s.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void me(null);const n=this.getNodes(),s=[];for(const D of n)M(D)&&s.push(D);const o=D=>{n.forEach(k=>{if(sr(k)){const v=k.getFormatFlags(e,D);k.setTextFormat(v)}})},i=s.length;if(i===0)return this.toggleFormat(e),me(null),void o(t);const l=this.anchor,u=this.focus,a=this.isBackward(),c=a?u:l,f=a?l:u;let d=0,h=s[0],p=c.type==="element"?0:c.offset;if(c.type==="text"&&p===h.getTextContentSize()&&(d=1,h=s[1],p=0),h==null)return;const m=h.getFormatFlags(e,t);o(m);const y=i-1;let C=s[y];const _=f.type==="text"?f.offset:C.getTextContentSize();if(h.is(C)){if(p===_)return;if(Bt(h)||p===0&&_===h.getTextContentSize())h.setFormat(m);else{const D=h.splitText(p,_),k=p===0?D[0]:D[1];k.setFormat(m),c.type==="text"&&c.set(k.__key,0,"text"),f.type==="text"&&f.set(k.__key,_-p,"text")}return void(this.format=m)}p===0||Bt(h)||([,h]=h.splitText(p),p=0),h.setFormat(m);const E=C.getFormatFlags(e,m);_>0&&(_===C.getTextContentSize()||Bt(C)||([C]=C.splitText(_)),C.setFormat(E));for(let D=d+1;D<y;D++){const k=s[D],v=k.getFormatFlags(e,E);k.setFormat(v)}c.type==="text"&&c.set(h.__key,p,"text"),f.type==="text"&&f.set(C.__key,_,"text"),this.format=m|E}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const p=q();return P(p)||O(134),p.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=xr(t,mt),s=e[e.length-1];if(B(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const p=vs(this);n.splice(p,0,e),s.selectEnd()}return}if(!e.some(p=>(B(p)||Z(p))&&!p.isInline())){B(n)||O(211,t.constructor.name,t.getType());const p=vs(this);return n.splice(p,0,e),void s.selectEnd()}const o=function(p){const m=ce();let y=null;for(let C=0;C<p.length;C++){const _=p[C],E=jt(_);if(E||Z(_)&&_.isInline()||B(_)&&_.isInline()||M(_)||_.isParentRequired()){if(y===null&&(y=_.createParentElementNode(),m.append(y),E))continue;y!==null&&y.append(_)}else m.append(_),y=null}return m}(e),i=o.getLastDescendant(),l=o.getChildren(),u=!B(n)||!n.isEmpty()?this.insertParagraph():null,a=l[l.length-1];let c=l[0];var f;B(f=c)&&mt(f)&&!f.isEmpty()&&B(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(B(n)||O(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=l[1]),c&&(n===null&&O(212,t.constructor.name,t.getType()),function(p,m,y){const C=m.getParentOrThrow().getLastChild();let _=m;const E=[m];for(;_!==C;)_.getNextSibling()||O(140),_=_.getNextSibling(),E.push(_);let D=p;for(const k of E)D=D.insertAfter(k)}(n,c));const d=xr(i,mt);u&&B(d)&&(u.canMergeWhenEmpty()||mt(a))&&(d.append(...u.getChildren()),u.remove()),B(n)&&n.isEmpty()&&n.remove(),i.selectEnd();const h=B(n)?n.getLastChild():null;jt(h)&&d!==n&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=ce();return se().splice(this.anchor.offset,0,[i]),i.select(),i}const e=vs(this),t=xr(this.anchor.getNode(),mt);B(t)||O(213);const n=t.getChildAtIndex(e),s=n?[n,...n.getNextSiblings()]:[],o=t.insertNewAfter(this,!1);return o?(o.append(...s),o.selectStart(),o):null}insertLineBreak(e){const t=Rt();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,o=this.focus;let i=e[0],l=e[n];const[u,a]=zs(this);if(t===0)return[];if(t===1){if(M(i)&&!this.isCollapsed()){const f=u>a?a:u,d=u>a?u:a,h=i.splitText(f,d),p=f===0?h[0]:h[1];return p!=null?[p]:[]}return[i]}const c=s.isBefore(o);if(M(i)){const f=c?u:a;f===i.getTextContentSize()?e.shift():f!==0&&([,i]=i.splitText(f),e[0]=i)}if(M(l)){const f=l.getTextContent().length,d=c?a:u;d===0?e.pop():d!==f&&([l]=l.splitText(d),e[n]=l)}return e}modify(e,t,n){const s=this.focus,o=this.anchor,i=e==="move",l=Mr(s,t);if(Z(l)&&!l.isIsolated()){if(i&&l.isKeyboardSelectable()){const h=mo();return h.add(l.__key),void rt(h)}const d=t?l.getPreviousSibling():l.getNextSibling();if(M(d)){const h=d.__key,p=t?d.getTextContent().length:0;return s.set(h,p,"text"),void(i&&o.set(h,p,"text"))}{const h=l.getParentOrThrow();let p,m;return B(d)?(m=d.__key,p=t?d.getChildrenSize():0):(p=l.getIndexWithinParent(),m=h.__key,t||p++),s.set(m,p,"element"),void(i&&o.set(m,p,"element"))}}const u=ne(),a=ze(u._window);if(!a)return;const c=u._blockCursorElement,f=u._rootElement;if(f===null||c===null||!B(l)||l.isInline()||l.canBeEmpty()||pi(c,u,f),function(d,h,p,m){d.modify(h,p,m)}(a,e,t?"backward":"forward",n),a.rangeCount>0){const d=a.getRangeAt(0),h=this.anchor.getNode(),p=Ce(h)?h:lc(h);if(this.applyDOMRange(d),this.dirty=!0,!i){const m=this.getNodes(),y=[];let C=!1;for(let _=0;_<m.length;_++){const E=m[_];Tr(E,p)?y.push(E):C=!0}if(C&&y.length>0)if(t){const _=y[0];B(_)?_.selectStart():_.getParentOrThrow().selectStart()}else{const _=y[y.length-1];B(_)?_.selectEnd():_.getParentOrThrow().selectEnd()}a.anchorNode===d.startContainer&&a.anchorOffset===d.startOffset||function(_){const E=_.focus,D=_.anchor,k=D.key,v=D.offset,b=D.type;yt(D,E.key,E.offset,E.type),yt(E,k,v,b),_._cachedNodes=null}(this)}}}forwardDeletion(e,t,n){if(!n&&(e.type==="element"&&B(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const s=t.getParent(),o=t.getNextSibling()||(s===null?null:s.getNextSibling());if(B(o)&&o.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 o=this.focus,i=Mr(o,e);if(Z(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&B(s)&&s.getChildrenSize()===0){s.remove();const l=mo();l.add(i.__key),rt(l)}else i.remove(),ne().dispatchCommand(Js,void 0);return}if(!e&&B(i)&&B(s)&&s.isEmpty())return s.remove(),void i.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=o.type==="text"?o.getNode():null;if(s=n.type==="text"?n.getNode():null,l!==null&&l.isSegmented()){const u=o.offset,a=l.getTextContentSize();if(l.is(s)||e&&u!==a||!e&&u!==0)return void ho(l,e,u)}else if(s!==null&&s.isSegmented()){const u=n.offset,a=s.getTextContentSize();if(s.is(l)||e&&u!==0||!e&&u!==a)return void ho(s,e,u)}(function(u,a){const c=u.anchor,f=u.focus,d=c.getNode(),h=f.getNode();if(d===h&&c.type==="text"&&f.type==="text"){const p=c.offset,m=f.offset,y=p<m,C=y?p:m,_=y?m:p,E=_-1;C!==E&&(Bl(d.getTextContent().slice(C,_))||(a?f.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()&&Ce(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 Ze(r){return r instanceof Qn}function fo(r){const e=r.offset;if(r.type==="text")return e;const t=r.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function zs(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]:[fo(t),fo(n)]}function ho(r,e,t){const n=r,s=n.getTextContent().split(/(?=\s)/g),o=s.length;let i=0,l=0;for(let a=0;a<o;a++){const c=a===o-1;if(l=i,i+=s[a].length,e&&i===t||i>t||c){s.splice(a,1),c&&(l=void 0);break}}const u=s.join("").trim();u===""?n.remove():(n.setTextContent(u),n.select(l,l))}function po(r,e,t,n){let s,o=e;if(r.nodeType===Ur){let i=!1;const l=r.childNodes,u=l.length,a=n._blockCursorElement;o===u&&(i=!0,o=u-1);let c=l[o],f=!1;if(c===a)c=l[o+1],f=!0;else if(a!==null){const d=a.parentNode;r===d&&e>Array.prototype.indexOf.call(d.children,a)&&o--}if(s=Qt(c),M(s))o=Hi(s,i);else{let d=Qt(r);if(d===null)return null;if(B(d)){const h=n.getElementByKey(d.getKey());h===null&&O(214),[d,o]=d.getDOMSlot(h).resolveChildIndex(d,h,r,e),B(d)||O(215),i&&o>=d.getChildrenSize()&&(o=Math.max(0,d.getChildrenSize()-1));let m=d.getChildAtIndex(o);if(B(m)&&function(y,C,_){const E=y.getParent();return _===null||E===null||!E.canBeEmpty()||E!==_.getNode()}(m,0,t)){const y=i?m.getLastDescendant():m.getFirstDescendant();y===null?d=m:(m=y,d=B(m)?m:m.getParentOrThrow()),o=0}M(m)?(s=m,d=null,o=Hi(m,i)):m!==d&&i&&!f&&(B(d)||O(216),o=Math.min(d.getChildrenSize(),o+1))}else{const h=d.getIndexWithinParent();o=e===0&&Z(d)&&Qt(r)===d?h:h+1,d=d.getParentOrThrow()}if(B(d))return st(d.__key,o,"element")}}else s=Qt(r);return M(s)?st(s.__key,o,"text"):null}function go(r,e,t){const n=r.offset,s=r.getNode();if(n===0){const o=s.getPreviousSibling(),i=s.getParent();if(e){if((t||!e)&&o===null&&B(i)&&i.isInline()){const l=i.getPreviousSibling();M(l)&&(r.key=l.__key,r.offset=l.getTextContent().length)}}else B(o)&&!t&&o.isInline()?(r.key=o.__key,r.offset=o.getChildrenSize(),r.type="element"):M(o)&&(r.key=o.__key,r.offset=o.getTextContent().length)}else if(n===s.getTextContent().length){const o=s.getNextSibling(),i=s.getParent();if(e&&B(o)&&o.isInline())r.key=o.__key,r.offset=0,r.type="element";else if((t||e)&&o===null&&B(i)&&i.isInline()&&!i.canInsertTextAfter()){const l=i.getNextSibling();M(l)&&(r.key=l.__key,r.offset=0)}}}function Ql(r,e,t){if(r.type==="text"&&e.type==="text"){const n=r.isBefore(e),s=r.is(e);go(r,n,s),go(e,!n,s),s&&(e.key=r.key,e.offset=r.offset,e.type=r.type);const o=ne();if(o.isComposing()&&o._compositionKey!==r.key&&P(t)){const i=t.anchor,l=t.focus;yt(r,i.key,i.offset,i.type),yt(e,l.key,l.offset,l.type)}}}function Yl(r,e,t,n,s,o){if(r===null||t===null||!Wr(s,r,t))return null;const i=po(r,e,P(o)?o.anchor:null,s);if(i===null)return null;const l=po(t,n,P(o)?o.focus:null,s);if(l===null)return null;if(i.type==="element"&&l.type==="element"){const u=Qt(r),a=Qt(t);if(Z(u)&&Z(a))return null}return Ql(i,l,o),[i,l]}function qs(r){return B(r)&&!r.isInline()}function Xl(r,e,t,n,s,o){const i=ft(),l=new wt(st(r,e,s),st(t,n,o),0,"");return l.dirty=!0,i._selection=l,l}function Ac(){const r=st("root",0,"element"),e=st("root",0,"element");return new wt(r,e,0,"")}function mo(){return new Qn(new Set)}function xi(r,e,t,n){const s=t._window;if(s===null)return null;const o=n||s.event,i=o?o.type:void 0,l=i==="selectionchange",u=!Ss&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&o&&o.detail===3||i==="drop"||i===void 0);let a,c,f,d;if(P(r)&&!u)return r.clone();if(e===null)return null;if(a=e.anchorNode,c=e.focusNode,f=e.anchorOffset,d=e.focusOffset,l&&P(r)&&!Wr(t,a,c))return r.clone();const h=Yl(a,f,c,d,t,r);if(h===null)return null;const[p,m]=h;return new wt(p,m,P(r)?r.format:0,P(r)?r.style:"")}function q(){return ft()._selection}function Jr(){return ne()._editorState._selection}function jn(r,e,t,n=1){const s=r.anchor,o=r.focus,i=s.getNode(),l=o.getNode();if(!e.is(i)&&!e.is(l))return;const u=e.__key;if(r.isCollapsed()){const a=s.offset;if(t<=a&&n>0||t<a&&n<0){const c=Math.max(0,a+n);s.set(u,c,"element"),o.set(u,c,"element"),yo(r)}}else{const a=r.isBackward(),c=a?o:s,f=c.getNode(),d=a?s:o,h=d.getNode();if(e.is(f)){const p=c.offset;(t<=p&&n>0||t<p&&n<0)&&c.set(u,Math.max(0,p+n),"element")}if(e.is(h)){const p=d.offset;(t<=p&&n>0||t<p&&n<0)&&d.set(u,Math.max(0,p+n),"element")}}yo(r)}function yo(r){const e=r.anchor,t=e.offset,n=r.focus,s=n.offset,o=e.getNode(),i=n.getNode();if(r.isCollapsed()){if(!B(o))return;const l=o.getChildrenSize(),u=t>=l,a=u?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(M(a)){let c=0;u&&(c=a.getTextContentSize()),e.set(a.__key,c,"text"),n.set(a.__key,c,"text")}}else{if(B(o)){const l=o.getChildrenSize(),u=t>=l,a=u?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(M(a)){let c=0;u&&(c=a.getTextContentSize()),e.set(a.__key,c,"text")}}if(B(i)){const l=i.getChildrenSize(),u=s>=l,a=u?i.getChildAtIndex(l-1):i.getChildAtIndex(s);if(M(a)){let c=0;u&&(c=a.getTextContentSize()),n.set(a.__key,c,"text")}}}}function Pn(r,e,t,n,s){let o=null,i=0,l=null;n!==null?(o=n.__key,M(n)?(i=n.getTextContentSize(),l="text"):B(n)&&(i=n.getChildrenSize(),l="element")):s!==null&&(o=s.__key,M(s)?l="text":B(s)&&(l="element")),o!==null&&l!==null?r.set(o,i,l):(i=e.getIndexWithinParent(),i===-1&&(i=t.getChildrenSize()),r.set(t.__key,i,"element"))}function xo(r,e,t,n,s){r.type==="text"?(r.key=t,e||(r.offset+=s)):r.offset>n.getIndexWithinParent()&&(r.offset-=1)}function kc(r,e,t,n,s,o,i){const l=n.anchorNode,u=n.focusNode,a=n.anchorOffset,c=n.focusOffset,f=document.activeElement;if(s.has("collaboration")&&f!==o||f!==null&&ui(f))return;if(!P(e))return void(r!==null&&Wr(t,l,u)&&n.removeAllRanges());const d=e.anchor,h=e.focus,p=d.key,m=h.key,y=Sn(t,p),C=Sn(t,m),_=d.offset,E=h.offset,D=e.format,k=e.style,v=e.isCollapsed();let b=y,w=C,S=!1;if(d.type==="text"){b=En(y);const $=d.getNode();S=$.getFormat()!==D||$.getStyle()!==k}else P(r)&&r.anchor.type==="text"&&(S=!0);var R,T,N,F,j;if(h.type==="text"&&(w=En(C)),b!==null&&w!==null&&(v&&(r===null||S||P(r)&&(r.format!==D||r.style!==k))&&(R=D,T=k,N=_,F=p,j=performance.now(),Ul=[R,T,N,F,j]),a!==_||c!==E||l!==b||u!==w||n.type==="Range"&&v||(f!==null&&o.contains(f)||o.focus({preventScroll:!0}),d.type==="element"))){try{n.setBaseAndExtent(b,_,w,E)}catch{}if(!s.has("skip-scroll-into-view")&&e.isCollapsed()&&o!==null&&o===document.activeElement){const $=e instanceof wt&&e.anchor.type==="element"?b.childNodes[_]||null:n.rangeCount>0?n.getRangeAt(0):null;if($!==null){let G;if($ instanceof Text){const de=document.createRange();de.selectNode($),G=de.getBoundingClientRect()}else G=$.getBoundingClientRect();(function(de,fe,Oe){const _e=Oe.ownerDocument,qe=_e.defaultView;if(qe===null)return;let{top:Qe,bottom:Ee}=fe,Ae=0,Fe=0,le=Oe;for(;le!==null;){const Me=le===_e.body;if(Me)Ae=0,Fe=Gn(de).innerHeight;else{const te=le.getBoundingClientRect();Ae=te.top,Fe=te.bottom}let be=0;if(Qe<Ae?be=-(Ae-Qe):Ee>Fe&&(be=Ee-Fe),be!==0)if(Me)qe.scrollBy(0,be);else{const te=le.scrollTop;le.scrollTop+=be;const Re=le.scrollTop-te;Qe-=Re,Ee-=Re}if(Me)break;le=Kr(le)}})(t,G,o)}}Rs=!0}}function Zl(r){let e=q()||Jr();e===null&&(e=se().selectEnd()),e.insertNodes(r)}function vs(r){let e=r;r.isCollapsed()||e.removeText();const t=q();P(t)&&(e=t),P(e)||O(161);const n=e.anchor;let s=n.getNode(),o=n.offset;for(;!mt(s);)[s,o]=Sc(s,o);return o}function Sc(r,e){const t=r.getParent();if(!t){const s=ce();return se().append(s),s.select(),[se(),0]}if(M(r)){const s=r.splitText(e);if(s.length===0)return[t,r.getIndexWithinParent()];const o=e===0?0:1;return[t,s[0].getIndexWithinParent()+o]}if(!B(r)||e===0)return[t,r.getIndexWithinParent()];const n=r.getChildAtIndex(e);if(n){const s=new wt(st(r.__key,e,"element"),st(r.__key,e,"element"),0,""),o=r.insertNewAfter(s);o&&o.append(n,...n.getNextSiblings())}return[t,r.getIndexWithinParent()+1]}let pe=null,ge=null,Be=!1,Ds=!1,yn=0;const _o={characterData:!0,childList:!0,subtree:!0};function Qr(){return Be||pe!==null&&pe._readOnly}function Te(){Be&&O(13)}function eu(){yn>99&&O(14)}function ft(){return pe===null&&O(195,tu()),pe}function ne(){return ge===null&&O(196,tu()),ge}function tu(){let r=0;const e=new Set,t=Xn.version;if(typeof window<"u")for(const s of document.querySelectorAll("[contenteditable]")){const o=Wn(s);if(ai(o))r++;else if(o){let i=String(o.constructor.version||"<0.17.1");i===t&&(i+=" (separately built, likely a bundler configuration issue)"),e.add(i)}}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 Tc(){return ge}function bo(r,e,t){const n=e.__type,s=function(l,u){const a=l._nodes.get(u);return a===void 0&&O(30,u),a}(r,n);let o=t.get(n);o===void 0&&(o=Array.from(s.transforms),t.set(n,o));const i=o.length;for(let l=0;l<i&&(o[l](e),e.isAttached());l++);}function vo(r,e){return r!==void 0&&r.__key!==e&&r.isAttached()}function ru(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 Bc(r){return _i(r,ne()._nodes)}function _i(r,e){const t=r.type,n=e.get(t);n===void 0&&O(17,t);const s=n.klass;r.type!==s.getType()&&O(18,s.name);const o=s.importJSON(r),i=r.children;if(B(o)&&Array.isArray(i))for(let l=0;l<i.length;l++){const u=_i(i[l],e);o.append(u)}return o}function Do(r,e,t){const n=pe,s=Be,o=ge;pe=e,Be=!0,ge=r;try{return t()}finally{pe=n,Be=s,ge=o}}function _t(r,e){const t=r._pendingEditorState,n=r._rootElement,s=r._headless||n===null;if(t===null)return;const o=r._editorState,i=o._selection,l=t._selection,u=r._dirtyType!==Pt,a=pe,c=Be,f=ge,d=r._updating,h=r._observer;let p=null;if(r._pendingEditorState=null,r._editorState=t,!s&&u&&h!==null){ge=r,pe=t,Be=!1,r._updating=!0;try{const v=r._dirtyType,b=r._dirtyElements,w=r._dirtyLeaves;h.disconnect(),p=mc(o,t,r,v,b,w)}catch(v){if(v instanceof Error&&r._onError(v),Ds)throw v;return lu(r,null,n,t),Cl(r),r._dirtyType=rr,Ds=!0,_t(r,o),void(Ds=!1)}finally{h.observe(n,_o),r._updating=d,pe=a,Be=c,ge=f}}t._readOnly||(t._readOnly=!0);const m=r._dirtyLeaves,y=r._dirtyElements,C=r._normalizedNodes,_=r._updateTags,E=r._deferred;u&&(r._dirtyType=Pt,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set,r._updateTags=new Set),function(v,b){const w=v._decorators;let S=v._pendingDecorators||w;const R=b._nodeMap;let T;for(T in S)R.has(T)||(S===w&&(S=Sl(v)),delete S[T])}(r,t);const D=s?null:ze(r._window);if(r._editable&&D!==null&&(u||l===null||l.dirty)){ge=r,pe=t;try{if(h!==null&&h.disconnect(),u||l===null||l.dirty){const v=r._blockCursorElement;v!==null&&pi(v,r,n),kc(i,l,r,D,_,n)}uc(r,n,l),h!==null&&h.observe(n,_o)}finally{ge=f,pe=a}}p!==null&&function(v,b,w,S,R){const T=Array.from(v._listeners.mutation),N=T.length;for(let F=0;F<N;F++){const[j,$]=T[F],G=b.get($);G!==void 0&&j(G,{dirtyLeaves:S,prevEditorState:R,updateTags:w})}}(r,p,_,m,o),P(l)||l===null||i!==null&&i.is(l)||r.dispatchCommand(Js,void 0);const k=r._pendingDecorators;k!==null&&(r._decorators=k,r._pendingDecorators=null,Fr("decorator",r,!0,k)),function(v,b,w){const S=Gi(b),R=Gi(w);S!==R&&Fr("textcontent",v,!0,R)}(r,e||o,t),Fr("update",r,!0,{dirtyElements:y,dirtyLeaves:m,editorState:t,normalizedNodes:C,prevEditorState:e||o,tags:_}),function(v,b){if(v._deferred=[],b.length!==0){const w=v._updating;v._updating=!0;try{for(let S=0;S<b.length;S++)b[S]()}finally{v._updating=w}}}(r,E),function(v){const b=v._updates;if(b.length!==0){const w=b.shift();if(w){const[S,R]=w;su(v,S,R)}}}(r)}function Fr(r,e,t,...n){const s=e._updating;e._updating=t;try{const o=Array.from(e._listeners[r]);for(let i=0;i<o.length;i++)o[i].apply(null,n)}finally{e._updating=s}}function nu(r,e,t){if(r._updating===!1||ge!==r){let s=!1;return r.update(()=>{s=nu(r,e,t)}),s}const n=ci(r);for(let s=4;s>=0;s--)for(let o=0;o<n.length;o++){const i=n[o]._commands.get(e);if(i!==void 0){const l=i[s];if(l!==void 0){const u=Array.from(l),a=u.length;for(let c=0;c<a;c++)if(u[c](t,r)===!0)return!0}}}return!1}function Co(r,e){const t=r._updates;let n=e||!1;for(;t.length!==0;){const s=t.shift();if(s){const[o,i]=s;let l;if(i!==void 0){if(l=i.onUpdate,i.skipTransforms&&(n=!0),i.discrete){const u=r._pendingEditorState;u===null&&O(191),u._flushSync=!0}l&&r._deferred.push(l),ru(r,i.tag)}o()}}return n}function su(r,e,t){const n=r._updateTags;let s,o=!1,i=!1;t!==void 0&&(s=t.onUpdate,ru(r,t.tag),o=t.skipTransforms||!1,i=t.discrete||!1),s&&r._deferred.push(s);const l=r._editorState;let u=r._pendingEditorState,a=!1;(u===null||u._readOnly)&&(u=r._pendingEditorState=iu(u||l),a=!0),u._flushSync=i;const c=pe,f=Be,d=ge,h=r._updating;pe=u,Be=!1,r._updating=!0,ge=r;try{a&&(r._headless?l._selection!==null&&(u._selection=l._selection.clone()):u._selection=function(C){const _=C.getEditorState()._selection,E=ze(C._window);return P(_)||_==null?xi(_,E,C,null):_.clone()}(r));const m=r._compositionKey;e(),o=Co(r,o),function(C,_){const E=_.getEditorState()._selection,D=C._selection;if(P(D)){const k=D.anchor,v=D.focus;let b;if(k.type==="text"&&(b=k.getNode(),b.selectionTransform(E,D)),v.type==="text"){const w=v.getNode();b!==w&&w.selectionTransform(E,D)}}}(u,r),r._dirtyType!==Pt&&(o?function(C,_){const E=_._dirtyLeaves,D=C._nodeMap;for(const k of E){const v=D.get(k);M(v)&&v.isAttached()&&v.isSimpleText()&&!v.isUnmergeable()&&Ki(v)}}(u,r):function(C,_){const E=_._dirtyLeaves,D=_._dirtyElements,k=C._nodeMap,v=xt(),b=new Map;let w=E,S=w.size,R=D,T=R.size;for(;S>0||T>0;){if(S>0){_._dirtyLeaves=new Set;for(const N of w){const F=k.get(N);M(F)&&F.isAttached()&&F.isSimpleText()&&!F.isUnmergeable()&&Ki(F),F!==void 0&&vo(F,v)&&bo(_,F,b),E.add(N)}if(w=_._dirtyLeaves,S=w.size,S>0){yn++;continue}}_._dirtyLeaves=new Set,_._dirtyElements=new Map;for(const N of R){const F=N[0],j=N[1];if(F!=="root"&&!j)continue;const $=k.get(F);$!==void 0&&vo($,v)&&bo(_,$,b),D.set(F,j)}w=_._dirtyLeaves,S=w.size,R=_._dirtyElements,T=R.size,yn++}_._dirtyLeaves=E,_._dirtyElements=D}(u,r),Co(r),function(C,_,E,D){const k=C._nodeMap,v=_._nodeMap,b=[];for(const[w]of D){const S=v.get(w);S!==void 0&&(S.isAttached()||(B(S)&&jl(S,w,k,v,b,D),k.has(w)||D.delete(w),b.push(w)))}for(const w of b)v.delete(w);for(const w of E){const S=v.get(w);S===void 0||S.isAttached()||(k.has(w)||E.delete(w),v.delete(w))}}(l,u,r._dirtyLeaves,r._dirtyElements)),m!==r._compositionKey&&(u._flushSync=!0);const y=u._selection;if(P(y)){const C=u._nodeMap,_=y.anchor.key,E=y.focus.key;C.get(_)!==void 0&&C.get(E)!==void 0||O(19)}else Ze(y)&&y._nodes.size===0&&(u._selection=null)}catch(m){return m instanceof Error&&r._onError(m),r._pendingEditorState=l,r._dirtyType=rr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),void _t(r)}finally{pe=c,Be=f,ge=d,r._updating=h,yn=0}r._dirtyType!==Pt||function(m,y){const C=y.getEditorState()._selection,_=m._selection;if(_!==null){if(_.dirty||!_.is(C))return!0}else if(C!==null)return!0;return!1}(u,r)?u._flushSync?(u._flushSync=!1,_t(r)):a&&rc(()=>{_t(r)}):(u._flushSync=!1,a&&(n.clear(),r._deferred=[],r._pendingEditorState=null))}function je(r,e,t){r._updating?r._updates.push([e,t]):su(r,e,t)}class Lr{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new Lr(this.element,e,this.after)}withAfter(e){return new Lr(this.element,this.before,e)}withElement(e){return new Lr(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&O(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&O(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&O(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"&&(qr||qn);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,o=document.createElement("br");if(n.insertBefore(o,s),e){const i=document.createElement("img");i.setAttribute("data-lexical-linebreak","true"),i.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",i.alt="",n.insertBefore(i,o),n.__lexicalLineBreak=i}else n.__lexicalLineBreak=o}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 u=this.getFirstChildOffset();return[e,Math.min(u+e.getChildrenSize(),Math.max(u,s))]}const o=wo(t,n);o.push(s);const i=wo(t,this.element);let l=e.getIndexWithinParent();for(let u=0;u<i.length;u++){const a=o[u],c=i[u];if(a===void 0||a<c)break;if(a>c){l+=1;break}}return[e.getParentOrThrow(),l]}}function wo(r,e){const t=[];let n=e;for(;n!==r&&n!==null;n=e.parentNode){let s=0;for(let o=n.previousSibling;o!==null;o=n.previousSibling)s++;t.push(s)}return n!==r&&O(225),t.reverse()}class ht extends Jn{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 Va[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=ne()._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(M(t)&&e.push(t),B(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;B(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;B(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 o=t[n-1];return B(o)&&o.getLastDescendant()||o||null}const s=t[e];return B(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&&O(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:xe(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&O(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 o=t[s];e+=o.getTextContent(),B(o)&&s!==n-1&&!o.isInline()&&(e+=ct)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const o=t[s];e+=o.getTextContentSize(),B(o)&&s!==n-1&&!o.isInline()&&(e+=ct.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=qi[e];return!!(this.getFormat()&t)}return!1}select(e,t){Te();const n=q();let s=e,o=t;const i=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const u=this.getFirstChild();if(M(u)||B(u))return u.select(0,0)}else if(!(e!==void 0&&e!==i||t!==void 0&&t!==i)){const u=this.getLastChild();if(M(u)||B(u))return u.select()}}s===void 0&&(s=i),o===void 0&&(o=i);const l=this.__key;return P(n)?(n.anchor.set(l,s,"element"),n.focus.set(l,o,"element"),n.dirty=!0,n):Xl(l,s,l,o,"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!==""?qi[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,o=this.getChildrenSize(),i=this.getWritable();e+t<=o||O(226,String(e),String(t),String(o));const l=i.__key,u=[],a=[],c=this.getChildAtIndex(e+t);let f=null,d=o-t+s;if(e!==0)if(e===o)f=this.getLastChild();else{const p=this.getChildAtIndex(e);p!==null&&(f=p.getPreviousSibling())}if(t>0){let p=f===null?this.getFirstChild():f.getNextSibling();for(let m=0;m<t;m++){p===null&&O(100);const y=p.getNextSibling(),C=p.__key;Lt(p.getWritable()),a.push(C),p=y}}let h=f;for(let p=0;p<s;p++){const m=n[p];h!==null&&m.is(h)&&(f=h=h.getPreviousSibling());const y=m.getWritable();y.__parent===l&&d--,Lt(y);const C=m.__key;if(h===null)i.__first=C,y.__prev=null;else{const _=h.getWritable();_.__next=C,y.__prev=_.__key}m.__key===l&&O(76),y.__parent=l,u.push(C),h=m}if(e+t===o)h!==null&&(h.getWritable().__next=null,i.__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(i.__size=d,a.length){const p=q();if(P(p)){const m=new Set(a),y=new Set(u),{anchor:C,focus:_}=p;Eo(C,m,y)&&Pn(C,C.getNode(),this,f,c),Eo(_,m,y)&&Pn(_,_.getNode(),this,f,c),d!==0||this.canBeEmpty()||nt(this)||this.remove()}}return i}getDOMSlot(e){return new Lr(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&dt(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 o=this.getFirstChild();o;o=o.getNextSibling()){const i=t.getElementByKey(o.getKey());i!==null&&(s==null?(n.insertChild(i),s=i):s!==i&&n.replaceChild(i,s),s=s.nextSibling)}}}function B(r){return r instanceof ht}function Eo(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 Nc extends Jn{constructor(e){super(e)}decorate(e,t){O(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Z(r){return r instanceof Nc}class Yr extends ht{static getType(){return"root"}static clone(){return new Yr}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){O(51)}getTextContent(){const e=this.__cachedText;return!Qr()&&ne()._dirtyType!==Pt||e===null?super.getTextContent():e}remove(){O(52)}replace(e){O(53)}insertBefore(e){O(54)}insertAfter(e){O(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];B(n)||Z(n)||O(56)}return super.append(...e)}static importJSON(e){const t=se();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 Ce(r){return r instanceof Yr}function iu(r){return new Yn(new Map(r._nodeMap))}function bi(){return new Yn(new Map([["root",new Yr]]))}function ou(r){const e=r.exportJSON(),t=r.constructor;if(e.type!==t.getType()&&O(130,t.name),B(r)){const n=e.children;Array.isArray(n)||O(59,t.name);const s=r.getChildren();for(let o=0;o<s.length;o++){const i=ou(s[o]);n.push(i)}}return e}class Yn{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 Do(t&&t.editor||null,this,e)}clone(e){const t=new Yn(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return Do(null,this,()=>({root:ou(se())}))}}class vi extends ht{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class or extends ht{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=Ot[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return An(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 or(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=Sr(e.theme,"paragraph");return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Fc,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&dt(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=ce();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=ce();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||M(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 Fc(r){const e=ce();return r.style&&(e.setFormat(r.style.textAlign),mi(r,e)),{node:e}}function ce(){return ot(new or)}function sr(r){return r instanceof or}const Y=0,Yt=1,Lc=4;function lu(r,e,t,n){const s=r._keyToDOMMap;s.clear(),r._editorState=bi(),r._pendingEditorState=n,r._compositionKey=null,r._dirtyType=Pt,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),r._normalizedNodes=new Set,r._updateTags=new Set,r._updates=[],r._blockCursorElement=null;const o=r._observer;o!==null&&(o.disconnect(),r._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",s.set("root",t))}function jc(r){const e=r||{},t=Tc(),n=e.theme||{},s=r===void 0?t:e.parentEditor||null,o=e.disableEvents||!1,i=bi(),l=e.namespace||(s!==null?s._config.namespace:Nl()),u=e.editorState,a=[Yr,ir,Vr,Gr,or,vi,...e.nodes||[]],{onError:c,html:f}=e,d=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<a.length;m++){let y=a[m],C=null,_=null;if(typeof y!="function"){const v=y;y=v.replace,C=v.with,_=v.withKlass||null}const E=y.getType(),D=y.transform(),k=new Set;D!==null&&k.add(D),h.set(E,{exportDOM:f&&f.export?f.export.get(y):void 0,klass:y,replace:C,replaceWithKlass:_,transforms:k})}}const p=new Xn(i,s,h,{disableEvents:o,namespace:l,theme:n},c||console.error,function(m,y){const C=new Map,_=new Set,E=D=>{Object.keys(D).forEach(k=>{let v=C.get(k);v===void 0&&(v=[],C.set(k,v)),v.push(D[k])})};return m.forEach(D=>{const k=D.klass.importDOM;if(k==null||_.has(k))return;_.add(k);const v=k.call(D.klass);v!==null&&E(v)}),y&&E(y),C}(h,f?f.import:void 0),d);return u!==void 0&&(p._pendingEditorState=u,p._dirtyType=rr),p}class Xn{constructor(e,t,n,s,o,i,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=Pt,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=Nl(),this._onError=o,this._htmlConversions=i,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&&O(35);const s=this._commands;s.has(e)||s.set(e,[new Set,new Set,new Set,new Set,new Set]);const o=s.get(e);o===void 0&&O(36,String(e));const i=o[n];return i.add(t),()=>{i.delete(t),o.every(l=>l.size===0)&&s.delete(e)}}registerMutationListener(e,t,n){const s=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,o=this._listeners.mutation;o.set(t,s);const i=n&&n.skipInitialization;return i!==void 0&&i||this.initializeMutationListener(t,s),()=>{o.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&O(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,s=fc(n).get(t.getType());if(!s)return;const o=new Map;for(const i of s.keys())o.set(i,"created");o.size>0&&e(o,{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],o=n.replaceWithKlass;if(o!=null){const u=this.registerNodeTransformToKlass(o,t);s.push(u)}var i,l;return i=this,l=e.getType(),je(i,()=>{const u=ft();if(u.isEmpty())return;if(l==="root")return void se().markDirty();const a=u._nodeMap;for(const[,c]of a)c.markDirty()},i._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{s.forEach(u=>u.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return I(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=Sr(this._config.theme,"root"),s=this._pendingEditorState||this._editorState;if(this._rootElement=e,lu(this,t,e,s),t!==null&&(this._config.disableEvents||yc(t),n!=null&&t.classList.remove(...n)),e!==null){const o=function(l){const u=l.ownerDocument;return u&&u.defaultView||null}(e),i=e.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=o,this._dirtyType=rr,Cl(this),this._updateTags.add("history-merge"),_t(this),this._config.disableEvents||function(l,u){const a=l.ownerDocument,c=Ln.get(a);(c===void 0||c<1)&&a.addEventListener("selectionchange",Gl),Ln.set(a,(c||0)+1),l.__lexicalEditor=u;const f=Vl(l);for(let d=0;d<Ms.length;d++){const[h,p]=Ms[d],m=typeof p=="function"?y=>{oo(y)||(io(y),(u.isEditable()||h==="click")&&p(y,u))}:y=>{if(oo(y))return;io(y);const C=u.isEditable();switch(h){case"cut":return C&&I(u,Xs,y);case"copy":return I(u,zn,y);case"paste":return C&&I(u,In,y);case"dragstart":return C&&I(u,gl,y);case"dragover":return C&&I(u,ml,y);case"dragend":return C&&I(u,Ta,y);case"focus":return C&&I(u,Fa,y);case"blur":return C&&I(u,La,y);case"drop":return C&&I(u,pl,y)}};l.addEventListener(h,m),f.push(()=>{l.removeEventListener(h,m)})}}(e,this),n!=null&&e.classList.add(...n)}else this._editorState=s,this._pendingEditorState=null,this._window=null;Fr("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&O(38);let n=e;n._readOnly&&(n=iu(e),n._selection=e._selection?e._selection.clone():null),Dl(this);const s=this._pendingEditorState,o=this._updateTags,i=t!==void 0?t.tag:null;s===null||s.isEmpty()||(i!=null&&o.add(i),_t(this)),this._pendingEditorState=n,this._dirtyType=rr,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&o.add(i),this._updating||_t(this)}parseEditorState(e,t){return function(n,s,o){const i=bi(),l=pe,u=Be,a=ge,c=s._dirtyElements,f=s._dirtyLeaves,d=s._cloneNotNeeded,h=s._dirtyType;s._dirtyElements=new Map,s._dirtyLeaves=new Set,s._cloneNotNeeded=new Set,s._dirtyType=0,pe=i,Be=!1,ge=s;try{const p=s._nodes;_i(n.root,p),o&&o(),i._readOnly=!0}catch(p){p instanceof Error&&s._onError(p)}finally{s._dirtyElements=c,s._dirtyLeaves=f,s._cloneNotNeeded=d,s._dirtyType=h,pe=l,Be=u,ge=a}return i}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return _t(this),this.getEditorState().read(e,{editor:this})}update(e,t){je(this,e,t)}focus(e,t={}){const n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),je(this,()=>{const s=q(),o=se();s!==null?s.dirty=!0:o.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?o.selectStart():o.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=ze(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Fr("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Xn.version="0.21.0+prod.esm";const uu=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Pc=uu?A.useLayoutEffect:A.useEffect,dn={tag:"history-merge"};function Oc({initialConfig:r,children:e}){const t=A.useMemo(()=>{const{theme:n,namespace:s,nodes:o,onError:i,editorState:l,html:u}=r,a=_a(null,n),c=jc({editable:r.editable,html:u,namespace:s,nodes:o,onError:f=>i(f,c),theme:n});return function(f,d){if(d!==null){if(d===void 0)f.update(()=>{const h=se();if(h.isEmpty()){const p=ce();h.append(p);const m=uu?document.activeElement:null;(q()!==null||m!==null&&m===f.getRootElement())&&p.select()}},dn);else if(d!==null)switch(typeof d){case"string":{const h=f.parseEditorState(d);f.setEditorState(h,dn);break}case"object":f.setEditorState(d,dn);break;case"function":f.update(()=>{se().isEmpty()&&d(f)},dn)}}}(c,l),[c,a]},[]);return Pc(()=>{const n=r.editable,[s]=t;s.setEditable(n===void 0||n)},[]),g.jsx(il.Provider,{value:t,children:e})}const Mc=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?A.useLayoutEffect:A.useEffect;function Rc(r){return{initialValueFn:()=>r.isEditable(),subscribe:e=>r.registerEditableListener(e)}}function $c(){return function(r){const[e]=it(),t=A.useMemo(()=>r(e),[e,r]),[n,s]=A.useState(()=>t.initialValueFn()),o=A.useRef(n);return Mc(()=>{const{initialValueFn:i,subscribe:l}=t,u=i();return o.current!==u&&(o.current=u,s(u)),l(a=>{o.current=a,s(a)})},[t,r]),n}(Rc)}function Ic(){return se().getTextContent()}function zc(r,e=!0){if(r)return!1;let t=Ic();return e&&(t=t.trim()),t===""}function qc(r){if(!zc(r,!1))return!1;const e=se().getChildren(),t=e.length;if(t>1)return!1;for(let n=0;n<t;n++){const s=e[n];if(Z(s))return!1;if(B(s)){if(!sr(s)||s.__indent!==0)return!1;const o=s.getChildren(),i=o.length;for(let l=0;l<i;l++){const u=o[n];if(!M(u))return!1}}}return!0}function au(r){return()=>qc(r)}function Uc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}Uc(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 Wc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Kc=Wc(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 Vc=new Map;function Gc(r){const e={};if(!r)return e;const t=r.split(";");for(const n of t)if(n!==""){const[s,o]=n.split(/:([^]+)/);s&&o&&(e[s.trim()]=o.trim())}return e}function cu(r,e){const t=r.getStartEndPoints();if(e.isSelected(r)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[n,s]=t,o=r.isBackward(),i=n.getNode(),l=s.getNode(),u=e.is(i),a=e.is(l);if(u||a){const[c,f]=zs(r),d=i.is(l),h=e.is(o?l:i),p=e.is(o?i:l);let m,y=0;return d?(y=c>f?f:c,m=c>f?c:f):h?(y=o?f:c,m=void 0):p&&(y=0,m=o?c:f),e.__text=e.__text.slice(y,m),e}}return e}function Hc(r){const e=r.getStyle(),t=Gc(e);Vc.set(e,t)}function Jc(r,e){if(r===null)return;const t=r.getStartEndPoints(),n=t?t[0]:null;if(n!==null&&n.key==="root"){const i=e(),l=se(),u=l.getFirstChild();return void(u?u.replace(i,!0):l.append(i))}const s=r.getNodes(),o=n!==null&&function(i,l){let u=i;for(;u!==null&&u.getParent()!==null&&!l(u);)u=u.getParentOrThrow();return l(u)?u:null}(n.getNode(),So);o&&s.indexOf(o)===-1&&s.push(o);for(let i=0;i<s.length;i++){const l=s[i];if(!So(l))continue;B(l)||Kc(178);const u=e();u.setFormat(l.getFormatType()),u.setIndent(l.getIndent()),l.replace(u,!0)}}function Ao(r,e){const t=Mr(r.focus,e);return Z(t)&&!t.isIsolated()||B(t)&&!t.isInline()&&!t.canBeEmpty()}function Qc(r,e,t,n){r.modify(e?"extend":"move",t,n)}function Yc(r){const e=r.anchor.getNode();return(Ce(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function ko(r,e,t){const n=Yc(r);Qc(r,e,t?!n:n,"character")}function So(r){if(Z(r)||!B(r)||nt(r))return!1;const e=r.getFirstChild(),t=e===null||jt(e)||M(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Xc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Zc=Xc(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 du=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,ed=du&&"documentMode"in document?document.documentMode:null;!(!du||!("InputEvent"in window)||ed)&&"getTargetRanges"in new window.InputEvent("input");function fu(...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 It(...r){return()=>{for(let e=r.length-1;e>=0;e--)r[e]();r.length=0}}function Xr(r,...e){const t=fu(...e);t.length>0&&r.classList.add(...t)}function hu(r,...e){const t=fu(...e);t.length>0&&r.classList.remove(...t)}function td(r,e){let t=r;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function rd(r){const e=Zn(r,t=>B(t)&&!t.isInline());return B(e)||Zc(4,r.__key),e}const Zn=(r,e)=>{let t=r;for(;t!==se()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function bt(r,e){return r!==null&&Object.getPrototypeOf(r).constructor.name===e.name}function nd(r){const e=window.location.origin,t=n=>{if(n.origin!==e)return;const s=r.getRootElement();if(document.activeElement!==s)return;const o=n.data;if(typeof o=="string"){let i;try{i=JSON.parse(o)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){const l=i.payload;if(l&&l.functionId==="makeChanges"){const u=l.args;if(u){const[a,c,f,d,h,p]=u;r.update(()=>{const m=q();if(P(m)){const y=m.anchor;let C=y.getNode(),_=0,E=0;if(M(C)&&a>=0&&c>=0&&(_=a,E=a+c,m.setTextNodeRange(C,_,C,E)),_===E&&f===""||(m.insertRawText(f),C=y.getNode()),M(C)){_=d,E=d+h;const D=C.getTextContentSize();_=_>D?D:_,E=E>D?D:E,m.setTextNodeRange(C,_,C,E)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function pu(r,e){const t=e.body?e.body.childNodes:[];let n=[];const s=[];for(let o=0;o<t.length;o++){const i=t[o];if(!yu.has(i.nodeName)){const l=xu(i,r,s,!1);l!==null&&(n=n.concat(l))}}return function(o){for(const i of o)i.getNextSibling()instanceof vi&&i.insertAfter(Rt());for(const i of o){const l=i.getChildren();for(const u of l)i.insertBefore(u);i.remove()}}(s),n}function gu(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=se().getChildren();for(let s=0;s<n.length;s++)mu(r,n[s],t,e);return t.innerHTML}function mu(r,e,t,n=null){let s=n===null||e.isSelected(n);const o=B(e)&&e.excludeFromCopy("html");let i=e;if(n!==null){let h=gi(e);h=M(h)&&n!==null?cu(n,h):h,i=h}const l=B(i)?i.getChildren():[],u=r._nodes.get(i.getType());let a;a=u&&u.exportDOM!==void 0?u.exportDOM(r,i):i.exportDOM(r);const{element:c,after:f}=a;if(!c)return!1;const d=document.createDocumentFragment();for(let h=0;h<l.length;h++){const p=l[h],m=mu(r,p,d,n);!s&&B(e)&&m&&e.extractWithChild(p,n,"html")&&(s=!0)}if(s&&!o){if((dt(c)||eo(c))&&c.append(d),t.append(c),f){const h=f.call(i,c);h&&(eo(c)?c.replaceChildren(h):c.replaceWith(h))}}else t.append(d);return s}const yu=new Set(["STYLE","SCRIPT"]);function xu(r,e,t,n,s=new Map,o){let i=[];if(yu.has(r.nodeName))return i;let l=null;const u=function(p,m){const{nodeName:y}=p,C=m._htmlConversions.get(y.toLowerCase());let _=null;if(C!==void 0)for(const E of C){const D=E(p);D!==null&&(_===null||(_.priority||0)<=(D.priority||0))&&(_=D)}return _!==null?_.conversion:null}(r,e),a=u?u(r):null;let c=null;if(a!==null){c=a.after;const p=a.node;if(l=Array.isArray(p)?p[p.length-1]:p,l!==null){for(const[,m]of s)if(l=m(l,o),!l)break;l&&i.push(...Array.isArray(p)?p:[l])}a.forChild!=null&&s.set(r.nodeName,a.forChild)}const f=r.childNodes;let d=[];const h=(l==null||!nt(l))&&(l!=null&&qs(l)||n);for(let p=0;p<f.length;p++)d.push(...xu(f[p],e,t,h,new Map(s),l));return c!=null&&(d=c(d)),Tn(r)&&(d=sd(r,d,h?()=>{const p=new vi;return t.push(p),p}:ce)),l==null?d.length>0?i=i.concat(d):Tn(r)&&function(p){return p.nextSibling==null||p.previousSibling==null?!1:Ts(p.nextSibling)&&Ts(p.previousSibling)}(r)&&(i=i.concat(Rt())):B(l)&&l.append(...d),i}function sd(r,e,t){const n=r.style.textAlign,s=[];let o=[];for(let i=0;i<e.length;i++){const l=e[i];if(qs(l))n&&!l.getFormat()&&l.setFormat(n),s.push(l);else if(o.push(l),i===e.length-1||i<e.length-1&&qs(e[i+1])){const u=t();u.setFormat(n),u.append(...o),s.push(u),o=[]}}return s}function id(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var On=id(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 od(r,e=q()){return e==null&&On(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?"":gu(r,e)}function ld(r,e=q()){return e==null&&On(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(ud(r,e))}function To(r,e,t){const n=r.getData("application/x-lexical-editor");if(n)try{const i=JSON.parse(n);if(i.namespace===t._config.namespace&&Array.isArray(i.nodes))return Bo(t,ad(i.nodes),e)}catch{}const s=r.getData("text/html");if(s)try{const i=new DOMParser().parseFromString(function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:u=>u}).createHTML(l):l}(s),"text/html");return Bo(t,pu(t,i),e)}catch{}const o=r.getData("text/plain")||r.getData("text/uri-list");if(o!=null)if(P(e)){const i=o.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let l=0;l<i.length;l++){const u=q();if(P(u)){const a=i[l];a===`
71
+ `?n.push(Rt()):i===" "?n.push(Qr()):n.push(de(i))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,s=this.format,o=this.style;let i=t,l=n;!this.isCollapsed()&&n.isBefore(t)&&(i=n,l=t),i.type==="element"&&function(_,C,y,E){const D=_.getNode(),k=D.getChildAtIndex(_.offset),v=de(),b=De(D)?ce().append(v):v;v.setFormat(y),v.setStyle(E),k===null?D.append(b):k.insertBefore(b),_.is(C)&&C.set(v.__key,0,"text"),_.set(v.__key,0,"text")}(i,l,s,o);const u=i.offset;let a=l.offset;const c=this.getNodes(),d=c.length;let f=c[0];R(f)||M(26);const h=f.getTextContent().length,p=f.getParentOrThrow();let m=c[d-1];if(d===1&&l.type==="element"&&(a=h,l.set(i.key,a,"text")),this.isCollapsed()&&u===h&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!p.canInsertTextAfter()&&f.getNextSibling()===null)){let _=f.getNextSibling();if(R(_)&&_.canInsertTextBefore()&&!Bt(_)||(_=de(),_.setFormat(s),_.setStyle(o),p.canInsertTextAfter()?f.insertAfter(_):p.insertAfter(_)),_.select(0,0),f=_,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&u===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!p.canInsertTextBefore()&&f.getPreviousSibling()===null)){let _=f.getPreviousSibling();if(R(_)&&!Bt(_)||(_=de(),_.setFormat(s),p.canInsertTextBefore()?f.insertBefore(_):p.insertBefore(_)),_.select(),f=_,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&u!==h){const _=de(f.getTextContent());_.setFormat(s),f.replace(_),f=_}else if(!this.isCollapsed()&&e!==""){const _=m.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||B(_)&&(!_.canInsertTextBefore()||!_.canInsertTextAfter()))return this.insertText(""),Ql(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(f.isToken()){const E=de(e);return E.select(),void f.replace(E)}const _=f.getFormat(),C=f.getStyle();if(u!==a||_===s&&C===o){if(wc(f)){const E=de(e);return E.setFormat(s),E.setStyle(o),E.select(),void f.replace(E)}}else{if(f.getTextContent()!==""){const E=de(e);if(E.setFormat(s),E.setStyle(o),E.select(),u===0)f.insertBefore(E,!1);else{const[D]=f.splitText(u);D.insertAfter(E,!1)}return void(E.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(s),f.setStyle(o)}const y=a-u;f=f.spliceText(u,y,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=_,this.style=C))}else{const _=new Set([...f.getParentKeys(),...m.getParentKeys()]),C=B(f)?f:f.getParentOrThrow();let y=B(m)?m:m.getParentOrThrow(),E=m;if(!C.is(y)&&y.isInline())do E=y,y=y.getParentOrThrow();while(y.isInline());if(l.type==="text"&&(a!==0||m.getTextContent()==="")||l.type==="element"&&m.getIndexWithinParent()<a)if(R(m)&&!m.isToken()&&a!==m.getTextContentSize()){if(m.isSegmented()){const w=de(m.getTextContent());m.replace(w),m=w}De(l.getNode())||l.type!=="text"||(m=m.spliceText(0,a,"")),_.add(m.__key)}else{const w=m.getParentOrThrow();w.canBeEmpty()||w.getChildrenSize()!==1?m.remove():w.remove()}else _.add(m.__key);const D=y.getChildren(),k=new Set(c),v=C.is(y),b=C.isInline()&&f.getNextSibling()===null?C:f;for(let w=D.length-1;w>=0;w--){const S=D[w];if(S.is(f)||B(S)&&S.isParentOf(f))break;S.isAttached()&&(!k.has(S)||S.is(E)?v||b.insertAfter(S,!1):S.remove())}if(!v){let w=y,S=null;for(;w!==null;){const $=w.getChildren(),T=$.length;(T===0||$[T-1].is(S))&&(_.delete(w.__key),S=w),w=w.getParent()}}if(f.isToken())if(u===h)f.select();else{const w=de(e);w.select(),f.replace(w)}else f=f.spliceText(u,h-u,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let w=1;w<d;w++){const S=c[w],$=S.__key;_.has($)||S.remove()}}}removeText(){if(this.isCollapsed())return;const{anchor:e,focus:t}=this,n=this.getNodes(),s=this.isBackward()?t:e,o=this.isBackward()?e:t;let i=s.getNode(),l=o.getNode();const u=br(i,yt),a=br(l,yt);R(i)&&i.isToken()&&s.offset<i.getTextContentSize()&&(s.offset=0),o.offset>0&&R(l)&&l.isToken()&&(o.offset=l.getTextContentSize()),n.forEach(d=>{Nr(i,d)||Nr(l,d)||d.getKey()===i.getKey()||d.getKey()===l.getKey()||d.remove()});const c=(d,f)=>{if(d.getTextContent()==="")d.remove();else if(f!==0&&Bt(d)){const h=de(d.getTextContent());return h.setFormat(d.getFormat()),h.setStyle(d.getStyle()),d.replace(h)}};if(i===l&&R(i)){const d=Math.abs(t.offset-e.offset);return i.spliceText(s.offset,d,"",!0),void c(i,d)}if(R(i)){const d=i.getTextContentSize()-s.offset;i.spliceText(s.offset,d,""),i=c(i,d)||i}R(l)&&(l.spliceText(0,o.offset,""),l=c(l,o.offset)||l),i.isAttached()&&R(i)?i.selectEnd():l.isAttached()&&R(l)&&l.selectStart(),B(u)&&B(a)&&u!==a&&(u.append(...a.getChildren()),a.remove(),o.set(s.key,s.offset,s.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void me(null);const n=this.getNodes(),s=[];for(const D of n)R(D)&&s.push(D);const o=D=>{n.forEach(k=>{if(ir(k)){const v=k.getFormatFlags(e,D);k.setTextFormat(v)}})},i=s.length;if(i===0)return this.toggleFormat(e),me(null),void o(t);const l=this.anchor,u=this.focus,a=this.isBackward(),c=a?u:l,d=a?l:u;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);o(m);const _=i-1;let C=s[_];const y=d.type==="text"?d.offset:C.getTextContentSize();if(h.is(C)){if(p===y)return;if(Bt(h)||p===0&&y===h.getTextContentSize())h.setFormat(m);else{const D=h.splitText(p,y),k=p===0?D[0]:D[1];k.setFormat(m),c.type==="text"&&c.set(k.__key,0,"text"),d.type==="text"&&d.set(k.__key,y-p,"text")}return void(this.format=m)}p===0||Bt(h)||([,h]=h.splitText(p),p=0),h.setFormat(m);const E=C.getFormatFlags(e,m);y>0&&(y===C.getTextContentSize()||Bt(C)||([C]=C.splitText(y)),C.setFormat(E));for(let D=f+1;D<_;D++){const k=s[D],v=k.getFormatFlags(e,E);k.setFormat(v)}c.type==="text"&&c.set(h.__key,p,"text"),d.type==="text"&&d.set(C.__key,y,"text"),this.format=m|E}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const p=q();return P(p)||M(134),p.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=br(t,yt),s=e[e.length-1];if(B(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const p=vs(this);n.splice(p,0,e),s.selectEnd()}return}if(!e.some(p=>(B(p)||Z(p))&&!p.isInline())){B(n)||M(211,t.constructor.name,t.getType());const p=vs(this);return n.splice(p,0,e),void s.selectEnd()}const o=function(p){const m=ce();let _=null;for(let C=0;C<p.length;C++){const y=p[C],E=jt(y);if(E||Z(y)&&y.isInline()||B(y)&&y.isInline()||R(y)||y.isParentRequired()){if(_===null&&(_=y.createParentElementNode(),m.append(_),E))continue;_!==null&&_.append(y)}else m.append(y),_=null}return m}(e),i=o.getLastDescendant(),l=o.getChildren(),u=!B(n)||!n.isEmpty()?this.insertParagraph():null,a=l[l.length-1];let c=l[0];var d;B(d=c)&&yt(d)&&!d.isEmpty()&&B(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(B(n)||M(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=l[1]),c&&(n===null&&M(212,t.constructor.name,t.getType()),function(p,m,_){const C=m.getParentOrThrow().getLastChild();let y=m;const E=[m];for(;y!==C;)y.getNextSibling()||M(140),y=y.getNextSibling(),E.push(y);let D=p;for(const k of E)D=D.insertAfter(k)}(n,c));const f=br(i,yt);u&&B(f)&&(u.canMergeWhenEmpty()||yt(a))&&(f.append(...u.getChildren()),u.remove()),B(n)&&n.isEmpty()&&n.remove(),i.selectEnd();const h=B(n)?n.getLastChild():null;jt(h)&&f!==n&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=ce();return ne().splice(this.anchor.offset,0,[i]),i.select(),i}const e=vs(this),t=br(this.anchor.getNode(),yt);B(t)||M(213);const n=t.getChildAtIndex(e),s=n?[n,...n.getNextSiblings()]:[],o=t.insertNewAfter(this,!1);return o?(o.append(...s),o.selectStart(),o):null}insertLineBreak(e){const t=Rt();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,o=this.focus;let i=e[0],l=e[n];const[u,a]=zs(this);if(t===0)return[];if(t===1){if(R(i)&&!this.isCollapsed()){const d=u>a?a:u,f=u>a?u:a,h=i.splitText(d,f),p=d===0?h[0]:h[1];return p!=null?[p]:[]}return[i]}const c=s.isBefore(o);if(R(i)){const d=c?u:a;d===i.getTextContentSize()?e.shift():d!==0&&([,i]=i.splitText(d),e[0]=i)}if(R(l)){const d=l.getTextContent().length,f=c?a:u;f===0?e.pop():f!==d&&([l]=l.splitText(f),e[n]=l)}return e}modify(e,t,n){const s=this.focus,o=this.anchor,i=e==="move",l=$r(s,t);if(Z(l)&&!l.isIsolated()){if(i&&l.isKeyboardSelectable()){const h=mo();return h.add(l.__key),void nt(h)}const f=t?l.getPreviousSibling():l.getNextSibling();if(R(f)){const h=f.__key,p=t?f.getTextContent().length:0;return s.set(h,p,"text"),void(i&&o.set(h,p,"text"))}{const h=l.getParentOrThrow();let p,m;return B(f)?(m=f.__key,p=t?f.getChildrenSize():0):(p=l.getIndexWithinParent(),m=h.__key,t||p++),s.set(m,p,"element"),void(i&&o.set(m,p,"element"))}}const u=ie(),a=$e(u._window);if(!a)return;const c=u._blockCursorElement,d=u._rootElement;if(d===null||c===null||!B(l)||l.isInline()||l.canBeEmpty()||pi(c,u,d),function(f,h,p,m){f.modify(h,p,m)}(a,e,t?"backward":"forward",n),a.rangeCount>0){const f=a.getRangeAt(0),h=this.anchor.getNode(),p=De(h)?h:lc(h);if(this.applyDOMRange(f),this.dirty=!0,!i){const m=this.getNodes(),_=[];let C=!1;for(let y=0;y<m.length;y++){const E=m[y];Nr(E,p)?_.push(E):C=!0}if(C&&_.length>0)if(t){const y=_[0];B(y)?y.selectStart():y.getParentOrThrow().selectStart()}else{const y=_[_.length-1];B(y)?y.selectEnd():y.getParentOrThrow().selectEnd()}a.anchorNode===f.startContainer&&a.anchorOffset===f.startOffset||function(y){const E=y.focus,D=y.anchor,k=D.key,v=D.offset,b=D.type;xt(D,E.key,E.offset,E.type),xt(E,k,v,b),y._cachedNodes=null}(this)}}}forwardDeletion(e,t,n){if(!n&&(e.type==="element"&&B(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const s=t.getParent(),o=t.getNextSibling()||(s===null?null:s.getNextSibling());if(B(o)&&o.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 o=this.focus,i=$r(o,e);if(Z(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&B(s)&&s.getChildrenSize()===0){s.remove();const l=mo();l.add(i.__key),nt(l)}else i.remove(),ie().dispatchCommand(Js,void 0);return}if(!e&&B(i)&&B(s)&&s.isEmpty())return s.remove(),void i.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=o.type==="text"?o.getNode():null;if(s=n.type==="text"?n.getNode():null,l!==null&&l.isSegmented()){const u=o.offset,a=l.getTextContentSize();if(l.is(s)||e&&u!==a||!e&&u!==0)return void ho(l,e,u)}else if(s!==null&&s.isSegmented()){const u=n.offset,a=s.getTextContentSize();if(s.is(l)||e&&u!==0||!e&&u!==a)return void ho(s,e,u)}(function(u,a){const c=u.anchor,d=u.focus,f=c.getNode(),h=d.getNode();if(f===h&&c.type==="text"&&d.type==="text"){const p=c.offset,m=d.offset,_=p<m,C=_?p:m,y=_?m:p,E=y-1;C!==E&&(Bl(f.getTextContent().slice(C,y))||(a?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()&&De(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 et(r){return r instanceof Yn}function fo(r){const e=r.offset;if(r.type==="text")return e;const t=r.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function zs(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]:[fo(t),fo(n)]}function ho(r,e,t){const n=r,s=n.getTextContent().split(/(?=\s)/g),o=s.length;let i=0,l=0;for(let a=0;a<o;a++){const c=a===o-1;if(l=i,i+=s[a].length,e&&i===t||i>t||c){s.splice(a,1),c&&(l=void 0);break}}const u=s.join("").trim();u===""?n.remove():(n.setTextContent(u),n.select(l,l))}function po(r,e,t,n){let s,o=e;if(r.nodeType===Kr){let i=!1;const l=r.childNodes,u=l.length,a=n._blockCursorElement;o===u&&(i=!0,o=u-1);let c=l[o],d=!1;if(c===a)c=l[o+1],d=!0;else if(a!==null){const f=a.parentNode;r===f&&e>Array.prototype.indexOf.call(f.children,a)&&o--}if(s=Yt(c),R(s))o=Hi(s,i);else{let f=Yt(r);if(f===null)return null;if(B(f)){const h=n.getElementByKey(f.getKey());h===null&&M(214),[f,o]=f.getDOMSlot(h).resolveChildIndex(f,h,r,e),B(f)||M(215),i&&o>=f.getChildrenSize()&&(o=Math.max(0,f.getChildrenSize()-1));let m=f.getChildAtIndex(o);if(B(m)&&function(_,C,y){const E=_.getParent();return y===null||E===null||!E.canBeEmpty()||E!==y.getNode()}(m,0,t)){const _=i?m.getLastDescendant():m.getFirstDescendant();_===null?f=m:(m=_,f=B(m)?m:m.getParentOrThrow()),o=0}R(m)?(s=m,f=null,o=Hi(m,i)):m!==f&&i&&!d&&(B(f)||M(216),o=Math.min(f.getChildrenSize(),o+1))}else{const h=f.getIndexWithinParent();o=e===0&&Z(f)&&Yt(r)===f?h:h+1,f=f.getParentOrThrow()}if(B(f))return it(f.__key,o,"element")}}else s=Yt(r);return R(s)?it(s.__key,o,"text"):null}function go(r,e,t){const n=r.offset,s=r.getNode();if(n===0){const o=s.getPreviousSibling(),i=s.getParent();if(e){if((t||!e)&&o===null&&B(i)&&i.isInline()){const l=i.getPreviousSibling();R(l)&&(r.key=l.__key,r.offset=l.getTextContent().length)}}else B(o)&&!t&&o.isInline()?(r.key=o.__key,r.offset=o.getChildrenSize(),r.type="element"):R(o)&&(r.key=o.__key,r.offset=o.getTextContent().length)}else if(n===s.getTextContent().length){const o=s.getNextSibling(),i=s.getParent();if(e&&B(o)&&o.isInline())r.key=o.__key,r.offset=0,r.type="element";else if((t||e)&&o===null&&B(i)&&i.isInline()&&!i.canInsertTextAfter()){const l=i.getNextSibling();R(l)&&(r.key=l.__key,r.offset=0)}}}function Ql(r,e,t){if(r.type==="text"&&e.type==="text"){const n=r.isBefore(e),s=r.is(e);go(r,n,s),go(e,!n,s),s&&(e.key=r.key,e.offset=r.offset,e.type=r.type);const o=ie();if(o.isComposing()&&o._compositionKey!==r.key&&P(t)){const i=t.anchor,l=t.focus;xt(r,i.key,i.offset,i.type),xt(e,l.key,l.offset,l.type)}}}function Yl(r,e,t,n,s,o){if(r===null||t===null||!Vr(s,r,t))return null;const i=po(r,e,P(o)?o.anchor:null,s);if(i===null)return null;const l=po(t,n,P(o)?o.focus:null,s);if(l===null)return null;if(i.type==="element"&&l.type==="element"){const u=Yt(r),a=Yt(t);if(Z(u)&&Z(a))return null}return Ql(i,l,o),[i,l]}function qs(r){return B(r)&&!r.isInline()}function Xl(r,e,t,n,s,o){const i=ht(),l=new Et(it(r,e,s),it(t,n,o),0,"");return l.dirty=!0,i._selection=l,l}function Ac(){const r=it("root",0,"element"),e=it("root",0,"element");return new Et(r,e,0,"")}function mo(){return new Yn(new Set)}function xi(r,e,t,n){const s=t._window;if(s===null)return null;const o=n||s.event,i=o?o.type:void 0,l=i==="selectionchange",u=!Ss&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&o&&o.detail===3||i==="drop"||i===void 0);let a,c,d,f;if(P(r)&&!u)return r.clone();if(e===null)return null;if(a=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,l&&P(r)&&!Vr(t,a,c))return r.clone();const h=Yl(a,d,c,f,t,r);if(h===null)return null;const[p,m]=h;return new Et(p,m,P(r)?r.format:0,P(r)?r.style:"")}function q(){return ht()._selection}function Yr(){return ie()._editorState._selection}function Pn(r,e,t,n=1){const s=r.anchor,o=r.focus,i=s.getNode(),l=o.getNode();if(!e.is(i)&&!e.is(l))return;const u=e.__key;if(r.isCollapsed()){const a=s.offset;if(t<=a&&n>0||t<a&&n<0){const c=Math.max(0,a+n);s.set(u,c,"element"),o.set(u,c,"element"),yo(r)}}else{const a=r.isBackward(),c=a?o:s,d=c.getNode(),f=a?s:o,h=f.getNode();if(e.is(d)){const p=c.offset;(t<=p&&n>0||t<p&&n<0)&&c.set(u,Math.max(0,p+n),"element")}if(e.is(h)){const p=f.offset;(t<=p&&n>0||t<p&&n<0)&&f.set(u,Math.max(0,p+n),"element")}}yo(r)}function yo(r){const e=r.anchor,t=e.offset,n=r.focus,s=n.offset,o=e.getNode(),i=n.getNode();if(r.isCollapsed()){if(!B(o))return;const l=o.getChildrenSize(),u=t>=l,a=u?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(R(a)){let c=0;u&&(c=a.getTextContentSize()),e.set(a.__key,c,"text"),n.set(a.__key,c,"text")}}else{if(B(o)){const l=o.getChildrenSize(),u=t>=l,a=u?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(R(a)){let c=0;u&&(c=a.getTextContentSize()),e.set(a.__key,c,"text")}}if(B(i)){const l=i.getChildrenSize(),u=s>=l,a=u?i.getChildAtIndex(l-1):i.getChildAtIndex(s);if(R(a)){let c=0;u&&(c=a.getTextContentSize()),n.set(a.__key,c,"text")}}}}function On(r,e,t,n,s){let o=null,i=0,l=null;n!==null?(o=n.__key,R(n)?(i=n.getTextContentSize(),l="text"):B(n)&&(i=n.getChildrenSize(),l="element")):s!==null&&(o=s.__key,R(s)?l="text":B(s)&&(l="element")),o!==null&&l!==null?r.set(o,i,l):(i=e.getIndexWithinParent(),i===-1&&(i=t.getChildrenSize()),r.set(t.__key,i,"element"))}function xo(r,e,t,n,s){r.type==="text"?(r.key=t,e||(r.offset+=s)):r.offset>n.getIndexWithinParent()&&(r.offset-=1)}function kc(r,e,t,n,s,o,i){const l=n.anchorNode,u=n.focusNode,a=n.anchorOffset,c=n.focusOffset,d=document.activeElement;if(s.has("collaboration")&&d!==o||d!==null&&ui(d))return;if(!P(e))return void(r!==null&&Vr(t,l,u)&&n.removeAllRanges());const f=e.anchor,h=e.focus,p=f.key,m=h.key,_=Tn(t,p),C=Tn(t,m),y=f.offset,E=h.offset,D=e.format,k=e.style,v=e.isCollapsed();let b=_,w=C,S=!1;if(f.type==="text"){b=An(_);const O=f.getNode();S=O.getFormat()!==D||O.getStyle()!==k}else P(r)&&r.anchor.type==="text"&&(S=!0);var $,T,N,j,L;if(h.type==="text"&&(w=An(C)),b!==null&&w!==null&&(v&&(r===null||S||P(r)&&(r.format!==D||r.style!==k))&&($=D,T=k,N=y,j=p,L=performance.now(),Ul=[$,T,N,j,L]),a!==y||c!==E||l!==b||u!==w||n.type==="Range"&&v||(d!==null&&o.contains(d)||o.focus({preventScroll:!0}),f.type==="element"))){try{n.setBaseAndExtent(b,y,w,E)}catch{}if(!s.has("skip-scroll-into-view")&&e.isCollapsed()&&o!==null&&o===document.activeElement){const O=e instanceof Et&&e.anchor.type==="element"?b.childNodes[y]||null:n.rangeCount>0?n.getRangeAt(0):null;if(O!==null){let G;if(O instanceof Text){const he=document.createRange();he.selectNode(O),G=he.getBoundingClientRect()}else G=O.getBoundingClientRect();(function(he,oe,Ne){const we=Ne.ownerDocument,Ye=we.defaultView;if(Ye===null)return;let{top:Ie,bottom:je}=oe,Xe=0,Ee=0,te=Ne;for(;te!==null;){const Ae=te===we.body;if(Ae)Xe=0,Ee=Hn(he).innerHeight;else{const re=te.getBoundingClientRect();Xe=re.top,Ee=re.bottom}let xe=0;if(Ie<Xe?xe=-(Xe-Ie):je>Ee&&(xe=je-Ee),xe!==0)if(Ae)Ye.scrollBy(0,xe);else{const re=te.scrollTop;te.scrollTop+=xe;const Pe=te.scrollTop-re;Ie-=Pe,je-=Pe}if(Ae)break;te=Gr(te)}})(t,G,o)}}Rs=!0}}function Zl(r){let e=q()||Yr();e===null&&(e=ne().selectEnd()),e.insertNodes(r)}function vs(r){let e=r;r.isCollapsed()||e.removeText();const t=q();P(t)&&(e=t),P(e)||M(161);const n=e.anchor;let s=n.getNode(),o=n.offset;for(;!yt(s);)[s,o]=Sc(s,o);return o}function Sc(r,e){const t=r.getParent();if(!t){const s=ce();return ne().append(s),s.select(),[ne(),0]}if(R(r)){const s=r.splitText(e);if(s.length===0)return[t,r.getIndexWithinParent()];const o=e===0?0:1;return[t,s[0].getIndexWithinParent()+o]}if(!B(r)||e===0)return[t,r.getIndexWithinParent()];const n=r.getChildAtIndex(e);if(n){const s=new Et(it(r.__key,e,"element"),it(r.__key,e,"element"),0,""),o=r.insertNewAfter(s);o&&o.append(n,...n.getNextSiblings())}return[t,r.getIndexWithinParent()+1]}let pe=null,ge=null,Te=!1,Ds=!1,xn=0;const _o={characterData:!0,childList:!0,subtree:!0};function Xr(){return Te||pe!==null&&pe._readOnly}function Se(){Te&&M(13)}function eu(){xn>99&&M(14)}function ht(){return pe===null&&M(195,tu()),pe}function ie(){return ge===null&&M(196,tu()),ge}function tu(){let r=0;const e=new Set,t=Zn.version;if(typeof window<"u")for(const s of document.querySelectorAll("[contenteditable]")){const o=Kn(s);if(ai(o))r++;else if(o){let i=String(o.constructor.version||"<0.17.1");i===t&&(i+=" (separately built, likely a bundler configuration issue)"),e.add(i)}}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 Tc(){return ge}function bo(r,e,t){const n=e.__type,s=function(l,u){const a=l._nodes.get(u);return a===void 0&&M(30,u),a}(r,n);let o=t.get(n);o===void 0&&(o=Array.from(s.transforms),t.set(n,o));const i=o.length;for(let l=0;l<i&&(o[l](e),e.isAttached());l++);}function vo(r,e){return r!==void 0&&r.__key!==e&&r.isAttached()}function ru(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 Bc(r){return _i(r,ie()._nodes)}function _i(r,e){const t=r.type,n=e.get(t);n===void 0&&M(17,t);const s=n.klass;r.type!==s.getType()&&M(18,s.name);const o=s.importJSON(r),i=r.children;if(B(o)&&Array.isArray(i))for(let l=0;l<i.length;l++){const u=_i(i[l],e);o.append(u)}return o}function Do(r,e,t){const n=pe,s=Te,o=ge;pe=e,Te=!0,ge=r;try{return t()}finally{pe=n,Te=s,ge=o}}function bt(r,e){const t=r._pendingEditorState,n=r._rootElement,s=r._headless||n===null;if(t===null)return;const o=r._editorState,i=o._selection,l=t._selection,u=r._dirtyType!==Pt,a=pe,c=Te,d=ge,f=r._updating,h=r._observer;let p=null;if(r._pendingEditorState=null,r._editorState=t,!s&&u&&h!==null){ge=r,pe=t,Te=!1,r._updating=!0;try{const v=r._dirtyType,b=r._dirtyElements,w=r._dirtyLeaves;h.disconnect(),p=mc(o,t,r,v,b,w)}catch(v){if(v instanceof Error&&r._onError(v),Ds)throw v;return lu(r,null,n,t),Cl(r),r._dirtyType=nr,Ds=!0,bt(r,o),void(Ds=!1)}finally{h.observe(n,_o),r._updating=f,pe=a,Te=c,ge=d}}t._readOnly||(t._readOnly=!0);const m=r._dirtyLeaves,_=r._dirtyElements,C=r._normalizedNodes,y=r._updateTags,E=r._deferred;u&&(r._dirtyType=Pt,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set,r._updateTags=new Set),function(v,b){const w=v._decorators;let S=v._pendingDecorators||w;const $=b._nodeMap;let T;for(T in S)$.has(T)||(S===w&&(S=Sl(v)),delete S[T])}(r,t);const D=s?null:$e(r._window);if(r._editable&&D!==null&&(u||l===null||l.dirty)){ge=r,pe=t;try{if(h!==null&&h.disconnect(),u||l===null||l.dirty){const v=r._blockCursorElement;v!==null&&pi(v,r,n),kc(i,l,r,D,y,n)}uc(r,n,l),h!==null&&h.observe(n,_o)}finally{ge=d,pe=a}}p!==null&&function(v,b,w,S,$){const T=Array.from(v._listeners.mutation),N=T.length;for(let j=0;j<N;j++){const[L,O]=T[j],G=b.get(O);G!==void 0&&L(G,{dirtyLeaves:S,prevEditorState:$,updateTags:w})}}(r,p,y,m,o),P(l)||l===null||i!==null&&i.is(l)||r.dispatchCommand(Js,void 0);const k=r._pendingDecorators;k!==null&&(r._decorators=k,r._pendingDecorators=null,jr("decorator",r,!0,k)),function(v,b,w){const S=Gi(b),$=Gi(w);S!==$&&jr("textcontent",v,!0,$)}(r,e||o,t),jr("update",r,!0,{dirtyElements:_,dirtyLeaves:m,editorState:t,normalizedNodes:C,prevEditorState:e||o,tags:y}),function(v,b){if(v._deferred=[],b.length!==0){const w=v._updating;v._updating=!0;try{for(let S=0;S<b.length;S++)b[S]()}finally{v._updating=w}}}(r,E),function(v){const b=v._updates;if(b.length!==0){const w=b.shift();if(w){const[S,$]=w;su(v,S,$)}}}(r)}function jr(r,e,t,...n){const s=e._updating;e._updating=t;try{const o=Array.from(e._listeners[r]);for(let i=0;i<o.length;i++)o[i].apply(null,n)}finally{e._updating=s}}function nu(r,e,t){if(r._updating===!1||ge!==r){let s=!1;return r.update(()=>{s=nu(r,e,t)}),s}const n=ci(r);for(let s=4;s>=0;s--)for(let o=0;o<n.length;o++){const i=n[o]._commands.get(e);if(i!==void 0){const l=i[s];if(l!==void 0){const u=Array.from(l),a=u.length;for(let c=0;c<a;c++)if(u[c](t,r)===!0)return!0}}}return!1}function Co(r,e){const t=r._updates;let n=e||!1;for(;t.length!==0;){const s=t.shift();if(s){const[o,i]=s;let l;if(i!==void 0){if(l=i.onUpdate,i.skipTransforms&&(n=!0),i.discrete){const u=r._pendingEditorState;u===null&&M(191),u._flushSync=!0}l&&r._deferred.push(l),ru(r,i.tag)}o()}}return n}function su(r,e,t){const n=r._updateTags;let s,o=!1,i=!1;t!==void 0&&(s=t.onUpdate,ru(r,t.tag),o=t.skipTransforms||!1,i=t.discrete||!1),s&&r._deferred.push(s);const l=r._editorState;let u=r._pendingEditorState,a=!1;(u===null||u._readOnly)&&(u=r._pendingEditorState=iu(u||l),a=!0),u._flushSync=i;const c=pe,d=Te,f=ge,h=r._updating;pe=u,Te=!1,r._updating=!0,ge=r;try{a&&(r._headless?l._selection!==null&&(u._selection=l._selection.clone()):u._selection=function(C){const y=C.getEditorState()._selection,E=$e(C._window);return P(y)||y==null?xi(y,E,C,null):y.clone()}(r));const m=r._compositionKey;e(),o=Co(r,o),function(C,y){const E=y.getEditorState()._selection,D=C._selection;if(P(D)){const k=D.anchor,v=D.focus;let b;if(k.type==="text"&&(b=k.getNode(),b.selectionTransform(E,D)),v.type==="text"){const w=v.getNode();b!==w&&w.selectionTransform(E,D)}}}(u,r),r._dirtyType!==Pt&&(o?function(C,y){const E=y._dirtyLeaves,D=C._nodeMap;for(const k of E){const v=D.get(k);R(v)&&v.isAttached()&&v.isSimpleText()&&!v.isUnmergeable()&&Ki(v)}}(u,r):function(C,y){const E=y._dirtyLeaves,D=y._dirtyElements,k=C._nodeMap,v=_t(),b=new Map;let w=E,S=w.size,$=D,T=$.size;for(;S>0||T>0;){if(S>0){y._dirtyLeaves=new Set;for(const N of w){const j=k.get(N);R(j)&&j.isAttached()&&j.isSimpleText()&&!j.isUnmergeable()&&Ki(j),j!==void 0&&vo(j,v)&&bo(y,j,b),E.add(N)}if(w=y._dirtyLeaves,S=w.size,S>0){xn++;continue}}y._dirtyLeaves=new Set,y._dirtyElements=new Map;for(const N of $){const j=N[0],L=N[1];if(j!=="root"&&!L)continue;const O=k.get(j);O!==void 0&&vo(O,v)&&bo(y,O,b),D.set(j,L)}w=y._dirtyLeaves,S=w.size,$=y._dirtyElements,T=$.size,xn++}y._dirtyLeaves=E,y._dirtyElements=D}(u,r),Co(r),function(C,y,E,D){const k=C._nodeMap,v=y._nodeMap,b=[];for(const[w]of D){const S=v.get(w);S!==void 0&&(S.isAttached()||(B(S)&&jl(S,w,k,v,b,D),k.has(w)||D.delete(w),b.push(w)))}for(const w of b)v.delete(w);for(const w of E){const S=v.get(w);S===void 0||S.isAttached()||(k.has(w)||E.delete(w),v.delete(w))}}(l,u,r._dirtyLeaves,r._dirtyElements)),m!==r._compositionKey&&(u._flushSync=!0);const _=u._selection;if(P(_)){const C=u._nodeMap,y=_.anchor.key,E=_.focus.key;C.get(y)!==void 0&&C.get(E)!==void 0||M(19)}else et(_)&&_._nodes.size===0&&(u._selection=null)}catch(m){return m instanceof Error&&r._onError(m),r._pendingEditorState=l,r._dirtyType=nr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),void bt(r)}finally{pe=c,Te=d,ge=f,r._updating=h,xn=0}r._dirtyType!==Pt||function(m,_){const C=_.getEditorState()._selection,y=m._selection;if(y!==null){if(y.dirty||!y.is(C))return!0}else if(C!==null)return!0;return!1}(u,r)?u._flushSync?(u._flushSync=!1,bt(r)):a&&rc(()=>{bt(r)}):(u._flushSync=!1,a&&(n.clear(),r._deferred=[],r._pendingEditorState=null))}function Fe(r,e,t){r._updating?r._updates.push([e,t]):su(r,e,t)}class Pr{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new Pr(this.element,e,this.after)}withAfter(e){return new Pr(this.element,this.before,e)}withElement(e){return new Pr(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&M(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&M(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&M(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"&&(Wr||Un);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,o=document.createElement("br");if(n.insertBefore(o,s),e){const i=document.createElement("img");i.setAttribute("data-lexical-linebreak","true"),i.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",i.alt="",n.insertBefore(i,o),n.__lexicalLineBreak=i}else n.__lexicalLineBreak=o}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 u=this.getFirstChildOffset();return[e,Math.min(u+e.getChildrenSize(),Math.max(u,s))]}const o=wo(t,n);o.push(s);const i=wo(t,this.element);let l=e.getIndexWithinParent();for(let u=0;u<i.length;u++){const a=o[u],c=i[u];if(a===void 0||a<c)break;if(a>c){l+=1;break}}return[e.getParentOrThrow(),l]}}function wo(r,e){const t=[];let n=e;for(;n!==r&&n!==null;n=e.parentNode){let s=0;for(let o=n.previousSibling;o!==null;o=n.previousSibling)s++;t.push(s)}return n!==r&&M(225),t.reverse()}class pt extends Qn{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 Va[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=ie()._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(R(t)&&e.push(t),B(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;B(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;B(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 o=t[n-1];return B(o)&&o.getLastDescendant()||o||null}const s=t[e];return B(s)&&s.getFirstDescendant()||s||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:ye(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&M(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:ye(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&M(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 o=t[s];e+=o.getTextContent(),B(o)&&s!==n-1&&!o.isInline()&&(e+=dt)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const o=t[s];e+=o.getTextContentSize(),B(o)&&s!==n-1&&!o.isInline()&&(e+=dt.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=qi[e];return!!(this.getFormat()&t)}return!1}select(e,t){Se();const n=q();let s=e,o=t;const i=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const u=this.getFirstChild();if(R(u)||B(u))return u.select(0,0)}else if(!(e!==void 0&&e!==i||t!==void 0&&t!==i)){const u=this.getLastChild();if(R(u)||B(u))return u.select()}}s===void 0&&(s=i),o===void 0&&(o=i);const l=this.__key;return P(n)?(n.anchor.set(l,s,"element"),n.focus.set(l,o,"element"),n.dirty=!0,n):Xl(l,s,l,o,"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!==""?qi[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,o=this.getChildrenSize(),i=this.getWritable();e+t<=o||M(226,String(e),String(t),String(o));const l=i.__key,u=[],a=[],c=this.getChildAtIndex(e+t);let d=null,f=o-t+s;if(e!==0)if(e===o)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&&M(100);const _=p.getNextSibling(),C=p.__key;Lt(p.getWritable()),a.push(C),p=_}}let h=d;for(let p=0;p<s;p++){const m=n[p];h!==null&&m.is(h)&&(d=h=h.getPreviousSibling());const _=m.getWritable();_.__parent===l&&f--,Lt(_);const C=m.__key;if(h===null)i.__first=C,_.__prev=null;else{const y=h.getWritable();y.__next=C,_.__prev=y.__key}m.__key===l&&M(76),_.__parent=l,u.push(C),h=m}if(e+t===o)h!==null&&(h.getWritable().__next=null,i.__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(i.__size=f,a.length){const p=q();if(P(p)){const m=new Set(a),_=new Set(u),{anchor:C,focus:y}=p;Eo(C,m,_)&&On(C,C.getNode(),this,d,c),Eo(y,m,_)&&On(y,y.getNode(),this,d,c),f!==0||this.canBeEmpty()||st(this)||this.remove()}}return i}getDOMSlot(e){return new Pr(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&ft(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 o=this.getFirstChild();o;o=o.getNextSibling()){const i=t.getElementByKey(o.getKey());i!==null&&(s==null?(n.insertChild(i),s=i):s!==i&&n.replaceChild(i,s),s=s.nextSibling)}}}function B(r){return r instanceof pt}function Eo(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 Nc extends Qn{constructor(e){super(e)}decorate(e,t){M(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Z(r){return r instanceof Nc}class Zr extends pt{static getType(){return"root"}static clone(){return new Zr}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){M(51)}getTextContent(){const e=this.__cachedText;return!Xr()&&ie()._dirtyType!==Pt||e===null?super.getTextContent():e}remove(){M(52)}replace(e){M(53)}insertBefore(e){M(54)}insertAfter(e){M(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];B(n)||Z(n)||M(56)}return super.append(...e)}static importJSON(e){const t=ne();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 De(r){return r instanceof Zr}function iu(r){return new Xn(new Map(r._nodeMap))}function bi(){return new Xn(new Map([["root",new Zr]]))}function ou(r){const e=r.exportJSON(),t=r.constructor;if(e.type!==t.getType()&&M(130,t.name),B(r)){const n=e.children;Array.isArray(n)||M(59,t.name);const s=r.getChildren();for(let o=0;o<s.length;o++){const i=ou(s[o]);n.push(i)}}return e}class Xn{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 Do(t&&t.editor||null,this,e)}clone(e){const t=new Xn(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return Do(null,this,()=>({root:ou(ne())}))}}class vi extends pt{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class lr extends pt{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=Ot[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return kn(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 lr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=Br(e.theme,"paragraph");return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Fc,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&ft(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=ce();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=ce();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||R(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 Fc(r){const e=ce();return r.style&&(e.setFormat(r.style.textAlign),mi(r,e)),{node:e}}function ce(){return ot(new lr)}function ir(r){return r instanceof lr}const Y=0,Xt=1,Lc=4;function lu(r,e,t,n){const s=r._keyToDOMMap;s.clear(),r._editorState=bi(),r._pendingEditorState=n,r._compositionKey=null,r._dirtyType=Pt,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),r._normalizedNodes=new Set,r._updateTags=new Set,r._updates=[],r._blockCursorElement=null;const o=r._observer;o!==null&&(o.disconnect(),r._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",s.set("root",t))}function jc(r){const e=r||{},t=Tc(),n=e.theme||{},s=r===void 0?t:e.parentEditor||null,o=e.disableEvents||!1,i=bi(),l=e.namespace||(s!==null?s._config.namespace:Nl()),u=e.editorState,a=[Zr,or,Hr,Jr,lr,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<a.length;m++){let _=a[m],C=null,y=null;if(typeof _!="function"){const v=_;_=v.replace,C=v.with,y=v.withKlass||null}const E=_.getType(),D=_.transform(),k=new Set;D!==null&&k.add(D),h.set(E,{exportDOM:d&&d.export?d.export.get(_):void 0,klass:_,replace:C,replaceWithKlass:y,transforms:k})}}const p=new Zn(i,s,h,{disableEvents:o,namespace:l,theme:n},c||console.error,function(m,_){const C=new Map,y=new Set,E=D=>{Object.keys(D).forEach(k=>{let v=C.get(k);v===void 0&&(v=[],C.set(k,v)),v.push(D[k])})};return m.forEach(D=>{const k=D.klass.importDOM;if(k==null||y.has(k))return;y.add(k);const v=k.call(D.klass);v!==null&&E(v)}),_&&E(_),C}(h,d?d.import:void 0),f);return u!==void 0&&(p._pendingEditorState=u,p._dirtyType=nr),p}class Zn{constructor(e,t,n,s,o,i,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=Pt,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=Nl(),this._onError=o,this._htmlConversions=i,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&&M(35);const s=this._commands;s.has(e)||s.set(e,[new Set,new Set,new Set,new Set,new Set]);const o=s.get(e);o===void 0&&M(36,String(e));const i=o[n];return i.add(t),()=>{i.delete(t),o.every(l=>l.size===0)&&s.delete(e)}}registerMutationListener(e,t,n){const s=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,o=this._listeners.mutation;o.set(t,s);const i=n&&n.skipInitialization;return i!==void 0&&i||this.initializeMutationListener(t,s),()=>{o.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&M(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,s=fc(n).get(t.getType());if(!s)return;const o=new Map;for(const i of s.keys())o.set(i,"created");o.size>0&&e(o,{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],o=n.replaceWithKlass;if(o!=null){const u=this.registerNodeTransformToKlass(o,t);s.push(u)}var i,l;return i=this,l=e.getType(),Fe(i,()=>{const u=ht();if(u.isEmpty())return;if(l==="root")return void ne().markDirty();const a=u._nodeMap;for(const[,c]of a)c.markDirty()},i._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{s.forEach(u=>u.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return I(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=Br(this._config.theme,"root"),s=this._pendingEditorState||this._editorState;if(this._rootElement=e,lu(this,t,e,s),t!==null&&(this._config.disableEvents||yc(t),n!=null&&t.classList.remove(...n)),e!==null){const o=function(l){const u=l.ownerDocument;return u&&u.defaultView||null}(e),i=e.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=o,this._dirtyType=nr,Cl(this),this._updateTags.add("history-merge"),bt(this),this._config.disableEvents||function(l,u){const a=l.ownerDocument,c=jn.get(a);(c===void 0||c<1)&&a.addEventListener("selectionchange",Gl),jn.set(a,(c||0)+1),l.__lexicalEditor=u;const d=Vl(l);for(let f=0;f<Ms.length;f++){const[h,p]=Ms[f],m=typeof p=="function"?_=>{oo(_)||(io(_),(u.isEditable()||h==="click")&&p(_,u))}:_=>{if(oo(_))return;io(_);const C=u.isEditable();switch(h){case"cut":return C&&I(u,Xs,_);case"copy":return I(u,qn,_);case"paste":return C&&I(u,zn,_);case"dragstart":return C&&I(u,gl,_);case"dragover":return C&&I(u,ml,_);case"dragend":return C&&I(u,Ta,_);case"focus":return C&&I(u,Fa,_);case"blur":return C&&I(u,La,_);case"drop":return C&&I(u,pl,_)}};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;jr("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&M(38);let n=e;n._readOnly&&(n=iu(e),n._selection=e._selection?e._selection.clone():null),Dl(this);const s=this._pendingEditorState,o=this._updateTags,i=t!==void 0?t.tag:null;s===null||s.isEmpty()||(i!=null&&o.add(i),bt(this)),this._pendingEditorState=n,this._dirtyType=nr,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&o.add(i),this._updating||bt(this)}parseEditorState(e,t){return function(n,s,o){const i=bi(),l=pe,u=Te,a=ge,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,pe=i,Te=!1,ge=s;try{const p=s._nodes;_i(n.root,p),o&&o(),i._readOnly=!0}catch(p){p instanceof Error&&s._onError(p)}finally{s._dirtyElements=c,s._dirtyLeaves=d,s._cloneNotNeeded=f,s._dirtyType=h,pe=l,Te=u,ge=a}return i}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return bt(this),this.getEditorState().read(e,{editor:this})}update(e,t){Fe(this,e,t)}focus(e,t={}){const n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),Fe(this,()=>{const s=q(),o=ne();s!==null?s.dirty=!0:o.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?o.selectStart():o.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=$e(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,jr("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Zn.version="0.21.0+prod.esm";const uu=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Pc=uu?A.useLayoutEffect:A.useEffect,fn={tag:"history-merge"};function Oc({initialConfig:r,children:e}){const t=A.useMemo(()=>{const{theme:n,namespace:s,nodes:o,onError:i,editorState:l,html:u}=r,a=_a(null,n),c=jc({editable:r.editable,html:u,namespace:s,nodes:o,onError:d=>i(d,c),theme:n});return function(d,f){if(f!==null){if(f===void 0)d.update(()=>{const h=ne();if(h.isEmpty()){const p=ce();h.append(p);const m=uu?document.activeElement:null;(q()!==null||m!==null&&m===d.getRootElement())&&p.select()}},fn);else if(f!==null)switch(typeof f){case"string":{const h=d.parseEditorState(f);d.setEditorState(h,fn);break}case"object":d.setEditorState(f,fn);break;case"function":d.update(()=>{ne().isEmpty()&&f(d)},fn)}}}(c,l),[c,a]},[]);return Pc(()=>{const n=r.editable,[s]=t;s.setEditable(n===void 0||n)},[]),g.jsx(il.Provider,{value:t,children:e})}const Mc=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?A.useLayoutEffect:A.useEffect;function Rc(r){return{initialValueFn:()=>r.isEditable(),subscribe:e=>r.registerEditableListener(e)}}function $c(){return function(r){const[e]=Je(),t=A.useMemo(()=>r(e),[e,r]),[n,s]=A.useState(()=>t.initialValueFn()),o=A.useRef(n);return Mc(()=>{const{initialValueFn:i,subscribe:l}=t,u=i();return o.current!==u&&(o.current=u,s(u)),l(a=>{o.current=a,s(a)})},[t,r]),n}(Rc)}function Ic(){return ne().getTextContent()}function zc(r,e=!0){if(r)return!1;let t=Ic();return e&&(t=t.trim()),t===""}function qc(r){if(!zc(r,!1))return!1;const e=ne().getChildren(),t=e.length;if(t>1)return!1;for(let n=0;n<t;n++){const s=e[n];if(Z(s))return!1;if(B(s)){if(!ir(s)||s.__indent!==0)return!1;const o=s.getChildren(),i=o.length;for(let l=0;l<i;l++){const u=o[n];if(!R(u))return!1}}}return!0}function au(r){return()=>qc(r)}function Uc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}Uc(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 Wc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Kc=Wc(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 Vc=new Map;function Gc(r){const e={};if(!r)return e;const t=r.split(";");for(const n of t)if(n!==""){const[s,o]=n.split(/:([^]+)/);s&&o&&(e[s.trim()]=o.trim())}return e}function cu(r,e){const t=r.getStartEndPoints();if(e.isSelected(r)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[n,s]=t,o=r.isBackward(),i=n.getNode(),l=s.getNode(),u=e.is(i),a=e.is(l);if(u||a){const[c,d]=zs(r),f=i.is(l),h=e.is(o?l:i),p=e.is(o?i:l);let m,_=0;return f?(_=c>d?d:c,m=c>d?c:d):h?(_=o?d:c,m=void 0):p&&(_=0,m=o?c:d),e.__text=e.__text.slice(_,m),e}}return e}function Hc(r){const e=r.getStyle(),t=Gc(e);Vc.set(e,t)}function Jc(r,e){if(r===null)return;const t=r.getStartEndPoints(),n=t?t[0]:null;if(n!==null&&n.key==="root"){const i=e(),l=ne(),u=l.getFirstChild();return void(u?u.replace(i,!0):l.append(i))}const s=r.getNodes(),o=n!==null&&function(i,l){let u=i;for(;u!==null&&u.getParent()!==null&&!l(u);)u=u.getParentOrThrow();return l(u)?u:null}(n.getNode(),So);o&&s.indexOf(o)===-1&&s.push(o);for(let i=0;i<s.length;i++){const l=s[i];if(!So(l))continue;B(l)||Kc(178);const u=e();u.setFormat(l.getFormatType()),u.setIndent(l.getIndent()),l.replace(u,!0)}}function Ao(r,e){const t=$r(r.focus,e);return Z(t)&&!t.isIsolated()||B(t)&&!t.isInline()&&!t.canBeEmpty()}function Qc(r,e,t,n){r.modify(e?"extend":"move",t,n)}function Yc(r){const e=r.anchor.getNode();return(De(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function ko(r,e,t){const n=Yc(r);Qc(r,e,t?!n:n,"character")}function So(r){if(Z(r)||!B(r)||st(r))return!1;const e=r.getFirstChild(),t=e===null||jt(e)||R(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Xc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Zc=Xc(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 du=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,ed=du&&"documentMode"in document?document.documentMode:null;!(!du||!("InputEvent"in window)||ed)&&"getTargetRanges"in new window.InputEvent("input");function fu(...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 It(...r){return()=>{for(let e=r.length-1;e>=0;e--)r[e]();r.length=0}}function en(r,...e){const t=fu(...e);t.length>0&&r.classList.add(...t)}function hu(r,...e){const t=fu(...e);t.length>0&&r.classList.remove(...t)}function td(r,e){let t=r;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function rd(r){const e=es(r,t=>B(t)&&!t.isInline());return B(e)||Zc(4,r.__key),e}const es=(r,e)=>{let t=r;for(;t!==ne()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function vt(r,e){return r!==null&&Object.getPrototypeOf(r).constructor.name===e.name}function nd(r){const e=window.location.origin,t=n=>{if(n.origin!==e)return;const s=r.getRootElement();if(document.activeElement!==s)return;const o=n.data;if(typeof o=="string"){let i;try{i=JSON.parse(o)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){const l=i.payload;if(l&&l.functionId==="makeChanges"){const u=l.args;if(u){const[a,c,d,f,h,p]=u;r.update(()=>{const m=q();if(P(m)){const _=m.anchor;let C=_.getNode(),y=0,E=0;if(R(C)&&a>=0&&c>=0&&(y=a,E=a+c,m.setTextNodeRange(C,y,C,E)),y===E&&d===""||(m.insertRawText(d),C=_.getNode()),R(C)){y=f,E=f+h;const D=C.getTextContentSize();y=y>D?D:y,E=E>D?D:E,m.setTextNodeRange(C,y,C,E)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function pu(r,e){const t=e.body?e.body.childNodes:[];let n=[];const s=[];for(let o=0;o<t.length;o++){const i=t[o];if(!yu.has(i.nodeName)){const l=xu(i,r,s,!1);l!==null&&(n=n.concat(l))}}return function(o){for(const i of o)i.getNextSibling()instanceof vi&&i.insertAfter(Rt());for(const i of o){const l=i.getChildren();for(const u of l)i.insertBefore(u);i.remove()}}(s),n}function gu(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=ne().getChildren();for(let s=0;s<n.length;s++)mu(r,n[s],t,e);return t.innerHTML}function mu(r,e,t,n=null){let s=n===null||e.isSelected(n);const o=B(e)&&e.excludeFromCopy("html");let i=e;if(n!==null){let h=gi(e);h=R(h)&&n!==null?cu(n,h):h,i=h}const l=B(i)?i.getChildren():[],u=r._nodes.get(i.getType());let a;a=u&&u.exportDOM!==void 0?u.exportDOM(r,i):i.exportDOM(r);const{element:c,after:d}=a;if(!c)return!1;const f=document.createDocumentFragment();for(let h=0;h<l.length;h++){const p=l[h],m=mu(r,p,f,n);!s&&B(e)&&m&&e.extractWithChild(p,n,"html")&&(s=!0)}if(s&&!o){if((ft(c)||eo(c))&&c.append(f),t.append(c),d){const h=d.call(i,c);h&&(eo(c)?c.replaceChildren(h):c.replaceWith(h))}}else t.append(f);return s}const yu=new Set(["STYLE","SCRIPT"]);function xu(r,e,t,n,s=new Map,o){let i=[];if(yu.has(r.nodeName))return i;let l=null;const u=function(p,m){const{nodeName:_}=p,C=m._htmlConversions.get(_.toLowerCase());let y=null;if(C!==void 0)for(const E of C){const D=E(p);D!==null&&(y===null||(y.priority||0)<=(D.priority||0))&&(y=D)}return y!==null?y.conversion:null}(r,e),a=u?u(r):null;let c=null;if(a!==null){c=a.after;const p=a.node;if(l=Array.isArray(p)?p[p.length-1]:p,l!==null){for(const[,m]of s)if(l=m(l,o),!l)break;l&&i.push(...Array.isArray(p)?p:[l])}a.forChild!=null&&s.set(r.nodeName,a.forChild)}const d=r.childNodes;let f=[];const h=(l==null||!st(l))&&(l!=null&&qs(l)||n);for(let p=0;p<d.length;p++)f.push(...xu(d[p],e,t,h,new Map(s),l));return c!=null&&(f=c(f)),Bn(r)&&(f=sd(r,f,h?()=>{const p=new vi;return t.push(p),p}:ce)),l==null?f.length>0?i=i.concat(f):Bn(r)&&function(p){return p.nextSibling==null||p.previousSibling==null?!1:Ts(p.nextSibling)&&Ts(p.previousSibling)}(r)&&(i=i.concat(Rt())):B(l)&&l.append(...f),i}function sd(r,e,t){const n=r.style.textAlign,s=[];let o=[];for(let i=0;i<e.length;i++){const l=e[i];if(qs(l))n&&!l.getFormat()&&l.setFormat(n),s.push(l);else if(o.push(l),i===e.length-1||i<e.length-1&&qs(e[i+1])){const u=t();u.setFormat(n),u.append(...o),s.push(u),o=[]}}return s}function id(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Mn=id(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 od(r,e=q()){return e==null&&Mn(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?"":gu(r,e)}function ld(r,e=q()){return e==null&&Mn(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(ud(r,e))}function To(r,e,t){const n=r.getData("application/x-lexical-editor");if(n)try{const i=JSON.parse(n);if(i.namespace===t._config.namespace&&Array.isArray(i.nodes))return Bo(t,ad(i.nodes),e)}catch{}const s=r.getData("text/html");if(s)try{const i=new DOMParser().parseFromString(function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:u=>u}).createHTML(l):l}(s),"text/html");return Bo(t,pu(t,i),e)}catch{}const o=r.getData("text/plain")||r.getData("text/uri-list");if(o!=null)if(P(e)){const i=o.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let l=0;l<i.length;l++){const u=q();if(P(u)){const a=i[l];a===`
72
72
  `||a===`\r
73
- `?u.insertParagraph():a===" "?u.insertNodes([Hr()]):u.insertText(a)}}}else e.insertRawText(o)}function Bo(r,e,t){r.dispatchCommand(ba,{nodes:e,selection:t})||t.insertNodes(e)}function _u(r,e,t,n=[]){let s=e===null||t.isSelected(e);const o=B(t)&&t.excludeFromCopy("html");let i=t;if(e!==null){let a=gi(t);a=M(a)&&e!==null?cu(e,a):a,i=a}const l=B(i)?i.getChildren():[],u=function(a){const c=a.exportJSON(),f=a.constructor;if(c.type!==f.getType()&&On(58,f.name),B(a)){const d=c.children;Array.isArray(d)||On(59,f.name)}return c}(i);if(M(i)){const a=i.__text;a.length>0?u.text=a:s=!1}for(let a=0;a<l.length;a++){const c=l[a],f=_u(r,e,c,u.children);!s&&B(t)&&f&&t.extractWithChild(c,e,"clone")&&(s=!0)}if(s&&!o)n.push(u);else if(Array.isArray(u.children))for(let a=0;a<u.children.length;a++){const c=u.children[a];n.push(c)}return s}function ud(r,e){const t=[],n=se().getChildren();for(let s=0;s<n.length;s++)_u(r,e,n[s],t);return{namespace:r._config.namespace,nodes:t}}function ad(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t],s=Bc(n);M(s)&&Hc(s),e.push(s)}return e}let Gt=null;async function No(r,e,t){if(Gt!==null)return!1;if(e!==null)return new Promise((u,a)=>{r.update(()=>{u(Fo(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,o=ze(r._window);if(n===null||o===null)return!1;const i=s.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(s.createTextNode("#")),n.append(i);const l=new Range;return l.setStart(i,0),l.setEnd(i,1),o.removeAllRanges(),o.addRange(l),new Promise((u,a)=>{const c=r.registerCommand(zn,f=>(bt(f,ClipboardEvent)&&(c(),Gt!==null&&(window.clearTimeout(Gt),Gt=null),u(Fo(r,f,t))),!0),Lc);Gt=window.setTimeout(()=>{c(),Gt=null,u(!1)},50),s.execCommand("copy"),i.remove()})}function Fo(r,e,t){if(t===void 0){const s=ze(r._window);if(!s)return!1;const o=s.anchorNode,i=s.focusNode;if(o!==null&&i!==null&&!Wr(r,o,i))return!1;const l=q();if(l===null)return!1;t=dd(l)}e.preventDefault();const n=e.clipboardData;return n!==null&&(fd(n,t),!0)}const cd=[["text/html",od],["application/x-lexical-editor",ld]];function dd(r=q()){const e={"text/plain":r?r.getTextContent():""};if(r){const t=cc();for(const[n,s]of cd){const o=s(t,r);o!==null&&(e[n]=o)}}return e}function fd(r,e){for(const t in e){const n=e[t];n!==void 0&&r.setData(t,n)}}function Lo(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 lr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,hd=lr&&"documentMode"in document?document.documentMode:null,pd=!(!lr||!("InputEvent"in window)||hd)&&"getTargetRanges"in new window.InputEvent("input"),gd=lr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),jo=lr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,md=lr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),yd=lr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!md,Po=zr();class es extends ht{static getType(){return"quote"}static clone(e){return new es(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return Xr(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:xd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&dt(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=Di();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=ce(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=ce();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Di(){return ot(new es)}class ts extends ht{static getType(){return"heading"}static clone(e){return new ts(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 o=s[t];Xr(n,o)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:Ht,priority:0}),h2:e=>({conversion:Ht,priority:0}),h3:e=>({conversion:Ht,priority:0}),h4:e=>({conversion:Ht,priority:0}),h5:e=>({conversion:Ht,priority:0}),h6:e=>({conversion:Ht,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&Oo(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Oo(e)?{conversion:t=>({node:wr("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&dt(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=wr(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(),o=!s||e&&e.anchor.key===s.getKey()&&n===s.getTextContentSize()||!e?ce():wr(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),n===0&&!this.isEmpty()&&e){const l=ce();l.select(),this.replace(l,!0)}return o}collapseAtStart(){const e=this.isEmpty()?ce():wr(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function Oo(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function Ht(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=wr(e),r.style!==null&&(mi(r,t),t.setFormat(r.style.textAlign))),{node:t}}function xd(r){const e=Di();return r.style!==null&&(e.setFormat(r.style.textAlign),mi(r,e)),{node:e}}function wr(r){return ot(new ts(r))}function fn(r){let e=null;if(bt(r,DragEvent)?e=r.dataTransfer:bt(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 Mo(r){const e=q();if(!P(e))return!1;const t=new Set,n=e.getNodes();for(let s=0;s<n.length;s++){const o=n[s],i=o.getKey();if(t.has(i))continue;const l=Zn(o,a=>B(a)&&!a.isInline());if(l===null)continue;const u=l.getKey();l.canIndent()&&!t.has(u)&&(t.add(u),r(l))}return t.size>0}function hn(r){const e=nr(r);return Z(e)}function _d(r){return It(r.registerCommand(ol,e=>{const t=q();return!!Ze(t)&&(t.clear(),!0)},0),r.registerCommand(Ft,e=>{const t=q();return!!P(t)&&(t.deleteCharacter(e),!0)},Y),r.registerCommand(Pr,e=>{const t=q();return!!P(t)&&(t.deleteWord(e),!0)},Y),r.registerCommand(Or,e=>{const t=q();return!!P(t)&&(t.deleteLine(e),!0)},Y),r.registerCommand(Zt,e=>{const t=q();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const n=e.dataTransfer;if(n!=null)To(n,t,r);else if(P(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},Y),r.registerCommand(As,()=>{const e=q();return!!P(e)&&(e.removeText(),!0)},Y),r.registerCommand(Ge,e=>{const t=q();return!!P(t)&&(t.formatText(e),!0)},Y),r.registerCommand(Sa,e=>{const t=q();if(!P(t)&&!Ze(t))return!1;const n=t.getNodes();for(const s of n){const o=Zn(s,i=>B(i)&&!i.isInline());o!==null&&o.setFormat(e)}return!0},Y),r.registerCommand(Xt,e=>{const t=q();return!!P(t)&&(t.insertLineBreak(e),!0)},Y),r.registerCommand(jr,()=>{const e=q();return!!P(e)&&(e.insertParagraph(),!0)},Y),r.registerCommand(Aa,()=>(Zl([Hr()]),!0),Y),r.registerCommand(ka,()=>Mo(e=>{const t=e.getIndent();e.setIndent(t+1)}),Y),r.registerCommand(zi,()=>Mo(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),Y),r.registerCommand(al,e=>{const t=q();if(Ze(t)&&!hn(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(P(t)){const n=Mr(t.focus,!0);if(!e.shiftKey&&Z(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},Y),r.registerCommand(cl,e=>{const t=q();if(Ze(t)){const n=t.getNodes();if(n.length>0)return n[0].selectNext(0,0),!0}else if(P(t)){if(function(s){const o=s.focus;return o.key==="root"&&o.offset===se().getChildrenSize()}(t))return e.preventDefault(),!0;const n=Mr(t.focus,!1);if(!e.shiftKey&&Z(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},Y),r.registerCommand(ul,e=>{const t=q();if(Ze(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!P(t))return!1;if(Ao(t,!0)){const n=e.shiftKey;return e.preventDefault(),ko(t,n,!0),!0}return!1},Y),r.registerCommand(ll,e=>{const t=q();if(Ze(t)&&!hn(e.target)){const s=t.getNodes();if(s.length>0)return e.preventDefault(),s[0].selectNext(0,0),!0}if(!P(t))return!1;const n=e.shiftKey;return!!Ao(t,!1)&&(e.preventDefault(),ko(t,n,!1),!0)},Y),r.registerCommand(dl,e=>{if(hn(e.target))return!1;const t=q();if(!P(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!Ce(s)&&rd(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(zi,void 0)):(!jo||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(Ft,!0))},Y),r.registerCommand(hl,e=>{if(hn(e.target))return!1;const t=q();return!!P(t)&&(e.preventDefault(),r.dispatchCommand(Ft,!1))},Y),r.registerCommand(bn,e=>{const t=q();if(!P(t))return!1;if(e!==null){if((jo||gd||yd)&&pd)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(Xt,!1)}return r.dispatchCommand(jr,void 0)},Y),r.registerCommand(fl,()=>{const e=q();return!!P(e)&&(r.blur(),!0)},Y),r.registerCommand(pl,e=>{const[,t]=fn(e);if(t.length>0){const s=Lo(e.clientX,e.clientY);if(s!==null){const{offset:o,node:i}=s,l=nr(i);if(l!==null){const u=Ac();if(M(l))u.anchor.set(l.getKey(),o,"text"),u.focus.set(l.getKey(),o,"text");else{const c=l.getParentOrThrow().getKey(),f=l.getIndexWithinParent()+1;u.anchor.set(c,f,"element"),u.focus.set(c,f,"element")}const a=wl(u);rt(a)}r.dispatchCommand(Po,t)}return e.preventDefault(),!0}const n=q();return!!P(n)},Y),r.registerCommand(gl,e=>{const[t]=fn(e),n=q();return!(t&&!P(n))},Y),r.registerCommand(ml,e=>{const[t]=fn(e),n=q();if(t&&!P(n))return!1;const s=Lo(e.clientX,e.clientY);if(s!==null){const o=nr(s.node);Z(o)&&e.preventDefault()}return!0},Y),r.registerCommand(ks,()=>(oc(),!0),Y),r.registerCommand(zn,e=>(No(r,bt(e,ClipboardEvent)?e:null),!0),Y),r.registerCommand(Xs,e=>(async function(t,n){await No(n,bt(t,ClipboardEvent)?t:null),n.update(()=>{const s=q();P(s)?s.removeText():Ze(s)&&s.getNodes().forEach(o=>o.remove())})}(e,r),!0),Y),r.registerCommand(In,e=>{const[,t,n]=fn(e);return t.length>0&&!n?(r.dispatchCommand(Po,t),!0):ui(e.target)?!1:q()!==null&&(function(s,o){s.preventDefault(),o.update(()=>{const i=q(),l=bt(s,InputEvent)||bt(s,KeyboardEvent)?null:s.clipboardData;l!=null&&i!==null&&To(l,i,o)},{tag:"paste"})}(e,r),!0)},Y))}const Us=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?A.useLayoutEffect:A.useEffect;function Ro(r){return r.getEditorState().read(au(r.isComposing()))}function bd({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=it(),s=function(o,i){const[l,u]=A.useState(()=>o.getDecorators());return Us(()=>o.registerDecoratorListener(a=>{Ni.flushSync(()=>{u(a)})}),[o]),A.useEffect(()=>{u(o.getDecorators())},[o]),A.useMemo(()=>{const a=[],c=Object.keys(l);for(let f=0;f<c.length;f++){const d=c[f],h=g.jsx(i,{onError:m=>o._onError(m),children:g.jsx(A.Suspense,{fallback:null,children:l[d]})}),p=o.getElementByKey(d);p!==null&&a.push(Ni.createPortal(h,p,d))}return a},[i,l,o])}(n,t);return function(o){Us(()=>It(_d(o),nd(o)),[o])}(n),g.jsxs(g.Fragment,{children:[r,g.jsx(vd,{content:e}),s]})}function vd({content:r}){const[e]=it(),t=function(s){const[o,i]=A.useState(()=>Ro(s));return Us(()=>{function l(){const u=Ro(s);i(u)}return l(),It(s.registerUpdateListener(()=>{l()}),s.registerEditableListener(()=>{l()}))},[s]),o}(e),n=$c();return t?typeof r=="function"?r(n):r:null}const bu=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?A.useLayoutEffect:A.useEffect;function Dd({editor:r,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:s,ariaErrorMessage:o,ariaExpanded:i,ariaInvalid:l,ariaLabel:u,ariaLabelledBy:a,ariaMultiline:c,ariaOwns:f,ariaRequired:d,autoCapitalize:h,className:p,id:m,role:y="textbox",spellCheck:C=!0,style:_,tabIndex:E,"data-testid":D,...k},v){const[b,w]=A.useState(r.isEditable()),S=A.useCallback(T=>{T&&T.ownerDocument&&T.ownerDocument.defaultView?r.setRootElement(T):r.setRootElement(null)},[r]),R=A.useMemo(()=>function(...T){return N=>{T.forEach(F=>{typeof F=="function"?F(N):F!=null&&(F.current=N)})}}(v,S),[S,v]);return bu(()=>(w(r.isEditable()),r.registerEditableListener(T=>{w(T)})),[r]),g.jsx("div",{"aria-activedescendant":b?e:void 0,"aria-autocomplete":b?t:"none","aria-controls":b?n:void 0,"aria-describedby":s,...o!=null?{"aria-errormessage":o}:{},"aria-expanded":b&&y==="combobox"?!!i:void 0,...l!=null?{"aria-invalid":l}:{},"aria-label":u,"aria-labelledby":a,"aria-multiline":c,"aria-owns":b?f:void 0,"aria-readonly":!b||void 0,"aria-required":d,autoCapitalize:h,className:p,contentEditable:b,"data-testid":D,id:m,ref:R,role:b?y:void 0,spellCheck:C,style:_,tabIndex:E,...k})}const Cd=A.forwardRef(Dd);function $o(r){return r.getEditorState().read(au(r.isComposing()))}const wd=A.forwardRef(Ed);function Ed(r,e){const{placeholder:t,...n}=r,[s]=it();return g.jsxs(g.Fragment,{children:[g.jsx(Cd,{editor:s,...n,ref:e}),t!=null&&g.jsx(Ad,{editor:s,content:t})]})}function Ad({content:r,editor:e}){const t=function(i){const[l,u]=A.useState(()=>$o(i));return bu(()=>{function a(){const c=$o(i);u(c)}return a(),It(i.registerUpdateListener(()=>{a()}),i.registerEditableListener(()=>{a()}))},[i]),l}(e),[n,s]=A.useState(e.isEditable());if(A.useLayoutEffect(()=>(s(e.isEditable()),e.registerEditableListener(i=>{s(i)})),[e]),!t)return null;let o=null;return typeof r=="function"?o=r(n):r!==null&&(o=r),o===null?null:g.jsx("div",{"aria-hidden":!0,children:o})}const pn=0,Ws=1,Ks=2,Ve=0,kd=1,Io=2,Sd=3,Td=4;function Bd(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return Ve;const o=e._selection,i=r._selection;if(s)return kd;if(!(P(o)&&P(i)&&i.isCollapsed()&&o.isCollapsed()))return Ve;const l=function(C,_,E){const D=C._nodeMap,k=[];for(const v of _){const b=D.get(v);b!==void 0&&k.push(b)}for(const[v,b]of E){if(!b)continue;const w=D.get(v);w===void 0||Ce(w)||k.push(w)}return k}(e,t,n);if(l.length===0)return Ve;if(l.length>1){const C=e._nodeMap,_=C.get(o.anchor.key),E=C.get(i.anchor.key);return _&&E&&!r._nodeMap.has(_.__key)&&M(_)&&_.__text.length===1&&o.anchor.offset===1?Io:Ve}const u=l[0],a=r._nodeMap.get(u.__key);if(!M(a)||!M(u)||a.__mode!==u.__mode)return Ve;const c=a.__text,f=u.__text;if(c===f)return Ve;const d=o.anchor,h=i.anchor;if(d.key!==h.key||d.type!=="text")return Ve;const p=d.offset,m=h.offset,y=f.length-c.length;return y===1&&m===p-1?Io:y===-1&&m===p+1?Sd:y===-1&&m===p?Td:Ve}function Nd(r,e){let t=Date.now(),n=Ve;return(s,o,i,l,u,a)=>{const c=Date.now();if(a.has("historic"))return n=Ve,t=c,Ks;const f=Bd(s,o,l,u,r.isComposing()),d=(()=>{const h=i===null||i.editor===r,p=a.has("history-push");if(!p&&h&&a.has("history-merge"))return pn;if(s===null)return Ws;const m=o._selection;return l.size>0||u.size>0?p===!1&&f!==Ve&&f===n&&c<t+e&&h||l.size===1&&function(y,C,_){const E=C._nodeMap.get(y),D=_._nodeMap.get(y),k=C._selection,v=_._selection;return!(P(k)&&P(v)&&k.anchor.type==="element"&&k.focus.type==="element"&&v.anchor.type==="text"&&v.focus.type==="text"||!M(E)||!M(D)||E.__parent!==D.__parent)&&JSON.stringify(C.read(()=>E.exportJSON()))===JSON.stringify(_.read(()=>D.exportJSON()))}(Array.from(l)[0],s,o)?pn:Ws:m!==null?pn:Ks})();return t=c,n=f,d}}function zo(r){r.undoStack=[],r.redoStack=[],r.current=null}function Fd(r,e,t){const n=Nd(r,t);return It(r.registerCommand(Qs,()=>(function(o,i){const l=i.redoStack,u=i.undoStack;if(u.length!==0){const a=i.current,c=u.pop();a!==null&&(l.push(a),o.dispatchCommand(ln,!0)),u.length===0&&o.dispatchCommand(un,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),Y),r.registerCommand(Ys,()=>(function(o,i){const l=i.redoStack,u=i.undoStack;if(l.length!==0){const a=i.current;a!==null&&(u.push(a),o.dispatchCommand(un,!0));const c=l.pop();l.length===0&&o.dispatchCommand(ln,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),Y),r.registerCommand(Ba,()=>(zo(e),!1),Y),r.registerCommand(Na,()=>(zo(e),r.dispatchCommand(ln,!1),r.dispatchCommand(un,!1),!0),Y),r.registerUpdateListener(({editorState:o,prevEditorState:i,dirtyLeaves:l,dirtyElements:u,tags:a})=>{const c=e.current,f=e.redoStack,d=e.undoStack,h=c===null?null:c.editorState;if(c!==null&&o===h)return;const p=n(i,o,c,l,u,a);if(p===Ws)f.length!==0&&(e.redoStack=[],r.dispatchCommand(ln,!1)),c!==null&&(d.push({...c}),r.dispatchCommand(un,!0));else if(p===Ks)return;e.current={editor:r,editorState:o}}))}function Ld(){return{current:null,redoStack:[],undoStack:[]}}function jd({delay:r,externalHistoryState:e}){const[t]=it();return function(n,s,o=1e3){const i=A.useMemo(()=>s||Ld(),[s]);A.useEffect(()=>Fd(n,i,o),[o,n,i])}(t,e,r),null}const Pd=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?A.useLayoutEffect:A.useEffect;function Od({ignoreHistoryMergeTagChange:r=!0,ignoreSelectionChange:e=!1,onChange:t}){const[n]=it();return Pd(()=>{if(t)return n.registerUpdateListener(({editorState:s,dirtyElements:o,dirtyLeaves:i,prevEditorState:l,tags:u})=>{e&&o.size===0&&i.size===0||r&&u.has("history-merge")||l.isEmpty()||t(s,n,u)})},[n,r,e,t]),null}function Vs(r,e){return Vs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Vs(r,e)}var qo={error:null},Md=function(r){var e,t;function n(){for(var o,i=arguments.length,l=new Array(i),u=0;u<i;u++)l[u]=arguments[u];return(o=r.call.apply(r,[this].concat(l))||this).state=qo,o.resetErrorBoundary=function(){for(var a,c=arguments.length,f=new Array(c),d=0;d<c;d++)f[d]=arguments[d];o.props.onReset==null||(a=o.props).onReset.apply(a,f),o.reset()},o}t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,Vs(e,t),n.getDerivedStateFromError=function(o){return{error:o}};var s=n.prototype;return s.reset=function(){this.setState(qo)},s.componentDidCatch=function(o,i){var l,u;(l=(u=this.props).onError)==null||l.call(u,o,i)},s.componentDidUpdate=function(o,i){var l,u,a,c,f=this.state.error,d=this.props.resetKeys;f!==null&&i.error!==null&&((a=o.resetKeys)===void 0&&(a=[]),(c=d)===void 0&&(c=[]),a.length!==c.length||a.some(function(h,p){return!Object.is(h,c[p])}))&&((l=(u=this.props).onResetKeysChange)==null||l.call(u,o.resetKeys,d),this.reset())},s.render=function(){var o=this.state.error,i=this.props,l=i.fallbackRender,u=i.FallbackComponent,a=i.fallback;if(o!==null){var c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(us.isValidElement(a))return a;if(typeof l=="function")return l(c);if(u)return us.createElement(u,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(us.Component);function Rd({children:r,onError:e}){return g.jsx(Md,{fallback:g.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function $d(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var et=$d(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 Id(r){let e=1,t=r.getParent();for(;t!=null;){if(re(t)){const n=t.getParent();if(Q(n)){e++,t=n.getParent();continue}et(40)}return e}return e}function Gs(r){let e=r.getParent();Q(e)||et(40);let t=e;for(;t!==null;)t=t.getParent(),Q(t)&&(e=t);return e}function vu(r){let e=[];const t=r.getChildren().filter(re);for(let n=0;n<t.length;n++){const s=t[n],o=s.getFirstChild();Q(o)?e=e.concat(vu(o)):e.push(s)}return e}function tt(r){return re(r)&&Q(r.getFirstChild())}function Uo(r){return Pe().append(r)}function Du(r,e){return re(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function Wo(r,e){r.update(()=>{const t=q();if(t!==null){const n=t.getNodes();if(P(t)){const o=t.getStartEndPoints();o===null&&et(143);const[i]=o,l=i.getNode(),u=l.getParent();if(Du(l,n)){const a=Ne(e);if(nt(u)){l.replace(a);const c=Pe();B(l)&&(c.setFormat(l.getFormatType()),c.setIndent(l.getIndent())),a.append(c)}else if(re(l)){const c=l.getParentOrThrow();$t(a,c.getChildren()),c.replace(a)}return}}const s=new Set;for(let o=0;o<n.length;o++){const i=n[o];if(!B(i)||!i.isEmpty()||re(i)||s.has(i.getKey())){if(Al(i)){let l=i.getParent();for(;l!=null;){const u=l.getKey();if(Q(l)){if(!s.has(u)){const a=Ne(e);$t(a,l.getChildren()),l.replace(a),s.add(u)}break}{const a=l.getParent();if(nt(a)&&!s.has(u)){s.add(u),Ko(l,e);break}l=a}}}}else Ko(i,e)}}})}function $t(r,e){r.splice(r.getChildrenSize(),0,e)}function Ko(r,e){if(Q(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=Pe();let o;if($t(s,r.getChildren()),Q(t)&&e===t.getListType())t.append(s),Q(n)&&e===n.getListType()&&($t(t,n.getChildren()),n.remove()),o=t;else if(Q(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),o=n;else{const i=Ne(e);i.append(s),r.replace(i),o=i}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),o}function Ci(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&tt(t)&&tt(n)&&(Ci(t.getFirstChild(),n.getFirstChild()),n.remove());const s=e.getChildren();s.length>0&&r.append(...s),e.remove()}function zd(r){r.update(()=>{const e=q();if(P(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(Du(s,n))t.add(Gs(s));else for(let o=0;o<n.length;o++){const i=n[o];if(Al(i)){const l=td(i,zt);l!=null&&t.add(Gs(l))}}for(const o of t){let i=o;const l=vu(o);for(const u of l){const a=ce();$t(a,u.getChildren()),i.insertAfter(a),i=a,u.__key===e.anchor.key&&e.anchor.set(a.getKey(),0,"element"),u.__key===e.focus.key&&e.focus.set(a.getKey(),0,"element"),u.remove()}o.remove()}}})}function qd(r){const e=new Set;if(tt(r)||e.has(r.getKey()))return;const t=r.getParent(),n=r.getNextSibling(),s=r.getPreviousSibling();if(tt(n)&&tt(s)){const o=s.getFirstChild();if(Q(o)){o.append(r);const i=n.getFirstChild();Q(i)&&($t(o,i.getChildren()),n.remove(),e.add(n.getKey()))}}else if(tt(n)){const o=n.getFirstChild();if(Q(o)){const i=o.getFirstChild();i!==null&&i.insertBefore(r)}}else if(tt(s)){const o=s.getFirstChild();Q(o)&&o.append(r)}else if(Q(t)){const o=Pe(),i=Ne(t.getListType());o.append(i),i.append(r),s?s.insertAfter(o):n?n.insertBefore(o):t.append(o)}}function Ud(r){if(tt(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(Q(t?t.getParent():void 0)&&re(t)&&Q(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 o=e.getListType(),i=Pe(),l=Ne(o);i.append(l),r.getPreviousSiblings().forEach(c=>l.append(c));const u=Pe(),a=Ne(o);u.append(a),$t(a,r.getNextSiblings()),t.insertBefore(i),t.insertAfter(u),t.replace(r)}}}function Wd(){const r=q();if(!P(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!re(e)||e.getChildrenSize()!==0)return!1;const t=Gs(e),n=e.getParent();Q(n)||et(40);const s=n.getParent();let o;if(nt(s))o=ce(),t.insertAfter(o);else{if(!re(s))return!1;o=Pe(),s.insertAfter(o)}o.select();const i=e.getNextSiblings();if(i.length>0){const l=Ne(n.getListType());if(sr(o))o.insertAfter(l);else{const u=Pe();u.append(l),o.insertAfter(u)}i.forEach(u=>{u.remove(),l.append(u)})}return function(l){let u=l;for(;u.getNextSibling()==null&&u.getPreviousSibling()==null;){const a=u.getParent();if(a==null||!re(u)&&!Q(u))break;u=a}u.remove()}(e),!0}function Mn(...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 zt extends ht{static getType(){return"listitem"}static clone(e){return new zt(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 Q(n)&&n.getListType()==="check"&&Go(t,this,null),t.value=this.__value,Vo(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return Q(s)&&s.getListType()==="check"&&Go(t,this,e),t.value=this.__value,Vo(t,n.theme,this),!1}static transform(){return e=>{if(re(e)||et(144),e.__checked==null)return;const t=e.getParent();Q(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:Kd,priority:0})}}static importJSON(e){const t=Pe();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(B(n)&&this.canMergeWith(n)){const s=n.getChildren();this.append(...s),n.remove()}else super.append(n)}return this}replace(e,t){if(re(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!Q(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=Ne(n.getListType());let o=this.getNextSibling();for(;o;){const i=o;o=o.getNextSibling(),s.append(i)}n.insertAfter(e),e.insertAfter(s)}return t&&(B(e)||et(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(Q(n)||et(39),re(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const o=Ne(n.getListType());s.forEach(i=>o.append(i)),e.insertAfter(o,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&tt(t)&&tt(n)&&(Ci(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=Pe(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=ce();this.getChildren().forEach(i=>t.append(i));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),o=re(s);if(n.getChildrenSize()===1)if(o)n.remove(),s.select();else{n.insertBefore(t),n.remove();const i=e.anchor,l=e.focus,u=t.getKey();i.type==="element"&&i.getNode().is(this)&&i.set(u,i.offset,"element"),l.type==="element"&&l.getNode().is(this)&&l.set(u,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 Q(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(;re(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&et(117),(e=Math.floor(e))>=0||et(199);let t=this.getIndent();for(;t!==e;)t<e?(qd(this),t++):(Ud(this),t--);return this}canInsertAfter(e){return re(e)}canReplaceWith(e){return re(e)}canMergeWith(e){return sr(e)||re(e)}extractWithChild(e,t){if(!P(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 Ne("bullet")}canMergeWhenEmpty(){return!0}}function Vo(r,e,t){const n=[],s=[],o=e.list,i=o?o.listitem:void 0;let l;if(o&&o.nested&&(l=o.nested.listitem),i!==void 0&&n.push(...Mn(i)),o){const u=t.getParent(),a=Q(u)&&u.getListType()==="check",c=t.getChecked();a&&!c||s.push(o.listitemUnchecked),a&&c||s.push(o.listitemChecked),a&&n.push(c?o.listitemChecked:o.listitemUnchecked)}if(l!==void 0){const u=Mn(l);t.getChildren().some(a=>Q(a))?n.push(...u):s.push(...u)}s.length>0&&hu(r,...s),n.length>0&&Xr(r,...n)}function Go(r,e,t,n){Q(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 Kd(r){if(r.classList.contains("task-list-item")){for(const t of r.children)if(t.tagName==="INPUT")return Vd(t)}const e=r.getAttribute("aria-checked");return{node:Pe(e==="true"||e!=="false"&&void 0)}}function Vd(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:Pe(r.hasAttribute("checked"))}}function Pe(r){return ot(new zt(void 0,r))}function re(r){return r instanceof zt}class ur extends ht{static getType(){return"list"}static clone(e){const t=e.__listType||Qo[e.__tag];return new ur(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=Qo[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,Ho(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(Ho(t,n.theme,this),!1)}static transform(){return e=>{Q(e)||et(163),function(t){const n=t.getNextSibling();Q(n)&&t.getListType()===n.getListType()&&Ci(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const o of t.getChildren())re(o)&&(o.getValue()!==s&&o.setValue(s),n&&o.getLatest().__checked!=null&&o.setChecked(void 0),Q(o.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:Jo,priority:0}),ul:()=>({conversion:Jo,priority:0})}}static importJSON(e){const t=Ne(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&&dt(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(re(n))super.append(n);else{const s=Pe();if(Q(n))s.append(n);else if(B(n))if(n.isInline())s.append(n);else{const o=he(n.getTextContent());s.append(o)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return re(e)}}function Ho(r,e,t){const n=[],s=[],o=e.list;if(o!==void 0){const i=o[`${t.__tag}Depth`]||[],l=Id(t)-1,u=l%i.length,a=i[u],c=o[t.__tag];let f;const d=o.nested,h=o.checklist;if(d!==void 0&&d.list&&(f=d.list),c!==void 0&&n.push(c),h!==void 0&&t.__listType==="check"&&n.push(h),a!==void 0){n.push(...Mn(a));for(let p=0;p<i.length;p++)p!==u&&s.push(t.__tag+p)}if(f!==void 0){const p=Mn(f);l>1?n.push(...p):s.push(...p)}}s.length>0&&hu(r,...s),n.length>0&&Xr(r,...n)}function Gd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(re(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(o=>{Q(o)&&e.push(Uo(o))})}else e.push(Uo(n))}return e}function Jo(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=Ne("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(dt(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?Ne("check"):Ne("bullet")),{after:Gd,node:t}}const Qo={ol:"number",ul:"bullet"};function Ne(r,e=1){return ot(new ur(r,e))}function Q(r){return r instanceof ur}const Cu=zr(),wu=zr(),Hd=zr();function Jd(r){return It(r.registerCommand(wu,()=>(Wo(r,"number"),!0),Yt),r.registerCommand(Cu,()=>(Wo(r,"bullet"),!0),Yt),r.registerCommand(Hd,()=>(zd(r),!0),Yt),r.registerCommand(jr,()=>!!Wd(),Yt))}function Qd(){const[r]=it();return A.useEffect(()=>{if(!r.hasNodes([ur,zt]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[r]),function(e){A.useEffect(()=>Jd(e),[e])}(r),null}const Yd=new Set(["http:","https:","mailto:","sms:","tel:"]);class qt extends ht{static getType(){return"link"}static clone(e){return new qt(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},n){super(n);const{target:s=null,rel:o=null,title:i=null}=t;this.__url=e,this.__target=s,this.__rel=o,this.__title=i}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),Xr(t,e.theme.link),t}updateDOM(e,t,n){if(t instanceof HTMLAnchorElement){const s=this.__url,o=this.__target,i=this.__rel,l=this.__title;s!==e.__url&&(t.href=s),o!==e.__target&&(o?t.target=o:t.removeAttribute("target")),i!==e.__rel&&(i?t.rel=i:t.removeAttribute("rel")),l!==e.__title&&(l?t.title=l:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:Xd,priority:1})}}static importJSON(e){const t=Rn(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(!Yd.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=Rn(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(!P(t))return!1;const s=t.anchor.getNode(),o=t.focus.getNode();return this.isParentOf(s)&&this.isParentOf(o)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function Xd(r){let e=null;if(ac(r)){const t=r.textContent;(t!==null&&t!==""||r.children.length>0)&&(e=Rn(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function Rn(r,e){return ot(new qt(r,e))}function br(r){return r instanceof qt}class Zr extends qt{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 Zr(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=Yo(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(B(n)){const s=Yo(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function Yo(r,e){return ot(new Zr(r,e))}function Zd(r){return r instanceof Zr}const Xo=zr();function Cs(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,o=q();if(!P(o))return;const i=o.extract();if(r===null)i.forEach(l=>{const u=Zn(l,a=>!Zd(a)&&br(a));if(u){const a=u.getChildren();for(let c=0;c<a.length;c++)u.insertBefore(a[c]);u.remove()}});else{if(i.length===1){const a=function(c,f){let d=c;for(;d!==null&&d.getParent()!==null&&!f(d);)d=d.getParentOrThrow();return f(d)?d:null}(i[0],br);if(a!==null)return a.setURL(r),t!==void 0&&a.setTarget(t),s!==null&&a.setRel(s),void(n!==void 0&&a.setTitle(n))}let l=null,u=null;i.forEach(a=>{const c=a.getParent();if(c!==u&&c!==null&&(!B(a)||a.isInline())){if(br(c))return u=c,c.setURL(r),t!==void 0&&c.setTarget(t),s!==null&&u.setRel(s),void(n!==void 0&&u.setTitle(n));if(c.is(l)||(l=c,u=Rn(r,{rel:s,target:t,title:n}),br(c)?a.getPreviousSibling()===null?c.insertBefore(u):c.insertAfter(u):a.insertBefore(u)),br(a)){if(a.is(u))return;if(u!==null){const f=a.getChildren();for(let d=0;d<f.length;d++)u.append(f[d])}a.remove()}else u!==null&&u.append(a)}})}}function ef({validateUrl:r,attributes:e}){const[t]=it();return A.useEffect(()=>{if(!t.hasNodes([qt]))throw new Error("LinkPlugin: LinkNode not registered on editor");return It(t.registerCommand(Xo,n=>{if(n===null)return Cs(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(Cs(n,e),!0);{const{url:s,target:o,rel:i,title:l}=n;return Cs(s,{...e,rel:i,target:o,title:l}),!0}},Yt),r!==void 0?t.registerCommand(In,n=>{const s=q();if(!P(s)||s.isCollapsed()||!bt(n,ClipboardEvent))return!1;const o=n;if(o.clipboardData===null)return!1;const i=o.clipboardData.getData("text");return!!r(i)&&!s.getNodes().some(l=>B(l))&&(t.dispatchCommand(Xo,{...e,url:i}),n.preventDefault(),!0)},Yt):()=>{})},[t,r,e]),null}const tf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6"},rf={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 nf({theme:r,disabled:e}){const[t]=it(),n=A.useCallback(()=>{t.dispatchCommand(Ge,"bold")},[t]),s=A.useCallback(()=>{t.dispatchCommand(Ge,"italic")},[t]),o=A.useCallback(()=>{t.dispatchCommand(Ge,"underline")},[t]),i=A.useCallback(()=>{t.dispatchCommand(Cu,void 0)},[t]),l=A.useCallback(()=>{t.dispatchCommand(wu,void 0)},[t]),u=A.useCallback(()=>{t.update(()=>{const f=q();P(f)&&Jc(f,()=>Di())})},[t]),a={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},c=`
73
+ `?u.insertParagraph():a===" "?u.insertNodes([Qr()]):u.insertText(a)}}}else e.insertRawText(o)}function Bo(r,e,t){r.dispatchCommand(ba,{nodes:e,selection:t})||t.insertNodes(e)}function _u(r,e,t,n=[]){let s=e===null||t.isSelected(e);const o=B(t)&&t.excludeFromCopy("html");let i=t;if(e!==null){let a=gi(t);a=R(a)&&e!==null?cu(e,a):a,i=a}const l=B(i)?i.getChildren():[],u=function(a){const c=a.exportJSON(),d=a.constructor;if(c.type!==d.getType()&&Mn(58,d.name),B(a)){const f=c.children;Array.isArray(f)||Mn(59,d.name)}return c}(i);if(R(i)){const a=i.__text;a.length>0?u.text=a:s=!1}for(let a=0;a<l.length;a++){const c=l[a],d=_u(r,e,c,u.children);!s&&B(t)&&d&&t.extractWithChild(c,e,"clone")&&(s=!0)}if(s&&!o)n.push(u);else if(Array.isArray(u.children))for(let a=0;a<u.children.length;a++){const c=u.children[a];n.push(c)}return s}function ud(r,e){const t=[],n=ne().getChildren();for(let s=0;s<n.length;s++)_u(r,e,n[s],t);return{namespace:r._config.namespace,nodes:t}}function ad(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t],s=Bc(n);R(s)&&Hc(s),e.push(s)}return e}let Ht=null;async function No(r,e,t){if(Ht!==null)return!1;if(e!==null)return new Promise((u,a)=>{r.update(()=>{u(Fo(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,o=$e(r._window);if(n===null||o===null)return!1;const i=s.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(s.createTextNode("#")),n.append(i);const l=new Range;return l.setStart(i,0),l.setEnd(i,1),o.removeAllRanges(),o.addRange(l),new Promise((u,a)=>{const c=r.registerCommand(qn,d=>(vt(d,ClipboardEvent)&&(c(),Ht!==null&&(window.clearTimeout(Ht),Ht=null),u(Fo(r,d,t))),!0),Lc);Ht=window.setTimeout(()=>{c(),Ht=null,u(!1)},50),s.execCommand("copy"),i.remove()})}function Fo(r,e,t){if(t===void 0){const s=$e(r._window);if(!s)return!1;const o=s.anchorNode,i=s.focusNode;if(o!==null&&i!==null&&!Vr(r,o,i))return!1;const l=q();if(l===null)return!1;t=dd(l)}e.preventDefault();const n=e.clipboardData;return n!==null&&(fd(n,t),!0)}const cd=[["text/html",od],["application/x-lexical-editor",ld]];function dd(r=q()){const e={"text/plain":r?r.getTextContent():""};if(r){const t=cc();for(const[n,s]of cd){const o=s(t,r);o!==null&&(e[n]=o)}}return e}function fd(r,e){for(const t in e){const n=e[t];n!==void 0&&r.setData(t,n)}}function Lo(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 ur=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,hd=ur&&"documentMode"in document?document.documentMode:null,pd=!(!ur||!("InputEvent"in window)||hd)&&"getTargetRanges"in new window.InputEvent("input"),gd=ur&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),jo=ur&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,md=ur&&/^(?=.*Chrome).*/i.test(navigator.userAgent),yd=ur&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!md,Po=Ur();class ts extends pt{static getType(){return"quote"}static clone(e){return new ts(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return en(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:xd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&ft(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=Di();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=ce(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=ce();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Di(){return ot(new ts)}class rs extends pt{static getType(){return"heading"}static clone(e){return new rs(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 o=s[t];en(n,o)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:Jt,priority:0}),h2:e=>({conversion:Jt,priority:0}),h3:e=>({conversion:Jt,priority:0}),h4:e=>({conversion:Jt,priority:0}),h5:e=>({conversion:Jt,priority:0}),h6:e=>({conversion:Jt,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&Oo(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Oo(e)?{conversion:t=>({node:Ar("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&ft(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=Ar(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(),o=!s||e&&e.anchor.key===s.getKey()&&n===s.getTextContentSize()||!e?ce():Ar(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),n===0&&!this.isEmpty()&&e){const l=ce();l.select(),this.replace(l,!0)}return o}collapseAtStart(){const e=this.isEmpty()?ce():Ar(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function Oo(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function Jt(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=Ar(e),r.style!==null&&(mi(r,t),t.setFormat(r.style.textAlign))),{node:t}}function xd(r){const e=Di();return r.style!==null&&(e.setFormat(r.style.textAlign),mi(r,e)),{node:e}}function Ar(r){return ot(new rs(r))}function hn(r){let e=null;if(vt(r,DragEvent)?e=r.dataTransfer:vt(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 Mo(r){const e=q();if(!P(e))return!1;const t=new Set,n=e.getNodes();for(let s=0;s<n.length;s++){const o=n[s],i=o.getKey();if(t.has(i))continue;const l=es(o,a=>B(a)&&!a.isInline());if(l===null)continue;const u=l.getKey();l.canIndent()&&!t.has(u)&&(t.add(u),r(l))}return t.size>0}function pn(r){const e=sr(r);return Z(e)}function _d(r){return It(r.registerCommand(ol,e=>{const t=q();return!!et(t)&&(t.clear(),!0)},0),r.registerCommand(Ft,e=>{const t=q();return!!P(t)&&(t.deleteCharacter(e),!0)},Y),r.registerCommand(Mr,e=>{const t=q();return!!P(t)&&(t.deleteWord(e),!0)},Y),r.registerCommand(Rr,e=>{const t=q();return!!P(t)&&(t.deleteLine(e),!0)},Y),r.registerCommand(er,e=>{const t=q();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const n=e.dataTransfer;if(n!=null)To(n,t,r);else if(P(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},Y),r.registerCommand(As,()=>{const e=q();return!!P(e)&&(e.removeText(),!0)},Y),r.registerCommand(Ge,e=>{const t=q();return!!P(t)&&(t.formatText(e),!0)},Y),r.registerCommand(Sa,e=>{const t=q();if(!P(t)&&!et(t))return!1;const n=t.getNodes();for(const s of n){const o=es(s,i=>B(i)&&!i.isInline());o!==null&&o.setFormat(e)}return!0},Y),r.registerCommand(Zt,e=>{const t=q();return!!P(t)&&(t.insertLineBreak(e),!0)},Y),r.registerCommand(Or,()=>{const e=q();return!!P(e)&&(e.insertParagraph(),!0)},Y),r.registerCommand(Aa,()=>(Zl([Qr()]),!0),Y),r.registerCommand(ka,()=>Mo(e=>{const t=e.getIndent();e.setIndent(t+1)}),Y),r.registerCommand(zi,()=>Mo(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),Y),r.registerCommand(al,e=>{const t=q();if(et(t)&&!pn(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(P(t)){const n=$r(t.focus,!0);if(!e.shiftKey&&Z(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},Y),r.registerCommand(cl,e=>{const t=q();if(et(t)){const n=t.getNodes();if(n.length>0)return n[0].selectNext(0,0),!0}else if(P(t)){if(function(s){const o=s.focus;return o.key==="root"&&o.offset===ne().getChildrenSize()}(t))return e.preventDefault(),!0;const n=$r(t.focus,!1);if(!e.shiftKey&&Z(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},Y),r.registerCommand(ul,e=>{const t=q();if(et(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!P(t))return!1;if(Ao(t,!0)){const n=e.shiftKey;return e.preventDefault(),ko(t,n,!0),!0}return!1},Y),r.registerCommand(ll,e=>{const t=q();if(et(t)&&!pn(e.target)){const s=t.getNodes();if(s.length>0)return e.preventDefault(),s[0].selectNext(0,0),!0}if(!P(t))return!1;const n=e.shiftKey;return!!Ao(t,!1)&&(e.preventDefault(),ko(t,n,!1),!0)},Y),r.registerCommand(dl,e=>{if(pn(e.target))return!1;const t=q();if(!P(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!De(s)&&rd(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(zi,void 0)):(!jo||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(Ft,!0))},Y),r.registerCommand(hl,e=>{if(pn(e.target))return!1;const t=q();return!!P(t)&&(e.preventDefault(),r.dispatchCommand(Ft,!1))},Y),r.registerCommand(vn,e=>{const t=q();if(!P(t))return!1;if(e!==null){if((jo||gd||yd)&&pd)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(Zt,!1)}return r.dispatchCommand(Or,void 0)},Y),r.registerCommand(fl,()=>{const e=q();return!!P(e)&&(r.blur(),!0)},Y),r.registerCommand(pl,e=>{const[,t]=hn(e);if(t.length>0){const s=Lo(e.clientX,e.clientY);if(s!==null){const{offset:o,node:i}=s,l=sr(i);if(l!==null){const u=Ac();if(R(l))u.anchor.set(l.getKey(),o,"text"),u.focus.set(l.getKey(),o,"text");else{const c=l.getParentOrThrow().getKey(),d=l.getIndexWithinParent()+1;u.anchor.set(c,d,"element"),u.focus.set(c,d,"element")}const a=wl(u);nt(a)}r.dispatchCommand(Po,t)}return e.preventDefault(),!0}const n=q();return!!P(n)},Y),r.registerCommand(gl,e=>{const[t]=hn(e),n=q();return!(t&&!P(n))},Y),r.registerCommand(ml,e=>{const[t]=hn(e),n=q();if(t&&!P(n))return!1;const s=Lo(e.clientX,e.clientY);if(s!==null){const o=sr(s.node);Z(o)&&e.preventDefault()}return!0},Y),r.registerCommand(ks,()=>(oc(),!0),Y),r.registerCommand(qn,e=>(No(r,vt(e,ClipboardEvent)?e:null),!0),Y),r.registerCommand(Xs,e=>(async function(t,n){await No(n,vt(t,ClipboardEvent)?t:null),n.update(()=>{const s=q();P(s)?s.removeText():et(s)&&s.getNodes().forEach(o=>o.remove())})}(e,r),!0),Y),r.registerCommand(zn,e=>{const[,t,n]=hn(e);return t.length>0&&!n?(r.dispatchCommand(Po,t),!0):ui(e.target)?!1:q()!==null&&(function(s,o){s.preventDefault(),o.update(()=>{const i=q(),l=vt(s,InputEvent)||vt(s,KeyboardEvent)?null:s.clipboardData;l!=null&&i!==null&&To(l,i,o)},{tag:"paste"})}(e,r),!0)},Y))}const Us=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?A.useLayoutEffect:A.useEffect;function Ro(r){return r.getEditorState().read(au(r.isComposing()))}function bd({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=Je(),s=function(o,i){const[l,u]=A.useState(()=>o.getDecorators());return Us(()=>o.registerDecoratorListener(a=>{Ni.flushSync(()=>{u(a)})}),[o]),A.useEffect(()=>{u(o.getDecorators())},[o]),A.useMemo(()=>{const a=[],c=Object.keys(l);for(let d=0;d<c.length;d++){const f=c[d],h=g.jsx(i,{onError:m=>o._onError(m),children:g.jsx(A.Suspense,{fallback:null,children:l[f]})}),p=o.getElementByKey(f);p!==null&&a.push(Ni.createPortal(h,p,f))}return a},[i,l,o])}(n,t);return function(o){Us(()=>It(_d(o),nd(o)),[o])}(n),g.jsxs(g.Fragment,{children:[r,g.jsx(vd,{content:e}),s]})}function vd({content:r}){const[e]=Je(),t=function(s){const[o,i]=A.useState(()=>Ro(s));return Us(()=>{function l(){const u=Ro(s);i(u)}return l(),It(s.registerUpdateListener(()=>{l()}),s.registerEditableListener(()=>{l()}))},[s]),o}(e),n=$c();return t?typeof r=="function"?r(n):r:null}const bu=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?A.useLayoutEffect:A.useEffect;function Dd({editor:r,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:s,ariaErrorMessage:o,ariaExpanded:i,ariaInvalid:l,ariaLabel:u,ariaLabelledBy:a,ariaMultiline:c,ariaOwns:d,ariaRequired:f,autoCapitalize:h,className:p,id:m,role:_="textbox",spellCheck:C=!0,style:y,tabIndex:E,"data-testid":D,...k},v){const[b,w]=A.useState(r.isEditable()),S=A.useCallback(T=>{T&&T.ownerDocument&&T.ownerDocument.defaultView?r.setRootElement(T):r.setRootElement(null)},[r]),$=A.useMemo(()=>function(...T){return N=>{T.forEach(j=>{typeof j=="function"?j(N):j!=null&&(j.current=N)})}}(v,S),[S,v]);return bu(()=>(w(r.isEditable()),r.registerEditableListener(T=>{w(T)})),[r]),g.jsx("div",{"aria-activedescendant":b?e:void 0,"aria-autocomplete":b?t:"none","aria-controls":b?n:void 0,"aria-describedby":s,...o!=null?{"aria-errormessage":o}:{},"aria-expanded":b&&_==="combobox"?!!i:void 0,...l!=null?{"aria-invalid":l}:{},"aria-label":u,"aria-labelledby":a,"aria-multiline":c,"aria-owns":b?d:void 0,"aria-readonly":!b||void 0,"aria-required":f,autoCapitalize:h,className:p,contentEditable:b,"data-testid":D,id:m,ref:$,role:b?_:void 0,spellCheck:C,style:y,tabIndex:E,...k})}const Cd=A.forwardRef(Dd);function $o(r){return r.getEditorState().read(au(r.isComposing()))}const wd=A.forwardRef(Ed);function Ed(r,e){const{placeholder:t,...n}=r,[s]=Je();return g.jsxs(g.Fragment,{children:[g.jsx(Cd,{editor:s,...n,ref:e}),t!=null&&g.jsx(Ad,{editor:s,content:t})]})}function Ad({content:r,editor:e}){const t=function(i){const[l,u]=A.useState(()=>$o(i));return bu(()=>{function a(){const c=$o(i);u(c)}return a(),It(i.registerUpdateListener(()=>{a()}),i.registerEditableListener(()=>{a()}))},[i]),l}(e),[n,s]=A.useState(e.isEditable());if(A.useLayoutEffect(()=>(s(e.isEditable()),e.registerEditableListener(i=>{s(i)})),[e]),!t)return null;let o=null;return typeof r=="function"?o=r(n):r!==null&&(o=r),o===null?null:g.jsx("div",{"aria-hidden":!0,children:o})}const gn=0,Ws=1,Ks=2,Ve=0,kd=1,Io=2,Sd=3,Td=4;function Bd(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return Ve;const o=e._selection,i=r._selection;if(s)return kd;if(!(P(o)&&P(i)&&i.isCollapsed()&&o.isCollapsed()))return Ve;const l=function(C,y,E){const D=C._nodeMap,k=[];for(const v of y){const b=D.get(v);b!==void 0&&k.push(b)}for(const[v,b]of E){if(!b)continue;const w=D.get(v);w===void 0||De(w)||k.push(w)}return k}(e,t,n);if(l.length===0)return Ve;if(l.length>1){const C=e._nodeMap,y=C.get(o.anchor.key),E=C.get(i.anchor.key);return y&&E&&!r._nodeMap.has(y.__key)&&R(y)&&y.__text.length===1&&o.anchor.offset===1?Io:Ve}const u=l[0],a=r._nodeMap.get(u.__key);if(!R(a)||!R(u)||a.__mode!==u.__mode)return Ve;const c=a.__text,d=u.__text;if(c===d)return Ve;const f=o.anchor,h=i.anchor;if(f.key!==h.key||f.type!=="text")return Ve;const p=f.offset,m=h.offset,_=d.length-c.length;return _===1&&m===p-1?Io:_===-1&&m===p+1?Sd:_===-1&&m===p?Td:Ve}function Nd(r,e){let t=Date.now(),n=Ve;return(s,o,i,l,u,a)=>{const c=Date.now();if(a.has("historic"))return n=Ve,t=c,Ks;const d=Bd(s,o,l,u,r.isComposing()),f=(()=>{const h=i===null||i.editor===r,p=a.has("history-push");if(!p&&h&&a.has("history-merge"))return gn;if(s===null)return Ws;const m=o._selection;return l.size>0||u.size>0?p===!1&&d!==Ve&&d===n&&c<t+e&&h||l.size===1&&function(_,C,y){const E=C._nodeMap.get(_),D=y._nodeMap.get(_),k=C._selection,v=y._selection;return!(P(k)&&P(v)&&k.anchor.type==="element"&&k.focus.type==="element"&&v.anchor.type==="text"&&v.focus.type==="text"||!R(E)||!R(D)||E.__parent!==D.__parent)&&JSON.stringify(C.read(()=>E.exportJSON()))===JSON.stringify(y.read(()=>D.exportJSON()))}(Array.from(l)[0],s,o)?gn:Ws:m!==null?gn:Ks})();return t=c,n=d,f}}function zo(r){r.undoStack=[],r.redoStack=[],r.current=null}function Fd(r,e,t){const n=Nd(r,t);return It(r.registerCommand(Qs,()=>(function(o,i){const l=i.redoStack,u=i.undoStack;if(u.length!==0){const a=i.current,c=u.pop();a!==null&&(l.push(a),o.dispatchCommand(un,!0)),u.length===0&&o.dispatchCommand(an,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),Y),r.registerCommand(Ys,()=>(function(o,i){const l=i.redoStack,u=i.undoStack;if(l.length!==0){const a=i.current;a!==null&&(u.push(a),o.dispatchCommand(an,!0));const c=l.pop();l.length===0&&o.dispatchCommand(un,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),Y),r.registerCommand(Ba,()=>(zo(e),!1),Y),r.registerCommand(Na,()=>(zo(e),r.dispatchCommand(un,!1),r.dispatchCommand(an,!1),!0),Y),r.registerUpdateListener(({editorState:o,prevEditorState:i,dirtyLeaves:l,dirtyElements:u,tags:a})=>{const c=e.current,d=e.redoStack,f=e.undoStack,h=c===null?null:c.editorState;if(c!==null&&o===h)return;const p=n(i,o,c,l,u,a);if(p===Ws)d.length!==0&&(e.redoStack=[],r.dispatchCommand(un,!1)),c!==null&&(f.push({...c}),r.dispatchCommand(an,!0));else if(p===Ks)return;e.current={editor:r,editorState:o}}))}function Ld(){return{current:null,redoStack:[],undoStack:[]}}function jd({delay:r,externalHistoryState:e}){const[t]=Je();return function(n,s,o=1e3){const i=A.useMemo(()=>s||Ld(),[s]);A.useEffect(()=>Fd(n,i,o),[o,n,i])}(t,e,r),null}const Pd=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?A.useLayoutEffect:A.useEffect;function Od({ignoreHistoryMergeTagChange:r=!0,ignoreSelectionChange:e=!1,onChange:t}){const[n]=Je();return Pd(()=>{if(t)return n.registerUpdateListener(({editorState:s,dirtyElements:o,dirtyLeaves:i,prevEditorState:l,tags:u})=>{e&&o.size===0&&i.size===0||r&&u.has("history-merge")||l.isEmpty()||t(s,n,u)})},[n,r,e,t]),null}function Vs(r,e){return Vs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Vs(r,e)}var qo={error:null},Md=function(r){var e,t;function n(){for(var o,i=arguments.length,l=new Array(i),u=0;u<i;u++)l[u]=arguments[u];return(o=r.call.apply(r,[this].concat(l))||this).state=qo,o.resetErrorBoundary=function(){for(var a,c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];o.props.onReset==null||(a=o.props).onReset.apply(a,d),o.reset()},o}t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,Vs(e,t),n.getDerivedStateFromError=function(o){return{error:o}};var s=n.prototype;return s.reset=function(){this.setState(qo)},s.componentDidCatch=function(o,i){var l,u;(l=(u=this.props).onError)==null||l.call(u,o,i)},s.componentDidUpdate=function(o,i){var l,u,a,c,d=this.state.error,f=this.props.resetKeys;d!==null&&i.error!==null&&((a=o.resetKeys)===void 0&&(a=[]),(c=f)===void 0&&(c=[]),a.length!==c.length||a.some(function(h,p){return!Object.is(h,c[p])}))&&((l=(u=this.props).onResetKeysChange)==null||l.call(u,o.resetKeys,f),this.reset())},s.render=function(){var o=this.state.error,i=this.props,l=i.fallbackRender,u=i.FallbackComponent,a=i.fallback;if(o!==null){var c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(us.isValidElement(a))return a;if(typeof l=="function")return l(c);if(u)return us.createElement(u,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(us.Component);function Rd({children:r,onError:e}){return g.jsx(Md,{fallback:g.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function $d(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var tt=$d(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 Id(r){let e=1,t=r.getParent();for(;t!=null;){if(se(t)){const n=t.getParent();if(Q(n)){e++,t=n.getParent();continue}tt(40)}return e}return e}function Gs(r){let e=r.getParent();Q(e)||tt(40);let t=e;for(;t!==null;)t=t.getParent(),Q(t)&&(e=t);return e}function vu(r){let e=[];const t=r.getChildren().filter(se);for(let n=0;n<t.length;n++){const s=t[n],o=s.getFirstChild();Q(o)?e=e.concat(vu(o)):e.push(s)}return e}function rt(r){return se(r)&&Q(r.getFirstChild())}function Uo(r){return Le().append(r)}function Du(r,e){return se(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function Wo(r,e){r.update(()=>{const t=q();if(t!==null){const n=t.getNodes();if(P(t)){const o=t.getStartEndPoints();o===null&&tt(143);const[i]=o,l=i.getNode(),u=l.getParent();if(Du(l,n)){const a=Be(e);if(st(u)){l.replace(a);const c=Le();B(l)&&(c.setFormat(l.getFormatType()),c.setIndent(l.getIndent())),a.append(c)}else if(se(l)){const c=l.getParentOrThrow();$t(a,c.getChildren()),c.replace(a)}return}}const s=new Set;for(let o=0;o<n.length;o++){const i=n[o];if(!B(i)||!i.isEmpty()||se(i)||s.has(i.getKey())){if(Al(i)){let l=i.getParent();for(;l!=null;){const u=l.getKey();if(Q(l)){if(!s.has(u)){const a=Be(e);$t(a,l.getChildren()),l.replace(a),s.add(u)}break}{const a=l.getParent();if(st(a)&&!s.has(u)){s.add(u),Ko(l,e);break}l=a}}}}else Ko(i,e)}}})}function $t(r,e){r.splice(r.getChildrenSize(),0,e)}function Ko(r,e){if(Q(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=Le();let o;if($t(s,r.getChildren()),Q(t)&&e===t.getListType())t.append(s),Q(n)&&e===n.getListType()&&($t(t,n.getChildren()),n.remove()),o=t;else if(Q(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),o=n;else{const i=Be(e);i.append(s),r.replace(i),o=i}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),o}function Ci(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&rt(t)&&rt(n)&&(Ci(t.getFirstChild(),n.getFirstChild()),n.remove());const s=e.getChildren();s.length>0&&r.append(...s),e.remove()}function zd(r){r.update(()=>{const e=q();if(P(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(Du(s,n))t.add(Gs(s));else for(let o=0;o<n.length;o++){const i=n[o];if(Al(i)){const l=td(i,zt);l!=null&&t.add(Gs(l))}}for(const o of t){let i=o;const l=vu(o);for(const u of l){const a=ce();$t(a,u.getChildren()),i.insertAfter(a),i=a,u.__key===e.anchor.key&&e.anchor.set(a.getKey(),0,"element"),u.__key===e.focus.key&&e.focus.set(a.getKey(),0,"element"),u.remove()}o.remove()}}})}function qd(r){const e=new Set;if(rt(r)||e.has(r.getKey()))return;const t=r.getParent(),n=r.getNextSibling(),s=r.getPreviousSibling();if(rt(n)&&rt(s)){const o=s.getFirstChild();if(Q(o)){o.append(r);const i=n.getFirstChild();Q(i)&&($t(o,i.getChildren()),n.remove(),e.add(n.getKey()))}}else if(rt(n)){const o=n.getFirstChild();if(Q(o)){const i=o.getFirstChild();i!==null&&i.insertBefore(r)}}else if(rt(s)){const o=s.getFirstChild();Q(o)&&o.append(r)}else if(Q(t)){const o=Le(),i=Be(t.getListType());o.append(i),i.append(r),s?s.insertAfter(o):n?n.insertBefore(o):t.append(o)}}function Ud(r){if(rt(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(Q(t?t.getParent():void 0)&&se(t)&&Q(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 o=e.getListType(),i=Le(),l=Be(o);i.append(l),r.getPreviousSiblings().forEach(c=>l.append(c));const u=Le(),a=Be(o);u.append(a),$t(a,r.getNextSiblings()),t.insertBefore(i),t.insertAfter(u),t.replace(r)}}}function Wd(){const r=q();if(!P(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!se(e)||e.getChildrenSize()!==0)return!1;const t=Gs(e),n=e.getParent();Q(n)||tt(40);const s=n.getParent();let o;if(st(s))o=ce(),t.insertAfter(o);else{if(!se(s))return!1;o=Le(),s.insertAfter(o)}o.select();const i=e.getNextSiblings();if(i.length>0){const l=Be(n.getListType());if(ir(o))o.insertAfter(l);else{const u=Le();u.append(l),o.insertAfter(u)}i.forEach(u=>{u.remove(),l.append(u)})}return function(l){let u=l;for(;u.getNextSibling()==null&&u.getPreviousSibling()==null;){const a=u.getParent();if(a==null||!se(u)&&!Q(u))break;u=a}u.remove()}(e),!0}function Rn(...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 zt extends pt{static getType(){return"listitem"}static clone(e){return new zt(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 Q(n)&&n.getListType()==="check"&&Go(t,this,null),t.value=this.__value,Vo(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return Q(s)&&s.getListType()==="check"&&Go(t,this,e),t.value=this.__value,Vo(t,n.theme,this),!1}static transform(){return e=>{if(se(e)||tt(144),e.__checked==null)return;const t=e.getParent();Q(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:Kd,priority:0})}}static importJSON(e){const t=Le();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(B(n)&&this.canMergeWith(n)){const s=n.getChildren();this.append(...s),n.remove()}else super.append(n)}return this}replace(e,t){if(se(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!Q(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=Be(n.getListType());let o=this.getNextSibling();for(;o;){const i=o;o=o.getNextSibling(),s.append(i)}n.insertAfter(e),e.insertAfter(s)}return t&&(B(e)||tt(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(Q(n)||tt(39),se(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const o=Be(n.getListType());s.forEach(i=>o.append(i)),e.insertAfter(o,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&rt(t)&&rt(n)&&(Ci(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=Le(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=ce();this.getChildren().forEach(i=>t.append(i));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),o=se(s);if(n.getChildrenSize()===1)if(o)n.remove(),s.select();else{n.insertBefore(t),n.remove();const i=e.anchor,l=e.focus,u=t.getKey();i.type==="element"&&i.getNode().is(this)&&i.set(u,i.offset,"element"),l.type==="element"&&l.getNode().is(this)&&l.set(u,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 Q(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(;se(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&tt(117),(e=Math.floor(e))>=0||tt(199);let t=this.getIndent();for(;t!==e;)t<e?(qd(this),t++):(Ud(this),t--);return this}canInsertAfter(e){return se(e)}canReplaceWith(e){return se(e)}canMergeWith(e){return ir(e)||se(e)}extractWithChild(e,t){if(!P(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 Be("bullet")}canMergeWhenEmpty(){return!0}}function Vo(r,e,t){const n=[],s=[],o=e.list,i=o?o.listitem:void 0;let l;if(o&&o.nested&&(l=o.nested.listitem),i!==void 0&&n.push(...Rn(i)),o){const u=t.getParent(),a=Q(u)&&u.getListType()==="check",c=t.getChecked();a&&!c||s.push(o.listitemUnchecked),a&&c||s.push(o.listitemChecked),a&&n.push(c?o.listitemChecked:o.listitemUnchecked)}if(l!==void 0){const u=Rn(l);t.getChildren().some(a=>Q(a))?n.push(...u):s.push(...u)}s.length>0&&hu(r,...s),n.length>0&&en(r,...n)}function Go(r,e,t,n){Q(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 Kd(r){if(r.classList.contains("task-list-item")){for(const t of r.children)if(t.tagName==="INPUT")return Vd(t)}const e=r.getAttribute("aria-checked");return{node:Le(e==="true"||e!=="false"&&void 0)}}function Vd(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:Le(r.hasAttribute("checked"))}}function Le(r){return ot(new zt(void 0,r))}function se(r){return r instanceof zt}class ar extends pt{static getType(){return"list"}static clone(e){const t=e.__listType||Qo[e.__tag];return new ar(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=Qo[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,Ho(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(Ho(t,n.theme,this),!1)}static transform(){return e=>{Q(e)||tt(163),function(t){const n=t.getNextSibling();Q(n)&&t.getListType()===n.getListType()&&Ci(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const o of t.getChildren())se(o)&&(o.getValue()!==s&&o.setValue(s),n&&o.getLatest().__checked!=null&&o.setChecked(void 0),Q(o.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:Jo,priority:0}),ul:()=>({conversion:Jo,priority:0})}}static importJSON(e){const t=Be(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&&ft(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(se(n))super.append(n);else{const s=Le();if(Q(n))s.append(n);else if(B(n))if(n.isInline())s.append(n);else{const o=de(n.getTextContent());s.append(o)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return se(e)}}function Ho(r,e,t){const n=[],s=[],o=e.list;if(o!==void 0){const i=o[`${t.__tag}Depth`]||[],l=Id(t)-1,u=l%i.length,a=i[u],c=o[t.__tag];let d;const f=o.nested,h=o.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),a!==void 0){n.push(...Rn(a));for(let p=0;p<i.length;p++)p!==u&&s.push(t.__tag+p)}if(d!==void 0){const p=Rn(d);l>1?n.push(...p):s.push(...p)}}s.length>0&&hu(r,...s),n.length>0&&en(r,...n)}function Gd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(se(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(o=>{Q(o)&&e.push(Uo(o))})}else e.push(Uo(n))}return e}function Jo(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=Be("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(ft(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?Be("check"):Be("bullet")),{after:Gd,node:t}}const Qo={ol:"number",ul:"bullet"};function Be(r,e=1){return ot(new ar(r,e))}function Q(r){return r instanceof ar}const Cu=Ur(),wu=Ur(),Hd=Ur();function Jd(r){return It(r.registerCommand(wu,()=>(Wo(r,"number"),!0),Xt),r.registerCommand(Cu,()=>(Wo(r,"bullet"),!0),Xt),r.registerCommand(Hd,()=>(zd(r),!0),Xt),r.registerCommand(Or,()=>!!Wd(),Xt))}function Qd(){const[r]=Je();return A.useEffect(()=>{if(!r.hasNodes([ar,zt]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[r]),function(e){A.useEffect(()=>Jd(e),[e])}(r),null}const Yd=new Set(["http:","https:","mailto:","sms:","tel:"]);class qt extends pt{static getType(){return"link"}static clone(e){return new qt(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},n){super(n);const{target:s=null,rel:o=null,title:i=null}=t;this.__url=e,this.__target=s,this.__rel=o,this.__title=i}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),en(t,e.theme.link),t}updateDOM(e,t,n){if(t instanceof HTMLAnchorElement){const s=this.__url,o=this.__target,i=this.__rel,l=this.__title;s!==e.__url&&(t.href=s),o!==e.__target&&(o?t.target=o:t.removeAttribute("target")),i!==e.__rel&&(i?t.rel=i:t.removeAttribute("rel")),l!==e.__title&&(l?t.title=l:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:Xd,priority:1})}}static importJSON(e){const t=$n(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(!Yd.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=$n(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(!P(t))return!1;const s=t.anchor.getNode(),o=t.focus.getNode();return this.isParentOf(s)&&this.isParentOf(o)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function Xd(r){let e=null;if(ac(r)){const t=r.textContent;(t!==null&&t!==""||r.children.length>0)&&(e=$n(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function $n(r,e){return ot(new qt(r,e))}function Dr(r){return r instanceof qt}class tn extends qt{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 tn(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=Yo(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(B(n)){const s=Yo(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function Yo(r,e){return ot(new tn(r,e))}function Zd(r){return r instanceof tn}const Xo=Ur();function Cs(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,o=q();if(!P(o))return;const i=o.extract();if(r===null)i.forEach(l=>{const u=es(l,a=>!Zd(a)&&Dr(a));if(u){const a=u.getChildren();for(let c=0;c<a.length;c++)u.insertBefore(a[c]);u.remove()}});else{if(i.length===1){const a=function(c,d){let f=c;for(;f!==null&&f.getParent()!==null&&!d(f);)f=f.getParentOrThrow();return d(f)?f:null}(i[0],Dr);if(a!==null)return a.setURL(r),t!==void 0&&a.setTarget(t),s!==null&&a.setRel(s),void(n!==void 0&&a.setTitle(n))}let l=null,u=null;i.forEach(a=>{const c=a.getParent();if(c!==u&&c!==null&&(!B(a)||a.isInline())){if(Dr(c))return u=c,c.setURL(r),t!==void 0&&c.setTarget(t),s!==null&&u.setRel(s),void(n!==void 0&&u.setTitle(n));if(c.is(l)||(l=c,u=$n(r,{rel:s,target:t,title:n}),Dr(c)?a.getPreviousSibling()===null?c.insertBefore(u):c.insertAfter(u):a.insertBefore(u)),Dr(a)){if(a.is(u))return;if(u!==null){const d=a.getChildren();for(let f=0;f<d.length;f++)u.append(d[f])}a.remove()}else u!==null&&u.append(a)}})}}function ef({validateUrl:r,attributes:e}){const[t]=Je();return A.useEffect(()=>{if(!t.hasNodes([qt]))throw new Error("LinkPlugin: LinkNode not registered on editor");return It(t.registerCommand(Xo,n=>{if(n===null)return Cs(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(Cs(n,e),!0);{const{url:s,target:o,rel:i,title:l}=n;return Cs(s,{...e,rel:i,target:o,title:l}),!0}},Xt),r!==void 0?t.registerCommand(zn,n=>{const s=q();if(!P(s)||s.isCollapsed()||!vt(n,ClipboardEvent))return!1;const o=n;if(o.clipboardData===null)return!1;const i=o.clipboardData.getData("text");return!!r(i)&&!s.getNodes().some(l=>B(l))&&(t.dispatchCommand(Xo,{...e,url:i}),n.preventDefault(),!0)},Xt):()=>{})},[t,r,e]),null}const tf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6"},rf={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 nf({theme:r,disabled:e}){const[t]=Je(),n=A.useCallback(()=>{t.dispatchCommand(Ge,"bold")},[t]),s=A.useCallback(()=>{t.dispatchCommand(Ge,"italic")},[t]),o=A.useCallback(()=>{t.dispatchCommand(Ge,"underline")},[t]),i=A.useCallback(()=>{t.dispatchCommand(Cu,void 0)},[t]),l=A.useCallback(()=>{t.dispatchCommand(wu,void 0)},[t]),u=A.useCallback(()=>{t.update(()=>{const d=q();P(d)&&Jc(d,()=>Di())})},[t]),a={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},c=`
74
74
  .mail-editor-toolbar-btn:hover:not(:disabled) {
75
75
  background: ${r.border};
76
76
  }
77
- `;return g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",padding:"8px",borderBottom:`1px solid ${r.border}`,background:r.toolbarBackground},children:[g.jsx("style",{children:c}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:n,disabled:e,style:a,title:"Bold (Ctrl+B)",children:"B"}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:s,disabled:e,style:{...a,fontStyle:"italic"},title:"Italic (Ctrl+I)",children:"I"}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:o,disabled:e,style:{...a,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:i,disabled:e,style:a,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:l,disabled:e,style:a,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:u,disabled:e,style:a,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"})})})]})}function sf({html:r,isExternalUpdate:e,onImportComplete:t}){const[n]=it(),s=A.useRef(!1);return A.useEffect(()=>{r&&(s.current&&!e||(s.current=!0,n.update(()=>{const o=se();o.clear();const i=ce();o.append(i),i.select();const u=new DOMParser().parseFromString(r,"text/html"),c=pu(n,u).filter(f=>f.getParent()===null);c.length>0&&Zl(c),i.getTextContent()===""&&o.getChildrenSize()>1&&i.remove(),o.selectEnd()},{discrete:!0}),t(),setTimeout(()=>{n.focus()},0)))},[r,e,n,t]),null}function of({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 Eu({value:r="",onChange:e,placeholder:t="Write your message...",replyTo:n,theme:s={},disabled:o=!1,className:i="",minHeight:l="200px",externalUpdate:u}){const a={...tf,...s},[c,f]=A.useState(!1),d=A.useRef(void 0);A.useEffect(()=>{u!==void 0&&u!==d.current&&(d.current=u,f(!0))},[u]);const h=A.useCallback(()=>{f(!1)},[]),p={namespace:"MailEditor",theme:rf,onError:C=>{console.error("Lexical error:",C)},nodes:[ur,zt,qt,Zr,ts,es],editable:!o},m=A.useCallback((C,_)=>{C.read(()=>{const E=gu(_,null);e==null||e(E)})},[e]),y=`
77
+ `;return g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",padding:"8px",borderBottom:`1px solid ${r.border}`,background:r.toolbarBackground},children:[g.jsx("style",{children:c}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:n,disabled:e,style:a,title:"Bold (Ctrl+B)",children:"B"}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:s,disabled:e,style:{...a,fontStyle:"italic"},title:"Italic (Ctrl+I)",children:"I"}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:o,disabled:e,style:{...a,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:i,disabled:e,style:a,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:l,disabled:e,style:a,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:u,disabled:e,style:a,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"})})})]})}function sf({html:r,isExternalUpdate:e,onImportComplete:t}){const[n]=Je(),s=A.useRef(!1);return A.useEffect(()=>{r&&(s.current&&!e||(s.current=!0,n.update(()=>{const o=ne();o.clear();const i=ce();o.append(i),i.select();const u=new DOMParser().parseFromString(r,"text/html"),c=pu(n,u).filter(d=>d.getParent()===null);c.length>0&&Zl(c),i.getTextContent()===""&&o.getChildrenSize()>1&&i.remove(),o.selectEnd()},{discrete:!0}),t(),setTimeout(()=>{n.focus()},0)))},[r,e,n,t]),null}function of({text:r,trigger:e}){const[t]=Je(),n=A.useRef(void 0);return A.useEffect(()=>{e===void 0||e===n.current||!r||(n.current=e,t.update(()=>{const s=q();if(P(s))s.insertText(r);else{const o=ne(),i=o.getLastChild();if(i){i.selectEnd();const l=q();P(l)&&(o.getTextContent().trim()&&l.insertText(`
78
+
79
+ `),l.insertText(r))}else{const l=ce(),u=de(r);l.append(u),o.append(l)}}}),setTimeout(()=>{t.focus()},0))},[r,e,t]),null}function lf({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 Eu({value:r="",onChange:e,placeholder:t="Write your message...",replyTo:n,theme:s={},disabled:o=!1,className:i="",minHeight:l="200px",externalUpdate:u,insertText:a,insertTextTrigger:c}){const d={...tf,...s},[f,h]=A.useState(!1),p=A.useRef(void 0);A.useEffect(()=>{u!==void 0&&u!==p.current&&(p.current=u,h(!0))},[u]);const m=A.useCallback(()=>{h(!1)},[]),_={namespace:"MailEditor",theme:rf,onError:E=>{console.error("Lexical error:",E)},nodes:[ar,zt,qt,tn,rs,ts],editable:!o},C=A.useCallback((E,D)=>{E.read(()=>{const k=gu(D,null);e==null||e(k)})},[e]),y=`
78
80
  .mail-editor-paragraph {
79
81
  margin: 0 0 8px 0;
80
82
  line-height: 1.5;
@@ -96,15 +98,15 @@ React keys must be passed directly to JSX without using spread:
96
98
  margin: 4px 0;
97
99
  }
98
100
  .mail-editor-link {
99
- color: ${a.primary};
101
+ color: ${d.primary};
100
102
  text-decoration: underline;
101
103
  }
102
104
  .mail-editor-quote {
103
105
  margin: 8px 0;
104
106
  padding: 8px 16px;
105
- border-left: 3px solid ${a.quoteBorder};
106
- background: ${a.quoteBackground};
107
- color: ${a.textSecondary};
107
+ border-left: 3px solid ${d.quoteBorder};
108
+ background: ${d.quoteBackground};
109
+ color: ${d.textSecondary};
108
110
  }
109
111
  .mail-editor-h1 {
110
112
  font-size: 24px;
@@ -127,7 +129,7 @@ React keys must be passed directly to JSX without using spread:
127
129
  padding: 16px;
128
130
  font-size: 14px;
129
131
  line-height: 1.6;
130
- color: ${a.text};
132
+ color: ${d.text};
131
133
  }
132
134
  .mail-editor-content:focus {
133
135
  outline: none;
@@ -136,13 +138,13 @@ React keys must be passed directly to JSX without using spread:
136
138
  position: absolute;
137
139
  top: 16px;
138
140
  left: 16px;
139
- color: ${a.textSecondary};
141
+ color: ${d.textSecondary};
140
142
  pointer-events: none;
141
143
  font-size: 14px;
142
144
  }
143
- `;return g.jsxs("div",{className:i,style:{border:`1px solid ${a.border}`,borderRadius:"8px",background:a.background,overflow:"hidden",display:"flex",flexDirection:"column",height:"100%",minHeight:l},children:[g.jsx("style",{children:y}),g.jsxs(Oc,{initialConfig:p,children:[g.jsx(nf,{theme:a,disabled:o}),g.jsx("div",{style:{position:"relative",flex:1,display:"flex",flexDirection:"column"},children:g.jsx(bd,{contentEditable:g.jsx(wd,{className:"mail-editor-content",style:{outline:"none",flex:1,minHeight:"100px",padding:"16px",fontSize:"14px",lineHeight:1.6,color:a.text}}),placeholder:g.jsx("div",{className:"mail-editor-placeholder",children:t}),ErrorBoundary:Rd})}),g.jsx(Qd,{}),g.jsx(ef,{}),g.jsx(jd,{}),g.jsx(Od,{onChange:m}),g.jsx(sf,{html:r,isExternalUpdate:c,onImportComplete:h})]}),n&&g.jsx(of,{replyTo:n,theme:a})]})}const lf={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 uf({to:r="",subject:e="",body:t="",replyTo:n,onSend:s,onCancel:o,onBodyChange:i,externalUpdate:l,theme:u={},disabled:a=!1,showCcBcc:c=!1,placeholder:f="Write your message...",className:d="",minHeight:h="200px",sendButtonText:p="Send",hideCancelButton:m=!1}){const y={...lf,...u},[C,_]=A.useState(r),[E,D]=A.useState(""),[k,v]=A.useState(""),[b,w]=A.useState(e),[S,R]=A.useState(t),[T,N]=A.useState([]),[F,j]=A.useState(!1),[$,G]=A.useState(""),[de,fe]=A.useState(c),[Oe,_e]=A.useState(!1),qe=A.useRef(void 0);A.useEffect(()=>{l!==void 0&&l!==qe.current&&(qe.current=l,R(t),_e(!0))},[l,t]);const Qe=W=>{R(W),_e(!1),i==null||i(W)},Ee=A.useRef(null),[Ae,Fe]=A.useState(!1),le=W=>{const ye=W.target.files;ye&&N(ke=>[...ke,...Array.from(ye)]),Ee.current&&(Ee.current.value="")},Me=W=>{W.preventDefault(),W.stopPropagation(),Fe(!0)},be=W=>{W.preventDefault(),W.stopPropagation(),Fe(!1)},te=W=>{W.preventDefault(),W.stopPropagation(),Fe(!1),W.dataTransfer.files&&N(ye=>[...ye,...Array.from(W.dataTransfer.files)])},Re=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",Et=W=>{N(ye=>ye.filter((ke,At)=>At!==W))},Ut=W=>W<1024?`${W} B`:W<1024*1024?`${(W/1024).toFixed(1)} KB`:`${(W/(1024*1024)).toFixed(1)} MB`,ar=async()=>{if(!C.trim()){G("Recipient email is required");return}if(!b.trim()){G("Subject is required");return}j(!0),G("");try{const W=await Promise.all(T.map(async ke=>{const At=await ke.arrayBuffer(),cr=btoa(new Uint8Array(At).reduce((kt,dr)=>kt+String.fromCharCode(dr),""));return{filename:ke.name,content_type:ke.type||"application/octet-stream",data:cr,size:ke.size}})),ye=S.replace(/>\n+</g,"><").replace(/<p class="[^"]*"><\/p>/g,"<br>").trim();await s({to:C.trim(),cc:E.trim()||void 0,bcc:k.trim()||void 0,subject:b.trim(),html:ye,attachments:W,inReplyTo:n==null?void 0:n.messageId}),_(""),D(""),v(""),w(""),R(""),N([])}catch(W){G(W instanceof Error?W.message:"Failed to send email")}finally{j(!1)}},pt={width:"100%",padding:"8px 12px",fontSize:"14px",border:`1px solid ${y.inputBorder}`,borderRadius:"6px",background:y.inputBackground,color:y.text,outline:"none"},Le={display:"block",fontSize:"12px",fontWeight:500,color:y.textSecondary,marginBottom:"4px",textTransform:"uppercase"},Ye=W=>({padding:"10px 20px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",cursor:a||F?"not-allowed":"pointer",opacity:a||F?.6:1,background:W?y.buttonPrimary:y.buttonSecondary,color:W?"#ffffff":y.text,display:"flex",alignItems:"center",gap:"8px"});return g.jsxs("div",{className:d,style:{display:"flex",flexDirection:"column",gap:"16px",background:y.background},children:[$&&g.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:"6px",color:"#dc2626",fontSize:"14px"},children:$}),g.jsxs("div",{children:[g.jsx("label",{style:Le,children:"To"}),g.jsx("input",{type:"email",value:C,onChange:W=>_(W.target.value),placeholder:"recipient@example.com",disabled:a||F,style:pt})]}),!de&&g.jsx("button",{type:"button",onClick:()=>fe(!0),disabled:a||F,style:{background:"none",border:"none",padding:0,fontSize:"12px",color:y.primary,cursor:"pointer",textAlign:"left"},children:"+ Add CC/BCC"}),de&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{children:[g.jsx("label",{style:Le,children:"CC"}),g.jsx("input",{type:"email",value:E,onChange:W=>D(W.target.value),placeholder:"cc@example.com",disabled:a||F,style:pt})]}),g.jsxs("div",{children:[g.jsx("label",{style:Le,children:"BCC"}),g.jsx("input",{type:"email",value:k,onChange:W=>v(W.target.value),placeholder:"bcc@example.com",disabled:a||F,style:pt})]})]}),g.jsxs("div",{children:[g.jsx("label",{style:Le,children:"Subject"}),g.jsx("input",{type:"text",value:b,onChange:W=>w(W.target.value),placeholder:"Email subject",disabled:a||F,style:pt})]}),g.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[g.jsx("label",{style:Le,children:"Message"}),g.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:g.jsx(Eu,{value:S,onChange:Qe,placeholder:f,replyTo:n,theme:y,disabled:a||F,minHeight:h,externalUpdate:Oe?l:void 0})})]}),g.jsxs("div",{children:[g.jsx("label",{style:{...Le,marginBottom:"8px"},children:"Attachments"}),g.jsx("input",{ref:Ee,type:"file",multiple:!0,onChange:le,style:{display:"none"}}),g.jsxs("div",{onClick:()=>{var W;return(W=Ee.current)==null?void 0:W.click()},onDragOver:Me,onDragLeave:be,onDrop:te,style:{width:"100%",padding:"24px 16px",border:`2px dashed ${Ae?y.primary:y.border}`,borderRadius:"8px",background:Ae?`${y.primary}10`:"transparent",color:Ae?y.primary:y.textSecondary,cursor:a||F?"not-allowed":"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s",marginBottom:T.length>0?"12px":0},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"24px"},children:Ae?"file_download":"attach_file"}),g.jsx("span",{style:{fontSize:"14px"},children:Ae?"Drop files here":"Drop files or click to add"})]}),T.length>0&&g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:T.map((W,ye)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:y.attachmentBackground,borderRadius:"8px"},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y.textSecondary},children:Re(W)}),g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:y.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W.name}),g.jsx("div",{style:{fontSize:"12px",color:y.textSecondary},children:Ut(W.size)})]}),g.jsx("button",{type:"button",onClick:()=>Et(ye),disabled:a||F,style:{background:"none",border:"none",padding:"4px",cursor:"pointer",color:y.textSecondary,display:"flex",borderRadius:"4px"},children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px"},children:"close"})})]},`${W.name}-${ye}`))})]}),g.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"12px"},children:[!m&&o&&g.jsx("button",{type:"button",onClick:o,disabled:a||F,style:Ye(!1),children:"Cancel"}),g.jsxs("button",{type:"button",onClick:ar,disabled:a||F||!C.trim()||!b.trim(),style:Ye(!0),children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",animation:F?"spin 1s linear infinite":"none"},children:F?"sync":"send"}),F?"Sending...":p]})]}),g.jsx("style",{children:`
145
+ `;return g.jsxs("div",{className:i,style:{border:`1px solid ${d.border}`,borderRadius:"8px",background:d.background,overflow:"hidden",display:"flex",flexDirection:"column",height:"100%",minHeight:l},children:[g.jsx("style",{children:y}),g.jsxs(Oc,{initialConfig:_,children:[g.jsx(nf,{theme:d,disabled:o}),g.jsx("div",{style:{position:"relative",flex:1,display:"flex",flexDirection:"column"},children:g.jsx(bd,{contentEditable:g.jsx(wd,{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:Rd})}),g.jsx(Qd,{}),g.jsx(ef,{}),g.jsx(jd,{}),g.jsx(Od,{onChange:C}),g.jsx(sf,{html:r,isExternalUpdate:f,onImportComplete:m}),g.jsx(of,{text:a,trigger:c})]}),n&&g.jsx(lf,{replyTo:n,theme:d})]})}const uf={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 af({to:r="",subject:e="",body:t="",replyTo:n,onSend:s,onCancel:o,onBodyChange:i,externalUpdate:l,insertText:u,insertTextTrigger:a,theme:c={},disabled:d=!1,showCcBcc:f=!1,placeholder:h="Write your message...",className:p="",minHeight:m="200px",sendButtonText:_="Send",hideCancelButton:C=!1}){const y={...uf,...c},[E,D]=A.useState(r),[k,v]=A.useState(""),[b,w]=A.useState(""),[S,$]=A.useState(e),[T,N]=A.useState(t),[j,L]=A.useState([]),[O,G]=A.useState(!1),[he,oe]=A.useState(""),[Ne,we]=A.useState(f),[Ye,Ie]=A.useState(!1),je=A.useRef(void 0);A.useEffect(()=>{l!==void 0&&l!==je.current&&(je.current=l,N(t),Ie(!0))},[l,t]);const Xe=U=>{N(U),Ie(!1),i==null||i(U)},Ee=A.useRef(null),[te,Ae]=A.useState(!1),xe=U=>{const _e=U.target.files;_e&&L(qe=>[...qe,...Array.from(_e)]),Ee.current&&(Ee.current.value="")},re=U=>{U.preventDefault(),U.stopPropagation(),Ae(!0)},Pe=U=>{U.preventDefault(),U.stopPropagation(),Ae(!1)},At=U=>{U.preventDefault(),U.stopPropagation(),Ae(!1),U.dataTransfer.files&&L(_e=>[..._e,...Array.from(U.dataTransfer.files)])},Ut=U=>U.type.startsWith("image/")?"image":U.type==="application/pdf"?"picture_as_pdf":U.type.includes("spreadsheet")||U.type.includes("excel")?"table_chart":U.type.includes("document")||U.type.includes("word")?"description":"attach_file",cr=U=>{L(_e=>_e.filter((qe,lt)=>lt!==U))},dr=U=>U<1024?`${U} B`:U<1024*1024?`${(U/1024).toFixed(1)} KB`:`${(U/(1024*1024)).toFixed(1)} MB`,gt=async()=>{if(!E.trim()){oe("Recipient email is required");return}if(!S.trim()){oe("Subject is required");return}G(!0),oe("");try{const U=await Promise.all(j.map(async qe=>{const lt=await qe.arrayBuffer(),fr=btoa(new Uint8Array(lt).reduce((hr,Wt)=>hr+String.fromCharCode(Wt),""));return{filename:qe.name,content_type:qe.type||"application/octet-stream",data:fr,size:qe.size}})),_e=T.replace(/>\n+</g,"><").replace(/<p class="[^"]*"><\/p>/g,"<br>").trim();await s({to:E.trim(),cc:k.trim()||void 0,bcc:b.trim()||void 0,subject:S.trim(),html:_e,attachments:U,inReplyTo:n==null?void 0:n.messageId}),D(""),v(""),w(""),$(""),N(""),L([])}catch(U){oe(U instanceof Error?U.message:"Failed to send email")}finally{G(!1)}},Oe={width:"100%",padding:"8px 12px",fontSize:"14px",border:`1px solid ${y.inputBorder}`,borderRadius:"6px",background:y.inputBackground,color:y.text,outline:"none"},ze={display:"block",fontSize:"12px",fontWeight:500,color:y.textSecondary,marginBottom:"4px",textTransform:"uppercase"},kt=U=>({padding:"10px 20px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",cursor:d||O?"not-allowed":"pointer",opacity:d||O?.6:1,background:U?y.buttonPrimary:y.buttonSecondary,color:U?"#ffffff":y.text,display:"flex",alignItems:"center",gap:"8px"});return g.jsxs("div",{className:p,style:{display:"flex",flexDirection:"column",gap:"16px",background:y.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:ze,children:"To"}),g.jsx("input",{type:"email",value:E,onChange:U=>D(U.target.value),placeholder:"recipient@example.com",disabled:d||O,style:Oe})]}),!Ne&&g.jsx("button",{type:"button",onClick:()=>we(!0),disabled:d||O,style:{background:"none",border:"none",padding:0,fontSize:"12px",color:y.primary,cursor:"pointer",textAlign:"left"},children:"+ Add CC/BCC"}),Ne&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{children:[g.jsx("label",{style:ze,children:"CC"}),g.jsx("input",{type:"email",value:k,onChange:U=>v(U.target.value),placeholder:"cc@example.com",disabled:d||O,style:Oe})]}),g.jsxs("div",{children:[g.jsx("label",{style:ze,children:"BCC"}),g.jsx("input",{type:"email",value:b,onChange:U=>w(U.target.value),placeholder:"bcc@example.com",disabled:d||O,style:Oe})]})]}),g.jsxs("div",{children:[g.jsx("label",{style:ze,children:"Subject"}),g.jsx("input",{type:"text",value:S,onChange:U=>$(U.target.value),placeholder:"Email subject",disabled:d||O,style:Oe})]}),g.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[g.jsx("label",{style:ze,children:"Message"}),g.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:g.jsx(Eu,{value:T,onChange:Xe,placeholder:h,replyTo:n,theme:y,disabled:d||O,minHeight:m,externalUpdate:Ye?l:void 0,insertText:u,insertTextTrigger:a})})]}),g.jsxs("div",{children:[g.jsx("label",{style:{...ze,marginBottom:"8px"},children:"Attachments"}),g.jsx("input",{ref:Ee,type:"file",multiple:!0,onChange:xe,style:{display:"none"}}),g.jsxs("div",{onClick:()=>{var U;return(U=Ee.current)==null?void 0:U.click()},onDragOver:re,onDragLeave:Pe,onDrop:At,style:{width:"100%",padding:"24px 16px",border:`2px dashed ${te?y.primary:y.border}`,borderRadius:"8px",background:te?`${y.primary}10`:"transparent",color:te?y.primary:y.textSecondary,cursor:d||O?"not-allowed":"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s",marginBottom:j.length>0?"12px":0},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"24px"},children:te?"file_download":"attach_file"}),g.jsx("span",{style:{fontSize:"14px"},children:te?"Drop files here":"Drop files or click to add"})]}),j.length>0&&g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:j.map((U,_e)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:y.attachmentBackground,borderRadius:"8px"},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:y.textSecondary},children:Ut(U)}),g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:y.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:U.name}),g.jsx("div",{style:{fontSize:"12px",color:y.textSecondary},children:dr(U.size)})]}),g.jsx("button",{type:"button",onClick:()=>cr(_e),disabled:d||O,style:{background:"none",border:"none",padding:"4px",cursor:"pointer",color:y.textSecondary,display:"flex",borderRadius:"4px"},children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px"},children:"close"})})]},`${U.name}-${_e}`))})]}),g.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"12px"},children:[!C&&o&&g.jsx("button",{type:"button",onClick:o,disabled:d||O,style:kt(!1),children:"Cancel"}),g.jsxs("button",{type:"button",onClick:gt,disabled:d||O||!E.trim()||!S.trim(),style:kt(!0),children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",animation:O?"spin 1s linear infinite":"none"},children:O?"sync":"send"}),O?"Sending...":_]})]}),g.jsx("style",{children:`
144
146
  @keyframes spin {
145
147
  from { transform: rotate(0deg); }
146
148
  to { transform: rotate(360deg); }
147
149
  }
148
- `})]})}const af={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",chipBackground:"#f3f4f6",chipText:"#374151",hoverBackground:"#f9fafb"};function cf({options:r,value:e,onChange:t,placeholder:n="Search or select...",allowCreate:s=!0,onCreate:o,allowDelete:i=!1,onDelete:l,label:u,disabled:a=!1,max:c=0,theme:f={},className:d=""}){const h={...af,...f},[p,m]=A.useState(!1),[y,C]=A.useState(""),_=A.useRef(null),E=A.useRef(null);A.useEffect(()=>{function T(N){_.current&&!_.current.contains(N.target)&&(m(!1),C(""))}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const D=r.filter(T=>{var N;return((N=T.label)==null?void 0:N.toLowerCase().includes(y.toLowerCase()))&&!e.includes(T.id)}),k=s&&y.trim()&&!r.some(T=>{var N;return((N=T.label)==null?void 0:N.toLowerCase())===y.toLowerCase()}),v=e.map(T=>r.find(N=>N.id===T)).filter(Boolean),b=A.useCallback(T=>{var N;c>0&&e.length>=c||(t([...e,T]),C(""),(N=E.current)==null||N.focus())},[e,t,c]),w=A.useCallback(T=>{t(e.filter(N=>N!==T))},[e,t]),S=A.useCallback(async()=>{if(!k)return;const T=await(o==null?void 0:o(y.trim()));T&&b(T.id),C("")},[k,y,o,b]),R=A.useCallback(T=>{T.key==="Enter"?(T.preventDefault(),k?S():D.length>0&&b(D[0].id)):T.key==="Backspace"&&!y&&e.length>0?w(e[e.length-1]):T.key==="Escape"&&(m(!1),C(""))},[k,D,y,e,S,b,w]);return g.jsxs("div",{ref:_,className:d,style:{position:"relative"},children:[u&&g.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:u}),g.jsxs("div",{onClick:()=>!a&&m(!0),style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 12px",border:`1px solid ${p?h.primary:h.border}`,borderRadius:"8px",background:a?h.hoverBackground:h.background,cursor:a?"not-allowed":"text",minHeight:"42px",alignItems:"center"},children:[v.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,!a&&g.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),w(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=>{C(T.target.value),p||m(!0)},onFocus:()=>m(!0),onKeyDown:R,placeholder:v.length===0?n:"",disabled:a||c>0&&e.length>=c,style:{flex:1,minWidth:"60px",border:"none",outline:"none",fontSize:"14px",background:"transparent",color:h.text}})]}),p&&!a&&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:D.length===0&&!k?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:[D.map(T=>g.jsxs("div",{onClick:()=>b(T.id),style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.text,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseEnter:N=>{N.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:N=>{N.currentTarget.style.background=""},children:[T.label,i&&l&&g.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),l(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",fontSize:"14px",color:h.textSecondary,opacity:.5},onMouseEnter:N=>{N.currentTarget.style.opacity="1",N.currentTarget.style.color="#ef4444"},onMouseLeave:N=>{N.currentTarget.style.opacity="0.5",N.currentTarget.style.color=h.textSecondary||""},children:"×"})]},T.id)),k&&g.jsxs("div",{onClick:S,style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.primary,borderTop:D.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(),'"']})]})})]})}function df({items:r,columns:e,getItemId:t,getItemColumn:n,getItemOrder:s,renderItem:o,onItemMove:i,onItemReorder:l,onItemClick:u,renderColumnHeader:a,renderColumnFooter:c,className:f="",columnClassName:d="",itemClassName:h=""}){const[p,m]=A.useState(null),[y,C]=A.useState(null),[_,E]=A.useState(null),D=A.useRef(null),k=e.reduce((N,F)=>{let j=r.filter($=>n($)===F.id);return s&&(j=j.sort(($,G)=>s($)-s(G))),N[F.id]=j,N},{}),v=A.useCallback((N,F)=>{const j=t(F),$=n(F);m(j),D.current=$,N.dataTransfer.effectAllowed="move",N.dataTransfer.setData("text/plain",j),requestAnimationFrame(()=>{const G=N.target;G.style.opacity="0.5"})},[t,n]),b=A.useCallback(N=>{const F=N.target;F.style.opacity="1",m(null),C(null),E(null),D.current=null},[]),w=A.useCallback((N,F,j)=>{N.preventDefault(),N.dataTransfer.dropEffect="move",C(F),E(j)},[]),S=A.useCallback(N=>{const F=N.relatedTarget;F!=null&&F.closest("[data-kanban-column]")||(C(null),E(null))},[]),R=A.useCallback((N,F,j)=>{if(N.preventDefault(),!p)return;const $=D.current;$===F?l==null||l(p,F,j):$&&i(p,$,F,j),m(null),C(null),E(null),D.current=null},[p,i,l]),T=(N,F)=>g.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[N.color&&g.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:N.color}}),g.jsx("span",{className:"font-medium text-sm text-neutral-700",children:N.label})]}),g.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:F})]});return g.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${f}`,style:{minHeight:"400px"},children:e.map(N=>{const F=k[N.id]||[],j=y===N.id;return g.jsxs("div",{"data-kanban-column":N.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${d}`,onDragOver:$=>{$.preventDefault(),p&&!j&&C(N.id)},onDragLeave:S,onDrop:$=>R($,N.id,_??F.length),children:[g.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:a?a(N,F.length):T(N,F.length)}),g.jsxs("div",{className:`flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${j?"bg-blue-50":""}`,children:[F.map(($,G)=>{const de=t($),fe=p===de,Oe=j&&_===G&&!fe;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:_e=>v(_e,$),onDragEnd:b,onDragOver:_e=>w(_e,N.id,G),onClick:()=>u==null?void 0:u($),className:`cursor-grab active:cursor-grabbing transition-all ${fe?"opacity-50 scale-95":""} ${h}`,children:o($,fe)})]},de)}),g.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:$=>{$.preventDefault(),w($,N.id,F.length)},children:j&&_===F.length&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),F.length===0&&j&&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(N)})]},N.id)})})}const ff={background:"#ffffff",hourLineColor:"#e5e7eb",halfHourLineColor:"#f3f4f6",hourTextColor:"#9ca3af",currentTimeColor:"#ef4444",allDayBackground:"#f9fafb",allDayBorder:"#e5e7eb"};function hf(r){const e=r.match(/^(\d{1,2}):(\d{2})$/);return e?{hours:parseInt(e[1],10),minutes:parseInt(e[2],10)}:null}function pf(r){const e=r%12||12,t=r<12?"AM":"PM";return`${e} ${t}`}function gf(r){const e=new Date;return r.getDate()===e.getDate()&&r.getMonth()===e.getMonth()&&r.getFullYear()===e.getFullYear()}function mf({items:r,date:e,startHour:t=7,endHour:n=22,hourHeight:s=60,getItemTime:o,getItemDuration:i,getItemIsAllDay:l,getItemId:u,renderItem:a,onItemClick:c,onTimeSlotClick:f,showCurrentTime:d=!0,className:h="",theme:p={}}){const m={...ff,...p},{allDayItems:y,timedItems:C}=A.useMemo(()=>{const b=[],w=[];for(const S of r)l(S)?b.push(S):w.push(S);return{allDayItems:b,timedItems:w}},[r,l]),_=A.useMemo(()=>{const b=[];for(let w=t;w<=n;w++)b.push(w);return b},[t,n]),E=(n-t+1)*s,D=A.useCallback(b=>{const w=o(b);if(!w)return null;const S=hf(w);if(!S)return null;const{hours:R,minutes:T}=S,N=Math.max(t,Math.min(n,R)),F=R<t?0:T,j=(N-t)*s+F/60*s,$=i(b),G=Math.max(20,$/60*s);return{top:j,height:G}},[o,i,t,n,s]),k=A.useMemo(()=>{if(!d||!gf(e))return null;const b=new Date,w=b.getHours(),S=b.getMinutes();return w<t||w>n?null:(w-t)*s+S/60*s},[e,d,t,n,s]),v=A.useCallback(b=>{if(!f)return;const w=b.currentTarget.getBoundingClientRect(),R=(b.clientY-w.top)/s*60,T=Math.floor(R/60)+t,N=Math.round(R%60/15)*15,F=Math.min(n,Math.max(t,T)),j=N>=60?0:N,$=`${F.toString().padStart(2,"0")}:${j.toString().padStart(2,"0")}`;f($)},[f,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(b=>g.jsx("div",{onClick:()=>c==null?void 0:c(b),style:{cursor:c?"pointer":"default"},children:a(b)},u(b)))})]}),g.jsxs("div",{style:{position:"relative",height:E},children:[_.map((b,w)=>g.jsxs("div",{style:{position:"absolute",top:w*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:pf(b)}),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),w<_.length-1&&g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},b)),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:f?"pointer":"default"},onClick:v}),k!==null&&g.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:k,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}})]}),C.map(b=>{const w=D(b);return w?g.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:w.top,height:w.height,zIndex:10,cursor:c?"pointer":"default"},onClick:S=>{S.stopPropagation(),c==null||c(b)},children:a(b)},u(b)):null})]})]})}exports.AnimatedCardFlip=ha;exports.ApiClient=nl;exports.AuthManager=rl;exports.Card=ca;exports.ComboBox=cf;exports.DataOperations=gn;exports.Detail=da;exports.GraphClient=$u;exports.KanbanBoard=df;exports.Mail=ga;exports.MailClient=tl;exports.MailComposer=uf;exports.MailEditor=Eu;exports.SelectableList=ma;exports.Stack=aa;exports.Timeline=mf;exports.getApiClient=Hs;exports.initializeApiClient=ia;exports.useMutation=oa;exports.useQuery=sl;
150
+ `})]})}const cf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",chipBackground:"#f3f4f6",chipText:"#374151",hoverBackground:"#f9fafb"};function df({options:r,value:e,onChange:t,placeholder:n="Search or select...",allowCreate:s=!0,onCreate:o,allowDelete:i=!1,onDelete:l,label:u,disabled:a=!1,max:c=0,theme:d={},className:f=""}){const h={...cf,...d},[p,m]=A.useState(!1),[_,C]=A.useState(""),y=A.useRef(null),E=A.useRef(null);A.useEffect(()=>{function T(N){y.current&&!y.current.contains(N.target)&&(m(!1),C(""))}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const D=r.filter(T=>{var N;return((N=T.label)==null?void 0:N.toLowerCase().includes(_.toLowerCase()))&&!e.includes(T.id)}),k=s&&_.trim()&&!r.some(T=>{var N;return((N=T.label)==null?void 0:N.toLowerCase())===_.toLowerCase()}),v=e.map(T=>r.find(N=>N.id===T)).filter(Boolean),b=A.useCallback(T=>{var N;c>0&&e.length>=c||(t([...e,T]),C(""),(N=E.current)==null||N.focus())},[e,t,c]),w=A.useCallback(T=>{t(e.filter(N=>N!==T))},[e,t]),S=A.useCallback(async()=>{if(!k)return;const T=await(o==null?void 0:o(_.trim()));T&&b(T.id),C("")},[k,_,o,b]),$=A.useCallback(T=>{T.key==="Enter"?(T.preventDefault(),k?S():D.length>0&&b(D[0].id)):T.key==="Backspace"&&!_&&e.length>0?w(e[e.length-1]):T.key==="Escape"&&(m(!1),C(""))},[k,D,_,e,S,b,w]);return g.jsxs("div",{ref:y,className:f,style:{position:"relative"},children:[u&&g.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:u}),g.jsxs("div",{onClick:()=>!a&&m(!0),style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 12px",border:`1px solid ${p?h.primary:h.border}`,borderRadius:"8px",background:a?h.hoverBackground:h.background,cursor:a?"not-allowed":"text",minHeight:"42px",alignItems:"center"},children:[v.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,!a&&g.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),w(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:_,onChange:T=>{C(T.target.value),p||m(!0)},onFocus:()=>m(!0),onKeyDown:$,placeholder:v.length===0?n:"",disabled:a||c>0&&e.length>=c,style:{flex:1,minWidth:"60px",border:"none",outline:"none",fontSize:"14px",background:"transparent",color:h.text}})]}),p&&!a&&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:D.length===0&&!k?g.jsx("div",{style:{padding:"12px",fontSize:"14px",color:h.textSecondary,textAlign:"center"},children:_?"No matches":"No options available"}):g.jsxs(g.Fragment,{children:[D.map(T=>g.jsxs("div",{onClick:()=>b(T.id),style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.text,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseEnter:N=>{N.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:N=>{N.currentTarget.style.background=""},children:[T.label,i&&l&&g.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),l(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",fontSize:"14px",color:h.textSecondary,opacity:.5},onMouseEnter:N=>{N.currentTarget.style.opacity="1",N.currentTarget.style.color="#ef4444"},onMouseLeave:N=>{N.currentTarget.style.opacity="0.5",N.currentTarget.style.color=h.textSecondary||""},children:"×"})]},T.id)),k&&g.jsxs("div",{onClick:S,style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.primary,borderTop:D.length>0?`1px solid ${h.border}`:"none"},onMouseEnter:T=>{T.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:T=>{T.currentTarget.style.background=""},children:['+ Create "',_.trim(),'"']})]})})]})}function ff({items:r,columns:e,getItemId:t,getItemColumn:n,getItemOrder:s,renderItem:o,onItemMove:i,onItemReorder:l,onItemClick:u,renderColumnHeader:a,renderColumnFooter:c,className:d="",columnClassName:f="",itemClassName:h=""}){const[p,m]=A.useState(null),[_,C]=A.useState(null),[y,E]=A.useState(null),D=A.useRef(null),k=e.reduce((N,j)=>{let L=r.filter(O=>n(O)===j.id);return s&&(L=L.sort((O,G)=>s(O)-s(G))),N[j.id]=L,N},{}),v=A.useCallback((N,j)=>{const L=t(j),O=n(j);m(L),D.current=O,N.dataTransfer.effectAllowed="move",N.dataTransfer.setData("text/plain",L),requestAnimationFrame(()=>{const G=N.target;G.style.opacity="0.5"})},[t,n]),b=A.useCallback(N=>{const j=N.target;j.style.opacity="1",m(null),C(null),E(null),D.current=null},[]),w=A.useCallback((N,j,L)=>{N.preventDefault(),N.dataTransfer.dropEffect="move",C(j),E(L)},[]),S=A.useCallback(N=>{const j=N.relatedTarget;j!=null&&j.closest("[data-kanban-column]")||(C(null),E(null))},[]),$=A.useCallback((N,j,L)=>{if(N.preventDefault(),!p)return;const O=D.current;O===j?l==null||l(p,j,L):O&&i(p,O,j,L),m(null),C(null),E(null),D.current=null},[p,i,l]),T=(N,j)=>g.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[N.color&&g.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:N.color}}),g.jsx("span",{className:"font-medium text-sm text-neutral-700",children:N.label})]}),g.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:j})]});return g.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${d}`,style:{minHeight:"400px"},children:e.map(N=>{const j=k[N.id]||[],L=_===N.id;return g.jsxs("div",{"data-kanban-column":N.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,onDragOver:O=>{O.preventDefault(),p&&!L&&C(N.id)},onDragLeave:S,onDrop:O=>$(O,N.id,y??j.length),children:[g.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:a?a(N,j.length):T(N,j.length)}),g.jsxs("div",{className:`flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${L?"bg-blue-50":""}`,children:[j.map((O,G)=>{const he=t(O),oe=p===he,Ne=L&&y===G&&!oe;return g.jsxs("div",{children:[Ne&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mb-2 mx-1"}),g.jsx("div",{draggable:!0,onDragStart:we=>v(we,O),onDragEnd:b,onDragOver:we=>w(we,N.id,G),onClick:()=>u==null?void 0:u(O),className:`cursor-grab active:cursor-grabbing transition-all ${oe?"opacity-50 scale-95":""} ${h}`,children:o(O,oe)})]},he)}),g.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:O=>{O.preventDefault(),w(O,N.id,j.length)},children:L&&y===j.length&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),j.length===0&&L&&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(N)})]},N.id)})})}const hf={background:"#ffffff",hourLineColor:"#e5e7eb",halfHourLineColor:"#f3f4f6",hourTextColor:"#9ca3af",currentTimeColor:"#ef4444",allDayBackground:"#f9fafb",allDayBorder:"#e5e7eb"};function pf(r){const e=r.match(/^(\d{1,2}):(\d{2})$/);return e?{hours:parseInt(e[1],10),minutes:parseInt(e[2],10)}:null}function gf(r){const e=r%12||12,t=r<12?"AM":"PM";return`${e} ${t}`}function mf(r){const e=new Date;return r.getDate()===e.getDate()&&r.getMonth()===e.getMonth()&&r.getFullYear()===e.getFullYear()}function yf({items:r,date:e,startHour:t=7,endHour:n=22,hourHeight:s=60,getItemTime:o,getItemDuration:i,getItemIsAllDay:l,getItemId:u,renderItem:a,onItemClick:c,onTimeSlotClick:d,showCurrentTime:f=!0,className:h="",theme:p={}}){const m={...hf,...p},{allDayItems:_,timedItems:C}=A.useMemo(()=>{const b=[],w=[];for(const S of r)l(S)?b.push(S):w.push(S);return{allDayItems:b,timedItems:w}},[r,l]),y=A.useMemo(()=>{const b=[];for(let w=t;w<=n;w++)b.push(w);return b},[t,n]),E=(n-t+1)*s,D=A.useCallback(b=>{const w=o(b);if(!w)return null;const S=pf(w);if(!S)return null;const{hours:$,minutes:T}=S,N=Math.max(t,Math.min(n,$)),j=$<t?0:T,L=(N-t)*s+j/60*s,O=i(b),G=Math.max(20,O/60*s);return{top:L,height:G}},[o,i,t,n,s]),k=A.useMemo(()=>{if(!f||!mf(e))return null;const b=new Date,w=b.getHours(),S=b.getMinutes();return w<t||w>n?null:(w-t)*s+S/60*s},[e,f,t,n,s]),v=A.useCallback(b=>{if(!d)return;const w=b.currentTarget.getBoundingClientRect(),$=(b.clientY-w.top)/s*60,T=Math.floor($/60)+t,N=Math.round($%60/15)*15,j=Math.min(n,Math.max(t,T)),L=N>=60?0:N,O=`${j.toString().padStart(2,"0")}:${L.toString().padStart(2,"0")}`;d(O)},[d,s,t,n]);return g.jsxs("div",{className:h,style:{background:m.background},children:[_.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:_.map(b=>g.jsx("div",{onClick:()=>c==null?void 0:c(b),style:{cursor:c?"pointer":"default"},children:a(b)},u(b)))})]}),g.jsxs("div",{style:{position:"relative",height:E},children:[y.map((b,w)=>g.jsxs("div",{style:{position:"absolute",top:w*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:gf(b)}),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),w<y.length-1&&g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},b)),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:d?"pointer":"default"},onClick:v}),k!==null&&g.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:k,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}})]}),C.map(b=>{const w=D(b);return w?g.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:w.top,height:w.height,zIndex:10,cursor:c?"pointer":"default"},onClick:S=>{S.stopPropagation(),c==null||c(b)},children:a(b)},u(b)):null})]})]})}exports.AnimatedCardFlip=ha;exports.ApiClient=nl;exports.AuthManager=rl;exports.Card=ca;exports.ComboBox=df;exports.DataOperations=mn;exports.Detail=da;exports.GraphClient=$u;exports.KanbanBoard=ff;exports.Mail=ga;exports.MailClient=tl;exports.MailComposer=af;exports.MailEditor=Eu;exports.SelectableList=ma;exports.Stack=aa;exports.Timeline=yf;exports.getApiClient=Hs;exports.initializeApiClient=ia;exports.useMutation=oa;exports.useQuery=sl;