@qwanyx/stack 0.2.63 → 0.2.64

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 lu=Object.defineProperty;var au=(r,e,t)=>e in r?lu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var _t=(r,e,t)=>au(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),Ji=require("react-dom");function uu(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const Ns=uu(w);class cu{constructor(e){_t(this,"config");_t(this,"defaultUploadOptions",{maxSizeMB:10,maxImageDimension:0,imageQuality:.9});if(!e.system_id)throw new Error("GraphClient: system_id is REQUIRED. No system_id → No start.");this.config=e}async callGraph(e,t={}){const n={coprocessor:"graph",method:e,system_id:this.config.system_id,params:t};try{const s=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(n)});if(!s.ok){const o=await s.text();throw new Error(`API error (${s.status}): ${o}`)}const i=await s.json();if(!i.success&&i.error)throw new Error(i.error);return i}catch(s){throw console.error("Graph API call failed:",s),s}}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getChildren(e){return(await this.callGraph("get_children",{parent_id:e})).result||[]}async getNode(e){return(await this.callGraph("get_node",{node_id:e})).result||null}async addNode(e){const t={...e,created:e.created||new Date().toISOString(),modified:new Date().toISOString()},n=await this.callGraph("add_node",t);if(!n.result)throw new Error("Failed to add node");return n.result}async updateNode(e,t){const n={node_id:e,updates:{...t,modified:new Date().toISOString()}},s=await this.callGraph("update_node",n);if(!s.result)throw new Error("Failed to update node");return s.result}async deleteNode(e,t=!1){return(await this.callGraph("delete_node",{node_id:e,cascade:t})).success===!0}async getChildrenWithEdges(e,t="children",n,s){return(await this.callGraph("get_children_with_edges",{node_id:e,display_mode:t,edge_type:n,node_type:s})).result||[]}async addEdge(e,t,n="link",s){return await this.callGraph("add_edge",{source_id:e,target_id:t,edge_type:n,data:s})}async deleteEdge(e,t,n){return await this.callGraph("delete_edge",{source_id:e,target_id:t,edge_type:n})}async getEdges(e,t,n){return(await this.callGraph("get_edges",{source_id:e,edge_type:t,target_id:n})).result||[]}async getAncestors(e){return(await this.callGraph("get_ancestors",{node_id:e})).ancestors||[]}async getTree(e,t=10){return(await this.callGraph("get_tree",{root_id:e,max_depth:t})).tree||[]}async moveNode(e,t){const n=await this.callGraph("move",{node_id:e,new_parent_id:t});if(!n.node)throw new Error("Failed to move node");return n.node}async searchNodes(e,t){return(await this.callGraph("search",{query:e,type:t})).nodes||[]}async getNodesByType(e){return(await this.callGraph("get_nodes_by_type",{type:e})).result||[]}fileToBase64(e){return new Promise((t,n)=>{const s=new FileReader;s.onload=()=>{const o=s.result.split(",")[1];t(o)},s.onerror=()=>n(new Error("Failed to read file")),s.readAsDataURL(e)})}async resizeImage(e,t,n){return e.type.startsWith("image/")?new Promise(s=>{const i=new Image,o=URL.createObjectURL(e);i.onload=()=>{if(URL.revokeObjectURL(o),i.width<=t&&i.height<=t){s(e);return}let a,l;i.width>i.height?(a=t,l=Math.round(i.height/i.width*t)):(l=t,a=Math.round(i.width/i.height*t));const u=document.createElement("canvas");u.width=a,u.height=l;const c=u.getContext("2d");if(!c){s(e);return}c.drawImage(i,0,0,a,l);const d=e.type==="image/png"?"image/png":"image/jpeg";u.toBlob(f=>{if(f){const h=new File([f],e.name,{type:d});s(h)}else s(e)},d,n)},i.onerror=()=>{URL.revokeObjectURL(o),s(e)},i.src=o}):e}async uploadFile(e,t,n,s={}){const i={...this.defaultUploadOptions,...s};try{let o=n;i.maxImageDimension>0&&n.type.startsWith("image/")&&(o=await this.resizeImage(n,i.maxImageDimension,i.imageQuality));const a=i.maxSizeMB*1024*1024;if(o.size>a)return{success:!1,error:`File too large (${(o.size/1024/1024).toFixed(1)} MB). Max: ${i.maxSizeMB} MB`};const l=await this.fileToBase64(o),u=await this.callGraph("upload_file",{node_id:e,filename:t,content:l});return u.success?{success:!0,path:u.path}:{success:!1,error:u.error||"Upload failed"}}catch(o){return{success:!1,error:o instanceof Error?o.message:"Upload failed"}}}async listFiles(e){var s;return(((s=(await this.callGraph("list_files",{node_id:e})).result)==null?void 0:s.files)||[]).map(i=>({filename:i.name,path:i.path}))}async deleteFile(e,t){return{success:(await this.callGraph("delete_file",{node_id:e,filename:t})).success||!1}}getFileUrl(e,t){return`${this.config.baseUrl}/files/${this.config.system_id}/${e}/${t}`}}const Pr=new TextEncoder,Yi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yr=new Uint8Array(256);for(var Bn=0;Bn<Yi.length;Bn++)Yr[Yi.charCodeAt(Bn)]=Bn;function Vs(r){let e=Math.ceil(r.length/4)*3;const t=r.length;let n=0;r.length%4===3?e--:r.length%4===2?e-=2:r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);const s=new ArrayBuffer(e),i=new Uint8Array(s);for(let o=0;o<t;o+=4){let a=Yr[r.charCodeAt(o)],l=Yr[r.charCodeAt(o+1)],u=Yr[r.charCodeAt(o+2)],c=Yr[r.charCodeAt(o+3)];i[n++]=a<<2|l>>4,i[n++]=(l&15)<<4|u>>2,i[n++]=(u&3)<<6|c&63}return s}function tn(r){r=r||"utf8";let e;try{e=new TextDecoder(r)}catch{e=new TextDecoder("windows-1252")}return e}async function ds(r){if("arrayBuffer"in r)return await r.arrayBuffer();const e=new FileReader;return new Promise((t,n)=>{e.onload=function(s){t(s.target.result)},e.onerror=function(s){n(e.error)},e.readAsArrayBuffer(r)})}function Xi(r){return r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70?String.fromCharCode(r):!1}function du(r,e,t){let n=r.indexOf("*");n>=0&&(r=r.substr(0,n)),e=e.toUpperCase();let s;if(e==="Q"){t=t.replace(/=\s+([0-9a-fA-F])/g,"=$1").replace(/[_\s]/g," ");let i=Pr.encode(t),o=[];for(let l=0,u=i.length;l<u;l++){let c=i[l];if(l<=u-2&&c===61){let d=Xi(i[l+1]),f=Xi(i[l+2]);if(d&&f){let h=parseInt(d+f,16);o.push(h),l+=2;continue}}o.push(c)}s=new ArrayBuffer(o.length);let a=new DataView(s);for(let l=0,u=o.length;l<u;l++)a.setUint8(l,o[l])}else e==="B"?s=Vs(t.replace(/[^a-zA-Z0-9\+\/=]+/g,"")):s=Pr.encode(t);return tn(r).decode(s)}function rn(r){let e=!0;for(;;){let t=(r||"").toString().replace(/(=\?([^?]+)\?[Bb]\?([^?]*)\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g,(n,s,i,o,a)=>e&&i===a&&o.length%4===0&&!/=$/.test(o)?s+"__\0JOIN\0__":n).replace(/(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,(n,s,i,o)=>e&&i===o?s+"__\0JOIN\0__":n).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g,"").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g,"$1").replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,(n,s,i,o)=>du(s,i,o));if(e&&t.indexOf("�")>=0)e=!1;else return t}}function fu(r,e){e=e||"utf-8";let t=[];for(let i=0;i<r.length;i++){let o=r.charAt(i);if(o==="%"&&/^[a-f0-9]{2}/i.test(r.substr(i+1,2))){let a=r.substr(i+1,2);i+=2,t.push(parseInt(a,16))}else if(o.charCodeAt(0)>126){o=Pr.encode(o);for(let a=0;a<o.length;a++)t.push(o[a])}else t.push(o.charCodeAt(0))}const n=new ArrayBuffer(t.length),s=new DataView(n);for(let i=0,o=t.length;i<o;i++)s.setUint8(i,t[i]);return tn(e).decode(n)}function hu(r){let e=new Map;Object.keys(r.params).forEach(t=>{let n=t.match(/\*((\d+)\*?)?$/);if(!n)return;let s=t.substr(0,n.index).toLowerCase(),i=Number(n[2])||0,o;e.has(s)?o=e.get(s):(o={charset:!1,values:[]},e.set(s,o));let a=r.params[t];i===0&&n[0].charAt(n[0].length-1)==="*"&&(n=a.match(/^([^']*)'[^']*'(.*)$/))&&(o.charset=n[1]||"utf-8",a=n[2]),o.values.push({nr:i,value:a}),delete r.params[t]}),e.forEach((t,n)=>{r.params[n]=fu(t.values.sort((s,i)=>s.nr-i.nr).map(s=>s.value).join(""),t.charset)})}class pu{constructor(){this.chunks=[]}update(e){this.chunks.push(e),this.chunks.push(`
1
+ "use strict";var lu=Object.defineProperty;var au=(r,e,t)=>e in r?lu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var _t=(r,e,t)=>au(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),Ji=require("react-dom");function uu(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const Ns=uu(C);class cu{constructor(e){_t(this,"config");_t(this,"defaultUploadOptions",{maxSizeMB:10,maxImageDimension:0,imageQuality:.9});if(!e.system_id)throw new Error("GraphClient: system_id is REQUIRED. No system_id → No start.");this.config=e}async callGraph(e,t={}){const n={coprocessor:"graph",method:e,system_id:this.config.system_id,params:t};try{const s=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(n)});if(!s.ok){const o=await s.text();throw new Error(`API error (${s.status}): ${o}`)}const i=await s.json();if(!i.success&&i.error)throw new Error(i.error);return i}catch(s){throw console.error("Graph API call failed:",s),s}}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getChildren(e){return(await this.callGraph("get_children",{parent_id:e})).result||[]}async getNode(e){return(await this.callGraph("get_node",{node_id:e})).result||null}async addNode(e){const t={...e,created:e.created||new Date().toISOString(),modified:new Date().toISOString()},n=await this.callGraph("add_node",t);if(!n.result)throw new Error("Failed to add node");return n.result}async updateNode(e,t){const n={node_id:e,updates:{...t,modified:new Date().toISOString()}},s=await this.callGraph("update_node",n);if(!s.result)throw new Error("Failed to update node");return s.result}async deleteNode(e,t=!1){return(await this.callGraph("delete_node",{node_id:e,cascade:t})).success===!0}async getChildrenWithEdges(e,t="children",n,s){return(await this.callGraph("get_children_with_edges",{node_id:e,display_mode:t,edge_type:n,node_type:s})).result||[]}async addEdge(e,t,n="link",s){return await this.callGraph("add_edge",{source_id:e,target_id:t,edge_type:n,data:s})}async deleteEdge(e,t,n){return await this.callGraph("delete_edge",{source_id:e,target_id:t,edge_type:n})}async getEdges(e,t,n){return(await this.callGraph("get_edges",{source_id:e,edge_type:t,target_id:n})).result||[]}async getAncestors(e){return(await this.callGraph("get_ancestors",{node_id:e})).ancestors||[]}async getTree(e,t=10){return(await this.callGraph("get_tree",{root_id:e,max_depth:t})).tree||[]}async moveNode(e,t){const n=await this.callGraph("move",{node_id:e,new_parent_id:t});if(!n.node)throw new Error("Failed to move node");return n.node}async searchNodes(e,t){return(await this.callGraph("search",{query:e,type:t})).nodes||[]}async getNodesByType(e){return(await this.callGraph("get_nodes_by_type",{type:e})).result||[]}fileToBase64(e){return new Promise((t,n)=>{const s=new FileReader;s.onload=()=>{const o=s.result.split(",")[1];t(o)},s.onerror=()=>n(new Error("Failed to read file")),s.readAsDataURL(e)})}async resizeImage(e,t,n){return e.type.startsWith("image/")?new Promise(s=>{const i=new Image,o=URL.createObjectURL(e);i.onload=()=>{if(URL.revokeObjectURL(o),i.width<=t&&i.height<=t){s(e);return}let a,l;i.width>i.height?(a=t,l=Math.round(i.height/i.width*t)):(l=t,a=Math.round(i.width/i.height*t));const u=document.createElement("canvas");u.width=a,u.height=l;const c=u.getContext("2d");if(!c){s(e);return}c.drawImage(i,0,0,a,l);const d=e.type==="image/png"?"image/png":"image/jpeg";u.toBlob(f=>{if(f){const h=new File([f],e.name,{type:d});s(h)}else s(e)},d,n)},i.onerror=()=>{URL.revokeObjectURL(o),s(e)},i.src=o}):e}async uploadFile(e,t,n,s={}){const i={...this.defaultUploadOptions,...s};try{let o=n;i.maxImageDimension>0&&n.type.startsWith("image/")&&(o=await this.resizeImage(n,i.maxImageDimension,i.imageQuality));const a=i.maxSizeMB*1024*1024;if(o.size>a)return{success:!1,error:`File too large (${(o.size/1024/1024).toFixed(1)} MB). Max: ${i.maxSizeMB} MB`};const l=await this.fileToBase64(o),u=await this.callGraph("upload_file",{node_id:e,filename:t,content:l});return u.success?{success:!0,path:u.path}:{success:!1,error:u.error||"Upload failed"}}catch(o){return{success:!1,error:o instanceof Error?o.message:"Upload failed"}}}async listFiles(e){var s;return(((s=(await this.callGraph("list_files",{node_id:e})).result)==null?void 0:s.files)||[]).map(i=>({filename:i.name,path:i.path}))}async deleteFile(e,t){return{success:(await this.callGraph("delete_file",{node_id:e,filename:t})).success||!1}}getFileUrl(e,t){return`${this.config.baseUrl}/files/${this.config.system_id}/${e}/${t}`}}const Mr=new TextEncoder,Yi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yr=new Uint8Array(256);for(var Bn=0;Bn<Yi.length;Bn++)Yr[Yi.charCodeAt(Bn)]=Bn;function Vs(r){let e=Math.ceil(r.length/4)*3;const t=r.length;let n=0;r.length%4===3?e--:r.length%4===2?e-=2:r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);const s=new ArrayBuffer(e),i=new Uint8Array(s);for(let o=0;o<t;o+=4){let a=Yr[r.charCodeAt(o)],l=Yr[r.charCodeAt(o+1)],u=Yr[r.charCodeAt(o+2)],c=Yr[r.charCodeAt(o+3)];i[n++]=a<<2|l>>4,i[n++]=(l&15)<<4|u>>2,i[n++]=(u&3)<<6|c&63}return s}function tn(r){r=r||"utf8";let e;try{e=new TextDecoder(r)}catch{e=new TextDecoder("windows-1252")}return e}async function ds(r){if("arrayBuffer"in r)return await r.arrayBuffer();const e=new FileReader;return new Promise((t,n)=>{e.onload=function(s){t(s.target.result)},e.onerror=function(s){n(e.error)},e.readAsArrayBuffer(r)})}function Xi(r){return r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70?String.fromCharCode(r):!1}function du(r,e,t){let n=r.indexOf("*");n>=0&&(r=r.substr(0,n)),e=e.toUpperCase();let s;if(e==="Q"){t=t.replace(/=\s+([0-9a-fA-F])/g,"=$1").replace(/[_\s]/g," ");let i=Mr.encode(t),o=[];for(let l=0,u=i.length;l<u;l++){let c=i[l];if(l<=u-2&&c===61){let d=Xi(i[l+1]),f=Xi(i[l+2]);if(d&&f){let h=parseInt(d+f,16);o.push(h),l+=2;continue}}o.push(c)}s=new ArrayBuffer(o.length);let a=new DataView(s);for(let l=0,u=o.length;l<u;l++)a.setUint8(l,o[l])}else e==="B"?s=Vs(t.replace(/[^a-zA-Z0-9\+\/=]+/g,"")):s=Mr.encode(t);return tn(r).decode(s)}function rn(r){let e=!0;for(;;){let t=(r||"").toString().replace(/(=\?([^?]+)\?[Bb]\?([^?]*)\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g,(n,s,i,o,a)=>e&&i===a&&o.length%4===0&&!/=$/.test(o)?s+"__\0JOIN\0__":n).replace(/(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,(n,s,i,o)=>e&&i===o?s+"__\0JOIN\0__":n).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g,"").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g,"$1").replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,(n,s,i,o)=>du(s,i,o));if(e&&t.indexOf("�")>=0)e=!1;else return t}}function fu(r,e){e=e||"utf-8";let t=[];for(let i=0;i<r.length;i++){let o=r.charAt(i);if(o==="%"&&/^[a-f0-9]{2}/i.test(r.substr(i+1,2))){let a=r.substr(i+1,2);i+=2,t.push(parseInt(a,16))}else if(o.charCodeAt(0)>126){o=Mr.encode(o);for(let a=0;a<o.length;a++)t.push(o[a])}else t.push(o.charCodeAt(0))}const n=new ArrayBuffer(t.length),s=new DataView(n);for(let i=0,o=t.length;i<o;i++)s.setUint8(i,t[i]);return tn(e).decode(n)}function hu(r){let e=new Map;Object.keys(r.params).forEach(t=>{let n=t.match(/\*((\d+)\*?)?$/);if(!n)return;let s=t.substr(0,n.index).toLowerCase(),i=Number(n[2])||0,o;e.has(s)?o=e.get(s):(o={charset:!1,values:[]},e.set(s,o));let a=r.params[t];i===0&&n[0].charAt(n[0].length-1)==="*"&&(n=a.match(/^([^']*)'[^']*'(.*)$/))&&(o.charset=n[1]||"utf-8",a=n[2]),o.values.push({nr:i,value:a}),delete r.params[t]}),e.forEach((t,n)=>{r.params[n]=fu(t.values.sort((s,i)=>s.nr-i.nr).map(s=>s.value).join(""),t.charset)})}class pu{constructor(){this.chunks=[]}update(e){this.chunks.push(e),this.chunks.push(`
2
2
  `)}finalize(){return ds(new Blob(this.chunks,{type:"application/octet-stream"}))}}class gu{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.chunks=[],this.remainder=""}update(e){let t=this.decoder.decode(e);if(/[^a-zA-Z0-9+\/]/.test(t)&&(t=t.replace(/[^a-zA-Z0-9+\/]+/g,"")),this.remainder+=t,this.remainder.length>=this.maxChunkSize){let n=Math.floor(this.remainder.length/4)*4,s;n===this.remainder.length?(s=this.remainder,this.remainder=""):(s=this.remainder.substr(0,n),this.remainder=this.remainder.substr(n)),s.length&&this.chunks.push(Vs(s))}}finalize(){return this.remainder&&!/^=+$/.test(this.remainder)&&this.chunks.push(Vs(this.remainder)),ds(new Blob(this.chunks,{type:"application/octet-stream"}))}}const Zi=/^=[a-f0-9]{2}$/i,mu=/(?==[a-f0-9]{2})/i,yu=/=\r?\n/g,xu=/=[a-fA-F0-9]?$/;class bu{constructor(e){e=e||{},this.decoder=e.decoder||new TextDecoder,this.maxChunkSize=100*1024,this.remainder="",this.chunks=[]}decodeQPBytes(e){let t=new ArrayBuffer(e.length),n=new DataView(t);for(let s=0,i=e.length;s<i;s++)n.setUint8(s,parseInt(e[s],16));return t}decodeChunks(e){e=e.replace(yu,"");let t=e.split(mu),n=[];for(let s of t){if(s.charAt(0)!=="="){n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(s);continue}if(s.length===3){Zi.test(s)?n.push(s.substr(1)):(n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(s));continue}if(s.length>3){const i=s.substr(0,3);Zi.test(i)?(n.push(s.substr(1,2)),this.chunks.push(this.decodeQPBytes(n)),n=[],s=s.substr(3),this.chunks.push(s)):(n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[]),this.chunks.push(s))}}n.length&&(this.chunks.push(this.decodeQPBytes(n)),n=[])}update(e){let t=this.decoder.decode(e)+`
3
3
  `;if(t=this.remainder+t,t.length<this.maxChunkSize){this.remainder=t;return}this.remainder="";let n=t.match(xu);if(n){if(n.index===0){this.remainder=t;return}this.remainder=t.substr(n.index),t=t.substr(0,n.index)}this.decodeChunks(t)}finalize(){return this.remainder.length&&(this.decodeChunks(this.remainder),this.remainder=""),ds(new Blob(this.chunks,{type:"application/octet-stream"}))}}class eo{constructor(e){if(this.options=e||{},this.postalMime=this.options.postalMime,this.root=!!this.options.parentNode,this.childNodes=[],this.options.parentNode){if(this.parentNode=this.options.parentNode,this.depth=this.parentNode.depth+1,this.depth>this.options.maxNestingDepth)throw new Error(`Maximum MIME nesting depth of ${this.options.maxNestingDepth} levels exceeded`);this.options.parentNode.childNodes.push(this)}else this.depth=0;this.state="header",this.headerLines=[],this.headerSize=0,this.contentType={value:"text/plain",default:!0},this.contentTransferEncoding={value:"8bit"},this.contentDisposition={value:""},this.headers=[],this.contentDecoder=!1}setupContentDecoder(e){/base64/i.test(e)?this.contentDecoder=new gu:/quoted-printable/i.test(e)?this.contentDecoder=new bu({decoder:tn(this.contentType.parsed.params.charset)}):this.contentDecoder=new pu}async finalize(){if(this.state==="finished")return;this.state==="header"&&this.processHeaders();let e=this.postalMime.boundaries;for(let t=e.length-1;t>=0;t--)if(e[t].node===this){e.splice(t,1);break}await this.finalizeChildNodes(),this.content=this.contentDecoder?await this.contentDecoder.finalize():null,this.state="finished"}async finalizeChildNodes(){for(let e of this.childNodes)await e.finalize()}parseStructuredHeader(e){let t={value:!1,params:{}},n=!1,s="",i="value",o=!1,a=!1,l;for(let u=0,c=e.length;u<c;u++)switch(l=e.charAt(u),i){case"key":if(l==="="){n=s.trim().toLowerCase(),i="value",s="";break}s+=l;break;case"value":if(a)s+=l;else if(l==="\\"){a=!0;continue}else o&&l===o?o=!1:!o&&l==='"'?o=l:!o&&l===";"?(n===!1?t.value=s.trim():t.params[n]=s.trim(),i="key",s=""):s+=l;a=!1;break}return s=s.trim(),i==="value"?n===!1?t.value=s:t.params[n]=s:s&&(t.params[s.toLowerCase()]=""),t.value&&(t.value=t.value.toLowerCase()),hu(t),t}decodeFlowedText(e,t){return e.split(/\r?\n/).reduce((n,s)=>/ $/.test(n)&&!/(^|\n)-- $/.test(n)?t?n.slice(0,-1)+s:n+s:n+`
4
4
  `+s).replace(/^ /gm,"")}getTextContent(){if(!this.content)return"";let e=tn(this.contentType.parsed.params.charset).decode(this.content);return/^flowed$/i.test(this.contentType.parsed.params.format)&&(e=this.decodeFlowedText(e,/^yes$/i.test(this.contentType.parsed.params.delsp))),e}processHeaders(){for(let e=this.headerLines.length-1;e>=0;e--){let t=this.headerLines[e];if(e&&/^\s/.test(t))this.headerLines[e-1]+=`
5
- `+t,this.headerLines.splice(e,1);else{t=t.replace(/\s+/g," ");let n=t.indexOf(":"),s=n<0?t.trim():t.substr(0,n).trim(),i=n<0?"":t.substr(n+1).trim();switch(this.headers.push({key:s.toLowerCase(),originalKey:s,value:i}),s.toLowerCase()){case"content-type":this.contentType.default&&(this.contentType={value:i,parsed:{}});break;case"content-transfer-encoding":this.contentTransferEncoding={value:i,parsed:{}};break;case"content-disposition":this.contentDisposition={value:i,parsed:{}};break;case"content-id":this.contentId=i;break;case"content-description":this.contentDescription=i;break}}}this.contentType.parsed=this.parseStructuredHeader(this.contentType.value),this.contentType.multipart=/^multipart\//i.test(this.contentType.parsed.value)?this.contentType.parsed.value.substr(this.contentType.parsed.value.indexOf("/")+1):!1,this.contentType.multipart&&this.contentType.parsed.params.boundary&&this.postalMime.boundaries.push({value:Pr.encode(this.contentType.parsed.params.boundary),node:this}),this.contentDisposition.parsed=this.parseStructuredHeader(this.contentDisposition.value),this.contentTransferEncoding.encoding=this.contentTransferEncoding.value.toLowerCase().split(/[^\w-]/).shift(),this.setupContentDecoder(this.contentTransferEncoding.encoding)}feed(e){switch(this.state){case"header":if(!e.length)return this.state="body",this.processHeaders();if(this.headerSize+=e.length,this.headerSize>this.options.maxHeadersSize)throw new Error(`Maximum header size of ${this.options.maxHeadersSize} bytes exceeded`);this.headerLines.push(tn().decode(e));break;case"body":this.contentDecoder.update(e)}}}const to={"&AElig":"Æ","&AElig;":"Æ","&AMP":"&","&AMP;":"&","&Aacute":"Á","&Aacute;":"Á","&Abreve;":"Ă","&Acirc":"Â","&Acirc;":"Â","&Acy;":"А","&Afr;":"𝔄","&Agrave":"À","&Agrave;":"À","&Alpha;":"Α","&Amacr;":"Ā","&And;":"⩓","&Aogon;":"Ą","&Aopf;":"𝔸","&ApplyFunction;":"⁡","&Aring":"Å","&Aring;":"Å","&Ascr;":"𝒜","&Assign;":"≔","&Atilde":"Ã","&Atilde;":"Ã","&Auml":"Ä","&Auml;":"Ä","&Backslash;":"∖","&Barv;":"⫧","&Barwed;":"⌆","&Bcy;":"Б","&Because;":"∵","&Bernoullis;":"ℬ","&Beta;":"Β","&Bfr;":"𝔅","&Bopf;":"𝔹","&Breve;":"˘","&Bscr;":"ℬ","&Bumpeq;":"≎","&CHcy;":"Ч","&COPY":"©","&COPY;":"©","&Cacute;":"Ć","&Cap;":"⋒","&CapitalDifferentialD;":"ⅅ","&Cayleys;":"ℭ","&Ccaron;":"Č","&Ccedil":"Ç","&Ccedil;":"Ç","&Ccirc;":"Ĉ","&Cconint;":"∰","&Cdot;":"Ċ","&Cedilla;":"¸","&CenterDot;":"·","&Cfr;":"ℭ","&Chi;":"Χ","&CircleDot;":"⊙","&CircleMinus;":"⊖","&CirclePlus;":"⊕","&CircleTimes;":"⊗","&ClockwiseContourIntegral;":"∲","&CloseCurlyDoubleQuote;":"”","&CloseCurlyQuote;":"’","&Colon;":"∷","&Colone;":"⩴","&Congruent;":"≡","&Conint;":"∯","&ContourIntegral;":"∮","&Copf;":"ℂ","&Coproduct;":"∐","&CounterClockwiseContourIntegral;":"∳","&Cross;":"⨯","&Cscr;":"𝒞","&Cup;":"⋓","&CupCap;":"≍","&DD;":"ⅅ","&DDotrahd;":"⤑","&DJcy;":"Ђ","&DScy;":"Ѕ","&DZcy;":"Џ","&Dagger;":"‡","&Darr;":"↡","&Dashv;":"⫤","&Dcaron;":"Ď","&Dcy;":"Д","&Del;":"∇","&Delta;":"Δ","&Dfr;":"𝔇","&DiacriticalAcute;":"´","&DiacriticalDot;":"˙","&DiacriticalDoubleAcute;":"˝","&DiacriticalGrave;":"`","&DiacriticalTilde;":"˜","&Diamond;":"⋄","&DifferentialD;":"ⅆ","&Dopf;":"𝔻","&Dot;":"¨","&DotDot;":"⃜","&DotEqual;":"≐","&DoubleContourIntegral;":"∯","&DoubleDot;":"¨","&DoubleDownArrow;":"⇓","&DoubleLeftArrow;":"⇐","&DoubleLeftRightArrow;":"⇔","&DoubleLeftTee;":"⫤","&DoubleLongLeftArrow;":"⟸","&DoubleLongLeftRightArrow;":"⟺","&DoubleLongRightArrow;":"⟹","&DoubleRightArrow;":"⇒","&DoubleRightTee;":"⊨","&DoubleUpArrow;":"⇑","&DoubleUpDownArrow;":"⇕","&DoubleVerticalBar;":"∥","&DownArrow;":"↓","&DownArrowBar;":"⤓","&DownArrowUpArrow;":"⇵","&DownBreve;":"̑","&DownLeftRightVector;":"⥐","&DownLeftTeeVector;":"⥞","&DownLeftVector;":"↽","&DownLeftVectorBar;":"⥖","&DownRightTeeVector;":"⥟","&DownRightVector;":"⇁","&DownRightVectorBar;":"⥗","&DownTee;":"⊤","&DownTeeArrow;":"↧","&Downarrow;":"⇓","&Dscr;":"𝒟","&Dstrok;":"Đ","&ENG;":"Ŋ","&ETH":"Ð","&ETH;":"Ð","&Eacute":"É","&Eacute;":"É","&Ecaron;":"Ě","&Ecirc":"Ê","&Ecirc;":"Ê","&Ecy;":"Э","&Edot;":"Ė","&Efr;":"𝔈","&Egrave":"È","&Egrave;":"È","&Element;":"∈","&Emacr;":"Ē","&EmptySmallSquare;":"◻","&EmptyVerySmallSquare;":"▫","&Eogon;":"Ę","&Eopf;":"𝔼","&Epsilon;":"Ε","&Equal;":"⩵","&EqualTilde;":"≂","&Equilibrium;":"⇌","&Escr;":"ℰ","&Esim;":"⩳","&Eta;":"Η","&Euml":"Ë","&Euml;":"Ë","&Exists;":"∃","&ExponentialE;":"ⅇ","&Fcy;":"Ф","&Ffr;":"𝔉","&FilledSmallSquare;":"◼","&FilledVerySmallSquare;":"▪","&Fopf;":"𝔽","&ForAll;":"∀","&Fouriertrf;":"ℱ","&Fscr;":"ℱ","&GJcy;":"Ѓ","&GT":">","&GT;":">","&Gamma;":"Γ","&Gammad;":"Ϝ","&Gbreve;":"Ğ","&Gcedil;":"Ģ","&Gcirc;":"Ĝ","&Gcy;":"Г","&Gdot;":"Ġ","&Gfr;":"𝔊","&Gg;":"⋙","&Gopf;":"𝔾","&GreaterEqual;":"≥","&GreaterEqualLess;":"⋛","&GreaterFullEqual;":"≧","&GreaterGreater;":"⪢","&GreaterLess;":"≷","&GreaterSlantEqual;":"⩾","&GreaterTilde;":"≳","&Gscr;":"𝒢","&Gt;":"≫","&HARDcy;":"Ъ","&Hacek;":"ˇ","&Hat;":"^","&Hcirc;":"Ĥ","&Hfr;":"ℌ","&HilbertSpace;":"ℋ","&Hopf;":"ℍ","&HorizontalLine;":"─","&Hscr;":"ℋ","&Hstrok;":"Ħ","&HumpDownHump;":"≎","&HumpEqual;":"≏","&IEcy;":"Е","&IJlig;":"IJ","&IOcy;":"Ё","&Iacute":"Í","&Iacute;":"Í","&Icirc":"Î","&Icirc;":"Î","&Icy;":"И","&Idot;":"İ","&Ifr;":"ℑ","&Igrave":"Ì","&Igrave;":"Ì","&Im;":"ℑ","&Imacr;":"Ī","&ImaginaryI;":"ⅈ","&Implies;":"⇒","&Int;":"∬","&Integral;":"∫","&Intersection;":"⋂","&InvisibleComma;":"⁣","&InvisibleTimes;":"⁢","&Iogon;":"Į","&Iopf;":"𝕀","&Iota;":"Ι","&Iscr;":"ℐ","&Itilde;":"Ĩ","&Iukcy;":"І","&Iuml":"Ï","&Iuml;":"Ï","&Jcirc;":"Ĵ","&Jcy;":"Й","&Jfr;":"𝔍","&Jopf;":"𝕁","&Jscr;":"𝒥","&Jsercy;":"Ј","&Jukcy;":"Є","&KHcy;":"Х","&KJcy;":"Ќ","&Kappa;":"Κ","&Kcedil;":"Ķ","&Kcy;":"К","&Kfr;":"𝔎","&Kopf;":"𝕂","&Kscr;":"𝒦","&LJcy;":"Љ","&LT":"<","&LT;":"<","&Lacute;":"Ĺ","&Lambda;":"Λ","&Lang;":"⟪","&Laplacetrf;":"ℒ","&Larr;":"↞","&Lcaron;":"Ľ","&Lcedil;":"Ļ","&Lcy;":"Л","&LeftAngleBracket;":"⟨","&LeftArrow;":"←","&LeftArrowBar;":"⇤","&LeftArrowRightArrow;":"⇆","&LeftCeiling;":"⌈","&LeftDoubleBracket;":"⟦","&LeftDownTeeVector;":"⥡","&LeftDownVector;":"⇃","&LeftDownVectorBar;":"⥙","&LeftFloor;":"⌊","&LeftRightArrow;":"↔","&LeftRightVector;":"⥎","&LeftTee;":"⊣","&LeftTeeArrow;":"↤","&LeftTeeVector;":"⥚","&LeftTriangle;":"⊲","&LeftTriangleBar;":"⧏","&LeftTriangleEqual;":"⊴","&LeftUpDownVector;":"⥑","&LeftUpTeeVector;":"⥠","&LeftUpVector;":"↿","&LeftUpVectorBar;":"⥘","&LeftVector;":"↼","&LeftVectorBar;":"⥒","&Leftarrow;":"⇐","&Leftrightarrow;":"⇔","&LessEqualGreater;":"⋚","&LessFullEqual;":"≦","&LessGreater;":"≶","&LessLess;":"⪡","&LessSlantEqual;":"⩽","&LessTilde;":"≲","&Lfr;":"𝔏","&Ll;":"⋘","&Lleftarrow;":"⇚","&Lmidot;":"Ŀ","&LongLeftArrow;":"⟵","&LongLeftRightArrow;":"⟷","&LongRightArrow;":"⟶","&Longleftarrow;":"⟸","&Longleftrightarrow;":"⟺","&Longrightarrow;":"⟹","&Lopf;":"𝕃","&LowerLeftArrow;":"↙","&LowerRightArrow;":"↘","&Lscr;":"ℒ","&Lsh;":"↰","&Lstrok;":"Ł","&Lt;":"≪","&Map;":"⤅","&Mcy;":"М","&MediumSpace;":" ","&Mellintrf;":"ℳ","&Mfr;":"𝔐","&MinusPlus;":"∓","&Mopf;":"𝕄","&Mscr;":"ℳ","&Mu;":"Μ","&NJcy;":"Њ","&Nacute;":"Ń","&Ncaron;":"Ň","&Ncedil;":"Ņ","&Ncy;":"Н","&NegativeMediumSpace;":"​","&NegativeThickSpace;":"​","&NegativeThinSpace;":"​","&NegativeVeryThinSpace;":"​","&NestedGreaterGreater;":"≫","&NestedLessLess;":"≪","&NewLine;":`
5
+ `+t,this.headerLines.splice(e,1);else{t=t.replace(/\s+/g," ");let n=t.indexOf(":"),s=n<0?t.trim():t.substr(0,n).trim(),i=n<0?"":t.substr(n+1).trim();switch(this.headers.push({key:s.toLowerCase(),originalKey:s,value:i}),s.toLowerCase()){case"content-type":this.contentType.default&&(this.contentType={value:i,parsed:{}});break;case"content-transfer-encoding":this.contentTransferEncoding={value:i,parsed:{}};break;case"content-disposition":this.contentDisposition={value:i,parsed:{}};break;case"content-id":this.contentId=i;break;case"content-description":this.contentDescription=i;break}}}this.contentType.parsed=this.parseStructuredHeader(this.contentType.value),this.contentType.multipart=/^multipart\//i.test(this.contentType.parsed.value)?this.contentType.parsed.value.substr(this.contentType.parsed.value.indexOf("/")+1):!1,this.contentType.multipart&&this.contentType.parsed.params.boundary&&this.postalMime.boundaries.push({value:Mr.encode(this.contentType.parsed.params.boundary),node:this}),this.contentDisposition.parsed=this.parseStructuredHeader(this.contentDisposition.value),this.contentTransferEncoding.encoding=this.contentTransferEncoding.value.toLowerCase().split(/[^\w-]/).shift(),this.setupContentDecoder(this.contentTransferEncoding.encoding)}feed(e){switch(this.state){case"header":if(!e.length)return this.state="body",this.processHeaders();if(this.headerSize+=e.length,this.headerSize>this.options.maxHeadersSize)throw new Error(`Maximum header size of ${this.options.maxHeadersSize} bytes exceeded`);this.headerLines.push(tn().decode(e));break;case"body":this.contentDecoder.update(e)}}}const to={"&AElig":"Æ","&AElig;":"Æ","&AMP":"&","&AMP;":"&","&Aacute":"Á","&Aacute;":"Á","&Abreve;":"Ă","&Acirc":"Â","&Acirc;":"Â","&Acy;":"А","&Afr;":"𝔄","&Agrave":"À","&Agrave;":"À","&Alpha;":"Α","&Amacr;":"Ā","&And;":"⩓","&Aogon;":"Ą","&Aopf;":"𝔸","&ApplyFunction;":"⁡","&Aring":"Å","&Aring;":"Å","&Ascr;":"𝒜","&Assign;":"≔","&Atilde":"Ã","&Atilde;":"Ã","&Auml":"Ä","&Auml;":"Ä","&Backslash;":"∖","&Barv;":"⫧","&Barwed;":"⌆","&Bcy;":"Б","&Because;":"∵","&Bernoullis;":"ℬ","&Beta;":"Β","&Bfr;":"𝔅","&Bopf;":"𝔹","&Breve;":"˘","&Bscr;":"ℬ","&Bumpeq;":"≎","&CHcy;":"Ч","&COPY":"©","&COPY;":"©","&Cacute;":"Ć","&Cap;":"⋒","&CapitalDifferentialD;":"ⅅ","&Cayleys;":"ℭ","&Ccaron;":"Č","&Ccedil":"Ç","&Ccedil;":"Ç","&Ccirc;":"Ĉ","&Cconint;":"∰","&Cdot;":"Ċ","&Cedilla;":"¸","&CenterDot;":"·","&Cfr;":"ℭ","&Chi;":"Χ","&CircleDot;":"⊙","&CircleMinus;":"⊖","&CirclePlus;":"⊕","&CircleTimes;":"⊗","&ClockwiseContourIntegral;":"∲","&CloseCurlyDoubleQuote;":"”","&CloseCurlyQuote;":"’","&Colon;":"∷","&Colone;":"⩴","&Congruent;":"≡","&Conint;":"∯","&ContourIntegral;":"∮","&Copf;":"ℂ","&Coproduct;":"∐","&CounterClockwiseContourIntegral;":"∳","&Cross;":"⨯","&Cscr;":"𝒞","&Cup;":"⋓","&CupCap;":"≍","&DD;":"ⅅ","&DDotrahd;":"⤑","&DJcy;":"Ђ","&DScy;":"Ѕ","&DZcy;":"Џ","&Dagger;":"‡","&Darr;":"↡","&Dashv;":"⫤","&Dcaron;":"Ď","&Dcy;":"Д","&Del;":"∇","&Delta;":"Δ","&Dfr;":"𝔇","&DiacriticalAcute;":"´","&DiacriticalDot;":"˙","&DiacriticalDoubleAcute;":"˝","&DiacriticalGrave;":"`","&DiacriticalTilde;":"˜","&Diamond;":"⋄","&DifferentialD;":"ⅆ","&Dopf;":"𝔻","&Dot;":"¨","&DotDot;":"⃜","&DotEqual;":"≐","&DoubleContourIntegral;":"∯","&DoubleDot;":"¨","&DoubleDownArrow;":"⇓","&DoubleLeftArrow;":"⇐","&DoubleLeftRightArrow;":"⇔","&DoubleLeftTee;":"⫤","&DoubleLongLeftArrow;":"⟸","&DoubleLongLeftRightArrow;":"⟺","&DoubleLongRightArrow;":"⟹","&DoubleRightArrow;":"⇒","&DoubleRightTee;":"⊨","&DoubleUpArrow;":"⇑","&DoubleUpDownArrow;":"⇕","&DoubleVerticalBar;":"∥","&DownArrow;":"↓","&DownArrowBar;":"⤓","&DownArrowUpArrow;":"⇵","&DownBreve;":"̑","&DownLeftRightVector;":"⥐","&DownLeftTeeVector;":"⥞","&DownLeftVector;":"↽","&DownLeftVectorBar;":"⥖","&DownRightTeeVector;":"⥟","&DownRightVector;":"⇁","&DownRightVectorBar;":"⥗","&DownTee;":"⊤","&DownTeeArrow;":"↧","&Downarrow;":"⇓","&Dscr;":"𝒟","&Dstrok;":"Đ","&ENG;":"Ŋ","&ETH":"Ð","&ETH;":"Ð","&Eacute":"É","&Eacute;":"É","&Ecaron;":"Ě","&Ecirc":"Ê","&Ecirc;":"Ê","&Ecy;":"Э","&Edot;":"Ė","&Efr;":"𝔈","&Egrave":"È","&Egrave;":"È","&Element;":"∈","&Emacr;":"Ē","&EmptySmallSquare;":"◻","&EmptyVerySmallSquare;":"▫","&Eogon;":"Ę","&Eopf;":"𝔼","&Epsilon;":"Ε","&Equal;":"⩵","&EqualTilde;":"≂","&Equilibrium;":"⇌","&Escr;":"ℰ","&Esim;":"⩳","&Eta;":"Η","&Euml":"Ë","&Euml;":"Ë","&Exists;":"∃","&ExponentialE;":"ⅇ","&Fcy;":"Ф","&Ffr;":"𝔉","&FilledSmallSquare;":"◼","&FilledVerySmallSquare;":"▪","&Fopf;":"𝔽","&ForAll;":"∀","&Fouriertrf;":"ℱ","&Fscr;":"ℱ","&GJcy;":"Ѓ","&GT":">","&GT;":">","&Gamma;":"Γ","&Gammad;":"Ϝ","&Gbreve;":"Ğ","&Gcedil;":"Ģ","&Gcirc;":"Ĝ","&Gcy;":"Г","&Gdot;":"Ġ","&Gfr;":"𝔊","&Gg;":"⋙","&Gopf;":"𝔾","&GreaterEqual;":"≥","&GreaterEqualLess;":"⋛","&GreaterFullEqual;":"≧","&GreaterGreater;":"⪢","&GreaterLess;":"≷","&GreaterSlantEqual;":"⩾","&GreaterTilde;":"≳","&Gscr;":"𝒢","&Gt;":"≫","&HARDcy;":"Ъ","&Hacek;":"ˇ","&Hat;":"^","&Hcirc;":"Ĥ","&Hfr;":"ℌ","&HilbertSpace;":"ℋ","&Hopf;":"ℍ","&HorizontalLine;":"─","&Hscr;":"ℋ","&Hstrok;":"Ħ","&HumpDownHump;":"≎","&HumpEqual;":"≏","&IEcy;":"Е","&IJlig;":"IJ","&IOcy;":"Ё","&Iacute":"Í","&Iacute;":"Í","&Icirc":"Î","&Icirc;":"Î","&Icy;":"И","&Idot;":"İ","&Ifr;":"ℑ","&Igrave":"Ì","&Igrave;":"Ì","&Im;":"ℑ","&Imacr;":"Ī","&ImaginaryI;":"ⅈ","&Implies;":"⇒","&Int;":"∬","&Integral;":"∫","&Intersection;":"⋂","&InvisibleComma;":"⁣","&InvisibleTimes;":"⁢","&Iogon;":"Į","&Iopf;":"𝕀","&Iota;":"Ι","&Iscr;":"ℐ","&Itilde;":"Ĩ","&Iukcy;":"І","&Iuml":"Ï","&Iuml;":"Ï","&Jcirc;":"Ĵ","&Jcy;":"Й","&Jfr;":"𝔍","&Jopf;":"𝕁","&Jscr;":"𝒥","&Jsercy;":"Ј","&Jukcy;":"Є","&KHcy;":"Х","&KJcy;":"Ќ","&Kappa;":"Κ","&Kcedil;":"Ķ","&Kcy;":"К","&Kfr;":"𝔎","&Kopf;":"𝕂","&Kscr;":"𝒦","&LJcy;":"Љ","&LT":"<","&LT;":"<","&Lacute;":"Ĺ","&Lambda;":"Λ","&Lang;":"⟪","&Laplacetrf;":"ℒ","&Larr;":"↞","&Lcaron;":"Ľ","&Lcedil;":"Ļ","&Lcy;":"Л","&LeftAngleBracket;":"⟨","&LeftArrow;":"←","&LeftArrowBar;":"⇤","&LeftArrowRightArrow;":"⇆","&LeftCeiling;":"⌈","&LeftDoubleBracket;":"⟦","&LeftDownTeeVector;":"⥡","&LeftDownVector;":"⇃","&LeftDownVectorBar;":"⥙","&LeftFloor;":"⌊","&LeftRightArrow;":"↔","&LeftRightVector;":"⥎","&LeftTee;":"⊣","&LeftTeeArrow;":"↤","&LeftTeeVector;":"⥚","&LeftTriangle;":"⊲","&LeftTriangleBar;":"⧏","&LeftTriangleEqual;":"⊴","&LeftUpDownVector;":"⥑","&LeftUpTeeVector;":"⥠","&LeftUpVector;":"↿","&LeftUpVectorBar;":"⥘","&LeftVector;":"↼","&LeftVectorBar;":"⥒","&Leftarrow;":"⇐","&Leftrightarrow;":"⇔","&LessEqualGreater;":"⋚","&LessFullEqual;":"≦","&LessGreater;":"≶","&LessLess;":"⪡","&LessSlantEqual;":"⩽","&LessTilde;":"≲","&Lfr;":"𝔏","&Ll;":"⋘","&Lleftarrow;":"⇚","&Lmidot;":"Ŀ","&LongLeftArrow;":"⟵","&LongLeftRightArrow;":"⟷","&LongRightArrow;":"⟶","&Longleftarrow;":"⟸","&Longleftrightarrow;":"⟺","&Longrightarrow;":"⟹","&Lopf;":"𝕃","&LowerLeftArrow;":"↙","&LowerRightArrow;":"↘","&Lscr;":"ℒ","&Lsh;":"↰","&Lstrok;":"Ł","&Lt;":"≪","&Map;":"⤅","&Mcy;":"М","&MediumSpace;":" ","&Mellintrf;":"ℳ","&Mfr;":"𝔐","&MinusPlus;":"∓","&Mopf;":"𝕄","&Mscr;":"ℳ","&Mu;":"Μ","&NJcy;":"Њ","&Nacute;":"Ń","&Ncaron;":"Ň","&Ncedil;":"Ņ","&Ncy;":"Н","&NegativeMediumSpace;":"​","&NegativeThickSpace;":"​","&NegativeThinSpace;":"​","&NegativeVeryThinSpace;":"​","&NestedGreaterGreater;":"≫","&NestedLessLess;":"≪","&NewLine;":`
6
6
  `,"&Nfr;":"𝔑","&NoBreak;":"⁠","&NonBreakingSpace;":" ","&Nopf;":"ℕ","&Not;":"⫬","&NotCongruent;":"≢","&NotCupCap;":"≭","&NotDoubleVerticalBar;":"∦","&NotElement;":"∉","&NotEqual;":"≠","&NotEqualTilde;":"≂̸","&NotExists;":"∄","&NotGreater;":"≯","&NotGreaterEqual;":"≱","&NotGreaterFullEqual;":"≧̸","&NotGreaterGreater;":"≫̸","&NotGreaterLess;":"≹","&NotGreaterSlantEqual;":"⩾̸","&NotGreaterTilde;":"≵","&NotHumpDownHump;":"≎̸","&NotHumpEqual;":"≏̸","&NotLeftTriangle;":"⋪","&NotLeftTriangleBar;":"⧏̸","&NotLeftTriangleEqual;":"⋬","&NotLess;":"≮","&NotLessEqual;":"≰","&NotLessGreater;":"≸","&NotLessLess;":"≪̸","&NotLessSlantEqual;":"⩽̸","&NotLessTilde;":"≴","&NotNestedGreaterGreater;":"⪢̸","&NotNestedLessLess;":"⪡̸","&NotPrecedes;":"⊀","&NotPrecedesEqual;":"⪯̸","&NotPrecedesSlantEqual;":"⋠","&NotReverseElement;":"∌","&NotRightTriangle;":"⋫","&NotRightTriangleBar;":"⧐̸","&NotRightTriangleEqual;":"⋭","&NotSquareSubset;":"⊏̸","&NotSquareSubsetEqual;":"⋢","&NotSquareSuperset;":"⊐̸","&NotSquareSupersetEqual;":"⋣","&NotSubset;":"⊂⃒","&NotSubsetEqual;":"⊈","&NotSucceeds;":"⊁","&NotSucceedsEqual;":"⪰̸","&NotSucceedsSlantEqual;":"⋡","&NotSucceedsTilde;":"≿̸","&NotSuperset;":"⊃⃒","&NotSupersetEqual;":"⊉","&NotTilde;":"≁","&NotTildeEqual;":"≄","&NotTildeFullEqual;":"≇","&NotTildeTilde;":"≉","&NotVerticalBar;":"∤","&Nscr;":"𝒩","&Ntilde":"Ñ","&Ntilde;":"Ñ","&Nu;":"Ν","&OElig;":"Œ","&Oacute":"Ó","&Oacute;":"Ó","&Ocirc":"Ô","&Ocirc;":"Ô","&Ocy;":"О","&Odblac;":"Ő","&Ofr;":"𝔒","&Ograve":"Ò","&Ograve;":"Ò","&Omacr;":"Ō","&Omega;":"Ω","&Omicron;":"Ο","&Oopf;":"𝕆","&OpenCurlyDoubleQuote;":"“","&OpenCurlyQuote;":"‘","&Or;":"⩔","&Oscr;":"𝒪","&Oslash":"Ø","&Oslash;":"Ø","&Otilde":"Õ","&Otilde;":"Õ","&Otimes;":"⨷","&Ouml":"Ö","&Ouml;":"Ö","&OverBar;":"‾","&OverBrace;":"⏞","&OverBracket;":"⎴","&OverParenthesis;":"⏜","&PartialD;":"∂","&Pcy;":"П","&Pfr;":"𝔓","&Phi;":"Φ","&Pi;":"Π","&PlusMinus;":"±","&Poincareplane;":"ℌ","&Popf;":"ℙ","&Pr;":"⪻","&Precedes;":"≺","&PrecedesEqual;":"⪯","&PrecedesSlantEqual;":"≼","&PrecedesTilde;":"≾","&Prime;":"″","&Product;":"∏","&Proportion;":"∷","&Proportional;":"∝","&Pscr;":"𝒫","&Psi;":"Ψ","&QUOT":'"',"&QUOT;":'"',"&Qfr;":"𝔔","&Qopf;":"ℚ","&Qscr;":"𝒬","&RBarr;":"⤐","&REG":"®","&REG;":"®","&Racute;":"Ŕ","&Rang;":"⟫","&Rarr;":"↠","&Rarrtl;":"⤖","&Rcaron;":"Ř","&Rcedil;":"Ŗ","&Rcy;":"Р","&Re;":"ℜ","&ReverseElement;":"∋","&ReverseEquilibrium;":"⇋","&ReverseUpEquilibrium;":"⥯","&Rfr;":"ℜ","&Rho;":"Ρ","&RightAngleBracket;":"⟩","&RightArrow;":"→","&RightArrowBar;":"⇥","&RightArrowLeftArrow;":"⇄","&RightCeiling;":"⌉","&RightDoubleBracket;":"⟧","&RightDownTeeVector;":"⥝","&RightDownVector;":"⇂","&RightDownVectorBar;":"⥕","&RightFloor;":"⌋","&RightTee;":"⊢","&RightTeeArrow;":"↦","&RightTeeVector;":"⥛","&RightTriangle;":"⊳","&RightTriangleBar;":"⧐","&RightTriangleEqual;":"⊵","&RightUpDownVector;":"⥏","&RightUpTeeVector;":"⥜","&RightUpVector;":"↾","&RightUpVectorBar;":"⥔","&RightVector;":"⇀","&RightVectorBar;":"⥓","&Rightarrow;":"⇒","&Ropf;":"ℝ","&RoundImplies;":"⥰","&Rrightarrow;":"⇛","&Rscr;":"ℛ","&Rsh;":"↱","&RuleDelayed;":"⧴","&SHCHcy;":"Щ","&SHcy;":"Ш","&SOFTcy;":"Ь","&Sacute;":"Ś","&Sc;":"⪼","&Scaron;":"Š","&Scedil;":"Ş","&Scirc;":"Ŝ","&Scy;":"С","&Sfr;":"𝔖","&ShortDownArrow;":"↓","&ShortLeftArrow;":"←","&ShortRightArrow;":"→","&ShortUpArrow;":"↑","&Sigma;":"Σ","&SmallCircle;":"∘","&Sopf;":"𝕊","&Sqrt;":"√","&Square;":"□","&SquareIntersection;":"⊓","&SquareSubset;":"⊏","&SquareSubsetEqual;":"⊑","&SquareSuperset;":"⊐","&SquareSupersetEqual;":"⊒","&SquareUnion;":"⊔","&Sscr;":"𝒮","&Star;":"⋆","&Sub;":"⋐","&Subset;":"⋐","&SubsetEqual;":"⊆","&Succeeds;":"≻","&SucceedsEqual;":"⪰","&SucceedsSlantEqual;":"≽","&SucceedsTilde;":"≿","&SuchThat;":"∋","&Sum;":"∑","&Sup;":"⋑","&Superset;":"⊃","&SupersetEqual;":"⊇","&Supset;":"⋑","&THORN":"Þ","&THORN;":"Þ","&TRADE;":"™","&TSHcy;":"Ћ","&TScy;":"Ц","&Tab;":" ","&Tau;":"Τ","&Tcaron;":"Ť","&Tcedil;":"Ţ","&Tcy;":"Т","&Tfr;":"𝔗","&Therefore;":"∴","&Theta;":"Θ","&ThickSpace;":"  ","&ThinSpace;":" ","&Tilde;":"∼","&TildeEqual;":"≃","&TildeFullEqual;":"≅","&TildeTilde;":"≈","&Topf;":"𝕋","&TripleDot;":"⃛","&Tscr;":"𝒯","&Tstrok;":"Ŧ","&Uacute":"Ú","&Uacute;":"Ú","&Uarr;":"↟","&Uarrocir;":"⥉","&Ubrcy;":"Ў","&Ubreve;":"Ŭ","&Ucirc":"Û","&Ucirc;":"Û","&Ucy;":"У","&Udblac;":"Ű","&Ufr;":"𝔘","&Ugrave":"Ù","&Ugrave;":"Ù","&Umacr;":"Ū","&UnderBar;":"_","&UnderBrace;":"⏟","&UnderBracket;":"⎵","&UnderParenthesis;":"⏝","&Union;":"⋃","&UnionPlus;":"⊎","&Uogon;":"Ų","&Uopf;":"𝕌","&UpArrow;":"↑","&UpArrowBar;":"⤒","&UpArrowDownArrow;":"⇅","&UpDownArrow;":"↕","&UpEquilibrium;":"⥮","&UpTee;":"⊥","&UpTeeArrow;":"↥","&Uparrow;":"⇑","&Updownarrow;":"⇕","&UpperLeftArrow;":"↖","&UpperRightArrow;":"↗","&Upsi;":"ϒ","&Upsilon;":"Υ","&Uring;":"Ů","&Uscr;":"𝒰","&Utilde;":"Ũ","&Uuml":"Ü","&Uuml;":"Ü","&VDash;":"⊫","&Vbar;":"⫫","&Vcy;":"В","&Vdash;":"⊩","&Vdashl;":"⫦","&Vee;":"⋁","&Verbar;":"‖","&Vert;":"‖","&VerticalBar;":"∣","&VerticalLine;":"|","&VerticalSeparator;":"❘","&VerticalTilde;":"≀","&VeryThinSpace;":" ","&Vfr;":"𝔙","&Vopf;":"𝕍","&Vscr;":"𝒱","&Vvdash;":"⊪","&Wcirc;":"Ŵ","&Wedge;":"⋀","&Wfr;":"𝔚","&Wopf;":"𝕎","&Wscr;":"𝒲","&Xfr;":"𝔛","&Xi;":"Ξ","&Xopf;":"𝕏","&Xscr;":"𝒳","&YAcy;":"Я","&YIcy;":"Ї","&YUcy;":"Ю","&Yacute":"Ý","&Yacute;":"Ý","&Ycirc;":"Ŷ","&Ycy;":"Ы","&Yfr;":"𝔜","&Yopf;":"𝕐","&Yscr;":"𝒴","&Yuml;":"Ÿ","&ZHcy;":"Ж","&Zacute;":"Ź","&Zcaron;":"Ž","&Zcy;":"З","&Zdot;":"Ż","&ZeroWidthSpace;":"​","&Zeta;":"Ζ","&Zfr;":"ℨ","&Zopf;":"ℤ","&Zscr;":"𝒵","&aacute":"á","&aacute;":"á","&abreve;":"ă","&ac;":"∾","&acE;":"∾̳","&acd;":"∿","&acirc":"â","&acirc;":"â","&acute":"´","&acute;":"´","&acy;":"а","&aelig":"æ","&aelig;":"æ","&af;":"⁡","&afr;":"𝔞","&agrave":"à","&agrave;":"à","&alefsym;":"ℵ","&aleph;":"ℵ","&alpha;":"α","&amacr;":"ā","&amalg;":"⨿","&amp":"&","&amp;":"&","&and;":"∧","&andand;":"⩕","&andd;":"⩜","&andslope;":"⩘","&andv;":"⩚","&ang;":"∠","&ange;":"⦤","&angle;":"∠","&angmsd;":"∡","&angmsdaa;":"⦨","&angmsdab;":"⦩","&angmsdac;":"⦪","&angmsdad;":"⦫","&angmsdae;":"⦬","&angmsdaf;":"⦭","&angmsdag;":"⦮","&angmsdah;":"⦯","&angrt;":"∟","&angrtvb;":"⊾","&angrtvbd;":"⦝","&angsph;":"∢","&angst;":"Å","&angzarr;":"⍼","&aogon;":"ą","&aopf;":"𝕒","&ap;":"≈","&apE;":"⩰","&apacir;":"⩯","&ape;":"≊","&apid;":"≋","&apos;":"'","&approx;":"≈","&approxeq;":"≊","&aring":"å","&aring;":"å","&ascr;":"𝒶","&ast;":"*","&asymp;":"≈","&asympeq;":"≍","&atilde":"ã","&atilde;":"ã","&auml":"ä","&auml;":"ä","&awconint;":"∳","&awint;":"⨑","&bNot;":"⫭","&backcong;":"≌","&backepsilon;":"϶","&backprime;":"‵","&backsim;":"∽","&backsimeq;":"⋍","&barvee;":"⊽","&barwed;":"⌅","&barwedge;":"⌅","&bbrk;":"⎵","&bbrktbrk;":"⎶","&bcong;":"≌","&bcy;":"б","&bdquo;":"„","&becaus;":"∵","&because;":"∵","&bemptyv;":"⦰","&bepsi;":"϶","&bernou;":"ℬ","&beta;":"β","&beth;":"ℶ","&between;":"≬","&bfr;":"𝔟","&bigcap;":"⋂","&bigcirc;":"◯","&bigcup;":"⋃","&bigodot;":"⨀","&bigoplus;":"⨁","&bigotimes;":"⨂","&bigsqcup;":"⨆","&bigstar;":"★","&bigtriangledown;":"▽","&bigtriangleup;":"△","&biguplus;":"⨄","&bigvee;":"⋁","&bigwedge;":"⋀","&bkarow;":"⤍","&blacklozenge;":"⧫","&blacksquare;":"▪","&blacktriangle;":"▴","&blacktriangledown;":"▾","&blacktriangleleft;":"◂","&blacktriangleright;":"▸","&blank;":"␣","&blk12;":"▒","&blk14;":"░","&blk34;":"▓","&block;":"█","&bne;":"=⃥","&bnequiv;":"≡⃥","&bnot;":"⌐","&bopf;":"𝕓","&bot;":"⊥","&bottom;":"⊥","&bowtie;":"⋈","&boxDL;":"╗","&boxDR;":"╔","&boxDl;":"╖","&boxDr;":"╓","&boxH;":"═","&boxHD;":"╦","&boxHU;":"╩","&boxHd;":"╤","&boxHu;":"╧","&boxUL;":"╝","&boxUR;":"╚","&boxUl;":"╜","&boxUr;":"╙","&boxV;":"║","&boxVH;":"╬","&boxVL;":"╣","&boxVR;":"╠","&boxVh;":"╫","&boxVl;":"╢","&boxVr;":"╟","&boxbox;":"⧉","&boxdL;":"╕","&boxdR;":"╒","&boxdl;":"┐","&boxdr;":"┌","&boxh;":"─","&boxhD;":"╥","&boxhU;":"╨","&boxhd;":"┬","&boxhu;":"┴","&boxminus;":"⊟","&boxplus;":"⊞","&boxtimes;":"⊠","&boxuL;":"╛","&boxuR;":"╘","&boxul;":"┘","&boxur;":"└","&boxv;":"│","&boxvH;":"╪","&boxvL;":"╡","&boxvR;":"╞","&boxvh;":"┼","&boxvl;":"┤","&boxvr;":"├","&bprime;":"‵","&breve;":"˘","&brvbar":"¦","&brvbar;":"¦","&bscr;":"𝒷","&bsemi;":"⁏","&bsim;":"∽","&bsime;":"⋍","&bsol;":"\\","&bsolb;":"⧅","&bsolhsub;":"⟈","&bull;":"•","&bullet;":"•","&bump;":"≎","&bumpE;":"⪮","&bumpe;":"≏","&bumpeq;":"≏","&cacute;":"ć","&cap;":"∩","&capand;":"⩄","&capbrcup;":"⩉","&capcap;":"⩋","&capcup;":"⩇","&capdot;":"⩀","&caps;":"∩︀","&caret;":"⁁","&caron;":"ˇ","&ccaps;":"⩍","&ccaron;":"č","&ccedil":"ç","&ccedil;":"ç","&ccirc;":"ĉ","&ccups;":"⩌","&ccupssm;":"⩐","&cdot;":"ċ","&cedil":"¸","&cedil;":"¸","&cemptyv;":"⦲","&cent":"¢","&cent;":"¢","&centerdot;":"·","&cfr;":"𝔠","&chcy;":"ч","&check;":"✓","&checkmark;":"✓","&chi;":"χ","&cir;":"○","&cirE;":"⧃","&circ;":"ˆ","&circeq;":"≗","&circlearrowleft;":"↺","&circlearrowright;":"↻","&circledR;":"®","&circledS;":"Ⓢ","&circledast;":"⊛","&circledcirc;":"⊚","&circleddash;":"⊝","&cire;":"≗","&cirfnint;":"⨐","&cirmid;":"⫯","&cirscir;":"⧂","&clubs;":"♣","&clubsuit;":"♣","&colon;":":","&colone;":"≔","&coloneq;":"≔","&comma;":",","&commat;":"@","&comp;":"∁","&compfn;":"∘","&complement;":"∁","&complexes;":"ℂ","&cong;":"≅","&congdot;":"⩭","&conint;":"∮","&copf;":"𝕔","&coprod;":"∐","&copy":"©","&copy;":"©","&copysr;":"℗","&crarr;":"↵","&cross;":"✗","&cscr;":"𝒸","&csub;":"⫏","&csube;":"⫑","&csup;":"⫐","&csupe;":"⫒","&ctdot;":"⋯","&cudarrl;":"⤸","&cudarrr;":"⤵","&cuepr;":"⋞","&cuesc;":"⋟","&cularr;":"↶","&cularrp;":"⤽","&cup;":"∪","&cupbrcap;":"⩈","&cupcap;":"⩆","&cupcup;":"⩊","&cupdot;":"⊍","&cupor;":"⩅","&cups;":"∪︀","&curarr;":"↷","&curarrm;":"⤼","&curlyeqprec;":"⋞","&curlyeqsucc;":"⋟","&curlyvee;":"⋎","&curlywedge;":"⋏","&curren":"¤","&curren;":"¤","&curvearrowleft;":"↶","&curvearrowright;":"↷","&cuvee;":"⋎","&cuwed;":"⋏","&cwconint;":"∲","&cwint;":"∱","&cylcty;":"⌭","&dArr;":"⇓","&dHar;":"⥥","&dagger;":"†","&daleth;":"ℸ","&darr;":"↓","&dash;":"‐","&dashv;":"⊣","&dbkarow;":"⤏","&dblac;":"˝","&dcaron;":"ď","&dcy;":"д","&dd;":"ⅆ","&ddagger;":"‡","&ddarr;":"⇊","&ddotseq;":"⩷","&deg":"°","&deg;":"°","&delta;":"δ","&demptyv;":"⦱","&dfisht;":"⥿","&dfr;":"𝔡","&dharl;":"⇃","&dharr;":"⇂","&diam;":"⋄","&diamond;":"⋄","&diamondsuit;":"♦","&diams;":"♦","&die;":"¨","&digamma;":"ϝ","&disin;":"⋲","&div;":"÷","&divide":"÷","&divide;":"÷","&divideontimes;":"⋇","&divonx;":"⋇","&djcy;":"ђ","&dlcorn;":"⌞","&dlcrop;":"⌍","&dollar;":"$","&dopf;":"𝕕","&dot;":"˙","&doteq;":"≐","&doteqdot;":"≑","&dotminus;":"∸","&dotplus;":"∔","&dotsquare;":"⊡","&doublebarwedge;":"⌆","&downarrow;":"↓","&downdownarrows;":"⇊","&downharpoonleft;":"⇃","&downharpoonright;":"⇂","&drbkarow;":"⤐","&drcorn;":"⌟","&drcrop;":"⌌","&dscr;":"𝒹","&dscy;":"ѕ","&dsol;":"⧶","&dstrok;":"đ","&dtdot;":"⋱","&dtri;":"▿","&dtrif;":"▾","&duarr;":"⇵","&duhar;":"⥯","&dwangle;":"⦦","&dzcy;":"џ","&dzigrarr;":"⟿","&eDDot;":"⩷","&eDot;":"≑","&eacute":"é","&eacute;":"é","&easter;":"⩮","&ecaron;":"ě","&ecir;":"≖","&ecirc":"ê","&ecirc;":"ê","&ecolon;":"≕","&ecy;":"э","&edot;":"ė","&ee;":"ⅇ","&efDot;":"≒","&efr;":"𝔢","&eg;":"⪚","&egrave":"è","&egrave;":"è","&egs;":"⪖","&egsdot;":"⪘","&el;":"⪙","&elinters;":"⏧","&ell;":"ℓ","&els;":"⪕","&elsdot;":"⪗","&emacr;":"ē","&empty;":"∅","&emptyset;":"∅","&emptyv;":"∅","&emsp13;":" ","&emsp14;":" ","&emsp;":" ","&eng;":"ŋ","&ensp;":" ","&eogon;":"ę","&eopf;":"𝕖","&epar;":"⋕","&eparsl;":"⧣","&eplus;":"⩱","&epsi;":"ε","&epsilon;":"ε","&epsiv;":"ϵ","&eqcirc;":"≖","&eqcolon;":"≕","&eqsim;":"≂","&eqslantgtr;":"⪖","&eqslantless;":"⪕","&equals;":"=","&equest;":"≟","&equiv;":"≡","&equivDD;":"⩸","&eqvparsl;":"⧥","&erDot;":"≓","&erarr;":"⥱","&escr;":"ℯ","&esdot;":"≐","&esim;":"≂","&eta;":"η","&eth":"ð","&eth;":"ð","&euml":"ë","&euml;":"ë","&euro;":"€","&excl;":"!","&exist;":"∃","&expectation;":"ℰ","&exponentiale;":"ⅇ","&fallingdotseq;":"≒","&fcy;":"ф","&female;":"♀","&ffilig;":"ffi","&fflig;":"ff","&ffllig;":"ffl","&ffr;":"𝔣","&filig;":"fi","&fjlig;":"fj","&flat;":"♭","&fllig;":"fl","&fltns;":"▱","&fnof;":"ƒ","&fopf;":"𝕗","&forall;":"∀","&fork;":"⋔","&forkv;":"⫙","&fpartint;":"⨍","&frac12":"½","&frac12;":"½","&frac13;":"⅓","&frac14":"¼","&frac14;":"¼","&frac15;":"⅕","&frac16;":"⅙","&frac18;":"⅛","&frac23;":"⅔","&frac25;":"⅖","&frac34":"¾","&frac34;":"¾","&frac35;":"⅗","&frac38;":"⅜","&frac45;":"⅘","&frac56;":"⅚","&frac58;":"⅝","&frac78;":"⅞","&frasl;":"⁄","&frown;":"⌢","&fscr;":"𝒻","&gE;":"≧","&gEl;":"⪌","&gacute;":"ǵ","&gamma;":"γ","&gammad;":"ϝ","&gap;":"⪆","&gbreve;":"ğ","&gcirc;":"ĝ","&gcy;":"г","&gdot;":"ġ","&ge;":"≥","&gel;":"⋛","&geq;":"≥","&geqq;":"≧","&geqslant;":"⩾","&ges;":"⩾","&gescc;":"⪩","&gesdot;":"⪀","&gesdoto;":"⪂","&gesdotol;":"⪄","&gesl;":"⋛︀","&gesles;":"⪔","&gfr;":"𝔤","&gg;":"≫","&ggg;":"⋙","&gimel;":"ℷ","&gjcy;":"ѓ","&gl;":"≷","&glE;":"⪒","&gla;":"⪥","&glj;":"⪤","&gnE;":"≩","&gnap;":"⪊","&gnapprox;":"⪊","&gne;":"⪈","&gneq;":"⪈","&gneqq;":"≩","&gnsim;":"⋧","&gopf;":"𝕘","&grave;":"`","&gscr;":"ℊ","&gsim;":"≳","&gsime;":"⪎","&gsiml;":"⪐","&gt":">","&gt;":">","&gtcc;":"⪧","&gtcir;":"⩺","&gtdot;":"⋗","&gtlPar;":"⦕","&gtquest;":"⩼","&gtrapprox;":"⪆","&gtrarr;":"⥸","&gtrdot;":"⋗","&gtreqless;":"⋛","&gtreqqless;":"⪌","&gtrless;":"≷","&gtrsim;":"≳","&gvertneqq;":"≩︀","&gvnE;":"≩︀","&hArr;":"⇔","&hairsp;":" ","&half;":"½","&hamilt;":"ℋ","&hardcy;":"ъ","&harr;":"↔","&harrcir;":"⥈","&harrw;":"↭","&hbar;":"ℏ","&hcirc;":"ĥ","&hearts;":"♥","&heartsuit;":"♥","&hellip;":"…","&hercon;":"⊹","&hfr;":"𝔥","&hksearow;":"⤥","&hkswarow;":"⤦","&hoarr;":"⇿","&homtht;":"∻","&hookleftarrow;":"↩","&hookrightarrow;":"↪","&hopf;":"𝕙","&horbar;":"―","&hscr;":"𝒽","&hslash;":"ℏ","&hstrok;":"ħ","&hybull;":"⁃","&hyphen;":"‐","&iacute":"í","&iacute;":"í","&ic;":"⁣","&icirc":"î","&icirc;":"î","&icy;":"и","&iecy;":"е","&iexcl":"¡","&iexcl;":"¡","&iff;":"⇔","&ifr;":"𝔦","&igrave":"ì","&igrave;":"ì","&ii;":"ⅈ","&iiiint;":"⨌","&iiint;":"∭","&iinfin;":"⧜","&iiota;":"℩","&ijlig;":"ij","&imacr;":"ī","&image;":"ℑ","&imagline;":"ℐ","&imagpart;":"ℑ","&imath;":"ı","&imof;":"⊷","&imped;":"Ƶ","&in;":"∈","&incare;":"℅","&infin;":"∞","&infintie;":"⧝","&inodot;":"ı","&int;":"∫","&intcal;":"⊺","&integers;":"ℤ","&intercal;":"⊺","&intlarhk;":"⨗","&intprod;":"⨼","&iocy;":"ё","&iogon;":"į","&iopf;":"𝕚","&iota;":"ι","&iprod;":"⨼","&iquest":"¿","&iquest;":"¿","&iscr;":"𝒾","&isin;":"∈","&isinE;":"⋹","&isindot;":"⋵","&isins;":"⋴","&isinsv;":"⋳","&isinv;":"∈","&it;":"⁢","&itilde;":"ĩ","&iukcy;":"і","&iuml":"ï","&iuml;":"ï","&jcirc;":"ĵ","&jcy;":"й","&jfr;":"𝔧","&jmath;":"ȷ","&jopf;":"𝕛","&jscr;":"𝒿","&jsercy;":"ј","&jukcy;":"є","&kappa;":"κ","&kappav;":"ϰ","&kcedil;":"ķ","&kcy;":"к","&kfr;":"𝔨","&kgreen;":"ĸ","&khcy;":"х","&kjcy;":"ќ","&kopf;":"𝕜","&kscr;":"𝓀","&lAarr;":"⇚","&lArr;":"⇐","&lAtail;":"⤛","&lBarr;":"⤎","&lE;":"≦","&lEg;":"⪋","&lHar;":"⥢","&lacute;":"ĺ","&laemptyv;":"⦴","&lagran;":"ℒ","&lambda;":"λ","&lang;":"⟨","&langd;":"⦑","&langle;":"⟨","&lap;":"⪅","&laquo":"«","&laquo;":"«","&larr;":"←","&larrb;":"⇤","&larrbfs;":"⤟","&larrfs;":"⤝","&larrhk;":"↩","&larrlp;":"↫","&larrpl;":"⤹","&larrsim;":"⥳","&larrtl;":"↢","&lat;":"⪫","&latail;":"⤙","&late;":"⪭","&lates;":"⪭︀","&lbarr;":"⤌","&lbbrk;":"❲","&lbrace;":"{","&lbrack;":"[","&lbrke;":"⦋","&lbrksld;":"⦏","&lbrkslu;":"⦍","&lcaron;":"ľ","&lcedil;":"ļ","&lceil;":"⌈","&lcub;":"{","&lcy;":"л","&ldca;":"⤶","&ldquo;":"“","&ldquor;":"„","&ldrdhar;":"⥧","&ldrushar;":"⥋","&ldsh;":"↲","&le;":"≤","&leftarrow;":"←","&leftarrowtail;":"↢","&leftharpoondown;":"↽","&leftharpoonup;":"↼","&leftleftarrows;":"⇇","&leftrightarrow;":"↔","&leftrightarrows;":"⇆","&leftrightharpoons;":"⇋","&leftrightsquigarrow;":"↭","&leftthreetimes;":"⋋","&leg;":"⋚","&leq;":"≤","&leqq;":"≦","&leqslant;":"⩽","&les;":"⩽","&lescc;":"⪨","&lesdot;":"⩿","&lesdoto;":"⪁","&lesdotor;":"⪃","&lesg;":"⋚︀","&lesges;":"⪓","&lessapprox;":"⪅","&lessdot;":"⋖","&lesseqgtr;":"⋚","&lesseqqgtr;":"⪋","&lessgtr;":"≶","&lesssim;":"≲","&lfisht;":"⥼","&lfloor;":"⌊","&lfr;":"𝔩","&lg;":"≶","&lgE;":"⪑","&lhard;":"↽","&lharu;":"↼","&lharul;":"⥪","&lhblk;":"▄","&ljcy;":"љ","&ll;":"≪","&llarr;":"⇇","&llcorner;":"⌞","&llhard;":"⥫","&lltri;":"◺","&lmidot;":"ŀ","&lmoust;":"⎰","&lmoustache;":"⎰","&lnE;":"≨","&lnap;":"⪉","&lnapprox;":"⪉","&lne;":"⪇","&lneq;":"⪇","&lneqq;":"≨","&lnsim;":"⋦","&loang;":"⟬","&loarr;":"⇽","&lobrk;":"⟦","&longleftarrow;":"⟵","&longleftrightarrow;":"⟷","&longmapsto;":"⟼","&longrightarrow;":"⟶","&looparrowleft;":"↫","&looparrowright;":"↬","&lopar;":"⦅","&lopf;":"𝕝","&loplus;":"⨭","&lotimes;":"⨴","&lowast;":"∗","&lowbar;":"_","&loz;":"◊","&lozenge;":"◊","&lozf;":"⧫","&lpar;":"(","&lparlt;":"⦓","&lrarr;":"⇆","&lrcorner;":"⌟","&lrhar;":"⇋","&lrhard;":"⥭","&lrm;":"‎","&lrtri;":"⊿","&lsaquo;":"‹","&lscr;":"𝓁","&lsh;":"↰","&lsim;":"≲","&lsime;":"⪍","&lsimg;":"⪏","&lsqb;":"[","&lsquo;":"‘","&lsquor;":"‚","&lstrok;":"ł","&lt":"<","&lt;":"<","&ltcc;":"⪦","&ltcir;":"⩹","&ltdot;":"⋖","&lthree;":"⋋","&ltimes;":"⋉","&ltlarr;":"⥶","&ltquest;":"⩻","&ltrPar;":"⦖","&ltri;":"◃","&ltrie;":"⊴","&ltrif;":"◂","&lurdshar;":"⥊","&luruhar;":"⥦","&lvertneqq;":"≨︀","&lvnE;":"≨︀","&mDDot;":"∺","&macr":"¯","&macr;":"¯","&male;":"♂","&malt;":"✠","&maltese;":"✠","&map;":"↦","&mapsto;":"↦","&mapstodown;":"↧","&mapstoleft;":"↤","&mapstoup;":"↥","&marker;":"▮","&mcomma;":"⨩","&mcy;":"м","&mdash;":"—","&measuredangle;":"∡","&mfr;":"𝔪","&mho;":"℧","&micro":"µ","&micro;":"µ","&mid;":"∣","&midast;":"*","&midcir;":"⫰","&middot":"·","&middot;":"·","&minus;":"−","&minusb;":"⊟","&minusd;":"∸","&minusdu;":"⨪","&mlcp;":"⫛","&mldr;":"…","&mnplus;":"∓","&models;":"⊧","&mopf;":"𝕞","&mp;":"∓","&mscr;":"𝓂","&mstpos;":"∾","&mu;":"μ","&multimap;":"⊸","&mumap;":"⊸","&nGg;":"⋙̸","&nGt;":"≫⃒","&nGtv;":"≫̸","&nLeftarrow;":"⇍","&nLeftrightarrow;":"⇎","&nLl;":"⋘̸","&nLt;":"≪⃒","&nLtv;":"≪̸","&nRightarrow;":"⇏","&nVDash;":"⊯","&nVdash;":"⊮","&nabla;":"∇","&nacute;":"ń","&nang;":"∠⃒","&nap;":"≉","&napE;":"⩰̸","&napid;":"≋̸","&napos;":"ʼn","&napprox;":"≉","&natur;":"♮","&natural;":"♮","&naturals;":"ℕ","&nbsp":" ","&nbsp;":" ","&nbump;":"≎̸","&nbumpe;":"≏̸","&ncap;":"⩃","&ncaron;":"ň","&ncedil;":"ņ","&ncong;":"≇","&ncongdot;":"⩭̸","&ncup;":"⩂","&ncy;":"н","&ndash;":"–","&ne;":"≠","&neArr;":"⇗","&nearhk;":"⤤","&nearr;":"↗","&nearrow;":"↗","&nedot;":"≐̸","&nequiv;":"≢","&nesear;":"⤨","&nesim;":"≂̸","&nexist;":"∄","&nexists;":"∄","&nfr;":"𝔫","&ngE;":"≧̸","&nge;":"≱","&ngeq;":"≱","&ngeqq;":"≧̸","&ngeqslant;":"⩾̸","&nges;":"⩾̸","&ngsim;":"≵","&ngt;":"≯","&ngtr;":"≯","&nhArr;":"⇎","&nharr;":"↮","&nhpar;":"⫲","&ni;":"∋","&nis;":"⋼","&nisd;":"⋺","&niv;":"∋","&njcy;":"њ","&nlArr;":"⇍","&nlE;":"≦̸","&nlarr;":"↚","&nldr;":"‥","&nle;":"≰","&nleftarrow;":"↚","&nleftrightarrow;":"↮","&nleq;":"≰","&nleqq;":"≦̸","&nleqslant;":"⩽̸","&nles;":"⩽̸","&nless;":"≮","&nlsim;":"≴","&nlt;":"≮","&nltri;":"⋪","&nltrie;":"⋬","&nmid;":"∤","&nopf;":"𝕟","&not":"¬","&not;":"¬","&notin;":"∉","&notinE;":"⋹̸","&notindot;":"⋵̸","&notinva;":"∉","&notinvb;":"⋷","&notinvc;":"⋶","&notni;":"∌","&notniva;":"∌","&notnivb;":"⋾","&notnivc;":"⋽","&npar;":"∦","&nparallel;":"∦","&nparsl;":"⫽⃥","&npart;":"∂̸","&npolint;":"⨔","&npr;":"⊀","&nprcue;":"⋠","&npre;":"⪯̸","&nprec;":"⊀","&npreceq;":"⪯̸","&nrArr;":"⇏","&nrarr;":"↛","&nrarrc;":"⤳̸","&nrarrw;":"↝̸","&nrightarrow;":"↛","&nrtri;":"⋫","&nrtrie;":"⋭","&nsc;":"⊁","&nsccue;":"⋡","&nsce;":"⪰̸","&nscr;":"𝓃","&nshortmid;":"∤","&nshortparallel;":"∦","&nsim;":"≁","&nsime;":"≄","&nsimeq;":"≄","&nsmid;":"∤","&nspar;":"∦","&nsqsube;":"⋢","&nsqsupe;":"⋣","&nsub;":"⊄","&nsubE;":"⫅̸","&nsube;":"⊈","&nsubset;":"⊂⃒","&nsubseteq;":"⊈","&nsubseteqq;":"⫅̸","&nsucc;":"⊁","&nsucceq;":"⪰̸","&nsup;":"⊅","&nsupE;":"⫆̸","&nsupe;":"⊉","&nsupset;":"⊃⃒","&nsupseteq;":"⊉","&nsupseteqq;":"⫆̸","&ntgl;":"≹","&ntilde":"ñ","&ntilde;":"ñ","&ntlg;":"≸","&ntriangleleft;":"⋪","&ntrianglelefteq;":"⋬","&ntriangleright;":"⋫","&ntrianglerighteq;":"⋭","&nu;":"ν","&num;":"#","&numero;":"№","&numsp;":" ","&nvDash;":"⊭","&nvHarr;":"⤄","&nvap;":"≍⃒","&nvdash;":"⊬","&nvge;":"≥⃒","&nvgt;":">⃒","&nvinfin;":"⧞","&nvlArr;":"⤂","&nvle;":"≤⃒","&nvlt;":"<⃒","&nvltrie;":"⊴⃒","&nvrArr;":"⤃","&nvrtrie;":"⊵⃒","&nvsim;":"∼⃒","&nwArr;":"⇖","&nwarhk;":"⤣","&nwarr;":"↖","&nwarrow;":"↖","&nwnear;":"⤧","&oS;":"Ⓢ","&oacute":"ó","&oacute;":"ó","&oast;":"⊛","&ocir;":"⊚","&ocirc":"ô","&ocirc;":"ô","&ocy;":"о","&odash;":"⊝","&odblac;":"ő","&odiv;":"⨸","&odot;":"⊙","&odsold;":"⦼","&oelig;":"œ","&ofcir;":"⦿","&ofr;":"𝔬","&ogon;":"˛","&ograve":"ò","&ograve;":"ò","&ogt;":"⧁","&ohbar;":"⦵","&ohm;":"Ω","&oint;":"∮","&olarr;":"↺","&olcir;":"⦾","&olcross;":"⦻","&oline;":"‾","&olt;":"⧀","&omacr;":"ō","&omega;":"ω","&omicron;":"ο","&omid;":"⦶","&ominus;":"⊖","&oopf;":"𝕠","&opar;":"⦷","&operp;":"⦹","&oplus;":"⊕","&or;":"∨","&orarr;":"↻","&ord;":"⩝","&order;":"ℴ","&orderof;":"ℴ","&ordf":"ª","&ordf;":"ª","&ordm":"º","&ordm;":"º","&origof;":"⊶","&oror;":"⩖","&orslope;":"⩗","&orv;":"⩛","&oscr;":"ℴ","&oslash":"ø","&oslash;":"ø","&osol;":"⊘","&otilde":"õ","&otilde;":"õ","&otimes;":"⊗","&otimesas;":"⨶","&ouml":"ö","&ouml;":"ö","&ovbar;":"⌽","&par;":"∥","&para":"¶","&para;":"¶","&parallel;":"∥","&parsim;":"⫳","&parsl;":"⫽","&part;":"∂","&pcy;":"п","&percnt;":"%","&period;":".","&permil;":"‰","&perp;":"⊥","&pertenk;":"‱","&pfr;":"𝔭","&phi;":"φ","&phiv;":"ϕ","&phmmat;":"ℳ","&phone;":"☎","&pi;":"π","&pitchfork;":"⋔","&piv;":"ϖ","&planck;":"ℏ","&planckh;":"ℎ","&plankv;":"ℏ","&plus;":"+","&plusacir;":"⨣","&plusb;":"⊞","&pluscir;":"⨢","&plusdo;":"∔","&plusdu;":"⨥","&pluse;":"⩲","&plusmn":"±","&plusmn;":"±","&plussim;":"⨦","&plustwo;":"⨧","&pm;":"±","&pointint;":"⨕","&popf;":"𝕡","&pound":"£","&pound;":"£","&pr;":"≺","&prE;":"⪳","&prap;":"⪷","&prcue;":"≼","&pre;":"⪯","&prec;":"≺","&precapprox;":"⪷","&preccurlyeq;":"≼","&preceq;":"⪯","&precnapprox;":"⪹","&precneqq;":"⪵","&precnsim;":"⋨","&precsim;":"≾","&prime;":"′","&primes;":"ℙ","&prnE;":"⪵","&prnap;":"⪹","&prnsim;":"⋨","&prod;":"∏","&profalar;":"⌮","&profline;":"⌒","&profsurf;":"⌓","&prop;":"∝","&propto;":"∝","&prsim;":"≾","&prurel;":"⊰","&pscr;":"𝓅","&psi;":"ψ","&puncsp;":" ","&qfr;":"𝔮","&qint;":"⨌","&qopf;":"𝕢","&qprime;":"⁗","&qscr;":"𝓆","&quaternions;":"ℍ","&quatint;":"⨖","&quest;":"?","&questeq;":"≟","&quot":'"',"&quot;":'"',"&rAarr;":"⇛","&rArr;":"⇒","&rAtail;":"⤜","&rBarr;":"⤏","&rHar;":"⥤","&race;":"∽̱","&racute;":"ŕ","&radic;":"√","&raemptyv;":"⦳","&rang;":"⟩","&rangd;":"⦒","&range;":"⦥","&rangle;":"⟩","&raquo":"»","&raquo;":"»","&rarr;":"→","&rarrap;":"⥵","&rarrb;":"⇥","&rarrbfs;":"⤠","&rarrc;":"⤳","&rarrfs;":"⤞","&rarrhk;":"↪","&rarrlp;":"↬","&rarrpl;":"⥅","&rarrsim;":"⥴","&rarrtl;":"↣","&rarrw;":"↝","&ratail;":"⤚","&ratio;":"∶","&rationals;":"ℚ","&rbarr;":"⤍","&rbbrk;":"❳","&rbrace;":"}","&rbrack;":"]","&rbrke;":"⦌","&rbrksld;":"⦎","&rbrkslu;":"⦐","&rcaron;":"ř","&rcedil;":"ŗ","&rceil;":"⌉","&rcub;":"}","&rcy;":"р","&rdca;":"⤷","&rdldhar;":"⥩","&rdquo;":"”","&rdquor;":"”","&rdsh;":"↳","&real;":"ℜ","&realine;":"ℛ","&realpart;":"ℜ","&reals;":"ℝ","&rect;":"▭","&reg":"®","&reg;":"®","&rfisht;":"⥽","&rfloor;":"⌋","&rfr;":"𝔯","&rhard;":"⇁","&rharu;":"⇀","&rharul;":"⥬","&rho;":"ρ","&rhov;":"ϱ","&rightarrow;":"→","&rightarrowtail;":"↣","&rightharpoondown;":"⇁","&rightharpoonup;":"⇀","&rightleftarrows;":"⇄","&rightleftharpoons;":"⇌","&rightrightarrows;":"⇉","&rightsquigarrow;":"↝","&rightthreetimes;":"⋌","&ring;":"˚","&risingdotseq;":"≓","&rlarr;":"⇄","&rlhar;":"⇌","&rlm;":"‏","&rmoust;":"⎱","&rmoustache;":"⎱","&rnmid;":"⫮","&roang;":"⟭","&roarr;":"⇾","&robrk;":"⟧","&ropar;":"⦆","&ropf;":"𝕣","&roplus;":"⨮","&rotimes;":"⨵","&rpar;":")","&rpargt;":"⦔","&rppolint;":"⨒","&rrarr;":"⇉","&rsaquo;":"›","&rscr;":"𝓇","&rsh;":"↱","&rsqb;":"]","&rsquo;":"’","&rsquor;":"’","&rthree;":"⋌","&rtimes;":"⋊","&rtri;":"▹","&rtrie;":"⊵","&rtrif;":"▸","&rtriltri;":"⧎","&ruluhar;":"⥨","&rx;":"℞","&sacute;":"ś","&sbquo;":"‚","&sc;":"≻","&scE;":"⪴","&scap;":"⪸","&scaron;":"š","&sccue;":"≽","&sce;":"⪰","&scedil;":"ş","&scirc;":"ŝ","&scnE;":"⪶","&scnap;":"⪺","&scnsim;":"⋩","&scpolint;":"⨓","&scsim;":"≿","&scy;":"с","&sdot;":"⋅","&sdotb;":"⊡","&sdote;":"⩦","&seArr;":"⇘","&searhk;":"⤥","&searr;":"↘","&searrow;":"↘","&sect":"§","&sect;":"§","&semi;":";","&seswar;":"⤩","&setminus;":"∖","&setmn;":"∖","&sext;":"✶","&sfr;":"𝔰","&sfrown;":"⌢","&sharp;":"♯","&shchcy;":"щ","&shcy;":"ш","&shortmid;":"∣","&shortparallel;":"∥","&shy":"­","&shy;":"­","&sigma;":"σ","&sigmaf;":"ς","&sigmav;":"ς","&sim;":"∼","&simdot;":"⩪","&sime;":"≃","&simeq;":"≃","&simg;":"⪞","&simgE;":"⪠","&siml;":"⪝","&simlE;":"⪟","&simne;":"≆","&simplus;":"⨤","&simrarr;":"⥲","&slarr;":"←","&smallsetminus;":"∖","&smashp;":"⨳","&smeparsl;":"⧤","&smid;":"∣","&smile;":"⌣","&smt;":"⪪","&smte;":"⪬","&smtes;":"⪬︀","&softcy;":"ь","&sol;":"/","&solb;":"⧄","&solbar;":"⌿","&sopf;":"𝕤","&spades;":"♠","&spadesuit;":"♠","&spar;":"∥","&sqcap;":"⊓","&sqcaps;":"⊓︀","&sqcup;":"⊔","&sqcups;":"⊔︀","&sqsub;":"⊏","&sqsube;":"⊑","&sqsubset;":"⊏","&sqsubseteq;":"⊑","&sqsup;":"⊐","&sqsupe;":"⊒","&sqsupset;":"⊐","&sqsupseteq;":"⊒","&squ;":"□","&square;":"□","&squarf;":"▪","&squf;":"▪","&srarr;":"→","&sscr;":"𝓈","&ssetmn;":"∖","&ssmile;":"⌣","&sstarf;":"⋆","&star;":"☆","&starf;":"★","&straightepsilon;":"ϵ","&straightphi;":"ϕ","&strns;":"¯","&sub;":"⊂","&subE;":"⫅","&subdot;":"⪽","&sube;":"⊆","&subedot;":"⫃","&submult;":"⫁","&subnE;":"⫋","&subne;":"⊊","&subplus;":"⪿","&subrarr;":"⥹","&subset;":"⊂","&subseteq;":"⊆","&subseteqq;":"⫅","&subsetneq;":"⊊","&subsetneqq;":"⫋","&subsim;":"⫇","&subsub;":"⫕","&subsup;":"⫓","&succ;":"≻","&succapprox;":"⪸","&succcurlyeq;":"≽","&succeq;":"⪰","&succnapprox;":"⪺","&succneqq;":"⪶","&succnsim;":"⋩","&succsim;":"≿","&sum;":"∑","&sung;":"♪","&sup1":"¹","&sup1;":"¹","&sup2":"²","&sup2;":"²","&sup3":"³","&sup3;":"³","&sup;":"⊃","&supE;":"⫆","&supdot;":"⪾","&supdsub;":"⫘","&supe;":"⊇","&supedot;":"⫄","&suphsol;":"⟉","&suphsub;":"⫗","&suplarr;":"⥻","&supmult;":"⫂","&supnE;":"⫌","&supne;":"⊋","&supplus;":"⫀","&supset;":"⊃","&supseteq;":"⊇","&supseteqq;":"⫆","&supsetneq;":"⊋","&supsetneqq;":"⫌","&supsim;":"⫈","&supsub;":"⫔","&supsup;":"⫖","&swArr;":"⇙","&swarhk;":"⤦","&swarr;":"↙","&swarrow;":"↙","&swnwar;":"⤪","&szlig":"ß","&szlig;":"ß","&target;":"⌖","&tau;":"τ","&tbrk;":"⎴","&tcaron;":"ť","&tcedil;":"ţ","&tcy;":"т","&tdot;":"⃛","&telrec;":"⌕","&tfr;":"𝔱","&there4;":"∴","&therefore;":"∴","&theta;":"θ","&thetasym;":"ϑ","&thetav;":"ϑ","&thickapprox;":"≈","&thicksim;":"∼","&thinsp;":" ","&thkap;":"≈","&thksim;":"∼","&thorn":"þ","&thorn;":"þ","&tilde;":"˜","&times":"×","&times;":"×","&timesb;":"⊠","&timesbar;":"⨱","&timesd;":"⨰","&tint;":"∭","&toea;":"⤨","&top;":"⊤","&topbot;":"⌶","&topcir;":"⫱","&topf;":"𝕥","&topfork;":"⫚","&tosa;":"⤩","&tprime;":"‴","&trade;":"™","&triangle;":"▵","&triangledown;":"▿","&triangleleft;":"◃","&trianglelefteq;":"⊴","&triangleq;":"≜","&triangleright;":"▹","&trianglerighteq;":"⊵","&tridot;":"◬","&trie;":"≜","&triminus;":"⨺","&triplus;":"⨹","&trisb;":"⧍","&tritime;":"⨻","&trpezium;":"⏢","&tscr;":"𝓉","&tscy;":"ц","&tshcy;":"ћ","&tstrok;":"ŧ","&twixt;":"≬","&twoheadleftarrow;":"↞","&twoheadrightarrow;":"↠","&uArr;":"⇑","&uHar;":"⥣","&uacute":"ú","&uacute;":"ú","&uarr;":"↑","&ubrcy;":"ў","&ubreve;":"ŭ","&ucirc":"û","&ucirc;":"û","&ucy;":"у","&udarr;":"⇅","&udblac;":"ű","&udhar;":"⥮","&ufisht;":"⥾","&ufr;":"𝔲","&ugrave":"ù","&ugrave;":"ù","&uharl;":"↿","&uharr;":"↾","&uhblk;":"▀","&ulcorn;":"⌜","&ulcorner;":"⌜","&ulcrop;":"⌏","&ultri;":"◸","&umacr;":"ū","&uml":"¨","&uml;":"¨","&uogon;":"ų","&uopf;":"𝕦","&uparrow;":"↑","&updownarrow;":"↕","&upharpoonleft;":"↿","&upharpoonright;":"↾","&uplus;":"⊎","&upsi;":"υ","&upsih;":"ϒ","&upsilon;":"υ","&upuparrows;":"⇈","&urcorn;":"⌝","&urcorner;":"⌝","&urcrop;":"⌎","&uring;":"ů","&urtri;":"◹","&uscr;":"𝓊","&utdot;":"⋰","&utilde;":"ũ","&utri;":"▵","&utrif;":"▴","&uuarr;":"⇈","&uuml":"ü","&uuml;":"ü","&uwangle;":"⦧","&vArr;":"⇕","&vBar;":"⫨","&vBarv;":"⫩","&vDash;":"⊨","&vangrt;":"⦜","&varepsilon;":"ϵ","&varkappa;":"ϰ","&varnothing;":"∅","&varphi;":"ϕ","&varpi;":"ϖ","&varpropto;":"∝","&varr;":"↕","&varrho;":"ϱ","&varsigma;":"ς","&varsubsetneq;":"⊊︀","&varsubsetneqq;":"⫋︀","&varsupsetneq;":"⊋︀","&varsupsetneqq;":"⫌︀","&vartheta;":"ϑ","&vartriangleleft;":"⊲","&vartriangleright;":"⊳","&vcy;":"в","&vdash;":"⊢","&vee;":"∨","&veebar;":"⊻","&veeeq;":"≚","&vellip;":"⋮","&verbar;":"|","&vert;":"|","&vfr;":"𝔳","&vltri;":"⊲","&vnsub;":"⊂⃒","&vnsup;":"⊃⃒","&vopf;":"𝕧","&vprop;":"∝","&vrtri;":"⊳","&vscr;":"𝓋","&vsubnE;":"⫋︀","&vsubne;":"⊊︀","&vsupnE;":"⫌︀","&vsupne;":"⊋︀","&vzigzag;":"⦚","&wcirc;":"ŵ","&wedbar;":"⩟","&wedge;":"∧","&wedgeq;":"≙","&weierp;":"℘","&wfr;":"𝔴","&wopf;":"𝕨","&wp;":"℘","&wr;":"≀","&wreath;":"≀","&wscr;":"𝓌","&xcap;":"⋂","&xcirc;":"◯","&xcup;":"⋃","&xdtri;":"▽","&xfr;":"𝔵","&xhArr;":"⟺","&xharr;":"⟷","&xi;":"ξ","&xlArr;":"⟸","&xlarr;":"⟵","&xmap;":"⟼","&xnis;":"⋻","&xodot;":"⨀","&xopf;":"𝕩","&xoplus;":"⨁","&xotime;":"⨂","&xrArr;":"⟹","&xrarr;":"⟶","&xscr;":"𝓍","&xsqcup;":"⨆","&xuplus;":"⨄","&xutri;":"△","&xvee;":"⋁","&xwedge;":"⋀","&yacute":"ý","&yacute;":"ý","&yacy;":"я","&ycirc;":"ŷ","&ycy;":"ы","&yen":"¥","&yen;":"¥","&yfr;":"𝔶","&yicy;":"ї","&yopf;":"𝕪","&yscr;":"𝓎","&yucy;":"ю","&yuml":"ÿ","&yuml;":"ÿ","&zacute;":"ź","&zcaron;":"ž","&zcy;":"з","&zdot;":"ż","&zeetrf;":"ℨ","&zeta;":"ζ","&zfr;":"𝔷","&zhcy;":"ж","&zigrarr;":"⇝","&zopf;":"𝕫","&zscr;":"𝓏","&zwj;":"‍","&zwnj;":"‌"};function _u(r){return r.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi,(e,t)=>{if(typeof to[e]=="string")return to[e];if(t.charAt(0)!=="#"||e.charAt(e.length-1)!==";")return e;let n;t.charAt(1)==="x"?n=parseInt(t.substr(2),16):n=parseInt(t.substr(1),10);var s="";return n>=55296&&n<=57343||n>1114111?"�":(n>65535&&(n-=65536,s+=String.fromCharCode(n>>>10&1023|55296),n=56320|n&1023),s+=String.fromCharCode(n),s)})}function dr(r){return r.trim().replace(/[<>"'?&]/g,e=>{let t=e.charCodeAt(0).toString(16);return t.length<2&&(t="0"+t),"&#x"+t.toUpperCase()+";"})}function vu(r){return"<div>"+dr(r).replace(/\n/g,"<br />")+"</div>"}function Cu(r){return r=r.replace(/\r?\n/g,"").replace(/<\!\-\-.*?\-\->/gi," ").replace(/<br\b[^>]*>/gi,`
7
7
  `).replace(/<\/?(p|div|table|tr|td|th)\b[^>]*>/gi,`
8
8
 
@@ -24,8 +24,8 @@ ${s}
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
25
  `&&(e=" "),(e.charCodeAt(0)>=33||[" "," "].includes(e))&&(this.node.value+=e),this.escaped=!1}}const Su=50;function nn(r,e){e=e||{};let t=e._depth||0;if(t>Su)return[];let s=new Eu(r).tokenize(),i=[],o=[],a=[];if(s.forEach(l=>{l.type==="operator"&&(l.value===","||l.value===";")?(o.length&&i.push(o),o=[]):o.push(l)}),o.length&&i.push(o),i.forEach(l=>{l=Du(l,t),l.length&&(a=a.concat(l))}),e.flatten){let l=[],u=c=>{c.forEach(d=>{if(d.group)return u(d.group);l.push(d)})};return u(a),l}return a}function Au(r){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(r),s=n.byteLength,i=s%3,o=s-i,a,l,u,c,d,f=0;f<o;f=f+3)d=n[f]<<16|n[f+1]<<8|n[f+2],a=(d&16515072)>>18,l=(d&258048)>>12,u=(d&4032)>>6,c=d&63,e+=t[a]+t[l]+t[u]+t[c];return i==1?(d=n[o],a=(d&252)>>2,l=(d&3)<<4,e+=t[a]+t[l]+"=="):i==2&&(d=n[o]<<8|n[o+1],a=(d&64512)>>10,l=(d&1008)>>4,u=(d&15)<<2,e+=t[a]+t[l]+t[u]+"="),e}const ku=256,Tu=2*1024*1024;class Un{static parse(e,t){return new Un(t).parse(e)}constructor(e){this.options=e||{},this.mimeOptions={maxNestingDepth:this.options.maxNestingDepth||ku,maxHeadersSize:this.options.maxHeadersSize||Tu},this.root=this.currentNode=new eo({postalMime:this,...this.mimeOptions}),this.boundaries=[],this.textContent={},this.attachments=[],this.attachmentEncoding=(this.options.attachmentEncoding||"").toString().replace(/[-_\s]/g,"").trim().toLowerCase()||"arraybuffer",this.started=!1}async finalize(){await this.root.finalize()}async processLine(e,t){let n=this.boundaries;if(n.length&&e.length>2&&e[0]===45&&e[1]===45)for(let s=n.length-1;s>=0;s--){let i=n[s];if(e.length!==i.value.length+2&&e.length!==i.value.length+4)continue;let o=e.length===i.value.length+4;if(o&&(e[e.length-2]!==45||e[e.length-1]!==45))continue;let a=!0;for(let l=0;l<i.value.length;l++)if(e[l+2]!==i.value[l]){a=!1;break}if(a)return o?(await i.node.finalize(),this.currentNode=i.node.parentNode||this.root):(await i.node.finalizeChildNodes(),this.currentNode=new eo({postalMime:this,parentNode:i.node,...this.mimeOptions})),t?this.finalize():void 0}if(this.currentNode.feed(e),t)return this.finalize()}readLine(){let e=this.readPos,t=this.readPos,n=()=>({bytes:new Uint8Array(this.buf,e,t-e),done:this.readPos>=this.av.length});for(;this.readPos<this.av.length;){const s=this.av[this.readPos++];if(s!==13&&s!==10&&(t=this.readPos),s===10)return n()}return n()}async processNodeTree(){let e={},t=new Set,n=this.textMap=new Map,s=this.forceRfc822Attachments(),i=async(o,a,l)=>{if(a=a||!1,l=l||!1,o.contentType.multipart)o.contentType.multipart==="alternative"?a=o:o.contentType.multipart==="related"&&(l=o);else if(this.isInlineMessageRfc822(o)&&!s){const u=new Un;o.subMessage=await u.parse(o.content),n.has(o)||n.set(o,{});let c=n.get(o);(o.subMessage.text||!o.subMessage.html)&&(c.plain=c.plain||[],c.plain.push({type:"subMessage",value:o.subMessage}),t.add("plain")),o.subMessage.html&&(c.html=c.html||[],c.html.push({type:"subMessage",value:o.subMessage}),t.add("html")),u.textMap&&u.textMap.forEach((d,f)=>{n.set(f,d)});for(let d of o.subMessage.attachments||[])this.attachments.push(d)}else if(this.isInlineTextNode(o)){let u=o.contentType.parsed.value.substr(o.contentType.parsed.value.indexOf("/")+1),c=a||o;n.has(c)||n.set(c,{});let d=n.get(c);d[u]=d[u]||[],d[u].push({type:"text",value:o.getTextContent()}),t.add(u)}else if(o.content){const u=o.contentDisposition.parsed.params.filename||o.contentType.parsed.params.name||null,c={filename:u?rn(u):null,mimeType:o.contentType.parsed.value,disposition:o.contentDisposition.parsed.value||null};switch(l&&o.contentId&&(c.related=!0),o.contentDescription&&(c.description=o.contentDescription),o.contentId&&(c.contentId=o.contentId),o.contentType.parsed.value){case"text/calendar":case"application/ics":{o.contentType.parsed.params.method&&(c.method=o.contentType.parsed.params.method.toString().toUpperCase().trim());const d=o.getTextContent().replace(/\r?\n/g,`
26
26
  `).replace(/\n*$/,`
27
- `);c.content=Pr.encode(d);break}default:c.content=o.content}this.attachments.push(c)}for(let u of o.childNodes)await i(u,a,l)};await i(this.root,!1,[]),n.forEach(o=>{t.forEach(a=>{if(e[a]||(e[a]=[]),o[a])o[a].forEach(l=>{switch(l.type){case"text":e[a].push(l.value);break;case"subMessage":switch(a){case"html":e[a].push(no(l.value));break;case"plain":e[a].push(ro(l.value));break}break}});else{let l;switch(a){case"html":l="plain";break;case"plain":l="html";break}(o[l]||[]).forEach(u=>{switch(u.type){case"text":switch(a){case"html":e[a].push(vu(u.value));break;case"plain":e[a].push(Cu(u.value));break}break;case"subMessage":switch(a){case"html":e[a].push(no(u.value));break;case"plain":e[a].push(ro(u.value));break}break}})}})}),Object.keys(e).forEach(o=>{e[o]=e[o].join(`
28
- `)}),this.textContent=e}isInlineTextNode(e){if(e.contentDisposition.parsed.value==="attachment")return!1;switch(e.contentType.parsed.value){case"text/html":case"text/plain":return!0;case"text/calendar":case"text/csv":default:return!1}}isInlineMessageRfc822(e){return e.contentType.parsed.value!=="message/rfc822"?!1:(e.contentDisposition.parsed.value||(this.options.rfc822Attachments?"attachment":"inline"))==="inline"}forceRfc822Attachments(){if(this.options.forceRfc822Attachments)return!0;let e=!1,t=n=>{n.contentType.multipart||["message/delivery-status","message/feedback-report"].includes(n.contentType.parsed.value)&&(e=!0);for(let s of n.childNodes)t(s)};return t(this.root),e}async resolveStream(e){let t=0,n=[];const s=e.getReader();for(;;){const{done:a,value:l}=await s.read();if(a)break;n.push(l),t+=l.length}const i=new Uint8Array(t);let o=0;for(let a of n)i.set(a,o),o+=a.length;return i}async parse(e){var s,i;if(this.started)throw new Error("Can not reuse parser, create a new PostalMime object");for(this.started=!0,e&&typeof e.getReader=="function"&&(e=await this.resolveStream(e)),e=e||new ArrayBuffer(0),typeof e=="string"&&(e=Pr.encode(e)),(e instanceof Blob||Object.prototype.toString.call(e)==="[object Blob]")&&(e=await ds(e)),e.buffer instanceof ArrayBuffer&&(e=new Uint8Array(e).buffer),this.buf=e,this.av=new Uint8Array(e),this.readPos=0;this.readPos<this.av.length;){const o=this.readLine();await this.processLine(o.bytes,o.done)}await this.processNodeTree();const t={headers:this.root.headers.map(o=>({key:o.key,value:o.value})).reverse()};for(const o of["from","sender"]){const a=this.root.headers.find(l=>l.key===o);if(a&&a.value){const l=nn(a.value);l&&l.length&&(t[o]=l[0])}}for(const o of["delivered-to","return-path"]){const a=this.root.headers.find(l=>l.key===o);if(a&&a.value){const l=nn(a.value);if(l&&l.length&&l[0].address){const u=o.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[u]=l[0].address}}}for(const o of["to","cc","bcc","reply-to"]){const a=this.root.headers.filter(u=>u.key===o);let l=[];if(a.filter(u=>u&&u.value).map(u=>nn(u.value)).forEach(u=>l=l.concat(u||[])),l&&l.length){const u=o.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[u]=l}}for(const o of["subject","message-id","in-reply-to","references"]){const a=this.root.headers.find(l=>l.key===o);if(a&&a.value){const l=o.replace(/\-(.)/g,(u,c)=>c.toUpperCase());t[l]=rn(a.value)}}let n=this.root.headers.find(o=>o.key==="date");if(n){let o=new Date(n.value);!o||o.toString()==="Invalid Date"?o=n.value:o=o.toISOString(),t.date=o}switch((s=this.textContent)!=null&&s.html&&(t.html=this.textContent.html),(i=this.textContent)!=null&&i.plain&&(t.text=this.textContent.plain),t.attachments=this.attachments,this.attachmentEncoding){case"arraybuffer":break;case"base64":for(let a of t.attachments||[])a!=null&&a.content&&(a.content=Au(a.content),a.encoding="base64");break;case"utf8":let o=new TextDecoder("utf8");for(let a of t.attachments||[])a!=null&&a.content&&(a.content=o.decode(a.content),a.encoding="utf8");break;default:throw new Error("Unknwon attachment encoding")}return t}}class vl{constructor(e){_t(this,"config");if(!e.system_id)throw new Error("MailClient: system_id is REQUIRED");this.config=e}async callCoprocessor(e,t,n={}){const s={coprocessor:e,method:t,system_id:this.config.system_id,params:{user_id:this.config.system_id,...n}};try{const i=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(s)});if(!i.ok){const a=await i.text();throw new Error(`API error (${i.status}): ${a}`)}const o=await i.json();if(!o.success&&o.error)throw new Error(o.error);return o.result}catch(i){throw console.error("API call failed:",i),i}}async callMail(e,t={}){return this.callCoprocessor("mail",e,t)}async callEmail(e,t={}){return this.callCoprocessor("email",e,t)}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getSettings(){try{return await this.callMail("get_email_settings")||{accounts:[]}}catch{return{accounts:[]}}}async saveSettings(e){await this.callMail("save_email_settings",{accounts:e})}async listEmails(e,t=150,n){return this.callMail("list_emails",{account_id:e,limit:t,folder:n})}async deleteEmails(e,t,n=!0){return this.callMail("delete_emails",{account_id:e,uids:t,expunge:n})}async imapExec(e,t){return this.callMail("imap_exec",{account_id:e,commands:t})}async trashEmails(e,t,n="INBOX"){const s=["[Gmail]/Trash","[Gmail]/Corbeille","[Gmail]/Bin","Trash"];for(const i of s){const o=[`SELECT "${n}"`,...t.map(u=>`UID MOVE ${u} "${i}"`)],l=(await this.imapExec(e,o)).responses.filter(u=>u.ok&&u.command==="UID MOVE").length;if(l>0)return{success:!0,moved:l}}return{success:!1,moved:0}}async archiveEmails(e,t,n="INBOX"){const s=[`SELECT "${n}"`,...t.map(a=>`UID STORE ${a} +FLAGS (\\Deleted)`),"EXPUNGE"],o=(await this.imapExec(e,s)).responses.filter(a=>a.ok&&a.command==="UID STORE").length;return{success:o>0,archived:o}}async listFolders(e){const n=(await this.imapExec(e,['LIST "" *'])).responses.find(s=>s.command==="LIST");return n!=null&&n.ok&&n.folders?{success:!0,folders:n.folders}:{success:!1,folders:[]}}async listEmailsSorted(e,t="INBOX",n=150){const s=await this.imapExec(e,[`SELECT ${t}`,"FETCH 1:* (UID INTERNALDATE)"]),i=s.responses.find(h=>h.command==="SELECT");if(!(i!=null&&i.ok))throw new Error(`Failed to select folder: ${(i==null?void 0:i.error)||"Unknown error"}`);const o=s.responses.find(h=>h.command==="FETCH");if(!(o!=null&&o.ok)||!o.messages)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:i.exists||0},messages:[]};const l=[...o.messages].sort((h,p)=>{const m=h.internalDate?new Date(h.internalDate).getTime():0;return(p.internalDate?new Date(p.internalDate).getTime():0)-m}).slice(0,n).map(h=>h.uid).filter(Boolean);if(l.length===0)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:i.exists||0},messages:[]};const c=(await this.imapExec(e,[`SELECT ${t}`,`UID FETCH ${l.join(",")} (UID FLAGS ENVELOPE)`])).responses.find(h=>h.command==="UID FETCH");if(!(c!=null&&c.ok)||!c.messages)throw new Error(`Failed to fetch details: ${(c==null?void 0:c.error)||"Unknown error"}`);const d=new Map;for(const h of c.messages)h.uid&&d.set(h.uid,h);const f=l.map(h=>{var E,C,A,b,v;const p=d.get(h);if(!p)return null;const m=((E=p.flags)==null?void 0:E.some(S=>S.includes("Seen")))||!1,y=((A=(C=p.envelope)==null?void 0:C.from)==null?void 0:A.email)||"Unknown",D=((b=p.envelope)==null?void 0:b.subject)||"(No subject)",x=((v=p.envelope)==null?void 0:v.date)||"";return{uid:h,from:y,subject:D,date:x,seen:m}}).filter(Boolean);return{account:{id:e,label:"",email:""},mailbox:{name:t,total:i.exists||0},messages:f}}async getEmail(e,t,n="INBOX"){return this.callMail("get_email",{account_id:e,uid:t,folder:n})}async getAttachment(e,t,n,s="INBOX"){return this.callMail("get_attachment",{account_id:e,uid:t,attachment_index:n,folder:s})}async searchContactEmails(e,t,n=50){return this.callMail("search_contact_emails",{account_id:e,contact_email:t,limit:n})}async getEmailParsed(e,t,n="INBOX"){var p,m,y,D,x,E;const i=(await this.imapExec(e,[`SELECT "${n}"`,`UID FETCH ${t} (FLAGS BODY[])`])).responses.find(C=>C.command==="UID FETCH");if(!(i!=null&&i.ok)||!((p=i.messages)!=null&&p[0]))return console.error("Failed to fetch raw email:",i==null?void 0:i.error),null;const o=i.messages[0],a=o.body||o.raw;if(!a)return console.error("No raw email content in response"),null;const u=await new Un().parse(a);console.log("[MailClient] Parsed email - attachments count:",((m=u.attachments)==null?void 0:m.length)||0),console.log("[MailClient] Parsed attachments:",(y=u.attachments)==null?void 0:y.map(C=>({filename:C.filename,mimeType:C.mimeType,contentId:C.contentId})));const c=new Map;for(const C of u.attachments||[])if(C.contentId){const A=this.contentToBase64(C.content),b=`data:${C.mimeType};base64,${A}`,v=C.contentId.replace(/^<|>$/g,"");c.set(v,b),c.set(`<${v}>`,b)}let d=u.html||"";d&&c.size>0&&(d=d.replace(/src=["']cid:([^"']+)["']/gi,(C,A)=>{const b=c.get(A)||c.get(`<${A}>`);return b?`src="${b}"`:C}));const f=((D=o.flags)==null?void 0:D.some(C=>C.toLowerCase().includes("seen")))||!1,h=((x=u.from)==null?void 0:x.address)||((E=u.from)==null?void 0:E.name)||"Unknown";return{uid:t,from:h,subject:u.subject||"(No subject)",date:u.date||"",body:d||u.text||"",html:d,text:u.text||"",seen:f,attachments:(u.attachments||[]).map(C=>({filename:C.filename||"attachment",mimeType:C.mimeType||"application/octet-stream",size:this.getContentSize(C.content)}))}}contentToBase64(e){if(typeof e=="string")try{return btoa(e)}catch{return e}const t=e instanceof Uint8Array?e:new Uint8Array(e);let n="";for(let s=0;s<t.byteLength;s++)n+=String.fromCharCode(t[s]);return btoa(n)}getContentSize(e){return e?typeof e=="string"?e.length:(e instanceof Uint8Array,e.byteLength):0}async sendMail(e){const t={to:e.to,subject:e.subject,body:e.body};return e.html&&(t.html=e.html),e.from&&(t.from=e.from),e.smtpConfig&&(t.smtp_config=e.smtpConfig),this.callEmail("send",t)}async sendEmail(e,t){var n,s;try{const i=await this.getSettings(),o=((n=i.accounts)==null?void 0:n.find(u=>u.id===e))||((s=i.accounts)==null?void 0:s[0]);if(!(o!=null&&o.smtp))return{success:!1,error:"No SMTP configuration found for account"};const a={to:Array.isArray(t.to)?t.to:[t.to],subject:t.subject,body:t.text||"",html:t.html,from:o.email,smtp_config:{host:o.smtp.host,port:parseInt(o.smtp.port,10)||587,username:o.smtp.user,password:o.smtp.password}};t.in_reply_to&&(a.in_reply_to=t.in_reply_to),t.attachments&&t.attachments.length>0&&(a.attachments=t.attachments);const l=await this.callEmail("send",a);return{success:(l==null?void 0:l.sent)??!1,message_id:l==null?void 0:l.message_id,error:l==null?void 0:l.error}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}}const Rs="qwanyx_auth_token",Ls="qwanyx_refresh_token";class Cl{static setToken(e){typeof window<"u"&&localStorage.setItem(Rs,e)}static getToken(){return typeof window<"u"?localStorage.getItem(Rs):null}static clearToken(){typeof window<"u"&&(localStorage.removeItem(Rs),localStorage.removeItem(Ls))}static setRefreshToken(e){typeof window<"u"&&localStorage.setItem(Ls,e)}static getRefreshToken(){return typeof window<"u"?localStorage.getItem(Ls):null}static isAuthenticated(){return!!this.getToken()}static getAuthHeader(){const e=this.getToken();return e?{Authorization:`Bearer ${e}`}:{}}}class wl{constructor(e){_t(this,"config");this.config={timeout:3e4,headers:{"Content-Type":"application/json"},...e}}buildQueryString(e){if(!e||Object.keys(e).length===0)return"";const t=new URLSearchParams;Object.entries(e).forEach(([s,i])=>{i!=null&&t.append(s,String(i))});const n=t.toString();return n?`?${n}`:""}async request(e,t={}){const{method:n="GET",headers:s={},body:i,params:o}=t,a=`${this.config.baseUrl}/${e}${this.buildQueryString(o)}`,l={...this.config.headers,...Cl.getAuthHeader(),...s},u={method:n,headers:l};i&&n!=="GET"&&(u.body=JSON.stringify(i));try{const c=new AbortController,d=setTimeout(()=>c.abort(),this.config.timeout),f=await fetch(a,{...u,signal:c.signal});if(clearTimeout(d),!f.ok){const h=await f.json().catch(()=>({message:f.statusText}));throw new Error(h.message||`HTTP ${f.status}`)}return await f.json()}catch(c){throw c instanceof Error?c:new Error("An unexpected error occurred")}}async get(e,t){return this.request(e,{method:"GET",params:t})}async post(e,t,n){return this.request(e,{method:"POST",body:t,params:n})}async put(e,t,n){return this.request(e,{method:"PUT",body:t,params:n})}async patch(e,t,n){return this.request(e,{method:"PATCH",body:t,params:n})}async delete(e,t){return this.request(e,{method:"DELETE",params:t})}setBaseUrl(e){this.config.baseUrl=e}getBaseUrl(){return this.config.baseUrl}}let Wn=null;function Nu(r){return Wn=new wl(r),Wn}function xi(){if(!Wn)throw new Error("API client not initialized. Call initializeApiClient() first.");return Wn}function Dl(r,e,t={}){const{enabled:n=!0,refetchOnMount:s=!0,onSuccess:i,onError:o}=t,[a,l]=w.useState(null),[u,c]=w.useState(n),[d,f]=w.useState(null),h=w.useCallback(async()=>{if(n){c(!0),f(null);try{const m=await xi().get(r,e);l(m),i==null||i(m)}catch(p){const m=p instanceof Error?p:new Error("Unknown error");f(m),o==null||o(m)}finally{c(!1)}}},[r,JSON.stringify(e),n,i,o]);return w.useEffect(()=>{s&&h()},[h,s]),{data:a,loading:u,error:d,refetch:h}}function Bu(r,e="POST",t={}){const{onSuccess:n,onError:s}=t,[i,o]=w.useState(null),[a,l]=w.useState(!1),[u,c]=w.useState(null),d=w.useCallback(async h=>{l(!0),c(null);try{const p=xi();let m;switch(e){case"POST":m=await p.post(r,h);break;case"PUT":m=await p.put(r,h);break;case"PATCH":m=await p.patch(r,h);break;case"DELETE":m=await p.delete(r);break;default:throw new Error(`Unsupported method: ${e}`)}return o(m),n==null||n(m,h),m}catch(p){const m=p instanceof Error?p:new Error("Unknown error");return c(m),s==null||s(m,h),null}finally{l(!1)}},[r,e,n,s]),f=w.useCallback(()=>{o(null),c(null),l(!1)},[]);return{data:i,loading:a,error:u,mutate:d,reset:f}}var Ks={exports:{}},Wr={};/**
27
+ `);c.content=Mr.encode(d);break}default:c.content=o.content}this.attachments.push(c)}for(let u of o.childNodes)await i(u,a,l)};await i(this.root,!1,[]),n.forEach(o=>{t.forEach(a=>{if(e[a]||(e[a]=[]),o[a])o[a].forEach(l=>{switch(l.type){case"text":e[a].push(l.value);break;case"subMessage":switch(a){case"html":e[a].push(no(l.value));break;case"plain":e[a].push(ro(l.value));break}break}});else{let l;switch(a){case"html":l="plain";break;case"plain":l="html";break}(o[l]||[]).forEach(u=>{switch(u.type){case"text":switch(a){case"html":e[a].push(vu(u.value));break;case"plain":e[a].push(Cu(u.value));break}break;case"subMessage":switch(a){case"html":e[a].push(no(u.value));break;case"plain":e[a].push(ro(u.value));break}break}})}})}),Object.keys(e).forEach(o=>{e[o]=e[o].join(`
28
+ `)}),this.textContent=e}isInlineTextNode(e){if(e.contentDisposition.parsed.value==="attachment")return!1;switch(e.contentType.parsed.value){case"text/html":case"text/plain":return!0;case"text/calendar":case"text/csv":default:return!1}}isInlineMessageRfc822(e){return e.contentType.parsed.value!=="message/rfc822"?!1:(e.contentDisposition.parsed.value||(this.options.rfc822Attachments?"attachment":"inline"))==="inline"}forceRfc822Attachments(){if(this.options.forceRfc822Attachments)return!0;let e=!1,t=n=>{n.contentType.multipart||["message/delivery-status","message/feedback-report"].includes(n.contentType.parsed.value)&&(e=!0);for(let s of n.childNodes)t(s)};return t(this.root),e}async resolveStream(e){let t=0,n=[];const s=e.getReader();for(;;){const{done:a,value:l}=await s.read();if(a)break;n.push(l),t+=l.length}const i=new Uint8Array(t);let o=0;for(let a of n)i.set(a,o),o+=a.length;return i}async parse(e){var s,i;if(this.started)throw new Error("Can not reuse parser, create a new PostalMime object");for(this.started=!0,e&&typeof e.getReader=="function"&&(e=await this.resolveStream(e)),e=e||new ArrayBuffer(0),typeof e=="string"&&(e=Mr.encode(e)),(e instanceof Blob||Object.prototype.toString.call(e)==="[object Blob]")&&(e=await ds(e)),e.buffer instanceof ArrayBuffer&&(e=new Uint8Array(e).buffer),this.buf=e,this.av=new Uint8Array(e),this.readPos=0;this.readPos<this.av.length;){const o=this.readLine();await this.processLine(o.bytes,o.done)}await this.processNodeTree();const t={headers:this.root.headers.map(o=>({key:o.key,value:o.value})).reverse()};for(const o of["from","sender"]){const a=this.root.headers.find(l=>l.key===o);if(a&&a.value){const l=nn(a.value);l&&l.length&&(t[o]=l[0])}}for(const o of["delivered-to","return-path"]){const a=this.root.headers.find(l=>l.key===o);if(a&&a.value){const l=nn(a.value);if(l&&l.length&&l[0].address){const u=o.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[u]=l[0].address}}}for(const o of["to","cc","bcc","reply-to"]){const a=this.root.headers.filter(u=>u.key===o);let l=[];if(a.filter(u=>u&&u.value).map(u=>nn(u.value)).forEach(u=>l=l.concat(u||[])),l&&l.length){const u=o.replace(/\-(.)/g,(c,d)=>d.toUpperCase());t[u]=l}}for(const o of["subject","message-id","in-reply-to","references"]){const a=this.root.headers.find(l=>l.key===o);if(a&&a.value){const l=o.replace(/\-(.)/g,(u,c)=>c.toUpperCase());t[l]=rn(a.value)}}let n=this.root.headers.find(o=>o.key==="date");if(n){let o=new Date(n.value);!o||o.toString()==="Invalid Date"?o=n.value:o=o.toISOString(),t.date=o}switch((s=this.textContent)!=null&&s.html&&(t.html=this.textContent.html),(i=this.textContent)!=null&&i.plain&&(t.text=this.textContent.plain),t.attachments=this.attachments,this.attachmentEncoding){case"arraybuffer":break;case"base64":for(let a of t.attachments||[])a!=null&&a.content&&(a.content=Au(a.content),a.encoding="base64");break;case"utf8":let o=new TextDecoder("utf8");for(let a of t.attachments||[])a!=null&&a.content&&(a.content=o.decode(a.content),a.encoding="utf8");break;default:throw new Error("Unknwon attachment encoding")}return t}}class vl{constructor(e){_t(this,"config");if(!e.system_id)throw new Error("MailClient: system_id is REQUIRED");this.config=e}async callCoprocessor(e,t,n={}){const s={coprocessor:e,method:t,system_id:this.config.system_id,params:{user_id:this.config.system_id,...n}};try{const i=await fetch(`${this.config.baseUrl}/spu/invoke`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.getToken()}`},body:JSON.stringify(s)});if(!i.ok){const a=await i.text();throw new Error(`API error (${i.status}): ${a}`)}const o=await i.json();if(!o.success&&o.error)throw new Error(o.error);return o.result}catch(i){throw console.error("API call failed:",i),i}}async callMail(e,t={}){return this.callCoprocessor("mail",e,t)}async callEmail(e,t={}){return this.callCoprocessor("email",e,t)}getToken(){return typeof window<"u"&&window.localStorage&&localStorage.getItem("qwanyx_token")||""}async getSettings(){try{return await this.callMail("get_email_settings")||{accounts:[]}}catch{return{accounts:[]}}}async saveSettings(e){await this.callMail("save_email_settings",{accounts:e})}async listEmails(e,t=150,n){return this.callMail("list_emails",{account_id:e,limit:t,folder:n})}async deleteEmails(e,t,n=!0){return this.callMail("delete_emails",{account_id:e,uids:t,expunge:n})}async imapExec(e,t){return this.callMail("imap_exec",{account_id:e,commands:t})}async trashEmails(e,t,n="INBOX"){const s=["[Gmail]/Trash","[Gmail]/Corbeille","[Gmail]/Bin","Trash"];for(const i of s){const o=[`SELECT "${n}"`,...t.map(u=>`UID MOVE ${u} "${i}"`)],l=(await this.imapExec(e,o)).responses.filter(u=>u.ok&&u.command==="UID MOVE").length;if(l>0)return{success:!0,moved:l}}return{success:!1,moved:0}}async archiveEmails(e,t,n="INBOX"){const s=[`SELECT "${n}"`,...t.map(a=>`UID STORE ${a} +FLAGS (\\Deleted)`),"EXPUNGE"],o=(await this.imapExec(e,s)).responses.filter(a=>a.ok&&a.command==="UID STORE").length;return{success:o>0,archived:o}}async listFolders(e){const n=(await this.imapExec(e,['LIST "" *'])).responses.find(s=>s.command==="LIST");return n!=null&&n.ok&&n.folders?{success:!0,folders:n.folders}:{success:!1,folders:[]}}async listEmailsSorted(e,t="INBOX",n=150){const s=await this.imapExec(e,[`SELECT ${t}`,"FETCH 1:* (UID INTERNALDATE)"]),i=s.responses.find(h=>h.command==="SELECT");if(!(i!=null&&i.ok))throw new Error(`Failed to select folder: ${(i==null?void 0:i.error)||"Unknown error"}`);const o=s.responses.find(h=>h.command==="FETCH");if(!(o!=null&&o.ok)||!o.messages)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:i.exists||0},messages:[]};const l=[...o.messages].sort((h,p)=>{const m=h.internalDate?new Date(h.internalDate).getTime():0;return(p.internalDate?new Date(p.internalDate).getTime():0)-m}).slice(0,n).map(h=>h.uid).filter(Boolean);if(l.length===0)return{account:{id:e,label:"",email:""},mailbox:{name:t,total:i.exists||0},messages:[]};const c=(await this.imapExec(e,[`SELECT ${t}`,`UID FETCH ${l.join(",")} (UID FLAGS ENVELOPE)`])).responses.find(h=>h.command==="UID FETCH");if(!(c!=null&&c.ok)||!c.messages)throw new Error(`Failed to fetch details: ${(c==null?void 0:c.error)||"Unknown error"}`);const d=new Map;for(const h of c.messages)h.uid&&d.set(h.uid,h);const f=l.map(h=>{var E,D,A,b,v;const p=d.get(h);if(!p)return null;const m=((E=p.flags)==null?void 0:E.some(S=>S.includes("Seen")))||!1,y=((A=(D=p.envelope)==null?void 0:D.from)==null?void 0:A.email)||"Unknown",w=((b=p.envelope)==null?void 0:b.subject)||"(No subject)",x=((v=p.envelope)==null?void 0:v.date)||"";return{uid:h,from:y,subject:w,date:x,seen:m}}).filter(Boolean);return{account:{id:e,label:"",email:""},mailbox:{name:t,total:i.exists||0},messages:f}}async getEmail(e,t,n="INBOX"){return this.callMail("get_email",{account_id:e,uid:t,folder:n})}async getAttachment(e,t,n,s="INBOX"){return this.callMail("get_attachment",{account_id:e,uid:t,attachment_index:n,folder:s})}async searchContactEmails(e,t,n=50){return this.callMail("search_contact_emails",{account_id:e,contact_email:t,limit:n})}async getEmailParsed(e,t,n="INBOX"){var p,m,y,w,x,E;const i=(await this.imapExec(e,[`SELECT "${n}"`,`UID FETCH ${t} (FLAGS BODY[])`])).responses.find(D=>D.command==="UID FETCH");if(!(i!=null&&i.ok)||!((p=i.messages)!=null&&p[0]))return console.error("Failed to fetch raw email:",i==null?void 0:i.error),null;const o=i.messages[0],a=o.body||o.raw;if(!a)return console.error("No raw email content in response"),null;const u=await new Un().parse(a);console.log("[MailClient] Parsed email - attachments count:",((m=u.attachments)==null?void 0:m.length)||0),console.log("[MailClient] Parsed attachments:",(y=u.attachments)==null?void 0:y.map(D=>({filename:D.filename,mimeType:D.mimeType,contentId:D.contentId})));const c=new Map;for(const D of u.attachments||[])if(D.contentId){const A=this.contentToBase64(D.content),b=`data:${D.mimeType};base64,${A}`,v=D.contentId.replace(/^<|>$/g,"");c.set(v,b),c.set(`<${v}>`,b)}let d=u.html||"";d&&c.size>0&&(d=d.replace(/src=["']cid:([^"']+)["']/gi,(D,A)=>{const b=c.get(A)||c.get(`<${A}>`);return b?`src="${b}"`:D}));const f=((w=o.flags)==null?void 0:w.some(D=>D.toLowerCase().includes("seen")))||!1,h=((x=u.from)==null?void 0:x.address)||((E=u.from)==null?void 0:E.name)||"Unknown";return{uid:t,from:h,subject:u.subject||"(No subject)",date:u.date||"",body:d||u.text||"",html:d,text:u.text||"",seen:f,attachments:(u.attachments||[]).map(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 i=await this.getSettings(),o=((n=i.accounts)==null?void 0:n.find(u=>u.id===e))||((s=i.accounts)==null?void 0:s[0]);if(!(o!=null&&o.smtp))return{success:!1,error:"No SMTP configuration found for account"};const a={to:Array.isArray(t.to)?t.to:[t.to],subject:t.subject,body:t.text||"",html:t.html,from:o.email,smtp_config:{host:o.smtp.host,port:parseInt(o.smtp.port,10)||587,username:o.smtp.user,password:o.smtp.password}};t.in_reply_to&&(a.in_reply_to=t.in_reply_to),t.attachments&&t.attachments.length>0&&(a.attachments=t.attachments);const l=await this.callEmail("send",a);return{success:(l==null?void 0:l.sent)??!1,message_id:l==null?void 0:l.message_id,error:l==null?void 0:l.error}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}}const Rs="qwanyx_auth_token",Ls="qwanyx_refresh_token";class Cl{static setToken(e){typeof window<"u"&&localStorage.setItem(Rs,e)}static getToken(){return typeof window<"u"?localStorage.getItem(Rs):null}static clearToken(){typeof window<"u"&&(localStorage.removeItem(Rs),localStorage.removeItem(Ls))}static setRefreshToken(e){typeof window<"u"&&localStorage.setItem(Ls,e)}static getRefreshToken(){return typeof window<"u"?localStorage.getItem(Ls):null}static isAuthenticated(){return!!this.getToken()}static getAuthHeader(){const e=this.getToken();return e?{Authorization:`Bearer ${e}`}:{}}}class wl{constructor(e){_t(this,"config");this.config={timeout:3e4,headers:{"Content-Type":"application/json"},...e}}buildQueryString(e){if(!e||Object.keys(e).length===0)return"";const t=new URLSearchParams;Object.entries(e).forEach(([s,i])=>{i!=null&&t.append(s,String(i))});const n=t.toString();return n?`?${n}`:""}async request(e,t={}){const{method:n="GET",headers:s={},body:i,params:o}=t,a=`${this.config.baseUrl}/${e}${this.buildQueryString(o)}`,l={...this.config.headers,...Cl.getAuthHeader(),...s},u={method:n,headers:l};i&&n!=="GET"&&(u.body=JSON.stringify(i));try{const c=new AbortController,d=setTimeout(()=>c.abort(),this.config.timeout),f=await fetch(a,{...u,signal:c.signal});if(clearTimeout(d),!f.ok){const h=await f.json().catch(()=>({message:f.statusText}));throw new Error(h.message||`HTTP ${f.status}`)}return await f.json()}catch(c){throw c instanceof Error?c:new Error("An unexpected error occurred")}}async get(e,t){return this.request(e,{method:"GET",params:t})}async post(e,t,n){return this.request(e,{method:"POST",body:t,params:n})}async put(e,t,n){return this.request(e,{method:"PUT",body:t,params:n})}async patch(e,t,n){return this.request(e,{method:"PATCH",body:t,params:n})}async delete(e,t){return this.request(e,{method:"DELETE",params:t})}setBaseUrl(e){this.config.baseUrl=e}getBaseUrl(){return this.config.baseUrl}}let Wn=null;function Nu(r){return Wn=new wl(r),Wn}function xi(){if(!Wn)throw new Error("API client not initialized. Call initializeApiClient() first.");return Wn}function Dl(r,e,t={}){const{enabled:n=!0,refetchOnMount:s=!0,onSuccess:i,onError:o}=t,[a,l]=C.useState(null),[u,c]=C.useState(n),[d,f]=C.useState(null),h=C.useCallback(async()=>{if(n){c(!0),f(null);try{const m=await xi().get(r,e);l(m),i==null||i(m)}catch(p){const m=p instanceof Error?p:new Error("Unknown error");f(m),o==null||o(m)}finally{c(!1)}}},[r,JSON.stringify(e),n,i,o]);return C.useEffect(()=>{s&&h()},[h,s]),{data:a,loading:u,error:d,refetch:h}}function Bu(r,e="POST",t={}){const{onSuccess:n,onError:s}=t,[i,o]=C.useState(null),[a,l]=C.useState(!1),[u,c]=C.useState(null),d=C.useCallback(async h=>{l(!0),c(null);try{const p=xi();let m;switch(e){case"POST":m=await p.post(r,h);break;case"PUT":m=await p.put(r,h);break;case"PATCH":m=await p.patch(r,h);break;case"DELETE":m=await p.delete(r);break;default:throw new Error(`Unsupported method: ${e}`)}return o(m),n==null||n(m,h),m}catch(p){const m=p instanceof Error?p:new Error("Unknown error");return c(m),s==null||s(m,h),null}finally{l(!1)}},[r,e,n,s]),f=C.useCallback(()=>{o(null),c(null),l(!1)},[]);return{data:i,loading:a,error:u,mutate:d,reset:f}}var Ks={exports:{}},Wr={};/**
29
29
  * @license React
30
30
  * react-jsx-runtime.production.min.js
31
31
  *
@@ -33,7 +33,7 @@ ${s}
33
33
  *
34
34
  * This source code is licensed under the MIT license found in the
35
35
  * LICENSE file in the root directory of this source tree.
36
- */var so;function Fu(){if(so)return Wr;so=1;var r=w,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,u){var c,d={},f=null,h=null;u!==void 0&&(f=""+u),l.key!==void 0&&(f=""+l.key),l.ref!==void 0&&(h=l.ref);for(c in l)n.call(l,c)&&!i.hasOwnProperty(c)&&(d[c]=l[c]);if(a&&a.defaultProps)for(c in l=a.defaultProps,l)d[c]===void 0&&(d[c]=l[c]);return{$$typeof:e,type:a,key:f,ref:h,props:d,_owner:s.current}}return Wr.Fragment=t,Wr.jsx=o,Wr.jsxs=o,Wr}var Gr={};/**
36
+ */var so;function Fu(){if(so)return Wr;so=1;var r=C,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,u){var c,d={},f=null,h=null;u!==void 0&&(f=""+u),l.key!==void 0&&(f=""+l.key),l.ref!==void 0&&(h=l.ref);for(c in l)n.call(l,c)&&!i.hasOwnProperty(c)&&(d[c]=l[c]);if(a&&a.defaultProps)for(c in l=a.defaultProps,l)d[c]===void 0&&(d[c]=l[c]);return{$$typeof:e,type:a,key:f,ref:h,props:d,_owner:s.current}}return Wr.Fragment=t,Wr.jsx=o,Wr.jsxs=o,Wr}var Gr={};/**
37
37
  * @license React
38
38
  * react-jsx-runtime.development.js
39
39
  *
@@ -41,49 +41,49 @@ ${s}
41
41
  *
42
42
  * This source code is licensed under the MIT license found in the
43
43
  * LICENSE file in the root directory of this source tree.
44
- */var io;function Ru(){return io||(io=1,process.env.NODE_ENV!=="production"&&function(){var r=w,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),p=Symbol.iterator,m="@@iterator";function y(_){if(_===null||typeof _!="object")return null;var P=p&&_[p]||_[m];return typeof P=="function"?P:null}var D=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(_){{for(var P=arguments.length,U=new Array(P>1?P-1:0),X=1;X<P;X++)U[X-1]=arguments[X];E("error",_,U)}}function E(_,P,U){{var X=D.ReactDebugCurrentFrame,ue=X.getStackAddendum();ue!==""&&(P+="%s",U=U.concat([ue]));var _e=U.map(function(le){return String(le)});_e.unshift("Warning: "+P),Function.prototype.apply.call(console[_],console,_e)}}var C=!1,A=!1,b=!1,v=!1,S=!1,k;k=Symbol.for("react.module.reference");function j(_){return!!(typeof _=="string"||typeof _=="function"||_===n||_===i||S||_===s||_===u||_===c||v||_===h||C||A||b||typeof _=="object"&&_!==null&&(_.$$typeof===f||_.$$typeof===d||_.$$typeof===o||_.$$typeof===a||_.$$typeof===l||_.$$typeof===k||_.getModuleId!==void 0))}function T(_,P,U){var X=_.displayName;if(X)return X;var ue=P.displayName||P.name||"";return ue!==""?U+"("+ue+")":U}function B(_){return _.displayName||"Context"}function L(_){if(_==null)return null;if(typeof _.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof _=="function")return _.displayName||_.name||null;if(typeof _=="string")return _;switch(_){case n:return"Fragment";case t:return"Portal";case i:return"Profiler";case s:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof _=="object")switch(_.$$typeof){case a:var P=_;return B(P)+".Consumer";case o:var U=_;return B(U._context)+".Provider";case l:return T(_,_.render,"ForwardRef");case d:var X=_.displayName||null;return X!==null?X:L(_.type)||"Memo";case f:{var ue=_,_e=ue._payload,le=ue._init;try{return L(le(_e))}catch{return null}}}return null}var R=Object.assign,M=0,Q,se,xe,oe,Se,he,fe;function pe(){}pe.__reactDisabledLog=!0;function ge(){{if(M===0){Q=console.log,se=console.info,xe=console.warn,oe=console.error,Se=console.group,he=console.groupCollapsed,fe=console.groupEnd;var _={configurable:!0,enumerable:!0,value:pe,writable:!0};Object.defineProperties(console,{info:_,log:_,warn:_,error:_,group:_,groupCollapsed:_,groupEnd:_})}M++}}function Ae(){{if(M--,M===0){var _={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},_,{value:Q}),info:R({},_,{value:se}),warn:R({},_,{value:xe}),error:R({},_,{value:oe}),group:R({},_,{value:Se}),groupCollapsed:R({},_,{value:he}),groupEnd:R({},_,{value:fe})})}M<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var be=D.ReactCurrentDispatcher,we;function Re(_,P,U){{if(we===void 0)try{throw Error()}catch(ue){var X=ue.stack.trim().match(/\n( *(at )?)/);we=X&&X[1]||""}return`
45
- `+we+_}}var ce=!1,je;{var at=typeof WeakMap=="function"?WeakMap:Map;je=new at}function kt(_,P){if(!_||ce)return"";{var U=je.get(_);if(U!==void 0)return U}var X;ce=!0;var ue=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var _e;_e=be.current,be.current=null,ge();try{if(P){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(st){X=st}Reflect.construct(_,[],le)}else{try{le.call()}catch(st){X=st}_.call(le.prototype)}}else{try{throw Error()}catch(st){X=st}_()}}catch(st){if(st&&X&&typeof st.stack=="string"){for(var ae=st.stack.split(`
44
+ */var io;function Ru(){return io||(io=1,process.env.NODE_ENV!=="production"&&function(){var r=C,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),p=Symbol.iterator,m="@@iterator";function y(_){if(_===null||typeof _!="object")return null;var M=p&&_[p]||_[m];return typeof M=="function"?M:null}var w=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(_){{for(var M=arguments.length,U=new Array(M>1?M-1:0),X=1;X<M;X++)U[X-1]=arguments[X];E("error",_,U)}}function E(_,M,U){{var X=w.ReactDebugCurrentFrame,ue=X.getStackAddendum();ue!==""&&(M+="%s",U=U.concat([ue]));var _e=U.map(function(le){return String(le)});_e.unshift("Warning: "+M),Function.prototype.apply.call(console[_],console,_e)}}var D=!1,A=!1,b=!1,v=!1,S=!1,k;k=Symbol.for("react.module.reference");function j(_){return!!(typeof _=="string"||typeof _=="function"||_===n||_===i||S||_===s||_===u||_===c||v||_===h||D||A||b||typeof _=="object"&&_!==null&&(_.$$typeof===f||_.$$typeof===d||_.$$typeof===o||_.$$typeof===a||_.$$typeof===l||_.$$typeof===k||_.getModuleId!==void 0))}function T(_,M,U){var X=_.displayName;if(X)return X;var ue=M.displayName||M.name||"";return ue!==""?U+"("+ue+")":U}function B(_){return _.displayName||"Context"}function L(_){if(_==null)return null;if(typeof _.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof _=="function")return _.displayName||_.name||null;if(typeof _=="string")return _;switch(_){case n:return"Fragment";case t:return"Portal";case i:return"Profiler";case s:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof _=="object")switch(_.$$typeof){case a:var M=_;return B(M)+".Consumer";case o:var U=_;return B(U._context)+".Provider";case l:return T(_,_.render,"ForwardRef");case d:var X=_.displayName||null;return X!==null?X:L(_.type)||"Memo";case f:{var ue=_,_e=ue._payload,le=ue._init;try{return L(le(_e))}catch{return null}}}return null}var R=Object.assign,P=0,Q,se,xe,oe,Se,he,fe;function pe(){}pe.__reactDisabledLog=!0;function ge(){{if(P===0){Q=console.log,se=console.info,xe=console.warn,oe=console.error,Se=console.group,he=console.groupCollapsed,fe=console.groupEnd;var _={configurable:!0,enumerable:!0,value:pe,writable:!0};Object.defineProperties(console,{info:_,log:_,warn:_,error:_,group:_,groupCollapsed:_,groupEnd:_})}P++}}function Ae(){{if(P--,P===0){var _={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},_,{value:Q}),info:R({},_,{value:se}),warn:R({},_,{value:xe}),error:R({},_,{value:oe}),group:R({},_,{value:Se}),groupCollapsed:R({},_,{value:he}),groupEnd:R({},_,{value:fe})})}P<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var be=w.ReactCurrentDispatcher,we;function Re(_,M,U){{if(we===void 0)try{throw Error()}catch(ue){var X=ue.stack.trim().match(/\n( *(at )?)/);we=X&&X[1]||""}return`
45
+ `+we+_}}var ce=!1,je;{var at=typeof WeakMap=="function"?WeakMap:Map;je=new at}function kt(_,M){if(!_||ce)return"";{var U=je.get(_);if(U!==void 0)return U}var X;ce=!0;var ue=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var _e;_e=be.current,be.current=null,ge();try{if(M){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(st){X=st}Reflect.construct(_,[],le)}else{try{le.call()}catch(st){X=st}_.call(le.prototype)}}else{try{throw Error()}catch(st){X=st}_()}}catch(st){if(st&&X&&typeof st.stack=="string"){for(var ae=st.stack.split(`
46
46
  `),Ze=X.stack.split(`
47
47
  `),$e=ae.length-1,qe=Ze.length-1;$e>=1&&qe>=0&&ae[$e]!==Ze[qe];)qe--;for(;$e>=1&&qe>=0;$e--,qe--)if(ae[$e]!==Ze[qe]){if($e!==1||qe!==1)do if($e--,qe--,qe<0||ae[$e]!==Ze[qe]){var pt=`
48
- `+ae[$e].replace(" at new "," at ");return _.displayName&&pt.includes("<anonymous>")&&(pt=pt.replace("<anonymous>",_.displayName)),typeof _=="function"&&je.set(_,pt),pt}while($e>=1&&qe>=0);break}}}finally{ce=!1,be.current=_e,Ae(),Error.prepareStackTrace=ue}var Dr=_?_.displayName||_.name:"",ar=Dr?Re(Dr):"";return typeof _=="function"&&je.set(_,ar),ar}function zt(_,P,U){return kt(_,!1)}function nt(_){var P=_.prototype;return!!(P&&P.isReactComponent)}function mt(_,P,U){if(_==null)return"";if(typeof _=="function")return kt(_,nt(_));if(typeof _=="string")return Re(_);switch(_){case u:return Re("Suspense");case c:return Re("SuspenseList")}if(typeof _=="object")switch(_.$$typeof){case l:return zt(_.render);case d:return mt(_.type,P,U);case f:{var X=_,ue=X._payload,_e=X._init;try{return mt(_e(ue),P,U)}catch{}}}return""}var ft=Object.prototype.hasOwnProperty,Yt={},qt=D.ReactDebugCurrentFrame;function Tt(_){if(_){var P=_._owner,U=mt(_.type,_._source,P?P.type:null);qt.setExtraStackFrame(U)}else qt.setExtraStackFrame(null)}function Nt(_,P,U,X,ue){{var _e=Function.call.bind(ft);for(var le in _)if(_e(_,le)){var ae=void 0;try{if(typeof _[le]!="function"){var Ze=Error((X||"React class")+": "+U+" type `"+le+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof _[le]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ze.name="Invariant Violation",Ze}ae=_[le](P,le,X,U,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch($e){ae=$e}ae&&!(ae instanceof Error)&&(Tt(ue),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",X||"React class",U,le,typeof ae),Tt(null)),ae instanceof Error&&!(ae.message in Yt)&&(Yt[ae.message]=!0,Tt(ue),x("Failed %s type: %s",U,ae.message),Tt(null))}}}var ut=Array.isArray;function yt(_){return ut(_)}function W(_){{var P=typeof Symbol=="function"&&Symbol.toStringTag,U=P&&_[Symbol.toStringTag]||_.constructor.name||"Object";return U}}function De(_){try{return Te(_),!1}catch{return!0}}function Te(_){return""+_}function ke(_){if(De(_))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",W(_)),Te(_)}var Bt=D.ReactCurrentOwner,Ft={key:!0,ref:!0,__self:!0,__source:!0},Ut,V;function J(_){if(ft.call(_,"ref")){var P=Object.getOwnPropertyDescriptor(_,"ref").get;if(P&&P.isReactWarning)return!1}return _.ref!==void 0}function Ne(_){if(ft.call(_,"key")){var P=Object.getOwnPropertyDescriptor(_,"key").get;if(P&&P.isReactWarning)return!1}return _.key!==void 0}function Oe(_,P){typeof _.ref=="string"&&Bt.current}function Ie(_,P){{var U=function(){Ut||(Ut=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",P))};U.isReactWarning=!0,Object.defineProperty(_,"key",{get:U,configurable:!0})}}function xt(_,P){{var U=function(){V||(V=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",P))};U.isReactWarning=!0,Object.defineProperty(_,"ref",{get:U,configurable:!0})}}var q=function(_,P,U,X,ue,_e,le){var ae={$$typeof:e,type:_,key:P,ref:U,props:le,_owner:_e};return ae._store={},Object.defineProperty(ae._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ae,"_self",{configurable:!1,enumerable:!1,writable:!1,value:X}),Object.defineProperty(ae,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ue}),Object.freeze&&(Object.freeze(ae.props),Object.freeze(ae)),ae};function N(_,P,U,X,ue){{var _e,le={},ae=null,Ze=null;U!==void 0&&(ke(U),ae=""+U),Ne(P)&&(ke(P.key),ae=""+P.key),J(P)&&(Ze=P.ref,Oe(P,ue));for(_e in P)ft.call(P,_e)&&!Ft.hasOwnProperty(_e)&&(le[_e]=P[_e]);if(_&&_.defaultProps){var $e=_.defaultProps;for(_e in $e)le[_e]===void 0&&(le[_e]=$e[_e])}if(ae||Ze){var qe=typeof _=="function"?_.displayName||_.name||"Unknown":_;ae&&Ie(le,qe),Ze&&xt(le,qe)}return q(_,ae,Ze,ue,X,Bt.current,le)}}var H=D.ReactCurrentOwner,Y=D.ReactDebugCurrentFrame;function I(_){if(_){var P=_._owner,U=mt(_.type,_._source,P?P.type:null);Y.setExtraStackFrame(U)}else Y.setExtraStackFrame(null)}var re;re=!1;function Z(_){return typeof _=="object"&&_!==null&&_.$$typeof===e}function ee(){{if(H.current){var _=L(H.current.type);if(_)return`
48
+ `+ae[$e].replace(" at new "," at ");return _.displayName&&pt.includes("<anonymous>")&&(pt=pt.replace("<anonymous>",_.displayName)),typeof _=="function"&&je.set(_,pt),pt}while($e>=1&&qe>=0);break}}}finally{ce=!1,be.current=_e,Ae(),Error.prepareStackTrace=ue}var Dr=_?_.displayName||_.name:"",ar=Dr?Re(Dr):"";return typeof _=="function"&&je.set(_,ar),ar}function zt(_,M,U){return kt(_,!1)}function nt(_){var M=_.prototype;return!!(M&&M.isReactComponent)}function mt(_,M,U){if(_==null)return"";if(typeof _=="function")return kt(_,nt(_));if(typeof _=="string")return Re(_);switch(_){case u:return Re("Suspense");case c:return Re("SuspenseList")}if(typeof _=="object")switch(_.$$typeof){case l:return zt(_.render);case d:return mt(_.type,M,U);case f:{var X=_,ue=X._payload,_e=X._init;try{return mt(_e(ue),M,U)}catch{}}}return""}var ft=Object.prototype.hasOwnProperty,Yt={},qt=w.ReactDebugCurrentFrame;function Tt(_){if(_){var M=_._owner,U=mt(_.type,_._source,M?M.type:null);qt.setExtraStackFrame(U)}else qt.setExtraStackFrame(null)}function Nt(_,M,U,X,ue){{var _e=Function.call.bind(ft);for(var le in _)if(_e(_,le)){var ae=void 0;try{if(typeof _[le]!="function"){var Ze=Error((X||"React class")+": "+U+" type `"+le+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof _[le]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ze.name="Invariant Violation",Ze}ae=_[le](M,le,X,U,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch($e){ae=$e}ae&&!(ae instanceof Error)&&(Tt(ue),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",X||"React class",U,le,typeof ae),Tt(null)),ae instanceof Error&&!(ae.message in Yt)&&(Yt[ae.message]=!0,Tt(ue),x("Failed %s type: %s",U,ae.message),Tt(null))}}}var ut=Array.isArray;function yt(_){return ut(_)}function W(_){{var M=typeof Symbol=="function"&&Symbol.toStringTag,U=M&&_[Symbol.toStringTag]||_.constructor.name||"Object";return U}}function De(_){try{return Te(_),!1}catch{return!0}}function Te(_){return""+_}function ke(_){if(De(_))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",W(_)),Te(_)}var Bt=w.ReactCurrentOwner,Ft={key:!0,ref:!0,__self:!0,__source:!0},Ut,V;function J(_){if(ft.call(_,"ref")){var M=Object.getOwnPropertyDescriptor(_,"ref").get;if(M&&M.isReactWarning)return!1}return _.ref!==void 0}function Ne(_){if(ft.call(_,"key")){var M=Object.getOwnPropertyDescriptor(_,"key").get;if(M&&M.isReactWarning)return!1}return _.key!==void 0}function Oe(_,M){typeof _.ref=="string"&&Bt.current}function Ie(_,M){{var U=function(){Ut||(Ut=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",M))};U.isReactWarning=!0,Object.defineProperty(_,"key",{get:U,configurable:!0})}}function xt(_,M){{var U=function(){V||(V=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",M))};U.isReactWarning=!0,Object.defineProperty(_,"ref",{get:U,configurable:!0})}}var q=function(_,M,U,X,ue,_e,le){var ae={$$typeof:e,type:_,key:M,ref:U,props:le,_owner:_e};return ae._store={},Object.defineProperty(ae._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ae,"_self",{configurable:!1,enumerable:!1,writable:!1,value:X}),Object.defineProperty(ae,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ue}),Object.freeze&&(Object.freeze(ae.props),Object.freeze(ae)),ae};function N(_,M,U,X,ue){{var _e,le={},ae=null,Ze=null;U!==void 0&&(ke(U),ae=""+U),Ne(M)&&(ke(M.key),ae=""+M.key),J(M)&&(Ze=M.ref,Oe(M,ue));for(_e in M)ft.call(M,_e)&&!Ft.hasOwnProperty(_e)&&(le[_e]=M[_e]);if(_&&_.defaultProps){var $e=_.defaultProps;for(_e in $e)le[_e]===void 0&&(le[_e]=$e[_e])}if(ae||Ze){var qe=typeof _=="function"?_.displayName||_.name||"Unknown":_;ae&&Ie(le,qe),Ze&&xt(le,qe)}return q(_,ae,Ze,ue,X,Bt.current,le)}}var H=w.ReactCurrentOwner,Y=w.ReactDebugCurrentFrame;function I(_){if(_){var M=_._owner,U=mt(_.type,_._source,M?M.type:null);Y.setExtraStackFrame(U)}else Y.setExtraStackFrame(null)}var re;re=!1;function Z(_){return typeof _=="object"&&_!==null&&_.$$typeof===e}function ee(){{if(H.current){var _=L(H.current.type);if(_)return`
49
49
 
50
- Check the render method of \``+_+"`."}return""}}function me(_){return""}var Ee={};function te(_){{var P=ee();if(!P){var U=typeof _=="string"?_:_.displayName||_.name;U&&(P=`
50
+ Check the render method of \``+_+"`."}return""}}function me(_){return""}var Ee={};function te(_){{var M=ee();if(!M){var U=typeof _=="string"?_:_.displayName||_.name;U&&(M=`
51
51
 
52
- Check the top-level render call using <`+U+">.")}return P}}function ne(_,P){{if(!_._store||_._store.validated||_.key!=null)return;_._store.validated=!0;var U=te(P);if(Ee[U])return;Ee[U]=!0;var X="";_&&_._owner&&_._owner!==H.current&&(X=" It was passed a child from "+L(_._owner.type)+"."),I(_),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',U,X),I(null)}}function ze(_,P){{if(typeof _!="object")return;if(yt(_))for(var U=0;U<_.length;U++){var X=_[U];Z(X)&&ne(X,P)}else if(Z(_))_._store&&(_._store.validated=!0);else if(_){var ue=y(_);if(typeof ue=="function"&&ue!==_.entries)for(var _e=ue.call(_),le;!(le=_e.next()).done;)Z(le.value)&&ne(le.value,P)}}}function We(_){{var P=_.type;if(P==null||typeof P=="string")return;var U;if(typeof P=="function")U=P.propTypes;else if(typeof P=="object"&&(P.$$typeof===l||P.$$typeof===d))U=P.propTypes;else return;if(U){var X=L(P);Nt(U,_.props,"prop",X,_)}else if(P.PropTypes!==void 0&&!re){re=!0;var ue=L(P);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ue||"Unknown")}typeof P.getDefaultProps=="function"&&!P.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Be(_){{for(var P=Object.keys(_.props),U=0;U<P.length;U++){var X=P[U];if(X!=="children"&&X!=="key"){I(_),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",X),I(null);break}}_.ref!==null&&(I(_),x("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}var ve={};function Je(_,P,U,X,ue,_e){{var le=j(_);if(!le){var ae="";(_===void 0||typeof _=="object"&&_!==null&&Object.keys(_).length===0)&&(ae+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ze=me();Ze?ae+=Ze:ae+=ee();var $e;_===null?$e="null":yt(_)?$e="array":_!==void 0&&_.$$typeof===e?($e="<"+(L(_.type)||"Unknown")+" />",ae=" Did you accidentally export a JSX literal instead of a component?"):$e=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",$e,ae)}var qe=N(_,P,U,ue,_e);if(qe==null)return qe;if(le){var pt=P.children;if(pt!==void 0)if(X)if(yt(pt)){for(var Dr=0;Dr<pt.length;Dr++)ze(pt[Dr],_);Object.freeze&&Object.freeze(pt)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ze(pt,_)}if(ft.call(P,"key")){var ar=L(_),st=Object.keys(P).filter(function(ou){return ou!=="key"}),Ts=st.length>0?"{key: someKey, "+st.join(": ..., ")+": ...}":"{key: someKey}";if(!ve[ar+Ts]){var iu=st.length>0?"{"+st.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
52
+ Check the top-level render call using <`+U+">.")}return M}}function ne(_,M){{if(!_._store||_._store.validated||_.key!=null)return;_._store.validated=!0;var U=te(M);if(Ee[U])return;Ee[U]=!0;var X="";_&&_._owner&&_._owner!==H.current&&(X=" It was passed a child from "+L(_._owner.type)+"."),I(_),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',U,X),I(null)}}function ze(_,M){{if(typeof _!="object")return;if(yt(_))for(var U=0;U<_.length;U++){var X=_[U];Z(X)&&ne(X,M)}else if(Z(_))_._store&&(_._store.validated=!0);else if(_){var ue=y(_);if(typeof ue=="function"&&ue!==_.entries)for(var _e=ue.call(_),le;!(le=_e.next()).done;)Z(le.value)&&ne(le.value,M)}}}function We(_){{var M=_.type;if(M==null||typeof M=="string")return;var U;if(typeof M=="function")U=M.propTypes;else if(typeof M=="object"&&(M.$$typeof===l||M.$$typeof===d))U=M.propTypes;else return;if(U){var X=L(M);Nt(U,_.props,"prop",X,_)}else if(M.PropTypes!==void 0&&!re){re=!0;var ue=L(M);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ue||"Unknown")}typeof M.getDefaultProps=="function"&&!M.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Be(_){{for(var M=Object.keys(_.props),U=0;U<M.length;U++){var X=M[U];if(X!=="children"&&X!=="key"){I(_),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",X),I(null);break}}_.ref!==null&&(I(_),x("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}var ve={};function Je(_,M,U,X,ue,_e){{var le=j(_);if(!le){var ae="";(_===void 0||typeof _=="object"&&_!==null&&Object.keys(_).length===0)&&(ae+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ze=me();Ze?ae+=Ze:ae+=ee();var $e;_===null?$e="null":yt(_)?$e="array":_!==void 0&&_.$$typeof===e?($e="<"+(L(_.type)||"Unknown")+" />",ae=" Did you accidentally export a JSX literal instead of a component?"):$e=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",$e,ae)}var qe=N(_,M,U,ue,_e);if(qe==null)return qe;if(le){var pt=M.children;if(pt!==void 0)if(X)if(yt(pt)){for(var Dr=0;Dr<pt.length;Dr++)ze(pt[Dr],_);Object.freeze&&Object.freeze(pt)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ze(pt,_)}if(ft.call(M,"key")){var ar=L(_),st=Object.keys(M).filter(function(ou){return ou!=="key"}),Ts=st.length>0?"{key: someKey, "+st.join(": ..., ")+": ...}":"{key: someKey}";if(!ve[ar+Ts]){var iu=st.length>0?"{"+st.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
53
53
  let props = %s;
54
54
  <%s {...props} />
55
55
  React keys must be passed directly to JSX without using spread:
56
56
  let props = %s;
57
- <%s key={someKey} {...props} />`,Ts,ar,iu,ar),ve[ar+Ts]=!0}}return _===n?Be(qe):We(qe),qe}}function Ye(_,P,U){return Je(_,P,U,!0)}function ht(_,P,U){return Je(_,P,U,!1)}var Wt=ht,bt=Ye;Gr.Fragment=n,Gr.jsx=Wt,Gr.jsxs=bt}()),Gr}process.env.NODE_ENV==="production"?Ks.exports=Fu():Ks.exports=Ru();var g=Ks.exports;class $n{static filter(e,t){return e.filter(t)}static filterBy(e,t,n){return e.filter(s=>s[t]===n)}static filterByFields(e,t){return e.filter(n=>Object.entries(t).every(([s,i])=>n[s]===i))}static sort(e,t,n="asc"){return[...e].sort((s,i)=>{const o=s[t],a=i[t];if(o===a)return 0;let l=0;return o>a&&(l=1),o<a&&(l=-1),n==="asc"?l:-l})}static search(e,t,n){if(!t.trim())return e;const s=t.toLowerCase();return e.filter(i=>n.some(o=>{const a=i[o];return a==null?!1:String(a).toLowerCase().includes(s)}))}static paginate(e,t,n){const s=(t-1)*n,i=s+n;return{data:e.slice(s,i),total:e.length,page:t,totalPages:Math.ceil(e.length/n)}}static groupBy(e,t){return e.reduce((n,s)=>{const i=String(s[t]);return n[i]||(n[i]=[]),n[i].push(s),n},{})}static unique(e,t){const n=e.map(s=>s[t]);return[...new Set(n)]}static countBy(e,t){return e.reduce((n,s)=>{const i=String(s[t]);return n[i]=(n[i]||0)+1,n},{})}static pipe(e,t){return t.reduce((n,s)=>s(n),e)}}function Lu({endpoint:r,params:e,layout:t="list",title:n,emptyMessage:s="No items found",renderItem:i,keyExtractor:o=(m,y)=>m.id||m._id||String(y),searchable:a=!1,searchFields:l=[],searchPlaceholder:u="Search...",filters:c=[],pageSize:d=20,onItemClick:f,onRefresh:h,theme:p={}}){const{data:m,loading:y,error:D,refetch:x}=Dl(r,e),[E,C]=w.useState(""),[A,b]=w.useState({}),[v,S]=w.useState(1),k=w.useMemo(()=>{if(!m)return{data:[],total:0,totalPages:0};let R=m;return a&&E&&l.length>0&&(R=$n.search(R,E,l)),Object.keys(A).length>0&&(R=$n.filterByFields(R,A)),$n.paginate(R,v,d)},[m,E,A,v,d,a,l]);w.useEffect(()=>{S(1)},[E,A]);const j=()=>{C(""),b({}),S(1),x(),h==null||h()},T={background:p.background||"#ffffff",cardBackground:p.cardBackground||"#f9fafb",text:p.text||"#111827",textSecondary:p.textSecondary||"#6b7280",border:p.border||"#e5e7eb",primary:p.primary||"#3b82f6"},L=i||(R=>g.jsxs("div",{style:{padding:"16px",cursor:f?"pointer":"default"},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:T.text},children:R.title||R.name||R.label||"Untitled"}),R.description&&g.jsx("div",{style:{fontSize:"13px",color:T.textSecondary,marginTop:"4px"},children:R.description})]}));return y&&!m?g.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px",color:T.textSecondary},children:"Loading..."}):D?g.jsxs("div",{style:{padding:"24px",textAlign:"center",color:"#ef4444"},children:[g.jsx("div",{style:{fontWeight:500,marginBottom:"8px"},children:"Error"}),g.jsx("div",{style:{fontSize:"14px"},children:D.message}),g.jsx("button",{onClick:j,style:{marginTop:"16px",padding:"8px 16px",background:T.primary,color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Retry"})]}):g.jsxs("div",{style:{background:T.background,borderRadius:"12px",overflow:"hidden"},children:[(n||a||c.length>0)&&g.jsxs("div",{style:{padding:"16px",borderBottom:`1px solid ${T.border}`},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:a||c.length>0?"12px":"0"},children:[n&&g.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:T.text},children:n}),g.jsx("button",{onClick:j,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${T.border}`,borderRadius:"6px",color:T.textSecondary,cursor:"pointer",fontSize:"13px"},children:"Refresh"})]}),a&&g.jsx("input",{type:"text",placeholder:u,value:E,onChange:R=>C(R.target.value),style:{width:"100%",padding:"8px 12px",border:`1px solid ${T.border}`,borderRadius:"8px",fontSize:"14px",outline:"none"}})]}),g.jsx("div",{style:{display:t==="grid"?"grid":"flex",flexDirection:t==="list"?"column":void 0,gridTemplateColumns:t==="grid"?"repeat(auto-fill, minmax(250px, 1fr))":void 0,gap:t==="list"?"0":"16px",padding:t==="list"?"0":"16px"},children:k.data.length===0?g.jsx("div",{style:{padding:"48px",textAlign:"center",color:T.textSecondary},children:s}):k.data.map((R,M)=>g.jsx("div",{onClick:()=>f==null?void 0:f(R),style:{background:T.cardBackground,borderRadius:t==="list"?"0":"8px",borderBottom:t==="list"?`1px solid ${T.border}`:"none",transition:"all 0.15s ease"},onMouseEnter:Q=>{f&&(Q.currentTarget.style.background=T.border)},onMouseLeave:Q=>{Q.currentTarget.style.background=T.cardBackground},children:L(R,M)},o(R,M)))}),k.totalPages>1&&g.jsxs("div",{style:{padding:"16px",borderTop:`1px solid ${T.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[g.jsxs("div",{style:{fontSize:"13px",color:T.textSecondary},children:["Page ",v," of ",k.totalPages]}),g.jsxs("div",{style:{display:"flex",gap:"8px"},children:[g.jsx("button",{onClick:()=>S(R=>Math.max(1,R-1)),disabled:v===1,style:{padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:"6px",background:"white",cursor:v===1?"not-allowed":"pointer",opacity:v===1?.5:1},children:"Previous"}),g.jsx("button",{onClick:()=>S(R=>Math.min(k.totalPages,R+1)),disabled:v===k.totalPages,style:{padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:"6px",background:"white",cursor:v===k.totalPages?"not-allowed":"pointer",opacity:v===k.totalPages?.5:1},children:"Next"})]})]})]})}function Pu({item:r,onClick:e,title:t=o=>o.title||o.name||o.label||"Untitled",subtitle:n=o=>o.description||o.subtitle||"",image:s=o=>o.image||o.thumbnail||o.photo,badge:i=o=>o.badge||o.tag||o.type}){const o=t(r),a=n(r),l=s(r),u=i(r);return g.jsxs("div",{onClick:e,className:`
57
+ <%s key={someKey} {...props} />`,Ts,ar,iu,ar),ve[ar+Ts]=!0}}return _===n?Be(qe):We(qe),qe}}function Ye(_,M,U){return Je(_,M,U,!0)}function ht(_,M,U){return Je(_,M,U,!1)}var Wt=ht,bt=Ye;Gr.Fragment=n,Gr.jsx=Wt,Gr.jsxs=bt}()),Gr}process.env.NODE_ENV==="production"?Ks.exports=Fu():Ks.exports=Ru();var g=Ks.exports;class $n{static filter(e,t){return e.filter(t)}static filterBy(e,t,n){return e.filter(s=>s[t]===n)}static filterByFields(e,t){return e.filter(n=>Object.entries(t).every(([s,i])=>n[s]===i))}static sort(e,t,n="asc"){return[...e].sort((s,i)=>{const o=s[t],a=i[t];if(o===a)return 0;let l=0;return o>a&&(l=1),o<a&&(l=-1),n==="asc"?l:-l})}static search(e,t,n){if(!t.trim())return e;const s=t.toLowerCase();return e.filter(i=>n.some(o=>{const a=i[o];return a==null?!1:String(a).toLowerCase().includes(s)}))}static paginate(e,t,n){const s=(t-1)*n,i=s+n;return{data:e.slice(s,i),total:e.length,page:t,totalPages:Math.ceil(e.length/n)}}static groupBy(e,t){return e.reduce((n,s)=>{const i=String(s[t]);return n[i]||(n[i]=[]),n[i].push(s),n},{})}static unique(e,t){const n=e.map(s=>s[t]);return[...new Set(n)]}static countBy(e,t){return e.reduce((n,s)=>{const i=String(s[t]);return n[i]=(n[i]||0)+1,n},{})}static pipe(e,t){return t.reduce((n,s)=>s(n),e)}}function Lu({endpoint:r,params:e,layout:t="list",title:n,emptyMessage:s="No items found",renderItem:i,keyExtractor:o=(m,y)=>m.id||m._id||String(y),searchable:a=!1,searchFields:l=[],searchPlaceholder:u="Search...",filters:c=[],pageSize:d=20,onItemClick:f,onRefresh:h,theme:p={}}){const{data:m,loading:y,error:w,refetch:x}=Dl(r,e),[E,D]=C.useState(""),[A,b]=C.useState({}),[v,S]=C.useState(1),k=C.useMemo(()=>{if(!m)return{data:[],total:0,totalPages:0};let R=m;return a&&E&&l.length>0&&(R=$n.search(R,E,l)),Object.keys(A).length>0&&(R=$n.filterByFields(R,A)),$n.paginate(R,v,d)},[m,E,A,v,d,a,l]);C.useEffect(()=>{S(1)},[E,A]);const j=()=>{D(""),b({}),S(1),x(),h==null||h()},T={background:p.background||"#ffffff",cardBackground:p.cardBackground||"#f9fafb",text:p.text||"#111827",textSecondary:p.textSecondary||"#6b7280",border:p.border||"#e5e7eb",primary:p.primary||"#3b82f6"},L=i||(R=>g.jsxs("div",{style:{padding:"16px",cursor:f?"pointer":"default"},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:T.text},children:R.title||R.name||R.label||"Untitled"}),R.description&&g.jsx("div",{style:{fontSize:"13px",color:T.textSecondary,marginTop:"4px"},children:R.description})]}));return y&&!m?g.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"48px",color:T.textSecondary},children:"Loading..."}):w?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:w.message}),g.jsx("button",{onClick:j,style:{marginTop:"16px",padding:"8px 16px",background:T.primary,color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Retry"})]}):g.jsxs("div",{style:{background:T.background,borderRadius:"12px",overflow:"hidden"},children:[(n||a||c.length>0)&&g.jsxs("div",{style:{padding:"16px",borderBottom:`1px solid ${T.border}`},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:a||c.length>0?"12px":"0"},children:[n&&g.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:T.text},children:n}),g.jsx("button",{onClick:j,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${T.border}`,borderRadius:"6px",color:T.textSecondary,cursor:"pointer",fontSize:"13px"},children:"Refresh"})]}),a&&g.jsx("input",{type:"text",placeholder:u,value:E,onChange:R=>D(R.target.value),style:{width:"100%",padding:"8px 12px",border:`1px solid ${T.border}`,borderRadius:"8px",fontSize:"14px",outline:"none"}})]}),g.jsx("div",{style:{display:t==="grid"?"grid":"flex",flexDirection:t==="list"?"column":void 0,gridTemplateColumns:t==="grid"?"repeat(auto-fill, minmax(250px, 1fr))":void 0,gap:t==="list"?"0":"16px",padding:t==="list"?"0":"16px"},children:k.data.length===0?g.jsx("div",{style:{padding:"48px",textAlign:"center",color:T.textSecondary},children:s}):k.data.map((R,P)=>g.jsx("div",{onClick:()=>f==null?void 0:f(R),style:{background:T.cardBackground,borderRadius:t==="list"?"0":"8px",borderBottom:t==="list"?`1px solid ${T.border}`:"none",transition:"all 0.15s ease"},onMouseEnter:Q=>{f&&(Q.currentTarget.style.background=T.border)},onMouseLeave:Q=>{Q.currentTarget.style.background=T.cardBackground},children:L(R,P)},o(R,P)))}),k.totalPages>1&&g.jsxs("div",{style:{padding:"16px",borderTop:`1px solid ${T.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[g.jsxs("div",{style:{fontSize:"13px",color:T.textSecondary},children:["Page ",v," of ",k.totalPages]}),g.jsxs("div",{style:{display:"flex",gap:"8px"},children:[g.jsx("button",{onClick:()=>S(R=>Math.max(1,R-1)),disabled:v===1,style:{padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:"6px",background:"white",cursor:v===1?"not-allowed":"pointer",opacity:v===1?.5:1},children:"Previous"}),g.jsx("button",{onClick:()=>S(R=>Math.min(k.totalPages,R+1)),disabled:v===k.totalPages,style:{padding:"6px 12px",border:`1px solid ${T.border}`,borderRadius:"6px",background:"white",cursor:v===k.totalPages?"not-allowed":"pointer",opacity:v===k.totalPages?.5:1},children:"Next"})]})]})]})}function Mu({item:r,onClick:e,title:t=o=>o.title||o.name||o.label||"Untitled",subtitle:n=o=>o.description||o.subtitle||"",image:s=o=>o.image||o.thumbnail||o.photo,badge:i=o=>o.badge||o.tag||o.type}){const o=t(r),a=n(r),l=s(r),u=i(r);return g.jsxs("div",{onClick:e,className:`
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:[l&&g.jsx("div",{className:"flex-shrink-0",children:g.jsx("img",{src:l,alt:o,className:"w-16 h-16 object-cover rounded-lg"})}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("h3",{className:"font-medium text-gray-900 truncate",children:o}),u&&g.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:u})]}),a&&g.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:a})]}),e&&g.jsx("div",{className:"flex-shrink-0 text-gray-400",children:g.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function Mu({item:r,onClose:e,title:t=i=>i.title||i.name||i.label||"Detail",image:n=i=>i.image||i.thumbnail||i.photo,fields:s=[]}){if(!r)return null;const i=t(r),o=n(r);return g.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:g.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[g.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[g.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:i}),e&&g.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:g.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g.jsxs("div",{className:"p-6",children:[o&&g.jsx("div",{className:"mb-6",children:g.jsx("img",{src:o,alt:i,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&g.jsx("div",{className:"space-y-4",children:s.map((a,l)=>{const u=a.value(r);return u==null||u===""?null:g.jsxs("div",{children:[g.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:a.label}),g.jsx("div",{className:"text-base text-gray-900",children:typeof u=="object"?JSON.stringify(u,null,2):String(u)})]},l)})}),s.length===0&&g.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(r,null,2)})]}),e&&g.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:g.jsx("button",{onClick:e,className:"w-full px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors font-medium",children:"Close"})})]})})}const ju={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function Ou({nodes:r,cardCount:e=2,minInterval:t=1e3,maxInterval:n=3e3,onCardClick:s,cardSize:i="medium",className:o=""}){const a=Math.min(Math.max(e,1),5),[l,u]=w.useState([]),[c,d]=w.useState([]),[f,h]=w.useState(Array(a).fill(!1)),[p,m]=w.useState(Array(a).fill(!1)),y=w.useRef([]),D=w.useCallback(b=>{const v=r.filter(k=>!b.includes(k._id));if(v.length===0)return null;const S=Math.floor(Math.random()*v.length);return v[S]},[r]),x=w.useCallback(()=>Math.random()*(n-t)+t,[t,n]);w.useEffect(()=>{if(r.length===0){u([]),d([]);return}const b=[],v=[],S=[];for(let k=0;k<a&&k<r.length;k++){const j=D(S);j&&(b.push(j),S.push(j._id))}for(let k=0;k<b.length;k++){const j=[b[k]._id,...b.filter((B,L)=>L!==k).map(B=>B._id)],T=D(j);T?v.push(T):v.push(b[k])}u(b),d(v)},[r,a,D]);const E=w.useCallback(b=>{const v=x(),S=setTimeout(()=>{h(k=>{const j=[...k];return j[b]=!j[b],j}),setTimeout(()=>{m(k=>{const j=[...k];return j[b]=!j[b],j}),setTimeout(()=>{const k=!p[b];k&&u(j=>{const T=[...j];return T[b]=c[b],T}),d(j=>{const T=[...j],L=[(k?c[b]:l[b])._id,...l.filter((M,Q)=>Q!==b).map(M=>M._id),...j.filter((M,Q)=>Q!==b).map(M=>M._id)],R=D(L);return R&&(T[b]=R),T}),setTimeout(()=>{E(b)},150)},200)},150)},v);y.current[b]=S},[x,D,l,c,p]),C=w.useRef(!1);w.useEffect(()=>{if(!(l.length===0||r.length<=1)&&!C.current){C.current=!0;for(let b=0;b<l.length;b++)E(b);return()=>{y.current.forEach(b=>clearTimeout(b)),y.current=[],C.current=!1}}},[l.length,r.length]);const A=b=>{s&&s(b)};return r.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${o}`,children:g.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):l.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${o}`,children:g.jsx("p",{className:"text-gray-500",children:"Loading..."})}):g.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${o}`,children:l.map((b,v)=>{const S=c[v],k=p[v];return g.jsx("div",{className:`relative ${ju[i]}`,style:{perspective:"1000px"},onClick:()=>A(k?S:b),children:g.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${f[v]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[g.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:k?0:1},children:g.jsxs("div",{style:{transform:f[v]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:b.data.image,alt:b.title,className:"w-full h-full object-cover"}),g.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:g.jsx("p",{className:"text-white text-sm font-medium truncate",children:b.title})})]})}),S&&g.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:k?1:0},children:g.jsxs("div",{style:{transform:f[v]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:S.data.image,alt:S.title,className:"w-full h-full object-cover"}),g.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:g.jsx("p",{className:"text-white text-sm font-medium truncate",children:S.title})})]})})]})},`slot-${v}`)})})}function Er(r){if(!r)return"";const e=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return r.replace(e,(t,n,s,i)=>{try{if(s.toUpperCase()==="B"){const o=atob(i);return decodeURIComponent(escape(o))}else if(s.toUpperCase()==="Q"){const o=i.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(a,l)=>String.fromCharCode(parseInt(l,16)));return decodeURIComponent(escape(o))}}catch(o){console.warn("MIME decode error:",o)}return t}).replace(/\s+/g," ").trim()}const Iu={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function $u({baseUrl:r,systemId:e,accountId:t,limit:n=30,folder:s,selectable:i=!0,showDetail:o=!1,showSearch:a=!0,searchQuery:l,onSearchChange:u,emptyMessage:c="No emails",autoLoad:d=!0,onSelect:f,onSelectionChange:h,onDelete:p,onError:m,onLoad:y,renderItem:D,renderDetail:x,renderActions:E,renderEmpty:C,renderLoading:A,theme:b={}}){const v={...Iu,...b},[S,k]=w.useState([]),[j,T]=w.useState(!1),[B,L]=w.useState(null),[R,M]=w.useState(new Set),[Q,se]=w.useState(null),[xe,oe]=w.useState(null),[Se,he]=w.useState(null),[fe,pe]=w.useState(!1),[ge,Ae]=w.useState(""),be=l!==void 0?l:ge,we=V=>{u?u(V):Ae(V)},Re=w.useMemo(()=>{if(!be.trim())return S;const V=be.toLowerCase();return S.filter(J=>Er(J.from).toLowerCase().includes(V)||Er(J.subject).toLowerCase().includes(V))},[S,be]),ce=w.useMemo(()=>e?new vl({baseUrl:r,system_id:e}):null,[r,e]),je=w.useCallback(async()=>{if(ce){T(!0),L(null);try{const V=await ce.listEmails(t,n,s);V!=null&&V.messages&&(k(V.messages),y==null||y(V.messages))}catch(V){const J=V instanceof Error?V:new Error("Failed to fetch emails");L(J.message),m==null||m(J)}T(!1)}},[ce,t,n,s,m,y]);w.useEffect(()=>{k([]),M(new Set),oe(null),L(null),l===void 0&&Ae(""),d&&je()},[s,d]);const at=w.useCallback(async V=>{if(ce){oe(V),he(null),pe(!0);try{const J=await ce.getEmailParsed(t,V.uid,s||"INBOX");J!=null&&J.body&&he(J.body)}catch(J){console.error("Failed to fetch email body:",J)}pe(!1)}},[ce,t,s]),kt=w.useCallback(V=>{f==null||f(V),o&&at(V)},[f,o,at]),zt=w.useCallback((V,J,Ne)=>{if(!i){f==null||f(V),o&&at(V);return}const Oe=V.uid;if(Ne.shiftKey&&Q!==null){const Ie=Math.min(Q,J),xt=Math.max(Q,J),q=S.slice(Ie,xt+1).map(H=>H.uid),N=new Set(q);M(N),h==null||h(Array.from(N))}else if(Ne.ctrlKey||Ne.metaKey)M(Ie=>{const xt=new Set(Ie);return xt.has(Oe)?xt.delete(Oe):xt.add(Oe),h==null||h(Array.from(xt)),xt}),se(J);else{const Ie=new Set([Oe]);M(Ie),se(J),h==null||h(Array.from(Ie))}},[i,Q,S,R,f,h,o]),nt=w.useCallback(async()=>{if(!ce||R.size===0)return;const V=s||"INBOX";try{const J=await ce.trashEmails(t,Array.from(R),V);if(console.log("Trash result:",J),J.success&&J.moved>0){k(Oe=>Oe.filter(Ie=>!R.has(Ie.uid)));const Ne=Array.from(R);M(new Set),p==null||p(Ne)}else L("Failed to move emails to trash")}catch(J){const Ne=J instanceof Error?J:new Error("Trash failed");console.error("Trash error:",Ne),L(Ne.message),m==null||m(Ne)}},[ce,t,R,s,p,m]),mt=w.useCallback(async()=>{if(!ce||R.size===0)return;const V=s||"INBOX";try{const J=await ce.archiveEmails(t,Array.from(R),V);if(console.log("Archive result:",J),J.success&&J.archived>0){k(Oe=>Oe.filter(Ie=>!R.has(Ie.uid)));const Ne=Array.from(R);M(new Set),p==null||p(Ne)}else L("Failed to archive emails")}catch(J){const Ne=J instanceof Error?J:new Error("Archive failed");console.error("Archive error:",Ne),L(Ne.message),m==null||m(Ne)}},[ce,t,R,s,p,m]),ft=w.useCallback(()=>{if(R.size===S.length)M(new Set),h==null||h([]);else{const V=new Set(S.map(J=>J.uid));M(V),h==null||h(Array.from(V))}},[S,R.size,h]),Yt=w.useCallback(()=>{M(new Set),h==null||h([])},[h]),qt={delete:nt,archive:mt,refresh:je,selectAll:ft,clearSelection:Yt},Tt=V=>{if(!V)return"";const J=new Date(V),Ne=new Date;return J.toDateString()===Ne.toDateString()?J.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):J.toLocaleDateString([],{month:"short",day:"numeric"})},Nt=(V,J)=>g.jsx("div",{style:{padding:"12px 16px",background:J?v.selectedBackground:V.seen?v.cardBackground:v.unreadBackground,borderBottom:`1px solid ${v.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:g.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:V.seen?400:600,color:v.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Er(V.from).split("@")[0]}),g.jsx("div",{style:{fontSize:"14px",fontWeight:V.seen?400:500,color:V.seen?v.textSecondary:v.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Er(V.subject)||"(No subject)"})]}),g.jsx("div",{style:{fontSize:"12px",color:v.textSecondary,flexShrink:0},children:Tt(V.date)})]})}),ut=V=>g.jsxs("div",{style:{padding:"24px"},children:[g.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:v.text},children:Er(V.subject)||"(No subject)"}),g.jsxs("div",{style:{fontSize:"14px",color:v.textSecondary,marginBottom:"16px"},children:["From: ",Er(V.from)," • ",new Date(V.date).toLocaleString()]}),fe?g.jsx("div",{style:{fontSize:"14px",color:v.textSecondary},children:"Loading..."}):Se?g.jsx("div",{style:{fontSize:"14px",color:v.text},dangerouslySetInnerHTML:{__html:Se}}):g.jsx("div",{style:{fontSize:"14px",color:v.textSecondary},children:"No content available"})]}),yt=(V,J)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:v.cardBackground,borderBottom:`1px solid ${v.border}`},children:[g.jsx("button",{onClick:J.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:v.text},children:V.length===S.length?"Deselect All":"Select All"}),V.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("span",{style:{fontSize:"13px",color:v.textSecondary},children:[V.length," selected"]}),g.jsx("button",{onClick:J.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",cursor:"pointer",color:v.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),g.jsx("button",{onClick:J.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",cursor:"pointer",color:v.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),g.jsx("div",{style:{flex:1}}),g.jsx("button",{onClick:J.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",cursor:"pointer",color:v.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),W=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:v.textSecondary},children:c}),De=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:v.textSecondary},children:"Loading..."}),Te=D||Nt,ke=x||ut,Bt=E||yt,Ft=C||W,Ut=A||De;return j&&S.length===0?g.jsx("div",{style:{background:v.background,width:"100%",height:"100%"},children:Ut()}):g.jsxs("div",{style:{display:"flex",background:v.background,width:"100%",height:"100%"},children:[g.jsxs("div",{style:{flex:o&&xe?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:o&&xe?`1px solid ${v.border}`:"none",overflow:"hidden"},children:[i&&Bt(Array.from(R),qt),a&&g.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${v.border}`,background:v.background},children:g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",background:"#f5f5f5",borderRadius:"6px"},children:[g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:v.textSecondary,strokeWidth:"2",children:[g.jsx("circle",{cx:"11",cy:"11",r:"8"}),g.jsx("path",{d:"M21 21l-4.35-4.35"})]}),g.jsx("input",{type:"text",placeholder:"Search by email or subject...",value:be,onChange:V=>we(V.target.value),style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:"13px",color:v.text}}),be&&g.jsx("button",{onClick:()=>we(""),style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center"},children:g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:v.textSecondary,strokeWidth:"2",children:g.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})}),B&&g.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:v.danger,fontSize:"14px",borderBottom:`1px solid ${v.border}`},children:B}),g.jsx("div",{style:{flex:1,overflowY:"auto"},children:Re.length===0?Ft():Re.map((V,J)=>g.jsx("div",{onClick:Ne=>zt(V,J,Ne),onDoubleClick:()=>kt(V),children:Te(V,R.has(V.uid))},V.uid))})]}),o&&xe&&g.jsx("div",{style:{flex:1,overflowY:"auto"},children:ke(xe)})]})}function zu({items:r,renderItem:e,onSelectionChange:t,onCurrentChange:n,onAction:s,actions:i=[],emptyMessage:o="No items",showSelectAll:a=!0,className:l=""}){const[u,c]=w.useState(new Set),[d,f]=w.useState(-1),h=r.filter(C=>u.has(C.id)),p=d>=0&&d<h.length?h[d]:null,m=w.useCallback(C=>{c(A=>{const b=new Set(A);return b.has(C)?b.delete(C):b.add(C),t==null||t(Array.from(b)),b})},[t]),y=w.useCallback(()=>{if(u.size===r.length)c(new Set),f(-1),t==null||t([]);else{const C=new Set(r.map(A=>A.id));c(C),r.length>0&&(f(0),n==null||n(r[0],0)),t==null||t(r.map(A=>A.id))}},[r,u.size,t,n]),D=w.useCallback(()=>{if(h.length===0)return;const C=d<=0?h.length-1:d-1;f(C),n==null||n(h[C],C)},[h,d,n]),x=w.useCallback(()=>{if(h.length===0)return;const C=d>=h.length-1?0:d+1;f(C),n==null||n(h[C],C)},[h,d,n]),E=w.useCallback(C=>{s==null||s(C,h,p)},[s,h,p]);return w.useEffect(()=>{h.length===0?f(-1):d>=h.length?f(h.length-1):d<0&&h.length>0&&(f(0),n==null||n(h[0],0))},[h.length,d,n]),r.length===0?g.jsx("div",{className:`text-sm text-neutral-400 text-center py-4 ${l}`,children:o}):g.jsxs("div",{className:`space-y-2 ${l}`,children:[g.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[a&&g.jsxs("button",{onClick:y,className:"flex items-center gap-1 hover:text-neutral-700 transition-colors",children:[g.jsx("span",{className:"material-icons text-sm",children:u.size===r.length?"check_box":u.size>0?"indeterminate_check_box":"check_box_outline_blank"}),g.jsx("span",{children:u.size===r.length?"Deselect all":"Select all"})]}),u.size>0&&g.jsxs("span",{className:"text-neutral-400",children:["(",u.size," selected)"]})]}),h.length>1&&g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("button",{onClick:D,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Previous",children:g.jsx("span",{className:"material-icons text-sm",children:"chevron_left"})}),g.jsxs("span",{className:"text-xs min-w-[3rem] text-center",children:[d+1," / ",h.length]}),g.jsx("button",{onClick:x,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Next",children:g.jsx("span",{className:"material-icons text-sm",children:"chevron_right"})})]})]}),g.jsx("div",{className:"space-y-1",children:r.map(C=>{const A=u.has(C.id),b=(p==null?void 0:p.id)===C.id;return g.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${b?"bg-blue-50 ring-1 ring-blue-200":A?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>m(C.id),children:[g.jsx("span",{className:`material-icons text-lg ${A?"text-blue-500":"text-neutral-300"}`,children:A?"check_box":"check_box_outline_blank"}),g.jsx("div",{className:"flex-1 min-w-0",children:e(C,A,b)})]},C.id)})}),i.length>0&&u.size>0&&g.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:i.map(C=>{var b;const A=((b=C.disabled)==null?void 0:b.call(C,h))??!1;return g.jsxs("button",{onClick:()=>E(C.id),disabled:A,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${A?"bg-neutral-100 text-neutral-400 cursor-not-allowed":"bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,children:[C.icon&&g.jsx("span",{className:"material-icons text-sm",children:C.icon}),C.label]},C.id)})})]})}function qu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Uu=qu(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const El=w.createContext(null);function Wu(r,e){return{getTheme:function(){return e??null}}}function St(){const r=w.useContext(El);return r==null&&Uu(8),r}function xn(r){return{}}const bi={},Gu={},Sl={},fr={},Fr={},dn={},Rr={},fs={},Hs={},fn={},hn={},Dt={},_i={},vi={},Vu={},Al={},Ku={},kl={},Hu={},Tl={},Nl={},Gn={},Qu={},Bl={},Fl={},Rl={},Ju={},Yu={},Xu={},oo={},Ll={},Zu={},Pl={},Ml={},ec={},hs={},Ci={},Qs={},tc={},rc={},Fn={},Rn={},nc={},sc={},ic={},At=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,oc=At&&"documentMode"in document?document.documentMode:null,vt=At&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),sr=At&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Vn=!(!At||!("InputEvent"in window)||oc)&&"getTargetRanges"in new window.InputEvent("input"),ps=At&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),bn=At&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,lc=At&&/Android/.test(navigator.userAgent),jl=At&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ac=At&&lc&&jl,wi=At&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!jl,_n=1,or=3,gr=0,Ol=1,Mr=2,uc=0,cc=1,dc=2,Kn=4,Hn=8,Di=128,fc=112|(3|Kn|Hn)|Di,Ei=1,Si=2,Ai=3,ki=4,Ti=5,Ni=6,gs=ps||bn||wi?" ":"​",Kt=`
61
+ `,children:[l&&g.jsx("div",{className:"flex-shrink-0",children:g.jsx("img",{src:l,alt:o,className:"w-16 h-16 object-cover rounded-lg"})}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("h3",{className:"font-medium text-gray-900 truncate",children:o}),u&&g.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:u})]}),a&&g.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:a})]}),e&&g.jsx("div",{className:"flex-shrink-0 text-gray-400",children:g.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function Pu({item:r,onClose:e,title:t=i=>i.title||i.name||i.label||"Detail",image:n=i=>i.image||i.thumbnail||i.photo,fields:s=[]}){if(!r)return null;const i=t(r),o=n(r);return g.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:g.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[g.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[g.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:i}),e&&g.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:g.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:g.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),g.jsxs("div",{className:"p-6",children:[o&&g.jsx("div",{className:"mb-6",children:g.jsx("img",{src:o,alt:i,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&g.jsx("div",{className:"space-y-4",children:s.map((a,l)=>{const u=a.value(r);return u==null||u===""?null:g.jsxs("div",{children:[g.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:a.label}),g.jsx("div",{className:"text-base text-gray-900",children:typeof u=="object"?JSON.stringify(u,null,2):String(u)})]},l)})}),s.length===0&&g.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(r,null,2)})]}),e&&g.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:g.jsx("button",{onClick:e,className:"w-full px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors font-medium",children:"Close"})})]})})}const ju={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function Ou({nodes:r,cardCount:e=2,minInterval:t=1e3,maxInterval:n=3e3,onCardClick:s,cardSize:i="medium",className:o=""}){const a=Math.min(Math.max(e,1),5),[l,u]=C.useState([]),[c,d]=C.useState([]),[f,h]=C.useState(Array(a).fill(!1)),[p,m]=C.useState(Array(a).fill(!1)),y=C.useRef([]),w=C.useCallback(b=>{const v=r.filter(k=>!b.includes(k._id));if(v.length===0)return null;const S=Math.floor(Math.random()*v.length);return v[S]},[r]),x=C.useCallback(()=>Math.random()*(n-t)+t,[t,n]);C.useEffect(()=>{if(r.length===0){u([]),d([]);return}const b=[],v=[],S=[];for(let k=0;k<a&&k<r.length;k++){const j=w(S);j&&(b.push(j),S.push(j._id))}for(let k=0;k<b.length;k++){const j=[b[k]._id,...b.filter((B,L)=>L!==k).map(B=>B._id)],T=w(j);T?v.push(T):v.push(b[k])}u(b),d(v)},[r,a,w]);const E=C.useCallback(b=>{const v=x(),S=setTimeout(()=>{h(k=>{const j=[...k];return j[b]=!j[b],j}),setTimeout(()=>{m(k=>{const j=[...k];return j[b]=!j[b],j}),setTimeout(()=>{const k=!p[b];k&&u(j=>{const T=[...j];return T[b]=c[b],T}),d(j=>{const T=[...j],L=[(k?c[b]:l[b])._id,...l.filter((P,Q)=>Q!==b).map(P=>P._id),...j.filter((P,Q)=>Q!==b).map(P=>P._id)],R=w(L);return R&&(T[b]=R),T}),setTimeout(()=>{E(b)},150)},200)},150)},v);y.current[b]=S},[x,w,l,c,p]),D=C.useRef(!1);C.useEffect(()=>{if(!(l.length===0||r.length<=1)&&!D.current){D.current=!0;for(let b=0;b<l.length;b++)E(b);return()=>{y.current.forEach(b=>clearTimeout(b)),y.current=[],D.current=!1}}},[l.length,r.length]);const A=b=>{s&&s(b)};return r.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${o}`,children:g.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):l.length===0?g.jsx("div",{className:`flex items-center justify-center p-8 ${o}`,children:g.jsx("p",{className:"text-gray-500",children:"Loading..."})}):g.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${o}`,children:l.map((b,v)=>{const S=c[v],k=p[v];return g.jsx("div",{className:`relative ${ju[i]}`,style:{perspective:"1000px"},onClick:()=>A(k?S:b),children:g.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${f[v]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[g.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:k?0:1},children:g.jsxs("div",{style:{transform:f[v]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:b.data.image,alt:b.title,className:"w-full h-full object-cover"}),g.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:g.jsx("p",{className:"text-white text-sm font-medium truncate",children:b.title})})]})}),S&&g.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:k?1:0},children:g.jsxs("div",{style:{transform:f[v]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[g.jsx("img",{src:S.data.image,alt:S.title,className:"w-full h-full object-cover"}),g.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:g.jsx("p",{className:"text-white text-sm font-medium truncate",children:S.title})})]})})]})},`slot-${v}`)})})}function Er(r){if(!r)return"";const e=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return r.replace(e,(t,n,s,i)=>{try{if(s.toUpperCase()==="B"){const o=atob(i);return decodeURIComponent(escape(o))}else if(s.toUpperCase()==="Q"){const o=i.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(a,l)=>String.fromCharCode(parseInt(l,16)));return decodeURIComponent(escape(o))}}catch(o){console.warn("MIME decode error:",o)}return t}).replace(/\s+/g," ").trim()}const Iu={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function $u({baseUrl:r,systemId:e,accountId:t,limit:n=30,folder:s,selectable:i=!0,showDetail:o=!1,showSearch:a=!0,searchQuery:l,onSearchChange:u,emptyMessage:c="No emails",autoLoad:d=!0,onSelect:f,onSelectionChange:h,onDelete:p,onError:m,onLoad:y,renderItem:w,renderDetail:x,renderActions:E,renderEmpty:D,renderLoading:A,theme:b={}}){const v={...Iu,...b},[S,k]=C.useState([]),[j,T]=C.useState(!1),[B,L]=C.useState(null),[R,P]=C.useState(new Set),[Q,se]=C.useState(null),[xe,oe]=C.useState(null),[Se,he]=C.useState(null),[fe,pe]=C.useState(!1),[ge,Ae]=C.useState(""),be=l!==void 0?l:ge,we=V=>{u?u(V):Ae(V)},Re=C.useMemo(()=>{if(!be.trim())return S;const V=be.toLowerCase();return S.filter(J=>Er(J.from).toLowerCase().includes(V)||Er(J.subject).toLowerCase().includes(V))},[S,be]),ce=C.useMemo(()=>e?new vl({baseUrl:r,system_id:e}):null,[r,e]),je=C.useCallback(async()=>{if(ce){T(!0),L(null);try{const V=await ce.listEmails(t,n,s);V!=null&&V.messages&&(k(V.messages),y==null||y(V.messages))}catch(V){const J=V instanceof Error?V:new Error("Failed to fetch emails");L(J.message),m==null||m(J)}T(!1)}},[ce,t,n,s,m,y]);C.useEffect(()=>{k([]),P(new Set),oe(null),L(null),l===void 0&&Ae(""),d&&je()},[s,d]);const at=C.useCallback(async V=>{if(ce){oe(V),he(null),pe(!0);try{const J=await ce.getEmailParsed(t,V.uid,s||"INBOX");J!=null&&J.body&&he(J.body)}catch(J){console.error("Failed to fetch email body:",J)}pe(!1)}},[ce,t,s]),kt=C.useCallback(V=>{f==null||f(V),o&&at(V)},[f,o,at]),zt=C.useCallback((V,J,Ne)=>{if(!i){f==null||f(V),o&&at(V);return}const Oe=V.uid;if(Ne.shiftKey&&Q!==null){const Ie=Math.min(Q,J),xt=Math.max(Q,J),q=S.slice(Ie,xt+1).map(H=>H.uid),N=new Set(q);P(N),h==null||h(Array.from(N))}else if(Ne.ctrlKey||Ne.metaKey)P(Ie=>{const xt=new Set(Ie);return xt.has(Oe)?xt.delete(Oe):xt.add(Oe),h==null||h(Array.from(xt)),xt}),se(J);else{const Ie=new Set([Oe]);P(Ie),se(J),h==null||h(Array.from(Ie))}},[i,Q,S,R,f,h,o]),nt=C.useCallback(async()=>{if(!ce||R.size===0)return;const V=s||"INBOX";try{const J=await ce.trashEmails(t,Array.from(R),V);if(console.log("Trash result:",J),J.success&&J.moved>0){k(Oe=>Oe.filter(Ie=>!R.has(Ie.uid)));const Ne=Array.from(R);P(new Set),p==null||p(Ne)}else L("Failed to move emails to trash")}catch(J){const Ne=J instanceof Error?J:new Error("Trash failed");console.error("Trash error:",Ne),L(Ne.message),m==null||m(Ne)}},[ce,t,R,s,p,m]),mt=C.useCallback(async()=>{if(!ce||R.size===0)return;const V=s||"INBOX";try{const J=await ce.archiveEmails(t,Array.from(R),V);if(console.log("Archive result:",J),J.success&&J.archived>0){k(Oe=>Oe.filter(Ie=>!R.has(Ie.uid)));const Ne=Array.from(R);P(new Set),p==null||p(Ne)}else L("Failed to archive emails")}catch(J){const Ne=J instanceof Error?J:new Error("Archive failed");console.error("Archive error:",Ne),L(Ne.message),m==null||m(Ne)}},[ce,t,R,s,p,m]),ft=C.useCallback(()=>{if(R.size===S.length)P(new Set),h==null||h([]);else{const V=new Set(S.map(J=>J.uid));P(V),h==null||h(Array.from(V))}},[S,R.size,h]),Yt=C.useCallback(()=>{P(new Set),h==null||h([])},[h]),qt={delete:nt,archive:mt,refresh:je,selectAll:ft,clearSelection:Yt},Tt=V=>{if(!V)return"";const J=new Date(V),Ne=new Date;return J.toDateString()===Ne.toDateString()?J.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):J.toLocaleDateString([],{month:"short",day:"numeric"})},Nt=(V,J)=>g.jsx("div",{style:{padding:"12px 16px",background:J?v.selectedBackground:V.seen?v.cardBackground:v.unreadBackground,borderBottom:`1px solid ${v.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:g.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:V.seen?400:600,color:v.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Er(V.from).split("@")[0]}),g.jsx("div",{style:{fontSize:"14px",fontWeight:V.seen?400:500,color:V.seen?v.textSecondary:v.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Er(V.subject)||"(No subject)"})]}),g.jsx("div",{style:{fontSize:"12px",color:v.textSecondary,flexShrink:0},children:Tt(V.date)})]})}),ut=V=>g.jsxs("div",{style:{padding:"24px"},children:[g.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:v.text},children:Er(V.subject)||"(No subject)"}),g.jsxs("div",{style:{fontSize:"14px",color:v.textSecondary,marginBottom:"16px"},children:["From: ",Er(V.from)," • ",new Date(V.date).toLocaleString()]}),fe?g.jsx("div",{style:{fontSize:"14px",color:v.textSecondary},children:"Loading..."}):Se?g.jsx("div",{style:{fontSize:"14px",color:v.text},dangerouslySetInnerHTML:{__html:Se}}):g.jsx("div",{style:{fontSize:"14px",color:v.textSecondary},children:"No content available"})]}),yt=(V,J)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:v.cardBackground,borderBottom:`1px solid ${v.border}`},children:[g.jsx("button",{onClick:J.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:v.text},children:V.length===S.length?"Deselect All":"Select All"}),V.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("span",{style:{fontSize:"13px",color:v.textSecondary},children:[V.length," selected"]}),g.jsx("button",{onClick:J.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",cursor:"pointer",color:v.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),g.jsx("button",{onClick:J.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",cursor:"pointer",color:v.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),g.jsx("div",{style:{flex:1}}),g.jsx("button",{onClick:J.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${v.border}`,borderRadius:"6px",cursor:"pointer",color:v.textSecondary},children:g.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),W=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:v.textSecondary},children:c}),De=()=>g.jsx("div",{style:{padding:"48px",textAlign:"center",color:v.textSecondary},children:"Loading..."}),Te=w||Nt,ke=x||ut,Bt=E||yt,Ft=D||W,Ut=A||De;return j&&S.length===0?g.jsx("div",{style:{background:v.background,width:"100%",height:"100%"},children:Ut()}):g.jsxs("div",{style:{display:"flex",background:v.background,width:"100%",height:"100%"},children:[g.jsxs("div",{style:{flex:o&&xe?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:o&&xe?`1px solid ${v.border}`:"none",overflow:"hidden"},children:[i&&Bt(Array.from(R),qt),a&&g.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${v.border}`,background:v.background},children:g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",background:"#f5f5f5",borderRadius:"6px"},children:[g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:v.textSecondary,strokeWidth:"2",children:[g.jsx("circle",{cx:"11",cy:"11",r:"8"}),g.jsx("path",{d:"M21 21l-4.35-4.35"})]}),g.jsx("input",{type:"text",placeholder:"Search by email or subject...",value:be,onChange:V=>we(V.target.value),style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:"13px",color:v.text}}),be&&g.jsx("button",{onClick:()=>we(""),style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center"},children:g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:v.textSecondary,strokeWidth:"2",children:g.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})}),B&&g.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:v.danger,fontSize:"14px",borderBottom:`1px solid ${v.border}`},children:B}),g.jsx("div",{style:{flex:1,overflowY:"auto"},children:Re.length===0?Ft():Re.map((V,J)=>g.jsx("div",{onClick:Ne=>zt(V,J,Ne),onDoubleClick:()=>kt(V),children:Te(V,R.has(V.uid))},V.uid))})]}),o&&xe&&g.jsx("div",{style:{flex:1,overflowY:"auto"},children:ke(xe)})]})}function zu({items:r,renderItem:e,onSelectionChange:t,onCurrentChange:n,onAction:s,actions:i=[],emptyMessage:o="No items",showSelectAll:a=!0,className:l=""}){const[u,c]=C.useState(new Set),[d,f]=C.useState(-1),h=r.filter(D=>u.has(D.id)),p=d>=0&&d<h.length?h[d]:null,m=C.useCallback(D=>{c(A=>{const b=new Set(A);return b.has(D)?b.delete(D):b.add(D),t==null||t(Array.from(b)),b})},[t]),y=C.useCallback(()=>{if(u.size===r.length)c(new Set),f(-1),t==null||t([]);else{const D=new Set(r.map(A=>A.id));c(D),r.length>0&&(f(0),n==null||n(r[0],0)),t==null||t(r.map(A=>A.id))}},[r,u.size,t,n]),w=C.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]),x=C.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=C.useCallback(D=>{s==null||s(D,h,p)},[s,h,p]);return C.useEffect(()=>{h.length===0?f(-1):d>=h.length?f(h.length-1):d<0&&h.length>0&&(f(0),n==null||n(h[0],0))},[h.length,d,n]),r.length===0?g.jsx("div",{className:`text-sm text-neutral-400 text-center py-4 ${l}`,children:o}):g.jsxs("div",{className:`space-y-2 ${l}`,children:[g.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[a&&g.jsxs("button",{onClick:y,className:"flex items-center gap-1 hover:text-neutral-700 transition-colors",children:[g.jsx("span",{className:"material-icons text-sm",children:u.size===r.length?"check_box":u.size>0?"indeterminate_check_box":"check_box_outline_blank"}),g.jsx("span",{children:u.size===r.length?"Deselect all":"Select all"})]}),u.size>0&&g.jsxs("span",{className:"text-neutral-400",children:["(",u.size," selected)"]})]}),h.length>1&&g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("button",{onClick:w,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Previous",children:g.jsx("span",{className:"material-icons text-sm",children:"chevron_left"})}),g.jsxs("span",{className:"text-xs min-w-[3rem] text-center",children:[d+1," / ",h.length]}),g.jsx("button",{onClick:x,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Next",children:g.jsx("span",{className:"material-icons text-sm",children:"chevron_right"})})]})]}),g.jsx("div",{className:"space-y-1",children:r.map(D=>{const A=u.has(D.id),b=(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 ${b?"bg-blue-50 ring-1 ring-blue-200":A?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>m(D.id),children:[g.jsx("span",{className:`material-icons text-lg ${A?"text-blue-500":"text-neutral-300"}`,children:A?"check_box":"check_box_outline_blank"}),g.jsx("div",{className:"flex-1 min-w-0",children:e(D,A,b)})]},D.id)})}),i.length>0&&u.size>0&&g.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:i.map(D=>{var b;const A=((b=D.disabled)==null?void 0:b.call(D,h))??!1;return g.jsxs("button",{onClick:()=>E(D.id),disabled:A,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${A?"bg-neutral-100 text-neutral-400 cursor-not-allowed":"bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,children:[D.icon&&g.jsx("span",{className:"material-icons text-sm",children:D.icon}),D.label]},D.id)})})]})}function qu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Uu=qu(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const El=C.createContext(null);function Wu(r,e){return{getTheme:function(){return e??null}}}function St(){const r=C.useContext(El);return r==null&&Uu(8),r}function xn(r){return{}}const bi={},Gu={},Sl={},fr={},Fr={},dn={},Rr={},fs={},Hs={},fn={},hn={},Dt={},_i={},vi={},Vu={},Al={},Ku={},kl={},Hu={},Tl={},Nl={},Gn={},Qu={},Bl={},Fl={},Rl={},Ju={},Yu={},Xu={},oo={},Ll={},Zu={},Ml={},Pl={},ec={},hs={},Ci={},Qs={},tc={},rc={},Fn={},Rn={},nc={},sc={},ic={},At=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,oc=At&&"documentMode"in document?document.documentMode:null,vt=At&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),sr=At&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Vn=!(!At||!("InputEvent"in window)||oc)&&"getTargetRanges"in new window.InputEvent("input"),ps=At&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),bn=At&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,lc=At&&/Android/.test(navigator.userAgent),jl=At&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ac=At&&lc&&jl,wi=At&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!jl,_n=1,or=3,gr=0,Ol=1,Pr=2,uc=0,cc=1,dc=2,Kn=4,Hn=8,Di=128,fc=112|(3|Kn|Hn)|Di,Ei=1,Si=2,Ai=3,ki=4,Ti=5,Ni=6,gs=ps||bn||wi?" ":"​",Kt=`
62
62
 
63
- `,hc=sr?" ":gs,Il="֑-߿יִ-﷽ﹰ-ﻼ",$l="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",pc=new RegExp("^[^"+$l+"]*["+Il+"]"),gc=new RegExp("^[^"+Il+"]*["+$l+"]"),mr={bold:1,code:16,highlight:Di,italic:2,strikethrough:Kn,subscript:32,superscript:64,underline:Hn},mc={directionless:1,unmergeable:2},lo={center:Si,end:Ni,justify:ki,left:Ei,right:Ai,start:Ti},yc={[Si]:"center",[Ni]:"end",[ki]:"justify",[Ei]:"left",[Ai]:"right",[Ti]:"start"},xc={normal:0,segmented:2,token:1},bc={[uc]:"normal",[dc]:"segmented",[cc]:"token"};function _c(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var $=_c(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Qn(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}const vc=100;let Js=!1,Bi=0;function Cc(r){Bi=r.timeStamp}function Ps(r,e,t){const n=r.nodeName==="BR",s=e.__lexicalLineBreak;return s&&(r===s||n&&r.previousSibling===s)||n&&ys(r,t)!==void 0}function wc(r,e,t){const n=gt(t._window);let s=null,i=null;n!==null&&n.anchorNode===r&&(s=n.anchorOffset,i=n.focusOffset);const o=r.nodeValue;o!==null&&Mi(e,o,s,i,!1)}function Dc(r,e,t){if(O(r)){const n=r.anchor.getNode();if(n.is(t)&&r.format!==n.getFormat())return!1}return e.nodeType===or&&t.isAttached()}function Ec(r,e,t,n){for(let s=r;s&&!Oc(s);s=Cn(s)){const i=ys(s,e);if(i!==void 0){const o=Xe(i,t);if(o)return Ce(o)?void 0:[s,o]}else if(s===n)return[n,Ql(t)]}}function zl(r,e,t){Js=!0;const n=performance.now()-Bi>vc;try{ct(r,()=>{const s=K()||function(f){return f.getEditorState().read(()=>{const h=K();return h!==null?h.clone():null})}(r),i=new Map,o=r.getRootElement(),a=r._editorState,l=r._blockCursorElement;let u=!1,c="";for(let f=0;f<e.length;f++){const h=e[f],p=h.type,m=h.target,y=Ec(m,r,a,o);if(!y)continue;const[D,x]=y;if(p==="characterData")n&&z(x)&&Dc(s,m,x)&&wc(m,x,r);else if(p==="childList"){u=!0;const E=h.addedNodes;for(let b=0;b<E.length;b++){const v=E[b],S=Kl(v),k=v.parentNode;if(k!=null&&v!==l&&S===null&&!Ps(v,k,r)){if(sr){const j=v.innerText||v.nodeValue;j&&(c+=j)}k.removeChild(v)}}const C=h.removedNodes,A=C.length;if(A>0){let b=0;for(let v=0;v<A;v++){const S=C[v];(Ps(S,m,r)||l===S)&&(m.appendChild(S),b++)}A!==b&&i.set(D,x)}}}if(i.size>0)for(const[f,h]of i)h.reconcileObservedMutation(f,r);const d=t.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){const h=d[f],p=h.addedNodes,m=h.target;for(let y=0;y<p.length;y++){const D=p[y],x=D.parentNode;x==null||D.nodeName!=="BR"||Ps(D,m,r)||x.removeChild(D)}}t.takeRecords()}s!==null&&(u&&(s.dirty=!0,jt(s)),sr&&Zl(r)&&s.insertRawText(c))})}finally{Js=!1}}function ql(r){const e=r._observer;e!==null&&zl(r,e.takeRecords(),e)}function Ul(r){(function(e){Bi===0&&bs(e).addEventListener("textInput",Cc,!0)})(r),r._observer=new MutationObserver((e,t)=>{zl(r,e,t)})}function ao(r,e){const t=r.__mode,n=r.__format,s=r.__style,i=e.__mode,o=e.__format,a=e.__style;return!(t!==null&&t!==i||n!==null&&n!==o||s!==null&&s!==a)}function uo(r,e){const t=r.mergeWithSibling(e),n=Me()._normalizedNodes;return n.add(r.__key),n.add(e.__key),t}function co(r){let e,t,n=r;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&z(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(ao(e,n)){n=uo(e,n);break}break}e.remove()}for(;(t=n.getNextSibling())!==null&&z(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(ao(n,t)){n=uo(n,t);break}break}t.remove()}}else n.remove()}function Wl(r){return fo(r.anchor),fo(r.focus),r}function fo(r){for(;r.type==="element";){const e=r.getNode(),t=r.offset;let n,s;if(t===e.getChildrenSize()?(n=e.getChildAtIndex(t-1),s=!0):(n=e.getChildAtIndex(t),s=!1),z(n)){r.set(n.__key,s?n.getTextContentSize():0,"text");break}if(!F(n))break;r.set(n.__key,s?n.getChildrenSize():0,"element")}}let Sc=1;const Ac=typeof queueMicrotask=="function"?queueMicrotask:r=>{Promise.resolve().then(r)};function Fi(r){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return Ce(jr(r))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&ms(e)==null)}function vn(r,e,t){const n=r.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!Fi(e)&&Gl(e)===r}catch{return!1}}function Ri(r){return r instanceof Ds}function Gl(r){let e=r;for(;e!=null;){const t=ms(e);if(Ri(t))return t;e=Cn(e)}return null}function ms(r){return r?r.__lexicalEditor:null}function cr(r){return r.isToken()||r.isSegmented()}function kc(r){return r.nodeType===or}function Jn(r){let e=r;for(;e!=null;){if(kc(e))return e;e=e.firstChild}return null}function Yn(r,e,t){const n=mr[e];if(t!==null&&(r&n)==(t&n))return r;let s=r^n;return e==="subscript"?s&=-65:e==="superscript"&&(s&=-33),s}function Vl(r){return z(r)||pr(r)||Ce(r)}function Tc(r,e){if(e!=null)return void(r.__key=e);it(),_a();const t=Me(),n=Qt(),s=""+Sc++;n._nodeMap.set(s,r),F(r)?t._dirtyElements.set(s,!0):t._dirtyLeaves.add(s),t._cloneNotNeeded.add(s),t._dirtyType=Ol,r.__key=s}function hr(r){const e=r.getParent();if(e!==null){const t=r.getWritable(),n=e.getWritable(),s=r.getPreviousSibling(),i=r.getNextSibling();if(s===null)if(i!==null){const o=i.getWritable();n.__first=i.__key,o.__prev=null}else n.__first=null;else{const o=s.getWritable();if(i!==null){const a=i.getWritable();a.__prev=o.__key,o.__next=a.__key}else o.__next=null;t.__prev=null}if(i===null)if(s!==null){const o=s.getWritable();n.__last=s.__key,o.__next=null}else n.__last=null;else{const o=i.getWritable();if(s!==null){const a=s.getWritable();a.__next=o.__key,o.__prev=a.__key}else o.__prev=null;t.__next=null}n.__size--,t.__parent=null}}function Xn(r){_a();const e=r.getLatest(),t=e.__parent,n=Qt(),s=Me(),i=n._nodeMap,o=s._dirtyElements;t!==null&&function(l,u,c){let d=l;for(;d!==null;){if(c.has(d))return;const f=u.get(d);if(f===void 0)break;c.set(d,!1),d=f.__parent}}(t,i,o);const a=e.__key;s._dirtyType=Ol,F(r)?o.set(a,!0):s._dirtyLeaves.add(a)}function Qe(r){it();const e=Me(),t=e._compositionKey;if(r!==t){if(e._compositionKey=r,t!==null){const n=Xe(t);n!==null&&n.getWritable()}if(r!==null){const n=Xe(r);n!==null&&n.getWritable()}}}function tr(){return An()?null:Me()._compositionKey}function Xe(r,e){const t=(e||Qt())._nodeMap.get(r);return t===void 0?null:t}function Kl(r,e){const t=ys(r,Me());return t!==void 0?Xe(t,e):null}function ys(r,e){return r[`__lexicalKey_${e._key}`]}function jr(r,e){let t=r;for(;t!=null;){const n=Kl(t,e);if(n!==null)return n;t=Cn(t)}return null}function Hl(r){const e=r._decorators,t=Object.assign({},e);return r._pendingDecorators=t,t}function ho(r){return r.read(()=>Fe().getTextContent())}function Fe(){return Ql(Qt())}function Ql(r){return r._nodeMap.get("root")}function jt(r){it();const e=Qt();r!==null&&(r.dirty=!0,r.setCachedNodes(null)),e._selection=r}function Tr(r){const e=Me(),t=function(n,s){let i=n;for(;i!=null;){const o=ys(i,s);if(o!==void 0)return o;i=Cn(i)}return null}(r,e);return t===null?r===e.getRootElement()?Xe("root"):null:Xe(t)}function po(r,e){return e?r.getTextContentSize():0}function Jl(r){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(r)}function Li(r){const e=[];let t=r;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Yl(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Xl(r){return r.nodeType===or?r.nodeValue:null}function Pi(r,e,t){const n=gt(e._window);if(n===null)return;const s=n.anchorNode;let{anchorOffset:i,focusOffset:o}=n;if(s!==null){let a=Xl(s);const l=jr(s);if(a!==null&&z(l)){if(a===gs&&t){const u=t.length;a=t,i=u,o=u}a!==null&&Mi(l,a,i,o,r)}}}function Mi(r,e,t,n,s){let i=r;if(i.isAttached()&&(s||!i.isDirty())){const o=i.isComposing();let a=e;(o||s)&&e[e.length-1]===gs&&(a=e.slice(0,-1));const l=i.getTextContent();if(s||a!==l){if(a===""){if(Qe(null),ps||bn||wi)i.remove();else{const m=Me();setTimeout(()=>{m.update(()=>{i.isAttached()&&i.remove()})},20)}return}const u=i.getParent(),c=Sn(),d=i.getTextContentSize(),f=tr(),h=i.getKey();if(i.isToken()||f!==null&&h===f&&!o||O(c)&&(u!==null&&!u.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===r.__key&&c.anchor.offset===0&&!i.canInsertTextBefore()&&!o||c.focus.key===r.__key&&c.focus.offset===d&&!i.canInsertTextAfter()&&!o))return void i.markDirty();const p=K();if(!O(p)||t===null||n===null)return void i.setTextContent(a);if(p.setTextNodeRange(i,t,i,n),i.isSegmented()){const m=Ge(i.getTextContent());i.replace(m),i=m}i.setTextContent(a)}}}function Nc(r,e){if(e.isSegmented())return!0;if(!r.isCollapsed())return!1;const t=r.anchor.offset,n=e.getParentOrThrow(),s=e.isToken();return t===0?!e.canInsertTextBefore()||!n.canInsertTextBefore()&&!e.isComposing()||s||function(i){const o=i.getPreviousSibling();return(z(o)||F(o)&&o.isInline())&&!o.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||s)}function go(r){return r==="ArrowLeft"}function mo(r){return r==="ArrowRight"}function Xr(r,e){return vt?r:e}function yo(r){return r==="Enter"}function Vr(r){return r==="Backspace"}function Kr(r){return r==="Delete"}function xo(r,e,t){return r.toLowerCase()==="a"&&Xr(e,t)}function Bc(){const r=Fe();jt(Wl(r.select(0,r.getChildrenSize())))}function sn(r,e){r.__lexicalClassNameCache===void 0&&(r.__lexicalClassNameCache={});const t=r.__lexicalClassNameCache,n=t[e];if(n!==void 0)return n;const s=r[e];if(typeof s=="string"){const i=Qn(s);return t[e]=i,i}return s}function ji(r,e,t,n,s){if(t.size===0)return;const i=n.__type,o=n.__key,a=e.get(i);a===void 0&&$(33,i);const l=a.klass;let u=r.get(l);u===void 0&&(u=new Map,r.set(l,u));const c=u.get(o),d=c==="destroyed"&&s==="created";(c===void 0||d)&&u.set(o,d?"updated":s)}function bo(r,e,t){const n=r.getParent();let s=t,i=r;return n!==null&&(e&&t===0?(s=i.getIndexWithinParent(),i=n):e||t!==i.getChildrenSize()||(s=i.getIndexWithinParent()+1,i=n)),i.getChildAtIndex(e?s-1:s)}function pn(r,e){const t=r.offset;if(r.type==="element")return bo(r.getNode(),e,t);{const n=r.getNode();if(e&&t===0||!e&&t===n.getTextContentSize()){const s=e?n.getPreviousSibling():n.getNextSibling();return s===null?bo(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):s}}return null}function Zl(r){const e=bs(r).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function G(r,e,t){return wa(r,e,t)}function xs(r){return!tt(r)&&!r.isLastChild()&&!r.isInline()}function Zn(r,e){const t=r._keyToDOMMap.get(e);return t===void 0&&$(75,e),t}function Cn(r){const e=r.assignedSlot||r.parentElement;return e!==null&&e.nodeType===11?e.host:e}function on(r,e){let t=r.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function bs(r){const e=r._window;return e===null&&$(78),e}function Fc(r){let e=r.getParentOrThrow();for(;e!==null;){if(Ot(e))return e;e=e.getParentOrThrow()}return e}function Ot(r){return tt(r)||F(r)&&r.isShadowRoot()}function $t(r){const e=Me(),t=r.constructor.getType(),n=e._nodes.get(t);n===void 0&&$(200,r.constructor.name,t);const{replace:s,replaceWithKlass:i}=n;if(s!==null){const o=s(r),a=o.constructor;return i!==null?o instanceof i||$(201,i.name,i.getType(),a.name,a.getType(),r.constructor.name,t):o instanceof r.constructor&&a!==r.constructor||$(202,a.name,a.getType(),r.constructor.name,t),o.__key===r.__key&&$(203,r.constructor.name,t,a.name,a.getType()),o}return r}function Ms(r,e){!tt(r.getParent())||F(e)||Ce(e)||$(99)}function js(r){return(Ce(r)||F(r)&&!r.canBeEmpty())&&!r.isInline()}function Oi(r,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const n=r.parentElement;n!==null&&n.removeChild(r)}function Rc(r,e,t){let n=r._blockCursorElement;if(O(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const s=t.anchor,i=s.getNode(),o=s.offset;let a=!1,l=null;if(o===i.getChildrenSize())js(i.getChildAtIndex(o-1))&&(a=!0);else{const u=i.getChildAtIndex(o);if(u!==null&&js(u)){const c=u.getPreviousSibling();(c===null||js(c))&&(a=!0,l=r.getElementByKey(u.__key))}}if(a){const u=r.getElementByKey(i.__key);return n===null&&(r._blockCursorElement=n=function(c){const d=c.theme,f=document.createElement("div");f.contentEditable="false",f.setAttribute("data-lexical-cursor","true");let h=d.blockCursor;if(h!==void 0){if(typeof h=="string"){const p=Qn(h);h=d.blockCursor=p}h!==void 0&&f.classList.add(...h)}return f}(r._config)),e.style.caretColor="transparent",void(l===null?u.appendChild(n):u.insertBefore(n,l))}}n!==null&&Oi(n,r,e)}function gt(r){return At?(r||window).getSelection():null}function Lc(r){return Ht(r)&&r.tagName==="A"}function Ht(r){return r.nodeType===1}function _o(r){return r.nodeType===11}function Ys(r){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return r.nodeName.match(e)!==null}function es(r){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return r.nodeName.match(e)!==null}function Zt(r){if(Ce(r)&&!r.isInline())return!0;if(!F(r)||Ot(r))return!1;const e=r.getFirstChild(),t=e===null||pr(e)||z(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Hr(r,e){let t=r;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function Pc(){return Me()}const vo=new WeakMap,Mc=new Map;function jc(r){if(!r._readOnly&&r.isEmpty())return Mc;r._readOnly||$(192);let e=vo.get(r);if(!e){e=new Map,vo.set(r,e);for(const[t,n]of r._nodeMap){const s=n.__type;let i=e.get(s);i||(i=new Map,e.set(s,i)),i.set(t,n)}}return e}function Ii(r){const e=r.constructor.clone(r);return e.afterCloneFrom(r),e}function $i(r,e){const t=(parseInt(r.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function Oc(r){return r.__lexicalUnmanaged===!0}function ea(r,e,t,n,s,i){let o=r.getFirstChild();for(;o!==null;){const a=o.__key;o.__parent===e&&(F(o)&&ea(o,a,t,n,s,i),t.has(a)||i.delete(a),s.push(a)),o=o.getNextSibling()}}let ir,rt,gn,_s,Xs,Zs,yr,Et,ei,mn,Ve="",et="",Rt=null,Ct="",Vt="",ta=!1,yn=!1,zn=null;function ts(r,e){const t=yr.get(r);if(e!==null){const n=ni(r);n.parentNode===e&&e.removeChild(n)}if(Et.has(r)||rt._keyToDOMMap.delete(r),F(t)){const n=ns(t,yr);ti(n,0,n.length-1,null)}t!==void 0&&ji(mn,gn,_s,t,"destroyed")}function ti(r,e,t,n){let s=e;for(;s<=t;++s){const i=r[s];i!==void 0&&ts(i,n)}}function ur(r,e){r.setProperty("text-align",e)}const Ic="40px";function ra(r,e){const t=ir.theme.indent;if(typeof t=="string"){const s=r.classList.contains(t);e>0&&!s?r.classList.add(t):e<1&&s&&r.classList.remove(t)}const n=getComputedStyle(r).getPropertyValue("--lexical-indent-base-value")||Ic;r.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function na(r,e){const t=r.style;e===0?ur(t,""):e===Ei?ur(t,"left"):e===Si?ur(t,"center"):e===Ai?ur(t,"right"):e===ki?ur(t,"justify"):e===Ti?ur(t,"start"):e===Ni&&ur(t,"end")}function rs(r,e){const t=Et.get(r);t===void 0&&$(60);const n=t.createDOM(ir,rt);if(function(s,i,o){const a=o._keyToDOMMap;(function(l,u,c){l[`__lexicalKey_${u._key}`]=c})(i,o,s),a.set(s,i)}(r,n,rt),z(t)?n.setAttribute("data-lexical-text","true"):Ce(t)&&n.setAttribute("data-lexical-decorator","true"),F(t)){const s=t.__indent,i=t.__size;if(s!==0&&ra(n,s),i!==0){const a=i-1;(function(l,u,c,d){const f=et;et="",ri(l,c,0,u,c.getDOMSlot(d)),ia(c,d),et=f})(ns(t,Et),a,t,n)}const o=t.__format;o!==0&&na(n,o),t.isInline()||sa(null,t,n),xs(t)&&(Ve+=Kt,Vt+=Kt)}else{const s=t.getTextContent();if(Ce(t)){const i=t.decorate(rt,ir);i!==null&&oa(r,i),n.contentEditable="false"}else z(t)&&(t.isDirectionless()||(et+=s));Ve+=s,Vt+=s}return e!==null&&e.insertChild(n),ji(mn,gn,_s,t,"created"),n}function ri(r,e,t,n,s){const i=Ve;Ve="";let o=t;for(;o<=n;++o){rs(r[o],s);const a=Et.get(r[o]);a!==null&&z(a)&&(Rt===null&&(Rt=a.getFormat()),Ct===""&&(Ct=a.getStyle()))}xs(e)&&(Ve+=Kt),s.element.__lexicalTextContent=Ve,Ve=i+Ve}function Co(r,e){if(r){const t=r.__last;if(t){const n=e.get(t);if(n)return pr(n)?"line-break":Ce(n)&&n.isInline()?"decorator":null}return"empty"}return null}function sa(r,e,t){const n=Co(r,yr),s=Co(e,Et);n!==s&&e.getDOMSlot(t).setManagedLineBreak(s)}function ia(r,e){const t=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(t!==et||n!==zn){const i=et==="",o=i?zn:(s=et,pc.test(s)?"rtl":gc.test(s)?"ltr":null);if(o!==n){const a=e.classList,l=ir.theme;let u=n!==null?l[n]:void 0,c=o!==null?l[o]:void 0;if(u!==void 0){if(typeof u=="string"){const d=Qn(u);u=l[n]=d}a.remove(...u)}if(o===null||i&&o==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){const d=Qn(c);c=l[o]=d}c!==void 0&&a.add(...c)}e.dir=o}yn||(r.getWritable().__dir=o)}zn=o,e.__lexicalDirTextContent=et,e.__lexicalDir=o}var s}function $c(r,e,t){const n=et;var s;et="",Rt=null,Ct="",function(i,o,a){const l=Ve,u=i.__size,c=o.__size;Ve="";const d=a.element;if(u===1&&c===1){const f=i.__first,h=o.__first;if(f===h)Zr(f,d);else{const m=ni(f),y=rs(h,null);try{d.replaceChild(y,m)}catch(D){if(typeof D=="object"&&D!=null){const x=`${D.toString()} Parent: ${d.tagName}, new child: {tag: ${y.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${f}}.`;throw new Error(x)}throw D}ts(f,null)}const p=Et.get(h);z(p)&&(Rt===null&&(Rt=p.getFormat()),Ct===""&&(Ct=p.getStyle()))}else{const f=ns(i,yr),h=ns(o,Et);if(f.length!==u&&$(227),h.length!==c&&$(228),u===0)c!==0&&ri(h,o,0,c-1,a);else if(c===0){if(u!==0){const p=a.after==null&&a.before==null&&a.element.__lexicalLineBreak==null;ti(f,0,u-1,p?null:d),p&&(d.textContent="")}}else(function(p,m,y,D,x,E){const C=D-1,A=x-1;let b,v,S=E.getFirstChild(),k=0,j=0;for(;k<=C&&j<=A;){const L=m[k],R=y[j];if(L===R)S=Os(Zr(R,E.element)),k++,j++;else{b===void 0&&(b=new Set(m)),v===void 0&&(v=new Set(y));const Q=v.has(L),se=b.has(R);if(Q)if(se){const xe=Zn(rt,R);xe===S?S=Os(Zr(R,E.element)):(E.withBefore(S).insertChild(xe),Zr(R,E.element)),k++,j++}else rs(R,E.withBefore(S)),j++;else S=Os(ni(L)),ts(L,E.element),k++}const M=Et.get(R);M!==null&&z(M)&&(Rt===null&&(Rt=M.getFormat()),Ct===""&&(Ct=M.getStyle()))}const T=k>C,B=j>A;if(T&&!B){const L=y[A+1],R=L===void 0?null:rt.getElementByKey(L);ri(y,p,j,A,E.withBefore(R))}else B&&!T&&ti(m,k,C,E.element)})(o,f,h,u,c,a)}xs(o)&&(Ve+=Kt),d.__lexicalTextContent=Ve,Ve=l+Ve}(r,e,e.getDOMSlot(t)),ia(e,t),Or(s=e)&&Rt!=null&&Rt!==s.__textFormat&&!yn&&(s.setTextFormat(Rt),s.setTextStyle(Ct)),function(i){Or(i)&&Ct!==""&&Ct!==i.__textStyle&&!yn&&i.setTextStyle(Ct)}(e),et=n}function ns(r,e){const t=[];let n=r.__first;for(;n!==null;){const s=e.get(n);s===void 0&&$(101),t.push(n),n=s.__next}return t}function Zr(r,e){const t=yr.get(r);let n=Et.get(r);t!==void 0&&n!==void 0||$(61);const s=ta||Zs.has(r)||Xs.has(r),i=Zn(rt,r);if(t===n&&!s){if(F(t)){const o=i.__lexicalTextContent;o!==void 0&&(Ve+=o,Vt+=o);const a=i.__lexicalDirTextContent;a!==void 0&&(et+=a)}else{const o=t.getTextContent();z(t)&&!t.isDirectionless()&&(et+=o),Vt+=o,Ve+=o}return i}if(t!==n&&s&&ji(mn,gn,_s,n,"updated"),n.updateDOM(t,i,ir)){const o=rs(r,null);return e===null&&$(62),e.replaceChild(o,i),ts(r,null),o}if(F(t)&&F(n)){const o=n.__indent;o!==t.__indent&&ra(i,o);const a=n.__format;a!==t.__format&&na(i,a),s&&($c(t,n,i),tt(n)||n.isInline()||sa(t,n,i)),xs(n)&&(Ve+=Kt,Vt+=Kt)}else{const o=n.getTextContent();if(Ce(n)){const a=n.decorate(rt,ir);a!==null&&oa(r,a)}else z(n)&&!n.isDirectionless()&&(et+=o);Ve+=o,Vt+=o}if(!yn&&tt(n)&&n.__cachedText!==Vt){const o=n.getWritable();o.__cachedText=Vt,n=o}return i}function oa(r,e){let t=rt._pendingDecorators;const n=rt._decorators;if(t===null){if(n[r]===e)return;t=Hl(rt)}t[r]=e}function Os(r){let e=r.nextSibling;return e!==null&&e===rt._blockCursorElement&&(e=e.nextSibling),e}function zc(r,e,t,n,s,i){Ve="",Vt="",et="",ta=n===Mr,zn=null,rt=t,ir=t._config,gn=t._nodes,_s=rt._listeners.mutation,Xs=s,Zs=i,yr=r._nodeMap,Et=e._nodeMap,yn=e._readOnly,ei=new Map(t._keyToDOMMap);const o=new Map;return mn=o,Zr("root",null),rt=void 0,gn=void 0,Xs=void 0,Zs=void 0,yr=void 0,Et=void 0,ir=void 0,ei=void 0,mn=void 0,o}function ni(r){const e=ei.get(r);return e===void 0&&$(75,r),e}const Gt=Object.freeze({}),si=30,ii=[["keydown",function(r,e){if(ln=r.timeStamp,la=r.key,e.isComposing())return;const{key:t,shiftKey:n,ctrlKey:s,metaKey:i,altKey:o}=r;if(!G(e,Vu,r)&&t!=null){if(function(a,l,u,c){return mo(a)&&!l&&!c&&!u}(t,s,o,i))G(e,Al,r);else if(function(a,l,u,c,d){return mo(a)&&!c&&!u&&(l||d)}(t,s,n,o,i))G(e,Ku,r);else if(function(a,l,u,c){return go(a)&&!l&&!c&&!u}(t,s,o,i))G(e,kl,r);else if(function(a,l,u,c,d){return go(a)&&!c&&!u&&(l||d)}(t,s,n,o,i))G(e,Hu,r);else if(function(a,l,u){return function(c){return c==="ArrowUp"}(a)&&!l&&!u}(t,s,i))G(e,Tl,r);else if(function(a,l,u){return function(c){return c==="ArrowDown"}(a)&&!l&&!u}(t,s,i))G(e,Nl,r);else if(function(a,l){return yo(a)&&l}(t,n))an=!0,G(e,Gn,r);else if(function(a){return a===" "}(t))G(e,Qu,r);else if(function(a,l){return vt&&l&&a.toLowerCase()==="o"}(t,s))r.preventDefault(),an=!0,G(e,Fr,!0);else if(function(a,l){return yo(a)&&!l}(t,n))an=!1,G(e,Gn,r);else if(function(a,l,u,c){return vt?!l&&!u&&(Vr(a)||a.toLowerCase()==="h"&&c):!(c||l||u)&&Vr(a)}(t,o,i,s))Vr(t)?G(e,Bl,r):(r.preventDefault(),G(e,fr,!0));else if(function(a){return a==="Escape"}(t))G(e,Fl,r);else if(function(a,l,u,c,d){return vt?!(u||c||d)&&(Kr(a)||a.toLowerCase()==="d"&&l):!(l||c||d)&&Kr(a)}(t,s,n,o,i))Kr(t)?G(e,Rl,r):(r.preventDefault(),G(e,fr,!1));else if(function(a,l,u){return Vr(a)&&(vt?l:u)}(t,o,s))r.preventDefault(),G(e,fn,!0);else if(function(a,l,u){return Kr(a)&&(vt?l:u)}(t,o,s))r.preventDefault(),G(e,fn,!1);else if(function(a,l){return vt&&l&&Vr(a)}(t,i))r.preventDefault(),G(e,hn,!0);else if(function(a,l){return vt&&l&&Kr(a)}(t,i))r.preventDefault(),G(e,hn,!1);else if(function(a,l,u,c){return a.toLowerCase()==="b"&&!l&&Xr(u,c)}(t,o,i,s))r.preventDefault(),G(e,Dt,"bold");else if(function(a,l,u,c){return a.toLowerCase()==="u"&&!l&&Xr(u,c)}(t,o,i,s))r.preventDefault(),G(e,Dt,"underline");else if(function(a,l,u,c){return a.toLowerCase()==="i"&&!l&&Xr(u,c)}(t,o,i,s))r.preventDefault(),G(e,Dt,"italic");else if(function(a,l,u,c){return a==="Tab"&&!l&&!u&&!c}(t,o,s,i))G(e,Ju,r);else if(function(a,l,u,c){return a.toLowerCase()==="z"&&!l&&Xr(u,c)}(t,n,i,s))r.preventDefault(),G(e,_i,void 0);else if(function(a,l,u,c){return vt?a.toLowerCase()==="z"&&u&&l:a.toLowerCase()==="y"&&c||a.toLowerCase()==="z"&&c&&l}(t,n,i,s))r.preventDefault(),G(e,vi,void 0);else{const a=e._editorState._selection;a===null||O(a)?!sr&&xo(t,i,s)&&(r.preventDefault(),G(e,Qs,r)):function(l,u,c,d){return!u&&l.toLowerCase()==="c"&&(vt?c:d)}(t,n,i,s)?(r.preventDefault(),G(e,hs,r)):function(l,u,c,d){return!u&&l.toLowerCase()==="x"&&(vt?c:d)}(t,n,i,s)?(r.preventDefault(),G(e,Ci,r)):xo(t,i,s)&&(r.preventDefault(),G(e,Qs,r))}(function(a,l,u,c){return a||l||u||c})(s,n,o,i)&&G(e,ic,r)}}],["pointerdown",function(r,e){const t=r.target,n=r.pointerType;t instanceof Node&&n!=="touch"&&ct(e,()=>{Ce(jr(t))||(li=!0)})}],["compositionstart",function(r,e){ct(e,()=>{const t=K();if(O(t)&&!e.isComposing()){const n=t.anchor,s=t.anchor.getNode();Qe(n.key),(r.timeStamp<ln+si||n.type==="element"||!t.isCollapsed()||s.getFormat()!==t.format||z(s)&&s.getStyle()!==t.style)&&G(e,Rr,hc)}})}],["compositionend",function(r,e){sr?Qr=!0:ct(e,()=>{Is(e,r.data)})}],["input",function(r,e){r.stopPropagation(),ct(e,()=>{const t=K(),n=r.data,s=da(r);if(n!=null&&O(t)&&ca(t,s,n,r.timeStamp,!1)){Qr&&(Is(e,n),Qr=!1);const i=t.anchor.getNode(),o=gt(e._window);if(o===null)return;const a=t.isBackward(),l=a?t.anchor.offset:t.focus.offset,u=a?t.focus.offset:t.anchor.offset;Vn&&!t.isCollapsed()&&z(i)&&o.anchorNode!==null&&i.getTextContent().slice(0,l)+n+i.getTextContent().slice(l+u)===Xl(o.anchorNode)||G(e,Rr,n);const c=n.length;sr&&c>1&&r.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=c),ps||bn||wi||!e.isComposing()||(ln=0,Qe(null))}else Pi(!1,e,n!==null?n:void 0),Qr&&(Is(e,n||void 0),Qr=!1);it(),ql(Me())}),kr=null}],["click",function(r,e){ct(e,()=>{const t=K(),n=gt(e._window),s=Sn();if(n){if(O(t)){const i=t.anchor,o=i.getNode();i.type==="element"&&i.offset===0&&t.isCollapsed()&&!tt(o)&&Fe().getChildrenSize()===1&&o.getTopLevelElementOrThrow().isEmpty()&&s!==null&&t.is(s)?(n.removeAllRanges(),t.dirty=!0):r.detail===3&&!t.isCollapsed()&&o!==t.focus.getNode()&&(F(o)?o.select(0):o.getParentOrThrow().select(0))}else if(r.pointerType==="touch"){const i=n.anchorNode;if(i!==null){const o=i.nodeType;(o===_n||o===or)&&jt(qi(s,n,e,r))}}}G(e,Sl,r)})}],["cut",Gt],["copy",Gt],["dragstart",Gt],["dragover",Gt],["dragend",Gt],["paste",Gt],["focus",Gt],["blur",Gt],["drop",Gt]];Vn&&ii.push(["beforeinput",(r,e)=>function(t,n){const s=t.inputType,i=da(t);s==="deleteCompositionText"||sr&&Zl(n)||s!=="insertCompositionText"&&ct(n,()=>{const o=K();if(s==="deleteContentBackward"){if(o===null){const h=Sn();if(!O(h))return;jt(h.clone())}if(O(o)){const h=o.anchor.key===o.focus.key;if(a=t.timeStamp,la==="MediaLast"&&a<ln+si&&n.isComposing()&&h){if(Qe(null),ln=0,setTimeout(()=>{ct(n,()=>{Qe(null)})},si),O(o)){const p=o.anchor.getNode();p.markDirty(),o.format=p.getFormat(),z(p)||$(142),o.style=p.getStyle()}}else{Qe(null),t.preventDefault();const p=o.anchor.getNode(),m=p.getTextContent(),y=p.canInsertTextAfter(),D=o.anchor.offset===0&&o.focus.offset===m.length;ac&&h&&!D&&y||G(n,fr,!0)}return}}var a;if(!O(o))return;const l=t.data;kr!==null&&Pi(!1,n,kr),o.dirty&&kr===null||!o.isCollapsed()||tt(o.anchor.getNode())||i===null||o.applyDOMRange(i),kr=null;const u=o.anchor,c=o.focus,d=u.getNode(),f=c.getNode();if(s!=="insertText"&&s!=="insertTranspose")switch(t.preventDefault(),s){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":G(n,Rr,t);break;case"insertFromComposition":Qe(null),G(n,Rr,t);break;case"insertLineBreak":Qe(null),G(n,Fr,!1);break;case"insertParagraph":Qe(null),an&&!bn?(an=!1,G(n,Fr,!1)):G(n,dn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":G(n,fs,t);break;case"deleteByComposition":(function(h,p){return h!==p||F(h)||F(p)||!h.isToken()||!p.isToken()})(d,f)&&G(n,Hs,t);break;case"deleteByDrag":case"deleteByCut":G(n,Hs,t);break;case"deleteContent":G(n,fr,!1);break;case"deleteWordBackward":G(n,fn,!0);break;case"deleteWordForward":G(n,fn,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":G(n,hn,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":G(n,hn,!1);break;case"formatStrikeThrough":G(n,Dt,"strikethrough");break;case"formatBold":G(n,Dt,"bold");break;case"formatItalic":G(n,Dt,"italic");break;case"formatUnderline":G(n,Dt,"underline");break;case"historyUndo":G(n,_i,void 0);break;case"historyRedo":G(n,vi,void 0)}else{if(l===`
64
- `)t.preventDefault(),G(n,Fr,!1);else if(l===Kt)t.preventDefault(),G(n,dn,void 0);else if(l==null&&t.dataTransfer){const h=t.dataTransfer.getData("text/plain");t.preventDefault(),o.insertRawText(h)}else l!=null&&ca(o,i,l,t.timeStamp,!0)?(t.preventDefault(),G(n,Rr,l)):kr=l;aa=t.timeStamp}})}(r,e)]);let ln=0,la=null,aa=0,kr=null;const ss=new WeakMap;let oi=!1,li=!1,an=!1,Qr=!1,ua=[0,"",0,"root",0];function ca(r,e,t,n,s){const i=r.anchor,o=r.focus,a=i.getNode(),l=Me(),u=gt(l._window),c=u!==null?u.anchorNode:null,d=i.key,f=l.getElementByKey(d),h=t.length;return d!==o.key||!z(a)||(!s&&(!Vn||aa<n+50)||a.isDirty()&&h<2||Jl(t))&&i.offset!==o.offset&&!a.isComposing()||cr(a)||a.isDirty()&&h>1||(s||!Vn)&&f!==null&&!a.isComposing()&&c!==Jn(f)||u!==null&&e!==null&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||a.getFormat()!==r.format||a.getStyle()!==r.style||Nc(r,a)}function wo(r,e){return r!==null&&r.nodeValue!==null&&r.nodeType===or&&e!==0&&e!==r.nodeValue.length}function Do(r,e,t){const{anchorNode:n,anchorOffset:s,focusNode:i,focusOffset:o}=r;oi&&(oi=!1,wo(n,s)&&wo(i,o))||ct(e,()=>{if(!t)return void jt(null);if(!vn(e,n,i))return;const a=K();if(O(a)){const l=a.anchor,u=l.getNode();if(a.isCollapsed()){r.type==="Range"&&r.anchorNode===r.focusNode&&(a.dirty=!0);const c=bs(e).event,d=c?c.timeStamp:performance.now(),[f,h,p,m,y]=ua,D=Fe(),x=e.isComposing()===!1&&D.getTextContent()==="";if(d<y+200&&l.offset===p&&l.key===m)a.format=f,a.style=h;else if(l.type==="text")z(u)||$(141),a.format=u.getFormat(),a.style=u.getStyle();else if(l.type==="element"&&!x){const E=l.getNode();a.style="",E instanceof $r&&E.getChildrenSize()===0?(a.format=E.getTextFormat(),a.style=E.getTextStyle()):a.format=0}}else{const c=l.key,d=a.focus.key,f=a.getNodes(),h=f.length,p=a.isBackward(),m=p?o:s,y=p?s:o,D=p?d:c,x=p?c:d;let E=fc,C=!1;for(let A=0;A<h;A++){const b=f[A],v=b.getTextContentSize();if(z(b)&&v!==0&&!(A===0&&b.__key===D&&m===v||A===h-1&&b.__key===x&&y===0)&&(C=!0,E&=b.getFormat(),E===0))break}a.format=C?E:0}}G(e,bi,void 0)})}function da(r){if(!r.getTargetRanges)return null;const e=r.getTargetRanges();return e.length===0?null:e[0]}function Is(r,e){const t=r._compositionKey;if(Qe(null),t!==null&&e!=null){if(e===""){const n=Xe(t),s=Jn(r.getElementByKey(t));return void(s!==null&&s.nodeValue!==null&&z(n)&&Mi(n,s.nodeValue,null,null,!0))}if(e[e.length-1]===`
65
- `){const n=K();if(O(n)){const s=n.focus;return n.anchor.set(s.key,s.offset,s.type),void G(r,Gn,null)}}}Pi(!0,r,e)}function fa(r){let e=r.__lexicalEventHandles;return e===void 0&&(e=[],r.__lexicalEventHandles=e),e}const Lr=new Map;function ha(r){const e=r.target,t=gt(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const n=Gl(t.anchorNode);if(n===null)return;li&&(li=!1,ct(n,()=>{const u=Sn(),c=t.anchorNode;if(c===null)return;const d=c.nodeType;d!==_n&&d!==or||jt(qi(u,t,n,r))}));const s=Li(n),i=s[s.length-1],o=i._key,a=Lr.get(o),l=a||i;l!==n&&Do(t,l,!1),Do(t,n,!0),n!==i?Lr.set(o,n):a&&Lr.delete(o)}function Eo(r){r._lexicalHandled=!0}function So(r){return r._lexicalHandled===!0}function qc(r){const e=r.ownerDocument,t=ss.get(e);t===void 0&&$(162);const n=t-1;n>=0||$(164),ss.set(e,n),n===0&&e.removeEventListener("selectionchange",ha);const s=ms(r);Ri(s)?(function(o){if(o._parentEditor!==null){const a=Li(o),l=a[a.length-1]._key;Lr.get(l)===o&&Lr.delete(l)}else Lr.delete(o._key)}(s),r.__lexicalEditor=null):s&&$(198);const i=fa(r);for(let o=0;o<i.length;o++)i[o]();r.__lexicalEventHandles=[]}function ai(r,e,t){it();const n=r.__key,s=r.getParent();if(s===null)return;const i=function(a){const l=K();if(!O(l)||!F(a))return l;const{anchor:u,focus:c}=l,d=u.getNode(),f=c.getNode();return on(d,a)&&u.set(a.__key,0,"element"),on(f,a)&&c.set(a.__key,0,"element"),l}(r);let o=!1;if(O(i)&&e){const a=i.anchor,l=i.focus;a.key===n&&(os(a,r,s,r.getPreviousSibling(),r.getNextSibling()),o=!0),l.key===n&&(os(l,r,s,r.getPreviousSibling(),r.getNextSibling()),o=!0)}else Lt(i)&&e&&r.isSelected()&&r.selectPrevious();if(O(i)&&e&&!o){const a=r.getIndexWithinParent();hr(r),is(i,s,a,-1)}else hr(r);t||Ot(s)||s.canBeEmpty()||!s.isEmpty()||ai(s,e),e&&tt(s)&&s.isEmpty()&&s.selectEnd()}class vs{static getType(){$(64,this.name)}static clone(e){$(65,this.name)}afterCloneFrom(e){this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Tc(this,e)}getType(){return this.__type}isInline(){$(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=Xe(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||K();if(t==null)return!1;const n=t.getNodes().some(s=>s.__key===this.__key);if(z(this))return n;if(O(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const s=this.getParent();if(Ce(this)&&this.isInline()&&s){const i=t.isBackward()?t.focus:t.anchor,o=i.getNode();if(i.offset===o.getChildrenSize()&&o.is(s)&&o.getLastChildOrThrow().is(this))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:Xe(e)}getParentOrThrow(){const e=this.getParent();return e===null&&$(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(Ot(t))return F(e)||e===this&&Ce(e)||$(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&$(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:Xe(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return e===null?null:Xe(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=this.getParents(),n=e.getParents();F(this)&&t.unshift(this),F(e)&&n.unshift(e);const s=t.length,i=n.length;if(s===0||i===0||t[s-1]!==n[i-1])return null;const o=new Set(n);for(let a=0;a<s;a++){const l=t[a];if(o.has(l))return l}return null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;const t=this.getCommonAncestor(e);let n=0,s=0,i=this;for(;;){const o=i.getParentOrThrow();if(o===t){n=i.getIndexWithinParent();break}i=o}for(i=e;;){const o=i.getParentOrThrow();if(o===t){s=i.getIndexWithinParent();break}i=o}return n<s}isParentOf(e){const t=this.__key;if(t===e.__key)return!1;let n=e;for(;n!==null;){if(n.__key===t)return!0;n=n.getParent()}return!1}getNodesBetween(e){const t=this.isBefore(e),n=[],s=new Set;let i=this;for(;i!==null;){const o=i.__key;if(s.has(o)||(s.add(o),n.push(i)),i===e)break;const a=F(i)?t?i.getFirstChild():i.getLastChild():null;if(a!==null){i=a;continue}const l=t?i.getNextSibling():i.getPreviousSibling();if(l!==null){i=l;continue}const u=i.getParentOrThrow();if(s.has(u.__key)||n.push(u),u===e)break;let c=null,d=u;do{if(d===null&&$(68),c=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d===null)break;c!==null||s.has(d.__key)||n.push(d)}while(c===null);i=c}return t||n.reverse(),n}isDirty(){const e=Me()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=Xe(this.__key);return e===null&&$(113),e}getWritable(){it();const e=Qt(),t=Me(),n=e._nodeMap,s=this.__key,i=this.getLatest(),o=t._cloneNotNeeded,a=K();if(a!==null&&a.setCachedNodes(null),o.has(s))return Xn(i),i;const l=Ii(i);return o.add(s),Xn(l),n.set(s,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){$(70)}updateDOM(e,t,n){$(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){$(72)}static importJSON(e){$(18,this.name)}static transform(){return null}remove(e){ai(this,!0,e)}replace(e,t){it();let n=K();n!==null&&(n=n.clone()),Ms(this,e);const s=this.getLatest(),i=this.__key,o=e.__key,a=e.getWritable(),l=this.getParentOrThrow().getWritable(),u=l.__size;hr(a);const c=s.getPreviousSibling(),d=s.getNextSibling(),f=s.__prev,h=s.__next,p=s.__parent;if(ai(s,!1,!0),c===null?l.__first=o:c.getWritable().__next=o,a.__prev=f,d===null?l.__last=o:d.getWritable().__prev=o,a.__next=h,a.__parent=p,l.__size=u,t&&(F(this)&&F(a)||$(139),this.getChildren().forEach(m=>{a.append(m)})),O(n)){jt(n);const m=n.anchor,y=n.focus;m.key===i&&No(m,a),y.key===i&&No(y,a)}return tr()===i&&Qe(o),a}insertAfter(e,t=!0){it(),Ms(this,e);const n=this.getWritable(),s=e.getWritable(),i=s.getParent(),o=K();let a=!1,l=!1;if(i!==null){const h=e.getIndexWithinParent();if(hr(s),O(o)){const p=i.__key,m=o.anchor,y=o.focus;a=m.type==="element"&&m.key===p&&m.offset===h+1,l=y.type==="element"&&y.key===p&&y.offset===h+1}}const u=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),d=s.__key,f=n.__next;if(u===null?c.__last=d:u.getWritable().__prev=d,c.__size++,n.__next=d,s.__next=f,s.__prev=n.__key,s.__parent=n.__parent,t&&O(o)){const h=this.getIndexWithinParent();is(o,c,h+1);const p=c.__key;a&&o.anchor.set(p,h+2,"element"),l&&o.focus.set(p,h+2,"element")}return e}insertBefore(e,t=!0){it(),Ms(this,e);const n=this.getWritable(),s=e.getWritable(),i=s.__key;hr(s);const o=this.getPreviousSibling(),a=this.getParentOrThrow().getWritable(),l=n.__prev,u=this.getIndexWithinParent();o===null?a.__first=i:o.getWritable().__next=i,a.__size++,n.__prev=i,s.__prev=l,s.__next=n.__key,s.__parent=n.__parent;const c=K();return t&&O(c)&&is(c,this.getParentOrThrow(),u),e}isParentRequired(){return!1}createParentElementNode(){return Ue()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){it();const n=this.getPreviousSibling(),s=this.getParentOrThrow();if(n===null)return s.select(0,0);if(F(n))return n.select();if(!z(n)){const i=n.getIndexWithinParent()+1;return s.select(i,i)}return n.select(e,t)}selectNext(e,t){it();const n=this.getNextSibling(),s=this.getParentOrThrow();if(n===null)return s.select();if(F(n))return n.select(0,0);if(!z(n)){const i=n.getIndexWithinParent();return s.select(i,i)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class wn extends vs{static getType(){return"linebreak"}static clone(e){return new wn(e.__key)}constructor(e){super(e)}getTextContent(){return`
66
- `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const n=t.parentElement;if(n!==null&&es(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&Ln(s)){const i=n.lastChild;if(i===t||i.previousSibling===t&&Ln(i))return!0}}return!1}(e)||function(t){const n=t.parentElement;if(n!==null&&es(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&Ln(s))return!1;const i=n.lastChild;if(i===t||i.previousSibling===t&&Ln(i))return!0}return!1}(e)?null:{conversion:Uc,priority:0}}}static importJSON(e){return xr()}exportJSON(){return{type:"linebreak",version:1}}}function Uc(r){return{node:xr()}}function xr(){return $t(new wn)}function pr(r){return r instanceof wn}function Ln(r){return r.nodeType===or&&/^( |\t|\r?\n)+$/.test(r.textContent||"")}function $s(r,e){return 16&e?"code":e&Di?"mark":32&e?"sub":64&e?"sup":null}function zs(r,e){return 1&e?"strong":2&e?"em":"span"}function pa(r,e,t,n,s){const i=n.classList;let o=sn(s,"base");o!==void 0&&i.add(...o),o=sn(s,"underlineStrikethrough");let a=!1;const l=e&Hn&&e&Kn;o!==void 0&&(t&Hn&&t&Kn?(a=!0,l||i.add(...o)):l&&i.remove(...o));for(const u in mr){const c=mr[u];if(o=sn(s,u),o!==void 0)if(t&c){if(a&&(u==="underline"||u==="strikethrough")){e&c&&i.remove(...o);continue}e&c&&(!l||u!=="underline")&&u!=="strikethrough"||i.add(...o)}else e&c&&i.remove(...o)}}function ga(r,e,t){const n=e.firstChild,s=t.isComposing(),i=r+(s?gs:"");if(n==null)e.textContent=i;else{const o=n.nodeValue;if(o!==i)if(s||sr){const[a,l,u]=function(c,d){const f=c.length,h=d.length;let p=0,m=0;for(;p<f&&p<h&&c[p]===d[p];)p++;for(;m+p<f&&m+p<h&&c[f-m-1]===d[h-m-1];)m++;return[p,f-p-m,d.slice(p,h-m)]}(o,i);l!==0&&n.deleteData(a,l),n.insertData(a,u)}else n.nodeValue=i}}function Ao(r,e,t,n,s,i){ga(s,r,e);const o=i.theme.text;o!==void 0&&pa(0,0,n,r,o)}function Pn(r,e){const t=document.createElement(e);return t.appendChild(r),t}class Ir extends vs{static getType(){return"text"}static clone(e){return new Ir(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return bc[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===tr()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=mr[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Yn(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const n=this.__format,s=$s(0,n),i=zs(0,n),o=s===null?i:s,a=document.createElement(o);let l=a;this.hasFormat("code")&&a.setAttribute("spellcheck","false"),s!==null&&(l=document.createElement(i),a.appendChild(l)),Ao(l,this,0,n,this.__text,e);const u=this.__style;return u!==""&&(a.style.cssText=u),a}updateDOM(e,t,n){const s=this.__text,i=e.__format,o=this.__format,a=$s(0,i),l=$s(0,o),u=zs(0,i),c=zs(0,o);if((a===null?u:a)!==(l===null?c:l))return!0;if(a===l&&u!==c){const m=t.firstChild;m==null&&$(48);const y=document.createElement(c);return Ao(y,this,0,o,s,n),t.replaceChild(y,m),!1}let d=t;l!==null&&a!==null&&(d=t.firstChild,d==null&&$(49)),ga(s,d,this);const f=n.theme.text;f!==void 0&&i!==o&&pa(0,i,o,d,f);const h=e.__style,p=this.__style;return h!==p&&(t.style.cssText=p),!1}static importDOM(){return{"#text":()=>({conversion:Kc,priority:0}),b:()=>({conversion:Gc,priority:0}),code:()=>({conversion:Xt,priority:0}),em:()=>({conversion:Xt,priority:0}),i:()=>({conversion:Xt,priority:0}),s:()=>({conversion:Xt,priority:0}),span:()=>({conversion:Wc,priority:0}),strong:()=>({conversion:Xt,priority:0}),sub:()=>({conversion:Xt,priority:0}),sup:()=>({conversion:Xt,priority:0}),u:()=>({conversion:Xt,priority:0})}}static importJSON(e){const t=Ge(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);return t!==null&&Ht(t)||$(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=Pn(t,"b")),this.hasFormat("italic")&&(t=Pn(t,"i")),this.hasFormat("strikethrough")&&(t=Pn(t,"s")),this.hasFormat("underline")&&(t=Pn(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format=typeof e=="string"?mr[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?mc[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Yn(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=xc[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){it();let n=e,s=t;const i=K(),o=this.getTextContent(),a=this.__key;if(typeof o=="string"){const l=o.length;n===void 0&&(n=l),s===void 0&&(s=l)}else n=0,s=0;if(!O(i))return xa(a,n,a,s,"text","text");{const l=tr();l!==i.anchor.key&&l!==i.focus.key||Qe(a),i.setTextNodeRange(this,n,this,s)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,s){const i=this.getWritable(),o=i.__text,a=n.length;let l=e;l<0&&(l=a+l,l<0&&(l=0));const u=K();if(s&&O(u)){const d=e+a;u.setTextNodeRange(i,d,i,d)}const c=o.slice(0,l)+n+o.slice(l+t);return i.__text=c,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){it();const t=this.getLatest(),n=t.getTextContent(),s=t.__key,i=tr(),o=new Set(e),a=[],l=n.length;let u="";for(let A=0;A<l;A++)u!==""&&o.has(A)&&(a.push(u),u=""),u+=n[A];u!==""&&a.push(u);const c=a.length;if(c===0)return[];if(a[0]===n)return[t];const d=a[0],f=t.getParent();let h;const p=t.getFormat(),m=t.getStyle(),y=t.__detail;let D=!1;t.isSegmented()?(h=Ge(d),h.__format=p,h.__style=m,h.__detail=y,D=!0):(h=t.getWritable(),h.__text=d);const x=K(),E=[h];let C=d.length;for(let A=1;A<c;A++){const b=a[A],v=b.length,S=Ge(b).getWritable();S.__format=p,S.__style=m,S.__detail=y;const k=S.__key,j=C+v;if(O(x)){const T=x.anchor,B=x.focus;T.key===s&&T.type==="text"&&T.offset>C&&T.offset<=j&&(T.key=k,T.offset-=C,x.dirty=!0),B.key===s&&B.type==="text"&&B.offset>C&&B.offset<=j&&(B.key=k,B.offset-=C,x.dirty=!0)}i===s&&Qe(k),C=j,E.push(S)}if(f!==null){(function(v){const S=v.getPreviousSibling(),k=v.getNextSibling();S!==null&&Xn(S),k!==null&&Xn(k)})(this);const A=f.getWritable(),b=this.getIndexWithinParent();D?(A.splice(b,0,E),this.remove()):A.splice(b,1,E),O(x)&&is(x,f,b,c-1)}return E}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||$(50);const n=this.__key,s=e.__key,i=this.__text,o=i.length;tr()===s&&Qe(n);const a=K();if(O(a)){const d=a.anchor,f=a.focus;d!==null&&d.key===s&&(jo(d,t,n,e,o),a.dirty=!0),f!==null&&f.key===s&&(jo(f,t,n,e,o),a.dirty=!0)}const l=e.__text,u=t?l+i:i+l;this.setTextContent(u);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function Wc(r){return{forChild:zi(r.style),node:null}}function Gc(r){const e=r,t=e.style.fontWeight==="normal";return{forChild:zi(e.style,t?void 0:"bold"),node:null}}const ko=new WeakMap;function Vc(r){return r.nodeName==="PRE"||r.nodeType===_n&&r.style!==void 0&&r.style.whiteSpace!==void 0&&r.style.whiteSpace.startsWith("pre")}function Kc(r){const e=r;r.parentElement===null&&$(129);let t=e.textContent||"";if(function(n){let s,i=n.parentNode;const o=[n];for(;i!==null&&(s=ko.get(i))===void 0&&!Vc(i);)o.push(i),i=i.parentNode;const a=s===void 0?i:s;for(let l=0;l<o.length;l++)ko.set(o[l],a);return a}(e)!==null){const n=t.split(/(\r?\n|\t)/),s=[],i=n.length;for(let o=0;o<i;o++){const a=n[o];a===`
63
+ `,hc=sr?" ":gs,Il="֑-߿יִ-﷽ﹰ-ﻼ",$l="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",pc=new RegExp("^[^"+$l+"]*["+Il+"]"),gc=new RegExp("^[^"+Il+"]*["+$l+"]"),mr={bold:1,code:16,highlight:Di,italic:2,strikethrough:Kn,subscript:32,superscript:64,underline:Hn},mc={directionless:1,unmergeable:2},lo={center:Si,end:Ni,justify:ki,left:Ei,right:Ai,start:Ti},yc={[Si]:"center",[Ni]:"end",[ki]:"justify",[Ei]:"left",[Ai]:"right",[Ti]:"start"},xc={normal:0,segmented:2,token:1},bc={[uc]:"normal",[dc]:"segmented",[cc]:"token"};function _c(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var $=_c(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Qn(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}const vc=100;let Js=!1,Bi=0;function Cc(r){Bi=r.timeStamp}function Ms(r,e,t){const n=r.nodeName==="BR",s=e.__lexicalLineBreak;return s&&(r===s||n&&r.previousSibling===s)||n&&ys(r,t)!==void 0}function wc(r,e,t){const n=gt(t._window);let s=null,i=null;n!==null&&n.anchorNode===r&&(s=n.anchorOffset,i=n.focusOffset);const o=r.nodeValue;o!==null&&Pi(e,o,s,i,!1)}function Dc(r,e,t){if(O(r)){const n=r.anchor.getNode();if(n.is(t)&&r.format!==n.getFormat())return!1}return e.nodeType===or&&t.isAttached()}function Ec(r,e,t,n){for(let s=r;s&&!Oc(s);s=Cn(s)){const i=ys(s,e);if(i!==void 0){const o=Xe(i,t);if(o)return Ce(o)?void 0:[s,o]}else if(s===n)return[n,Ql(t)]}}function zl(r,e,t){Js=!0;const n=performance.now()-Bi>vc;try{ct(r,()=>{const s=K()||function(f){return f.getEditorState().read(()=>{const h=K();return h!==null?h.clone():null})}(r),i=new Map,o=r.getRootElement(),a=r._editorState,l=r._blockCursorElement;let u=!1,c="";for(let f=0;f<e.length;f++){const h=e[f],p=h.type,m=h.target,y=Ec(m,r,a,o);if(!y)continue;const[w,x]=y;if(p==="characterData")n&&z(x)&&Dc(s,m,x)&&wc(m,x,r);else if(p==="childList"){u=!0;const E=h.addedNodes;for(let b=0;b<E.length;b++){const v=E[b],S=Kl(v),k=v.parentNode;if(k!=null&&v!==l&&S===null&&!Ms(v,k,r)){if(sr){const j=v.innerText||v.nodeValue;j&&(c+=j)}k.removeChild(v)}}const D=h.removedNodes,A=D.length;if(A>0){let b=0;for(let v=0;v<A;v++){const S=D[v];(Ms(S,m,r)||l===S)&&(m.appendChild(S),b++)}A!==b&&i.set(w,x)}}}if(i.size>0)for(const[f,h]of i)h.reconcileObservedMutation(f,r);const d=t.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){const h=d[f],p=h.addedNodes,m=h.target;for(let y=0;y<p.length;y++){const w=p[y],x=w.parentNode;x==null||w.nodeName!=="BR"||Ms(w,m,r)||x.removeChild(w)}}t.takeRecords()}s!==null&&(u&&(s.dirty=!0,jt(s)),sr&&Zl(r)&&s.insertRawText(c))})}finally{Js=!1}}function ql(r){const e=r._observer;e!==null&&zl(r,e.takeRecords(),e)}function Ul(r){(function(e){Bi===0&&bs(e).addEventListener("textInput",Cc,!0)})(r),r._observer=new MutationObserver((e,t)=>{zl(r,e,t)})}function ao(r,e){const t=r.__mode,n=r.__format,s=r.__style,i=e.__mode,o=e.__format,a=e.__style;return!(t!==null&&t!==i||n!==null&&n!==o||s!==null&&s!==a)}function uo(r,e){const t=r.mergeWithSibling(e),n=Pe()._normalizedNodes;return n.add(r.__key),n.add(e.__key),t}function co(r){let e,t,n=r;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&z(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(ao(e,n)){n=uo(e,n);break}break}e.remove()}for(;(t=n.getNextSibling())!==null&&z(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(ao(n,t)){n=uo(n,t);break}break}t.remove()}}else n.remove()}function Wl(r){return fo(r.anchor),fo(r.focus),r}function fo(r){for(;r.type==="element";){const e=r.getNode(),t=r.offset;let n,s;if(t===e.getChildrenSize()?(n=e.getChildAtIndex(t-1),s=!0):(n=e.getChildAtIndex(t),s=!1),z(n)){r.set(n.__key,s?n.getTextContentSize():0,"text");break}if(!F(n))break;r.set(n.__key,s?n.getChildrenSize():0,"element")}}let Sc=1;const Ac=typeof queueMicrotask=="function"?queueMicrotask:r=>{Promise.resolve().then(r)};function Fi(r){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return Ce(jr(r))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&ms(e)==null)}function vn(r,e,t){const n=r.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!Fi(e)&&Gl(e)===r}catch{return!1}}function Ri(r){return r instanceof Ds}function Gl(r){let e=r;for(;e!=null;){const t=ms(e);if(Ri(t))return t;e=Cn(e)}return null}function ms(r){return r?r.__lexicalEditor:null}function cr(r){return r.isToken()||r.isSegmented()}function kc(r){return r.nodeType===or}function Jn(r){let e=r;for(;e!=null;){if(kc(e))return e;e=e.firstChild}return null}function Yn(r,e,t){const n=mr[e];if(t!==null&&(r&n)==(t&n))return r;let s=r^n;return e==="subscript"?s&=-65:e==="superscript"&&(s&=-33),s}function Vl(r){return z(r)||pr(r)||Ce(r)}function Tc(r,e){if(e!=null)return void(r.__key=e);it(),_a();const t=Pe(),n=Qt(),s=""+Sc++;n._nodeMap.set(s,r),F(r)?t._dirtyElements.set(s,!0):t._dirtyLeaves.add(s),t._cloneNotNeeded.add(s),t._dirtyType=Ol,r.__key=s}function hr(r){const e=r.getParent();if(e!==null){const t=r.getWritable(),n=e.getWritable(),s=r.getPreviousSibling(),i=r.getNextSibling();if(s===null)if(i!==null){const o=i.getWritable();n.__first=i.__key,o.__prev=null}else n.__first=null;else{const o=s.getWritable();if(i!==null){const a=i.getWritable();a.__prev=o.__key,o.__next=a.__key}else o.__next=null;t.__prev=null}if(i===null)if(s!==null){const o=s.getWritable();n.__last=s.__key,o.__next=null}else n.__last=null;else{const o=i.getWritable();if(s!==null){const a=s.getWritable();a.__next=o.__key,o.__prev=a.__key}else o.__prev=null;t.__next=null}n.__size--,t.__parent=null}}function Xn(r){_a();const e=r.getLatest(),t=e.__parent,n=Qt(),s=Pe(),i=n._nodeMap,o=s._dirtyElements;t!==null&&function(l,u,c){let d=l;for(;d!==null;){if(c.has(d))return;const f=u.get(d);if(f===void 0)break;c.set(d,!1),d=f.__parent}}(t,i,o);const a=e.__key;s._dirtyType=Ol,F(r)?o.set(a,!0):s._dirtyLeaves.add(a)}function Qe(r){it();const e=Pe(),t=e._compositionKey;if(r!==t){if(e._compositionKey=r,t!==null){const n=Xe(t);n!==null&&n.getWritable()}if(r!==null){const n=Xe(r);n!==null&&n.getWritable()}}}function tr(){return An()?null:Pe()._compositionKey}function Xe(r,e){const t=(e||Qt())._nodeMap.get(r);return t===void 0?null:t}function Kl(r,e){const t=ys(r,Pe());return t!==void 0?Xe(t,e):null}function ys(r,e){return r[`__lexicalKey_${e._key}`]}function jr(r,e){let t=r;for(;t!=null;){const n=Kl(t,e);if(n!==null)return n;t=Cn(t)}return null}function Hl(r){const e=r._decorators,t=Object.assign({},e);return r._pendingDecorators=t,t}function ho(r){return r.read(()=>Fe().getTextContent())}function Fe(){return Ql(Qt())}function Ql(r){return r._nodeMap.get("root")}function jt(r){it();const e=Qt();r!==null&&(r.dirty=!0,r.setCachedNodes(null)),e._selection=r}function Tr(r){const e=Pe(),t=function(n,s){let i=n;for(;i!=null;){const o=ys(i,s);if(o!==void 0)return o;i=Cn(i)}return null}(r,e);return t===null?r===e.getRootElement()?Xe("root"):null:Xe(t)}function po(r,e){return e?r.getTextContentSize():0}function Jl(r){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(r)}function Li(r){const e=[];let t=r;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Yl(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Xl(r){return r.nodeType===or?r.nodeValue:null}function Mi(r,e,t){const n=gt(e._window);if(n===null)return;const s=n.anchorNode;let{anchorOffset:i,focusOffset:o}=n;if(s!==null){let a=Xl(s);const l=jr(s);if(a!==null&&z(l)){if(a===gs&&t){const u=t.length;a=t,i=u,o=u}a!==null&&Pi(l,a,i,o,r)}}}function Pi(r,e,t,n,s){let i=r;if(i.isAttached()&&(s||!i.isDirty())){const o=i.isComposing();let a=e;(o||s)&&e[e.length-1]===gs&&(a=e.slice(0,-1));const l=i.getTextContent();if(s||a!==l){if(a===""){if(Qe(null),ps||bn||wi)i.remove();else{const m=Pe();setTimeout(()=>{m.update(()=>{i.isAttached()&&i.remove()})},20)}return}const u=i.getParent(),c=Sn(),d=i.getTextContentSize(),f=tr(),h=i.getKey();if(i.isToken()||f!==null&&h===f&&!o||O(c)&&(u!==null&&!u.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===r.__key&&c.anchor.offset===0&&!i.canInsertTextBefore()&&!o||c.focus.key===r.__key&&c.focus.offset===d&&!i.canInsertTextAfter()&&!o))return void i.markDirty();const p=K();if(!O(p)||t===null||n===null)return void i.setTextContent(a);if(p.setTextNodeRange(i,t,i,n),i.isSegmented()){const m=Ge(i.getTextContent());i.replace(m),i=m}i.setTextContent(a)}}}function Nc(r,e){if(e.isSegmented())return!0;if(!r.isCollapsed())return!1;const t=r.anchor.offset,n=e.getParentOrThrow(),s=e.isToken();return t===0?!e.canInsertTextBefore()||!n.canInsertTextBefore()&&!e.isComposing()||s||function(i){const o=i.getPreviousSibling();return(z(o)||F(o)&&o.isInline())&&!o.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||s)}function go(r){return r==="ArrowLeft"}function mo(r){return r==="ArrowRight"}function Xr(r,e){return vt?r:e}function yo(r){return r==="Enter"}function Vr(r){return r==="Backspace"}function Kr(r){return r==="Delete"}function xo(r,e,t){return r.toLowerCase()==="a"&&Xr(e,t)}function Bc(){const r=Fe();jt(Wl(r.select(0,r.getChildrenSize())))}function sn(r,e){r.__lexicalClassNameCache===void 0&&(r.__lexicalClassNameCache={});const t=r.__lexicalClassNameCache,n=t[e];if(n!==void 0)return n;const s=r[e];if(typeof s=="string"){const i=Qn(s);return t[e]=i,i}return s}function ji(r,e,t,n,s){if(t.size===0)return;const i=n.__type,o=n.__key,a=e.get(i);a===void 0&&$(33,i);const l=a.klass;let u=r.get(l);u===void 0&&(u=new Map,r.set(l,u));const c=u.get(o),d=c==="destroyed"&&s==="created";(c===void 0||d)&&u.set(o,d?"updated":s)}function bo(r,e,t){const n=r.getParent();let s=t,i=r;return n!==null&&(e&&t===0?(s=i.getIndexWithinParent(),i=n):e||t!==i.getChildrenSize()||(s=i.getIndexWithinParent()+1,i=n)),i.getChildAtIndex(e?s-1:s)}function pn(r,e){const t=r.offset;if(r.type==="element")return bo(r.getNode(),e,t);{const n=r.getNode();if(e&&t===0||!e&&t===n.getTextContentSize()){const s=e?n.getPreviousSibling():n.getNextSibling();return s===null?bo(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):s}}return null}function Zl(r){const e=bs(r).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function G(r,e,t){return wa(r,e,t)}function xs(r){return!tt(r)&&!r.isLastChild()&&!r.isInline()}function Zn(r,e){const t=r._keyToDOMMap.get(e);return t===void 0&&$(75,e),t}function Cn(r){const e=r.assignedSlot||r.parentElement;return e!==null&&e.nodeType===11?e.host:e}function on(r,e){let t=r.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function bs(r){const e=r._window;return e===null&&$(78),e}function Fc(r){let e=r.getParentOrThrow();for(;e!==null;){if(Ot(e))return e;e=e.getParentOrThrow()}return e}function Ot(r){return tt(r)||F(r)&&r.isShadowRoot()}function $t(r){const e=Pe(),t=r.constructor.getType(),n=e._nodes.get(t);n===void 0&&$(200,r.constructor.name,t);const{replace:s,replaceWithKlass:i}=n;if(s!==null){const o=s(r),a=o.constructor;return i!==null?o instanceof i||$(201,i.name,i.getType(),a.name,a.getType(),r.constructor.name,t):o instanceof r.constructor&&a!==r.constructor||$(202,a.name,a.getType(),r.constructor.name,t),o.__key===r.__key&&$(203,r.constructor.name,t,a.name,a.getType()),o}return r}function Ps(r,e){!tt(r.getParent())||F(e)||Ce(e)||$(99)}function js(r){return(Ce(r)||F(r)&&!r.canBeEmpty())&&!r.isInline()}function Oi(r,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const n=r.parentElement;n!==null&&n.removeChild(r)}function Rc(r,e,t){let n=r._blockCursorElement;if(O(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const s=t.anchor,i=s.getNode(),o=s.offset;let a=!1,l=null;if(o===i.getChildrenSize())js(i.getChildAtIndex(o-1))&&(a=!0);else{const u=i.getChildAtIndex(o);if(u!==null&&js(u)){const c=u.getPreviousSibling();(c===null||js(c))&&(a=!0,l=r.getElementByKey(u.__key))}}if(a){const u=r.getElementByKey(i.__key);return n===null&&(r._blockCursorElement=n=function(c){const d=c.theme,f=document.createElement("div");f.contentEditable="false",f.setAttribute("data-lexical-cursor","true");let h=d.blockCursor;if(h!==void 0){if(typeof h=="string"){const p=Qn(h);h=d.blockCursor=p}h!==void 0&&f.classList.add(...h)}return f}(r._config)),e.style.caretColor="transparent",void(l===null?u.appendChild(n):u.insertBefore(n,l))}}n!==null&&Oi(n,r,e)}function gt(r){return At?(r||window).getSelection():null}function Lc(r){return Ht(r)&&r.tagName==="A"}function Ht(r){return r.nodeType===1}function _o(r){return r.nodeType===11}function Ys(r){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return r.nodeName.match(e)!==null}function es(r){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return r.nodeName.match(e)!==null}function Zt(r){if(Ce(r)&&!r.isInline())return!0;if(!F(r)||Ot(r))return!1;const e=r.getFirstChild(),t=e===null||pr(e)||z(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Hr(r,e){let t=r;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function Mc(){return Pe()}const vo=new WeakMap,Pc=new Map;function jc(r){if(!r._readOnly&&r.isEmpty())return Pc;r._readOnly||$(192);let e=vo.get(r);if(!e){e=new Map,vo.set(r,e);for(const[t,n]of r._nodeMap){const s=n.__type;let i=e.get(s);i||(i=new Map,e.set(s,i)),i.set(t,n)}}return e}function Ii(r){const e=r.constructor.clone(r);return e.afterCloneFrom(r),e}function $i(r,e){const t=(parseInt(r.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function Oc(r){return r.__lexicalUnmanaged===!0}function ea(r,e,t,n,s,i){let o=r.getFirstChild();for(;o!==null;){const a=o.__key;o.__parent===e&&(F(o)&&ea(o,a,t,n,s,i),t.has(a)||i.delete(a),s.push(a)),o=o.getNextSibling()}}let ir,rt,gn,_s,Xs,Zs,yr,Et,ei,mn,Ve="",et="",Rt=null,Ct="",Vt="",ta=!1,yn=!1,zn=null;function ts(r,e){const t=yr.get(r);if(e!==null){const n=ni(r);n.parentNode===e&&e.removeChild(n)}if(Et.has(r)||rt._keyToDOMMap.delete(r),F(t)){const n=ns(t,yr);ti(n,0,n.length-1,null)}t!==void 0&&ji(mn,gn,_s,t,"destroyed")}function ti(r,e,t,n){let s=e;for(;s<=t;++s){const i=r[s];i!==void 0&&ts(i,n)}}function ur(r,e){r.setProperty("text-align",e)}const Ic="40px";function ra(r,e){const t=ir.theme.indent;if(typeof t=="string"){const s=r.classList.contains(t);e>0&&!s?r.classList.add(t):e<1&&s&&r.classList.remove(t)}const n=getComputedStyle(r).getPropertyValue("--lexical-indent-base-value")||Ic;r.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function na(r,e){const t=r.style;e===0?ur(t,""):e===Ei?ur(t,"left"):e===Si?ur(t,"center"):e===Ai?ur(t,"right"):e===ki?ur(t,"justify"):e===Ti?ur(t,"start"):e===Ni&&ur(t,"end")}function rs(r,e){const t=Et.get(r);t===void 0&&$(60);const n=t.createDOM(ir,rt);if(function(s,i,o){const a=o._keyToDOMMap;(function(l,u,c){l[`__lexicalKey_${u._key}`]=c})(i,o,s),a.set(s,i)}(r,n,rt),z(t)?n.setAttribute("data-lexical-text","true"):Ce(t)&&n.setAttribute("data-lexical-decorator","true"),F(t)){const s=t.__indent,i=t.__size;if(s!==0&&ra(n,s),i!==0){const a=i-1;(function(l,u,c,d){const f=et;et="",ri(l,c,0,u,c.getDOMSlot(d)),ia(c,d),et=f})(ns(t,Et),a,t,n)}const o=t.__format;o!==0&&na(n,o),t.isInline()||sa(null,t,n),xs(t)&&(Ve+=Kt,Vt+=Kt)}else{const s=t.getTextContent();if(Ce(t)){const i=t.decorate(rt,ir);i!==null&&oa(r,i),n.contentEditable="false"}else z(t)&&(t.isDirectionless()||(et+=s));Ve+=s,Vt+=s}return e!==null&&e.insertChild(n),ji(mn,gn,_s,t,"created"),n}function ri(r,e,t,n,s){const i=Ve;Ve="";let o=t;for(;o<=n;++o){rs(r[o],s);const a=Et.get(r[o]);a!==null&&z(a)&&(Rt===null&&(Rt=a.getFormat()),Ct===""&&(Ct=a.getStyle()))}xs(e)&&(Ve+=Kt),s.element.__lexicalTextContent=Ve,Ve=i+Ve}function Co(r,e){if(r){const t=r.__last;if(t){const n=e.get(t);if(n)return pr(n)?"line-break":Ce(n)&&n.isInline()?"decorator":null}return"empty"}return null}function sa(r,e,t){const n=Co(r,yr),s=Co(e,Et);n!==s&&e.getDOMSlot(t).setManagedLineBreak(s)}function ia(r,e){const t=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(t!==et||n!==zn){const i=et==="",o=i?zn:(s=et,pc.test(s)?"rtl":gc.test(s)?"ltr":null);if(o!==n){const a=e.classList,l=ir.theme;let u=n!==null?l[n]:void 0,c=o!==null?l[o]:void 0;if(u!==void 0){if(typeof u=="string"){const d=Qn(u);u=l[n]=d}a.remove(...u)}if(o===null||i&&o==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){const d=Qn(c);c=l[o]=d}c!==void 0&&a.add(...c)}e.dir=o}yn||(r.getWritable().__dir=o)}zn=o,e.__lexicalDirTextContent=et,e.__lexicalDir=o}var s}function $c(r,e,t){const n=et;var s;et="",Rt=null,Ct="",function(i,o,a){const l=Ve,u=i.__size,c=o.__size;Ve="";const d=a.element;if(u===1&&c===1){const f=i.__first,h=o.__first;if(f===h)Zr(f,d);else{const m=ni(f),y=rs(h,null);try{d.replaceChild(y,m)}catch(w){if(typeof w=="object"&&w!=null){const x=`${w.toString()} Parent: ${d.tagName}, new child: {tag: ${y.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${f}}.`;throw new Error(x)}throw w}ts(f,null)}const p=Et.get(h);z(p)&&(Rt===null&&(Rt=p.getFormat()),Ct===""&&(Ct=p.getStyle()))}else{const f=ns(i,yr),h=ns(o,Et);if(f.length!==u&&$(227),h.length!==c&&$(228),u===0)c!==0&&ri(h,o,0,c-1,a);else if(c===0){if(u!==0){const p=a.after==null&&a.before==null&&a.element.__lexicalLineBreak==null;ti(f,0,u-1,p?null:d),p&&(d.textContent="")}}else(function(p,m,y,w,x,E){const D=w-1,A=x-1;let b,v,S=E.getFirstChild(),k=0,j=0;for(;k<=D&&j<=A;){const L=m[k],R=y[j];if(L===R)S=Os(Zr(R,E.element)),k++,j++;else{b===void 0&&(b=new Set(m)),v===void 0&&(v=new Set(y));const Q=v.has(L),se=b.has(R);if(Q)if(se){const xe=Zn(rt,R);xe===S?S=Os(Zr(R,E.element)):(E.withBefore(S).insertChild(xe),Zr(R,E.element)),k++,j++}else rs(R,E.withBefore(S)),j++;else S=Os(ni(L)),ts(L,E.element),k++}const P=Et.get(R);P!==null&&z(P)&&(Rt===null&&(Rt=P.getFormat()),Ct===""&&(Ct=P.getStyle()))}const T=k>D,B=j>A;if(T&&!B){const L=y[A+1],R=L===void 0?null:rt.getElementByKey(L);ri(y,p,j,A,E.withBefore(R))}else B&&!T&&ti(m,k,D,E.element)})(o,f,h,u,c,a)}xs(o)&&(Ve+=Kt),d.__lexicalTextContent=Ve,Ve=l+Ve}(r,e,e.getDOMSlot(t)),ia(e,t),Or(s=e)&&Rt!=null&&Rt!==s.__textFormat&&!yn&&(s.setTextFormat(Rt),s.setTextStyle(Ct)),function(i){Or(i)&&Ct!==""&&Ct!==i.__textStyle&&!yn&&i.setTextStyle(Ct)}(e),et=n}function ns(r,e){const t=[];let n=r.__first;for(;n!==null;){const s=e.get(n);s===void 0&&$(101),t.push(n),n=s.__next}return t}function Zr(r,e){const t=yr.get(r);let n=Et.get(r);t!==void 0&&n!==void 0||$(61);const s=ta||Zs.has(r)||Xs.has(r),i=Zn(rt,r);if(t===n&&!s){if(F(t)){const o=i.__lexicalTextContent;o!==void 0&&(Ve+=o,Vt+=o);const a=i.__lexicalDirTextContent;a!==void 0&&(et+=a)}else{const o=t.getTextContent();z(t)&&!t.isDirectionless()&&(et+=o),Vt+=o,Ve+=o}return i}if(t!==n&&s&&ji(mn,gn,_s,n,"updated"),n.updateDOM(t,i,ir)){const o=rs(r,null);return e===null&&$(62),e.replaceChild(o,i),ts(r,null),o}if(F(t)&&F(n)){const o=n.__indent;o!==t.__indent&&ra(i,o);const a=n.__format;a!==t.__format&&na(i,a),s&&($c(t,n,i),tt(n)||n.isInline()||sa(t,n,i)),xs(n)&&(Ve+=Kt,Vt+=Kt)}else{const o=n.getTextContent();if(Ce(n)){const a=n.decorate(rt,ir);a!==null&&oa(r,a)}else z(n)&&!n.isDirectionless()&&(et+=o);Ve+=o,Vt+=o}if(!yn&&tt(n)&&n.__cachedText!==Vt){const o=n.getWritable();o.__cachedText=Vt,n=o}return i}function oa(r,e){let t=rt._pendingDecorators;const n=rt._decorators;if(t===null){if(n[r]===e)return;t=Hl(rt)}t[r]=e}function Os(r){let e=r.nextSibling;return e!==null&&e===rt._blockCursorElement&&(e=e.nextSibling),e}function zc(r,e,t,n,s,i){Ve="",Vt="",et="",ta=n===Pr,zn=null,rt=t,ir=t._config,gn=t._nodes,_s=rt._listeners.mutation,Xs=s,Zs=i,yr=r._nodeMap,Et=e._nodeMap,yn=e._readOnly,ei=new Map(t._keyToDOMMap);const o=new Map;return mn=o,Zr("root",null),rt=void 0,gn=void 0,Xs=void 0,Zs=void 0,yr=void 0,Et=void 0,ir=void 0,ei=void 0,mn=void 0,o}function ni(r){const e=ei.get(r);return e===void 0&&$(75,r),e}const Gt=Object.freeze({}),si=30,ii=[["keydown",function(r,e){if(ln=r.timeStamp,la=r.key,e.isComposing())return;const{key:t,shiftKey:n,ctrlKey:s,metaKey:i,altKey:o}=r;if(!G(e,Vu,r)&&t!=null){if(function(a,l,u,c){return mo(a)&&!l&&!c&&!u}(t,s,o,i))G(e,Al,r);else if(function(a,l,u,c,d){return mo(a)&&!c&&!u&&(l||d)}(t,s,n,o,i))G(e,Ku,r);else if(function(a,l,u,c){return go(a)&&!l&&!c&&!u}(t,s,o,i))G(e,kl,r);else if(function(a,l,u,c,d){return go(a)&&!c&&!u&&(l||d)}(t,s,n,o,i))G(e,Hu,r);else if(function(a,l,u){return function(c){return c==="ArrowUp"}(a)&&!l&&!u}(t,s,i))G(e,Tl,r);else if(function(a,l,u){return function(c){return c==="ArrowDown"}(a)&&!l&&!u}(t,s,i))G(e,Nl,r);else if(function(a,l){return yo(a)&&l}(t,n))an=!0,G(e,Gn,r);else if(function(a){return a===" "}(t))G(e,Qu,r);else if(function(a,l){return vt&&l&&a.toLowerCase()==="o"}(t,s))r.preventDefault(),an=!0,G(e,Fr,!0);else if(function(a,l){return yo(a)&&!l}(t,n))an=!1,G(e,Gn,r);else if(function(a,l,u,c){return vt?!l&&!u&&(Vr(a)||a.toLowerCase()==="h"&&c):!(c||l||u)&&Vr(a)}(t,o,i,s))Vr(t)?G(e,Bl,r):(r.preventDefault(),G(e,fr,!0));else if(function(a){return a==="Escape"}(t))G(e,Fl,r);else if(function(a,l,u,c,d){return vt?!(u||c||d)&&(Kr(a)||a.toLowerCase()==="d"&&l):!(l||c||d)&&Kr(a)}(t,s,n,o,i))Kr(t)?G(e,Rl,r):(r.preventDefault(),G(e,fr,!1));else if(function(a,l,u){return Vr(a)&&(vt?l:u)}(t,o,s))r.preventDefault(),G(e,fn,!0);else if(function(a,l,u){return Kr(a)&&(vt?l:u)}(t,o,s))r.preventDefault(),G(e,fn,!1);else if(function(a,l){return vt&&l&&Vr(a)}(t,i))r.preventDefault(),G(e,hn,!0);else if(function(a,l){return vt&&l&&Kr(a)}(t,i))r.preventDefault(),G(e,hn,!1);else if(function(a,l,u,c){return a.toLowerCase()==="b"&&!l&&Xr(u,c)}(t,o,i,s))r.preventDefault(),G(e,Dt,"bold");else if(function(a,l,u,c){return a.toLowerCase()==="u"&&!l&&Xr(u,c)}(t,o,i,s))r.preventDefault(),G(e,Dt,"underline");else if(function(a,l,u,c){return a.toLowerCase()==="i"&&!l&&Xr(u,c)}(t,o,i,s))r.preventDefault(),G(e,Dt,"italic");else if(function(a,l,u,c){return a==="Tab"&&!l&&!u&&!c}(t,o,s,i))G(e,Ju,r);else if(function(a,l,u,c){return a.toLowerCase()==="z"&&!l&&Xr(u,c)}(t,n,i,s))r.preventDefault(),G(e,_i,void 0);else if(function(a,l,u,c){return vt?a.toLowerCase()==="z"&&u&&l:a.toLowerCase()==="y"&&c||a.toLowerCase()==="z"&&c&&l}(t,n,i,s))r.preventDefault(),G(e,vi,void 0);else{const a=e._editorState._selection;a===null||O(a)?!sr&&xo(t,i,s)&&(r.preventDefault(),G(e,Qs,r)):function(l,u,c,d){return!u&&l.toLowerCase()==="c"&&(vt?c:d)}(t,n,i,s)?(r.preventDefault(),G(e,hs,r)):function(l,u,c,d){return!u&&l.toLowerCase()==="x"&&(vt?c:d)}(t,n,i,s)?(r.preventDefault(),G(e,Ci,r)):xo(t,i,s)&&(r.preventDefault(),G(e,Qs,r))}(function(a,l,u,c){return a||l||u||c})(s,n,o,i)&&G(e,ic,r)}}],["pointerdown",function(r,e){const t=r.target,n=r.pointerType;t instanceof Node&&n!=="touch"&&ct(e,()=>{Ce(jr(t))||(li=!0)})}],["compositionstart",function(r,e){ct(e,()=>{const t=K();if(O(t)&&!e.isComposing()){const n=t.anchor,s=t.anchor.getNode();Qe(n.key),(r.timeStamp<ln+si||n.type==="element"||!t.isCollapsed()||s.getFormat()!==t.format||z(s)&&s.getStyle()!==t.style)&&G(e,Rr,hc)}})}],["compositionend",function(r,e){sr?Qr=!0:ct(e,()=>{Is(e,r.data)})}],["input",function(r,e){r.stopPropagation(),ct(e,()=>{const t=K(),n=r.data,s=da(r);if(n!=null&&O(t)&&ca(t,s,n,r.timeStamp,!1)){Qr&&(Is(e,n),Qr=!1);const i=t.anchor.getNode(),o=gt(e._window);if(o===null)return;const a=t.isBackward(),l=a?t.anchor.offset:t.focus.offset,u=a?t.focus.offset:t.anchor.offset;Vn&&!t.isCollapsed()&&z(i)&&o.anchorNode!==null&&i.getTextContent().slice(0,l)+n+i.getTextContent().slice(l+u)===Xl(o.anchorNode)||G(e,Rr,n);const c=n.length;sr&&c>1&&r.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=c),ps||bn||wi||!e.isComposing()||(ln=0,Qe(null))}else Mi(!1,e,n!==null?n:void 0),Qr&&(Is(e,n||void 0),Qr=!1);it(),ql(Pe())}),kr=null}],["click",function(r,e){ct(e,()=>{const t=K(),n=gt(e._window),s=Sn();if(n){if(O(t)){const i=t.anchor,o=i.getNode();i.type==="element"&&i.offset===0&&t.isCollapsed()&&!tt(o)&&Fe().getChildrenSize()===1&&o.getTopLevelElementOrThrow().isEmpty()&&s!==null&&t.is(s)?(n.removeAllRanges(),t.dirty=!0):r.detail===3&&!t.isCollapsed()&&o!==t.focus.getNode()&&(F(o)?o.select(0):o.getParentOrThrow().select(0))}else if(r.pointerType==="touch"){const i=n.anchorNode;if(i!==null){const o=i.nodeType;(o===_n||o===or)&&jt(qi(s,n,e,r))}}}G(e,Sl,r)})}],["cut",Gt],["copy",Gt],["dragstart",Gt],["dragover",Gt],["dragend",Gt],["paste",Gt],["focus",Gt],["blur",Gt],["drop",Gt]];Vn&&ii.push(["beforeinput",(r,e)=>function(t,n){const s=t.inputType,i=da(t);s==="deleteCompositionText"||sr&&Zl(n)||s!=="insertCompositionText"&&ct(n,()=>{const o=K();if(s==="deleteContentBackward"){if(o===null){const h=Sn();if(!O(h))return;jt(h.clone())}if(O(o)){const h=o.anchor.key===o.focus.key;if(a=t.timeStamp,la==="MediaLast"&&a<ln+si&&n.isComposing()&&h){if(Qe(null),ln=0,setTimeout(()=>{ct(n,()=>{Qe(null)})},si),O(o)){const p=o.anchor.getNode();p.markDirty(),o.format=p.getFormat(),z(p)||$(142),o.style=p.getStyle()}}else{Qe(null),t.preventDefault();const p=o.anchor.getNode(),m=p.getTextContent(),y=p.canInsertTextAfter(),w=o.anchor.offset===0&&o.focus.offset===m.length;ac&&h&&!w&&y||G(n,fr,!0)}return}}var a;if(!O(o))return;const l=t.data;kr!==null&&Mi(!1,n,kr),o.dirty&&kr===null||!o.isCollapsed()||tt(o.anchor.getNode())||i===null||o.applyDOMRange(i),kr=null;const u=o.anchor,c=o.focus,d=u.getNode(),f=c.getNode();if(s!=="insertText"&&s!=="insertTranspose")switch(t.preventDefault(),s){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":G(n,Rr,t);break;case"insertFromComposition":Qe(null),G(n,Rr,t);break;case"insertLineBreak":Qe(null),G(n,Fr,!1);break;case"insertParagraph":Qe(null),an&&!bn?(an=!1,G(n,Fr,!1)):G(n,dn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":G(n,fs,t);break;case"deleteByComposition":(function(h,p){return h!==p||F(h)||F(p)||!h.isToken()||!p.isToken()})(d,f)&&G(n,Hs,t);break;case"deleteByDrag":case"deleteByCut":G(n,Hs,t);break;case"deleteContent":G(n,fr,!1);break;case"deleteWordBackward":G(n,fn,!0);break;case"deleteWordForward":G(n,fn,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":G(n,hn,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":G(n,hn,!1);break;case"formatStrikeThrough":G(n,Dt,"strikethrough");break;case"formatBold":G(n,Dt,"bold");break;case"formatItalic":G(n,Dt,"italic");break;case"formatUnderline":G(n,Dt,"underline");break;case"historyUndo":G(n,_i,void 0);break;case"historyRedo":G(n,vi,void 0)}else{if(l===`
64
+ `)t.preventDefault(),G(n,Fr,!1);else if(l===Kt)t.preventDefault(),G(n,dn,void 0);else if(l==null&&t.dataTransfer){const h=t.dataTransfer.getData("text/plain");t.preventDefault(),o.insertRawText(h)}else l!=null&&ca(o,i,l,t.timeStamp,!0)?(t.preventDefault(),G(n,Rr,l)):kr=l;aa=t.timeStamp}})}(r,e)]);let ln=0,la=null,aa=0,kr=null;const ss=new WeakMap;let oi=!1,li=!1,an=!1,Qr=!1,ua=[0,"",0,"root",0];function ca(r,e,t,n,s){const i=r.anchor,o=r.focus,a=i.getNode(),l=Pe(),u=gt(l._window),c=u!==null?u.anchorNode:null,d=i.key,f=l.getElementByKey(d),h=t.length;return d!==o.key||!z(a)||(!s&&(!Vn||aa<n+50)||a.isDirty()&&h<2||Jl(t))&&i.offset!==o.offset&&!a.isComposing()||cr(a)||a.isDirty()&&h>1||(s||!Vn)&&f!==null&&!a.isComposing()&&c!==Jn(f)||u!==null&&e!==null&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||a.getFormat()!==r.format||a.getStyle()!==r.style||Nc(r,a)}function wo(r,e){return r!==null&&r.nodeValue!==null&&r.nodeType===or&&e!==0&&e!==r.nodeValue.length}function Do(r,e,t){const{anchorNode:n,anchorOffset:s,focusNode:i,focusOffset:o}=r;oi&&(oi=!1,wo(n,s)&&wo(i,o))||ct(e,()=>{if(!t)return void jt(null);if(!vn(e,n,i))return;const a=K();if(O(a)){const l=a.anchor,u=l.getNode();if(a.isCollapsed()){r.type==="Range"&&r.anchorNode===r.focusNode&&(a.dirty=!0);const c=bs(e).event,d=c?c.timeStamp:performance.now(),[f,h,p,m,y]=ua,w=Fe(),x=e.isComposing()===!1&&w.getTextContent()==="";if(d<y+200&&l.offset===p&&l.key===m)a.format=f,a.style=h;else if(l.type==="text")z(u)||$(141),a.format=u.getFormat(),a.style=u.getStyle();else if(l.type==="element"&&!x){const E=l.getNode();a.style="",E instanceof $r&&E.getChildrenSize()===0?(a.format=E.getTextFormat(),a.style=E.getTextStyle()):a.format=0}}else{const c=l.key,d=a.focus.key,f=a.getNodes(),h=f.length,p=a.isBackward(),m=p?o:s,y=p?s:o,w=p?d:c,x=p?c:d;let E=fc,D=!1;for(let A=0;A<h;A++){const b=f[A],v=b.getTextContentSize();if(z(b)&&v!==0&&!(A===0&&b.__key===w&&m===v||A===h-1&&b.__key===x&&y===0)&&(D=!0,E&=b.getFormat(),E===0))break}a.format=D?E:0}}G(e,bi,void 0)})}function da(r){if(!r.getTargetRanges)return null;const e=r.getTargetRanges();return e.length===0?null:e[0]}function Is(r,e){const t=r._compositionKey;if(Qe(null),t!==null&&e!=null){if(e===""){const n=Xe(t),s=Jn(r.getElementByKey(t));return void(s!==null&&s.nodeValue!==null&&z(n)&&Pi(n,s.nodeValue,null,null,!0))}if(e[e.length-1]===`
65
+ `){const n=K();if(O(n)){const s=n.focus;return n.anchor.set(s.key,s.offset,s.type),void G(r,Gn,null)}}}Mi(!0,r,e)}function fa(r){let e=r.__lexicalEventHandles;return e===void 0&&(e=[],r.__lexicalEventHandles=e),e}const Lr=new Map;function ha(r){const e=r.target,t=gt(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const n=Gl(t.anchorNode);if(n===null)return;li&&(li=!1,ct(n,()=>{const u=Sn(),c=t.anchorNode;if(c===null)return;const d=c.nodeType;d!==_n&&d!==or||jt(qi(u,t,n,r))}));const s=Li(n),i=s[s.length-1],o=i._key,a=Lr.get(o),l=a||i;l!==n&&Do(t,l,!1),Do(t,n,!0),n!==i?Lr.set(o,n):a&&Lr.delete(o)}function Eo(r){r._lexicalHandled=!0}function So(r){return r._lexicalHandled===!0}function qc(r){const e=r.ownerDocument,t=ss.get(e);t===void 0&&$(162);const n=t-1;n>=0||$(164),ss.set(e,n),n===0&&e.removeEventListener("selectionchange",ha);const s=ms(r);Ri(s)?(function(o){if(o._parentEditor!==null){const a=Li(o),l=a[a.length-1]._key;Lr.get(l)===o&&Lr.delete(l)}else Lr.delete(o._key)}(s),r.__lexicalEditor=null):s&&$(198);const i=fa(r);for(let o=0;o<i.length;o++)i[o]();r.__lexicalEventHandles=[]}function ai(r,e,t){it();const n=r.__key,s=r.getParent();if(s===null)return;const i=function(a){const l=K();if(!O(l)||!F(a))return l;const{anchor:u,focus:c}=l,d=u.getNode(),f=c.getNode();return on(d,a)&&u.set(a.__key,0,"element"),on(f,a)&&c.set(a.__key,0,"element"),l}(r);let o=!1;if(O(i)&&e){const a=i.anchor,l=i.focus;a.key===n&&(os(a,r,s,r.getPreviousSibling(),r.getNextSibling()),o=!0),l.key===n&&(os(l,r,s,r.getPreviousSibling(),r.getNextSibling()),o=!0)}else Lt(i)&&e&&r.isSelected()&&r.selectPrevious();if(O(i)&&e&&!o){const a=r.getIndexWithinParent();hr(r),is(i,s,a,-1)}else hr(r);t||Ot(s)||s.canBeEmpty()||!s.isEmpty()||ai(s,e),e&&tt(s)&&s.isEmpty()&&s.selectEnd()}class vs{static getType(){$(64,this.name)}static clone(e){$(65,this.name)}afterCloneFrom(e){this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Tc(this,e)}getType(){return this.__type}isInline(){$(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=Xe(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||K();if(t==null)return!1;const n=t.getNodes().some(s=>s.__key===this.__key);if(z(this))return n;if(O(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const s=this.getParent();if(Ce(this)&&this.isInline()&&s){const i=t.isBackward()?t.focus:t.anchor,o=i.getNode();if(i.offset===o.getChildrenSize()&&o.is(s)&&o.getLastChildOrThrow().is(this))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:Xe(e)}getParentOrThrow(){const e=this.getParent();return e===null&&$(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(Ot(t))return F(e)||e===this&&Ce(e)||$(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&$(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:Xe(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return e===null?null:Xe(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=this.getParents(),n=e.getParents();F(this)&&t.unshift(this),F(e)&&n.unshift(e);const s=t.length,i=n.length;if(s===0||i===0||t[s-1]!==n[i-1])return null;const o=new Set(n);for(let a=0;a<s;a++){const l=t[a];if(o.has(l))return l}return null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;const t=this.getCommonAncestor(e);let n=0,s=0,i=this;for(;;){const o=i.getParentOrThrow();if(o===t){n=i.getIndexWithinParent();break}i=o}for(i=e;;){const o=i.getParentOrThrow();if(o===t){s=i.getIndexWithinParent();break}i=o}return n<s}isParentOf(e){const t=this.__key;if(t===e.__key)return!1;let n=e;for(;n!==null;){if(n.__key===t)return!0;n=n.getParent()}return!1}getNodesBetween(e){const t=this.isBefore(e),n=[],s=new Set;let i=this;for(;i!==null;){const o=i.__key;if(s.has(o)||(s.add(o),n.push(i)),i===e)break;const a=F(i)?t?i.getFirstChild():i.getLastChild():null;if(a!==null){i=a;continue}const l=t?i.getNextSibling():i.getPreviousSibling();if(l!==null){i=l;continue}const u=i.getParentOrThrow();if(s.has(u.__key)||n.push(u),u===e)break;let c=null,d=u;do{if(d===null&&$(68),c=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d===null)break;c!==null||s.has(d.__key)||n.push(d)}while(c===null);i=c}return t||n.reverse(),n}isDirty(){const e=Pe()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=Xe(this.__key);return e===null&&$(113),e}getWritable(){it();const e=Qt(),t=Pe(),n=e._nodeMap,s=this.__key,i=this.getLatest(),o=t._cloneNotNeeded,a=K();if(a!==null&&a.setCachedNodes(null),o.has(s))return Xn(i),i;const l=Ii(i);return o.add(s),Xn(l),n.set(s,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){$(70)}updateDOM(e,t,n){$(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){$(72)}static importJSON(e){$(18,this.name)}static transform(){return null}remove(e){ai(this,!0,e)}replace(e,t){it();let n=K();n!==null&&(n=n.clone()),Ps(this,e);const s=this.getLatest(),i=this.__key,o=e.__key,a=e.getWritable(),l=this.getParentOrThrow().getWritable(),u=l.__size;hr(a);const c=s.getPreviousSibling(),d=s.getNextSibling(),f=s.__prev,h=s.__next,p=s.__parent;if(ai(s,!1,!0),c===null?l.__first=o:c.getWritable().__next=o,a.__prev=f,d===null?l.__last=o:d.getWritable().__prev=o,a.__next=h,a.__parent=p,l.__size=u,t&&(F(this)&&F(a)||$(139),this.getChildren().forEach(m=>{a.append(m)})),O(n)){jt(n);const m=n.anchor,y=n.focus;m.key===i&&No(m,a),y.key===i&&No(y,a)}return tr()===i&&Qe(o),a}insertAfter(e,t=!0){it(),Ps(this,e);const n=this.getWritable(),s=e.getWritable(),i=s.getParent(),o=K();let a=!1,l=!1;if(i!==null){const h=e.getIndexWithinParent();if(hr(s),O(o)){const p=i.__key,m=o.anchor,y=o.focus;a=m.type==="element"&&m.key===p&&m.offset===h+1,l=y.type==="element"&&y.key===p&&y.offset===h+1}}const u=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),d=s.__key,f=n.__next;if(u===null?c.__last=d:u.getWritable().__prev=d,c.__size++,n.__next=d,s.__next=f,s.__prev=n.__key,s.__parent=n.__parent,t&&O(o)){const h=this.getIndexWithinParent();is(o,c,h+1);const p=c.__key;a&&o.anchor.set(p,h+2,"element"),l&&o.focus.set(p,h+2,"element")}return e}insertBefore(e,t=!0){it(),Ps(this,e);const n=this.getWritable(),s=e.getWritable(),i=s.__key;hr(s);const o=this.getPreviousSibling(),a=this.getParentOrThrow().getWritable(),l=n.__prev,u=this.getIndexWithinParent();o===null?a.__first=i:o.getWritable().__next=i,a.__size++,n.__prev=i,s.__prev=l,s.__next=n.__key,s.__parent=n.__parent;const c=K();return t&&O(c)&&is(c,this.getParentOrThrow(),u),e}isParentRequired(){return!1}createParentElementNode(){return Ue()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){it();const n=this.getPreviousSibling(),s=this.getParentOrThrow();if(n===null)return s.select(0,0);if(F(n))return n.select();if(!z(n)){const i=n.getIndexWithinParent()+1;return s.select(i,i)}return n.select(e,t)}selectNext(e,t){it();const n=this.getNextSibling(),s=this.getParentOrThrow();if(n===null)return s.select();if(F(n))return n.select(0,0);if(!z(n)){const i=n.getIndexWithinParent();return s.select(i,i)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class wn extends vs{static getType(){return"linebreak"}static clone(e){return new wn(e.__key)}constructor(e){super(e)}getTextContent(){return`
66
+ `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const n=t.parentElement;if(n!==null&&es(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&Ln(s)){const i=n.lastChild;if(i===t||i.previousSibling===t&&Ln(i))return!0}}return!1}(e)||function(t){const n=t.parentElement;if(n!==null&&es(n)){const s=n.firstChild;if(s===t||s.nextSibling===t&&Ln(s))return!1;const i=n.lastChild;if(i===t||i.previousSibling===t&&Ln(i))return!0}return!1}(e)?null:{conversion:Uc,priority:0}}}static importJSON(e){return xr()}exportJSON(){return{type:"linebreak",version:1}}}function Uc(r){return{node:xr()}}function xr(){return $t(new wn)}function pr(r){return r instanceof wn}function Ln(r){return r.nodeType===or&&/^( |\t|\r?\n)+$/.test(r.textContent||"")}function $s(r,e){return 16&e?"code":e&Di?"mark":32&e?"sub":64&e?"sup":null}function zs(r,e){return 1&e?"strong":2&e?"em":"span"}function pa(r,e,t,n,s){const i=n.classList;let o=sn(s,"base");o!==void 0&&i.add(...o),o=sn(s,"underlineStrikethrough");let a=!1;const l=e&Hn&&e&Kn;o!==void 0&&(t&Hn&&t&Kn?(a=!0,l||i.add(...o)):l&&i.remove(...o));for(const u in mr){const c=mr[u];if(o=sn(s,u),o!==void 0)if(t&c){if(a&&(u==="underline"||u==="strikethrough")){e&c&&i.remove(...o);continue}e&c&&(!l||u!=="underline")&&u!=="strikethrough"||i.add(...o)}else e&c&&i.remove(...o)}}function ga(r,e,t){const n=e.firstChild,s=t.isComposing(),i=r+(s?gs:"");if(n==null)e.textContent=i;else{const o=n.nodeValue;if(o!==i)if(s||sr){const[a,l,u]=function(c,d){const f=c.length,h=d.length;let p=0,m=0;for(;p<f&&p<h&&c[p]===d[p];)p++;for(;m+p<f&&m+p<h&&c[f-m-1]===d[h-m-1];)m++;return[p,f-p-m,d.slice(p,h-m)]}(o,i);l!==0&&n.deleteData(a,l),n.insertData(a,u)}else n.nodeValue=i}}function Ao(r,e,t,n,s,i){ga(s,r,e);const o=i.theme.text;o!==void 0&&pa(0,0,n,r,o)}function Mn(r,e){const t=document.createElement(e);return t.appendChild(r),t}class Ir extends vs{static getType(){return"text"}static clone(e){return new Ir(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return bc[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===tr()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=mr[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Yn(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const n=this.__format,s=$s(0,n),i=zs(0,n),o=s===null?i:s,a=document.createElement(o);let l=a;this.hasFormat("code")&&a.setAttribute("spellcheck","false"),s!==null&&(l=document.createElement(i),a.appendChild(l)),Ao(l,this,0,n,this.__text,e);const u=this.__style;return u!==""&&(a.style.cssText=u),a}updateDOM(e,t,n){const s=this.__text,i=e.__format,o=this.__format,a=$s(0,i),l=$s(0,o),u=zs(0,i),c=zs(0,o);if((a===null?u:a)!==(l===null?c:l))return!0;if(a===l&&u!==c){const m=t.firstChild;m==null&&$(48);const y=document.createElement(c);return Ao(y,this,0,o,s,n),t.replaceChild(y,m),!1}let d=t;l!==null&&a!==null&&(d=t.firstChild,d==null&&$(49)),ga(s,d,this);const f=n.theme.text;f!==void 0&&i!==o&&pa(0,i,o,d,f);const h=e.__style,p=this.__style;return h!==p&&(t.style.cssText=p),!1}static importDOM(){return{"#text":()=>({conversion:Kc,priority:0}),b:()=>({conversion:Gc,priority:0}),code:()=>({conversion:Xt,priority:0}),em:()=>({conversion:Xt,priority:0}),i:()=>({conversion:Xt,priority:0}),s:()=>({conversion:Xt,priority:0}),span:()=>({conversion:Wc,priority:0}),strong:()=>({conversion:Xt,priority:0}),sub:()=>({conversion:Xt,priority:0}),sup:()=>({conversion:Xt,priority:0}),u:()=>({conversion:Xt,priority:0})}}static importJSON(e){const t=Ge(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);return t!==null&&Ht(t)||$(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=Mn(t,"b")),this.hasFormat("italic")&&(t=Mn(t,"i")),this.hasFormat("strikethrough")&&(t=Mn(t,"s")),this.hasFormat("underline")&&(t=Mn(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format=typeof e=="string"?mr[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?mc[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Yn(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=xc[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){it();let n=e,s=t;const i=K(),o=this.getTextContent(),a=this.__key;if(typeof o=="string"){const l=o.length;n===void 0&&(n=l),s===void 0&&(s=l)}else n=0,s=0;if(!O(i))return xa(a,n,a,s,"text","text");{const l=tr();l!==i.anchor.key&&l!==i.focus.key||Qe(a),i.setTextNodeRange(this,n,this,s)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,s){const i=this.getWritable(),o=i.__text,a=n.length;let l=e;l<0&&(l=a+l,l<0&&(l=0));const u=K();if(s&&O(u)){const d=e+a;u.setTextNodeRange(i,d,i,d)}const c=o.slice(0,l)+n+o.slice(l+t);return i.__text=c,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){it();const t=this.getLatest(),n=t.getTextContent(),s=t.__key,i=tr(),o=new Set(e),a=[],l=n.length;let u="";for(let A=0;A<l;A++)u!==""&&o.has(A)&&(a.push(u),u=""),u+=n[A];u!==""&&a.push(u);const c=a.length;if(c===0)return[];if(a[0]===n)return[t];const d=a[0],f=t.getParent();let h;const p=t.getFormat(),m=t.getStyle(),y=t.__detail;let w=!1;t.isSegmented()?(h=Ge(d),h.__format=p,h.__style=m,h.__detail=y,w=!0):(h=t.getWritable(),h.__text=d);const x=K(),E=[h];let D=d.length;for(let A=1;A<c;A++){const b=a[A],v=b.length,S=Ge(b).getWritable();S.__format=p,S.__style=m,S.__detail=y;const k=S.__key,j=D+v;if(O(x)){const T=x.anchor,B=x.focus;T.key===s&&T.type==="text"&&T.offset>D&&T.offset<=j&&(T.key=k,T.offset-=D,x.dirty=!0),B.key===s&&B.type==="text"&&B.offset>D&&B.offset<=j&&(B.key=k,B.offset-=D,x.dirty=!0)}i===s&&Qe(k),D=j,E.push(S)}if(f!==null){(function(v){const S=v.getPreviousSibling(),k=v.getNextSibling();S!==null&&Xn(S),k!==null&&Xn(k)})(this);const A=f.getWritable(),b=this.getIndexWithinParent();w?(A.splice(b,0,E),this.remove()):A.splice(b,1,E),O(x)&&is(x,f,b,c-1)}return E}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||$(50);const n=this.__key,s=e.__key,i=this.__text,o=i.length;tr()===s&&Qe(n);const a=K();if(O(a)){const d=a.anchor,f=a.focus;d!==null&&d.key===s&&(jo(d,t,n,e,o),a.dirty=!0),f!==null&&f.key===s&&(jo(f,t,n,e,o),a.dirty=!0)}const l=e.__text,u=t?l+i:i+l;this.setTextContent(u);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function Wc(r){return{forChild:zi(r.style),node:null}}function Gc(r){const e=r,t=e.style.fontWeight==="normal";return{forChild:zi(e.style,t?void 0:"bold"),node:null}}const ko=new WeakMap;function Vc(r){return r.nodeName==="PRE"||r.nodeType===_n&&r.style!==void 0&&r.style.whiteSpace!==void 0&&r.style.whiteSpace.startsWith("pre")}function Kc(r){const e=r;r.parentElement===null&&$(129);let t=e.textContent||"";if(function(n){let s,i=n.parentNode;const o=[n];for(;i!==null&&(s=ko.get(i))===void 0&&!Vc(i);)o.push(i),i=i.parentNode;const a=s===void 0?i:s;for(let l=0;l<o.length;l++)ko.set(o[l],a);return a}(e)!==null){const n=t.split(/(\r?\n|\t)/),s=[],i=n.length;for(let o=0;o<i;o++){const a=n[o];a===`
67
67
  `||a===`\r
68
68
  `?s.push(xr()):a===" "?s.push(En()):a!==""&&s.push(Ge(a))}return{node:s}}if(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," "),t==="")return{node:null};if(t[0]===" "){let n=e,s=!0;for(;n!==null&&(n=To(n,!1))!==null;){const i=n.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(t=t.slice(1)),s=!1;break}}s&&(t=t.slice(1))}if(t[t.length-1]===" "){let n=e,s=!0;for(;n!==null&&(n=To(n,!0))!==null;)if((n.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){s=!1;break}s&&(t=t.slice(0,t.length-1))}return t===""?{node:null}:{node:Ge(t)}}function To(r,e){let t=r;for(;;){let n;for(;(n=e?t.nextSibling:t.previousSibling)===null;){const i=t.parentElement;if(i===null)return null;t=i}if(t=n,t.nodeType===_n){const i=t.style.display;if(i===""&&!Ys(t)||i!==""&&!i.startsWith("inline"))return null}let s=t;for(;(s=e?t.firstChild:t.lastChild)!==null;)t=s;if(t.nodeType===or)return t;if(t.nodeName==="BR")return null}}const Hc={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Xt(r){const e=Hc[r.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:zi(r.style,e),node:null}}function Ge(r=""){return $t(new Ir(r))}function z(r){return r instanceof Ir}function zi(r,e){const t=r.fontWeight,n=r.textDecoration.split(" "),s=t==="700"||t==="bold",i=n.includes("line-through"),o=r.fontStyle==="italic",a=n.includes("underline"),l=r.verticalAlign;return u=>(z(u)&&(s&&!u.hasFormat("bold")&&u.toggleFormat("bold"),i&&!u.hasFormat("strikethrough")&&u.toggleFormat("strikethrough"),o&&!u.hasFormat("italic")&&u.toggleFormat("italic"),a&&!u.hasFormat("underline")&&u.toggleFormat("underline"),l!=="sub"||u.hasFormat("subscript")||u.toggleFormat("subscript"),l!=="super"||u.hasFormat("superscript")||u.toggleFormat("superscript"),e&&!u.hasFormat(e)&&u.toggleFormat(e)),u)}class Dn extends Ir{static getType(){return"tab"}static clone(e){return new Dn(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}static importJSON(e){const t=En();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){$(126)}setDetail(e){$(127)}setMode(e){$(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function En(){return $t(new Dn)}function Qc(r){return r instanceof Dn}class Jc{constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode(),n=e.getNode();const s=this.offset,i=e.offset;if(F(t)){const o=t.getDescendantByIndex(s);t=o??t}if(F(n)){const o=n.getDescendantByIndex(i);n=o??n}return t===n?s<i:t.isBefore(n)}getNode(){const e=Xe(this.key);return e===null&&$(20),e}set(e,t,n){const s=this._selection,i=this.key;this.key=e,this.offset=t,this.type=n,An()||(tr()===i&&Qe(e),s!==null&&(s.setCachedNodes(null),s.dirty=!0))}}function It(r,e,t){return new Jc(r,e,t)}function qs(r,e){let t=e.__key,n=r.offset,s="element";if(z(e)){s="text";const i=e.getTextContentSize();n>i&&(n=i)}else if(!F(e)){const i=e.getNextSibling();if(z(i))t=i.__key,n=0,s="text";else{const o=e.getParent();o&&(t=o.__key,n=e.getIndexWithinParent()+1)}}r.set(t,n,s)}function No(r,e){if(F(e)){const t=e.getLastDescendant();F(t)||z(t)?qs(r,t):qs(r,e)}else qs(r,e)}function er(r,e,t,n){r.key=e,r.offset=t,r.type=n}class Cs{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Lt(e))return!1;const t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(s=>n.has(s))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new Cs(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),n=t.length,s=t[n-1];let i;if(z(s))i=s.select();else{const o=s.getIndexWithinParent()+1;i=s.getParentOrThrow().select(o,o)}i.insertNodes(e);for(let o=0;o<n;o++)t[o].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,n=[];for(const s of t){const i=Xe(s);i!==null&&n.push(i)}return An()||(this._cachedNodes=n),n}getTextContent(){const e=this.getNodes();let t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}}function O(r){return r instanceof lr}class lr{constructor(e,t,n,s){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=s,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!O(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor,n=this.focus,s=t.isBefore(n),i=s?t:n,o=s?n:t;let a=i.getNode(),l=o.getNode();const u=i.offset,c=o.offset;if(F(a)){const f=a.getDescendantByIndex(u);a=f??a}if(F(l)){let f=l.getDescendantByIndex(c);f!==null&&f!==a&&l.getChildAtIndex(c)===f&&(f=f.getPreviousSibling()),l=f??l}let d;return d=a.is(l)?F(a)&&a.getChildrenSize()>0?[]:[a]:a.getNodesBetween(l),An()||(this._cachedNodes=d),d}setTextNodeRange(e,t,n,s){er(this.anchor,e.__key,t,"text"),er(this.focus,n.__key,s,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const t=e[0],n=e[e.length-1],s=this.anchor,i=this.focus,o=s.isBefore(i),[a,l]=ui(this);let u="",c=!0;for(let d=0;d<e.length;d++){const f=e[d];if(F(f)&&!f.isInline())c||(u+=`
69
- `),c=!f.isEmpty();else if(c=!1,z(f)){let h=f.getTextContent();f===t?f===n?s.type==="element"&&i.type==="element"&&i.offset!==s.offset||(h=a<l?h.slice(a,l):h.slice(l,a)):h=o?h.slice(a):h.slice(l):f===n&&(h=o?h.slice(0,l):h.slice(0,a)),u+=h}else!Ce(f)&&!pr(f)||f===n&&this.isCollapsed()||(u+=f.getTextContent())}return u}applyDOMRange(e){const t=Me(),n=t.getEditorState()._selection,s=ya(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(s===null)return;const[i,o]=s;er(this.anchor,i.key,i.offset,i.type),er(this.focus,o.key,o.offset,o.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new lr(It(e.key,e.offset,e.type),It(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Yn(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=mr[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],s=t.length;for(let i=0;i<s;i++){const o=t[i];o===`
69
+ `),c=!f.isEmpty();else if(c=!1,z(f)){let h=f.getTextContent();f===t?f===n?s.type==="element"&&i.type==="element"&&i.offset!==s.offset||(h=a<l?h.slice(a,l):h.slice(l,a)):h=o?h.slice(a):h.slice(l):f===n&&(h=o?h.slice(0,l):h.slice(0,a)),u+=h}else!Ce(f)&&!pr(f)||f===n&&this.isCollapsed()||(u+=f.getTextContent())}return u}applyDOMRange(e){const t=Pe(),n=t.getEditorState()._selection,s=ya(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(s===null)return;const[i,o]=s;er(this.anchor,i.key,i.offset,i.type),er(this.focus,o.key,o.offset,o.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new lr(It(e.key,e.offset,e.type),It(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Yn(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=mr[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],s=t.length;for(let i=0;i<s;i++){const o=t[i];o===`
70
70
  `||o===`\r
71
- `?n.push(xr()):o===" "?n.push(En()):n.push(Ge(o))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,s=this.format,i=this.style;let o=t,a=n;!this.isCollapsed()&&n.isBefore(t)&&(o=n,a=t),o.type==="element"&&function(y,D,x,E){const C=y.getNode(),A=C.getChildAtIndex(y.offset),b=Ge(),v=tt(C)?Ue().append(b):b;b.setFormat(x),b.setStyle(E),A===null?C.append(v):A.insertBefore(v),y.is(D)&&D.set(b.__key,0,"text"),y.set(b.__key,0,"text")}(o,a,s,i);const l=o.offset;let u=a.offset;const c=this.getNodes(),d=c.length;let f=c[0];z(f)||$(26);const h=f.getTextContent().length,p=f.getParentOrThrow();let m=c[d-1];if(d===1&&a.type==="element"&&(u=h,a.set(o.key,u,"text")),this.isCollapsed()&&l===h&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!p.canInsertTextAfter()&&f.getNextSibling()===null)){let y=f.getNextSibling();if(z(y)&&y.canInsertTextBefore()&&!cr(y)||(y=Ge(),y.setFormat(s),y.setStyle(i),p.canInsertTextAfter()?f.insertAfter(y):p.insertAfter(y)),y.select(0,0),f=y,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&l===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!p.canInsertTextBefore()&&f.getPreviousSibling()===null)){let y=f.getPreviousSibling();if(z(y)&&!cr(y)||(y=Ge(),y.setFormat(s),p.canInsertTextBefore()?f.insertBefore(y):p.insertBefore(y)),y.select(),f=y,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&l!==h){const y=Ge(f.getTextContent());y.setFormat(s),f.replace(y),f=y}else if(!this.isCollapsed()&&e!==""){const y=m.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||F(y)&&(!y.canInsertTextBefore()||!y.canInsertTextAfter()))return this.insertText(""),ma(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(f.isToken()){const E=Ge(e);return E.select(),void f.replace(E)}const y=f.getFormat(),D=f.getStyle();if(l!==u||y===s&&D===i){if(Qc(f)){const E=Ge(e);return E.setFormat(s),E.setStyle(i),E.select(),void f.replace(E)}}else{if(f.getTextContent()!==""){const E=Ge(e);if(E.setFormat(s),E.setStyle(i),E.select(),l===0)f.insertBefore(E,!1);else{const[C]=f.splitText(l);C.insertAfter(E,!1)}return void(E.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(s),f.setStyle(i)}const x=u-l;f=f.spliceText(l,x,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=y,this.style=D))}else{const y=new Set([...f.getParentKeys(),...m.getParentKeys()]),D=F(f)?f:f.getParentOrThrow();let x=F(m)?m:m.getParentOrThrow(),E=m;if(!D.is(x)&&x.isInline())do E=x,x=x.getParentOrThrow();while(x.isInline());if(a.type==="text"&&(u!==0||m.getTextContent()==="")||a.type==="element"&&m.getIndexWithinParent()<u)if(z(m)&&!m.isToken()&&u!==m.getTextContentSize()){if(m.isSegmented()){const S=Ge(m.getTextContent());m.replace(S),m=S}tt(a.getNode())||a.type!=="text"||(m=m.spliceText(0,u,"")),y.add(m.__key)}else{const S=m.getParentOrThrow();S.canBeEmpty()||S.getChildrenSize()!==1?m.remove():S.remove()}else y.add(m.__key);const C=x.getChildren(),A=new Set(c),b=D.is(x),v=D.isInline()&&f.getNextSibling()===null?D:f;for(let S=C.length-1;S>=0;S--){const k=C[S];if(k.is(f)||F(k)&&k.isParentOf(f))break;k.isAttached()&&(!A.has(k)||k.is(E)?b||v.insertAfter(k,!1):k.remove())}if(!b){let S=x,k=null;for(;S!==null;){const j=S.getChildren(),T=j.length;(T===0||j[T-1].is(k))&&(y.delete(S.__key),k=S),S=S.getParent()}}if(f.isToken())if(l===h)f.select();else{const S=Ge(e);S.select(),f.replace(S)}else f=f.spliceText(l,h-l,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let S=1;S<d;S++){const k=c[S],j=k.__key;y.has(j)||k.remove()}}}removeText(){if(this.isCollapsed())return;const{anchor:e,focus:t}=this,n=this.getNodes(),s=this.isBackward()?t:e,i=this.isBackward()?e:t;let o=s.getNode(),a=i.getNode();const l=Hr(o,Zt),u=Hr(a,Zt);z(o)&&o.isToken()&&s.offset<o.getTextContentSize()&&(s.offset=0),i.offset>0&&z(a)&&a.isToken()&&(i.offset=a.getTextContentSize()),n.forEach(d=>{on(o,d)||on(a,d)||d.getKey()===o.getKey()||d.getKey()===a.getKey()||d.remove()});const c=(d,f)=>{if(d.getTextContent()==="")d.remove();else if(f!==0&&cr(d)){const h=Ge(d.getTextContent());return h.setFormat(d.getFormat()),h.setStyle(d.getStyle()),d.replace(h)}};if(o===a&&z(o)){const d=Math.abs(t.offset-e.offset);return o.spliceText(s.offset,d,"",!0),void c(o,d)}if(z(o)){const d=o.getTextContentSize()-s.offset;o.spliceText(s.offset,d,""),o=c(o,d)||o}z(a)&&(a.spliceText(0,i.offset,""),a=c(a,i.offset)||a),o.isAttached()&&z(o)?o.selectEnd():a.isAttached()&&z(a)&&a.selectStart(),F(l)&&F(u)&&l!==u&&(l.append(...u.getChildren()),u.remove(),i.set(s.key,s.offset,s.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void Qe(null);const n=this.getNodes(),s=[];for(const C of n)z(C)&&s.push(C);const i=C=>{n.forEach(A=>{if(Or(A)){const b=A.getFormatFlags(e,C);A.setTextFormat(b)}})},o=s.length;if(o===0)return this.toggleFormat(e),Qe(null),void i(t);const a=this.anchor,l=this.focus,u=this.isBackward(),c=u?l:a,d=u?a:l;let f=0,h=s[0],p=c.type==="element"?0:c.offset;if(c.type==="text"&&p===h.getTextContentSize()&&(f=1,h=s[1],p=0),h==null)return;const m=h.getFormatFlags(e,t);i(m);const y=o-1;let D=s[y];const x=d.type==="text"?d.offset:D.getTextContentSize();if(h.is(D)){if(p===x)return;if(cr(h)||p===0&&x===h.getTextContentSize())h.setFormat(m);else{const C=h.splitText(p,x),A=p===0?C[0]:C[1];A.setFormat(m),c.type==="text"&&c.set(A.__key,0,"text"),d.type==="text"&&d.set(A.__key,x-p,"text")}return void(this.format=m)}p===0||cr(h)||([,h]=h.splitText(p),p=0),h.setFormat(m);const E=D.getFormatFlags(e,m);x>0&&(x===D.getTextContentSize()||cr(D)||([D]=D.splitText(x)),D.setFormat(E));for(let C=f+1;C<y;C++){const A=s[C],b=A.getFormatFlags(e,E);A.setFormat(b)}c.type==="text"&&c.set(h.__key,p,"text"),d.type==="text"&&d.set(D.__key,x,"text"),this.format=m|E}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const p=K();return O(p)||$(134),p.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=Hr(t,Zt),s=e[e.length-1];if(F(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const p=Us(this);n.splice(p,0,e),s.selectEnd()}return}if(!e.some(p=>(F(p)||Ce(p))&&!p.isInline())){F(n)||$(211,t.constructor.name,t.getType());const p=Us(this);return n.splice(p,0,e),void s.selectEnd()}const i=function(p){const m=Ue();let y=null;for(let D=0;D<p.length;D++){const x=p[D],E=pr(x);if(E||Ce(x)&&x.isInline()||F(x)&&x.isInline()||z(x)||x.isParentRequired()){if(y===null&&(y=x.createParentElementNode(),m.append(y),E))continue;y!==null&&y.append(x)}else m.append(x),y=null}return m}(e),o=i.getLastDescendant(),a=i.getChildren(),l=!F(n)||!n.isEmpty()?this.insertParagraph():null,u=a[a.length-1];let c=a[0];var d;F(d=c)&&Zt(d)&&!d.isEmpty()&&F(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(F(n)||$(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=a[1]),c&&(n===null&&$(212,t.constructor.name,t.getType()),function(p,m,y){const D=m.getParentOrThrow().getLastChild();let x=m;const E=[m];for(;x!==D;)x.getNextSibling()||$(140),x=x.getNextSibling(),E.push(x);let C=p;for(const A of E)C=C.insertAfter(A)}(n,c));const f=Hr(o,Zt);l&&F(f)&&(l.canMergeWhenEmpty()||Zt(u))&&(f.append(...l.getChildren()),l.remove()),F(n)&&n.isEmpty()&&n.remove(),o.selectEnd();const h=F(n)?n.getLastChild():null;pr(h)&&f!==n&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const o=Ue();return Fe().splice(this.anchor.offset,0,[o]),o.select(),o}const e=Us(this),t=Hr(this.anchor.getNode(),Zt);F(t)||$(213);const n=t.getChildAtIndex(e),s=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...s),i.selectStart(),i):null}insertLineBreak(e){const t=xr();if(this.insertNodes([t]),e){const n=t.getParentOrThrow(),s=t.getIndexWithinParent();n.select(s,s)}}extract(){const e=this.getNodes(),t=e.length,n=t-1,s=this.anchor,i=this.focus;let o=e[0],a=e[n];const[l,u]=ui(this);if(t===0)return[];if(t===1){if(z(o)&&!this.isCollapsed()){const d=l>u?u:l,f=l>u?l:u,h=o.splitText(d,f),p=d===0?h[0]:h[1];return p!=null?[p]:[]}return[o]}const c=s.isBefore(i);if(z(o)){const d=c?l:u;d===o.getTextContentSize()?e.shift():d!==0&&([,o]=o.splitText(d),e[0]=o)}if(z(a)){const d=a.getTextContent().length,f=c?u:l;f===0?e.pop():f!==d&&([a]=a.splitText(f),e[n]=a)}return e}modify(e,t,n){const s=this.focus,i=this.anchor,o=e==="move",a=pn(s,t);if(Ce(a)&&!a.isIsolated()){if(o&&a.isKeyboardSelectable()){const h=Po();return h.add(a.__key),void jt(h)}const f=t?a.getPreviousSibling():a.getNextSibling();if(z(f)){const h=f.__key,p=t?f.getTextContent().length:0;return s.set(h,p,"text"),void(o&&i.set(h,p,"text"))}{const h=a.getParentOrThrow();let p,m;return F(f)?(m=f.__key,p=t?f.getChildrenSize():0):(p=a.getIndexWithinParent(),m=h.__key,t||p++),s.set(m,p,"element"),void(o&&i.set(m,p,"element"))}}const l=Me(),u=gt(l._window);if(!u)return;const c=l._blockCursorElement,d=l._rootElement;if(d===null||c===null||!F(a)||a.isInline()||a.canBeEmpty()||Oi(c,l,d),function(f,h,p,m){f.modify(h,p,m)}(u,e,t?"backward":"forward",n),u.rangeCount>0){const f=u.getRangeAt(0),h=this.anchor.getNode(),p=tt(h)?h:Fc(h);if(this.applyDOMRange(f),this.dirty=!0,!o){const m=this.getNodes(),y=[];let D=!1;for(let x=0;x<m.length;x++){const E=m[x];on(E,p)?y.push(E):D=!0}if(D&&y.length>0)if(t){const x=y[0];F(x)?x.selectStart():x.getParentOrThrow().selectStart()}else{const x=y[y.length-1];F(x)?x.selectEnd():x.getParentOrThrow().selectEnd()}u.anchorNode===f.startContainer&&u.anchorOffset===f.startOffset||function(x){const E=x.focus,C=x.anchor,A=C.key,b=C.offset,v=C.type;er(C,E.key,E.offset,E.type),er(E,A,b,v),x._cachedNodes=null}(this)}}}forwardDeletion(e,t,n){if(!n&&(e.type==="element"&&F(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const s=t.getParent(),i=t.getNextSibling()||(s===null?null:s.getNextSibling());if(F(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const n=this.anchor;let s=n.getNode();if(this.forwardDeletion(n,s,e))return;const i=this.focus,o=pn(i,e);if(Ce(o)&&!o.isIsolated()){if(o.isKeyboardSelectable()&&F(s)&&s.getChildrenSize()===0){s.remove();const a=Po();a.add(o.__key),jt(a)}else o.remove(),Me().dispatchCommand(bi,void 0);return}if(!e&&F(o)&&F(s)&&s.isEmpty())return s.remove(),void o.selectStart();if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&n.offset===0&&(n.type==="element"?n.getNode():n.getNode().getParentOrThrow()).collapseAtStart(this))return}else{const a=i.type==="text"?i.getNode():null;if(s=n.type==="text"?n.getNode():null,a!==null&&a.isSegmented()){const l=i.offset,u=a.getTextContentSize();if(a.is(s)||e&&l!==u||!e&&l!==0)return void Fo(a,e,l)}else if(s!==null&&s.isSegmented()){const l=n.offset,u=s.getTextContentSize();if(s.is(a)||e&&l!==0||!e&&l!==u)return void Fo(s,e,l)}(function(l,u){const c=l.anchor,d=l.focus,f=c.getNode(),h=d.getNode();if(f===h&&c.type==="text"&&d.type==="text"){const p=c.offset,m=d.offset,y=p<m,D=y?p:m,x=y?m:p,E=x-1;D!==E&&(Jl(f.getTextContent().slice(D,x))||(u?d.offset=E:c.offset=E))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const n=this.anchor.getNode();n.isEmpty()&&tt(n.getParent())&&n.getIndexWithinParent()===0&&n.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t=this.anchor.type==="element";if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),this.isCollapsed()&&this.anchor.offset===0&&this.modify("extend",e,"character"),t){const n=e?this.anchor:this.focus;n.set(n.key,n.offset+1,n.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Lt(r){return r instanceof Cs}function Bo(r){const e=r.offset;if(r.type==="text")return e;const t=r.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function ui(r){const e=r.getStartEndPoints();if(e===null)return[0,0];const[t,n]=e;return t.type==="element"&&n.type==="element"&&t.key===n.key&&t.offset===n.offset?[0,0]:[Bo(t),Bo(n)]}function Fo(r,e,t){const n=r,s=n.getTextContent().split(/(?=\s)/g),i=s.length;let o=0,a=0;for(let u=0;u<i;u++){const c=u===i-1;if(a=o,o+=s[u].length,e&&o===t||o>t||c){s.splice(u,1),c&&(a=void 0);break}}const l=s.join("").trim();l===""?n.remove():(n.setTextContent(l),n.select(a,a))}function Ro(r,e,t,n){let s,i=e;if(r.nodeType===_n){let o=!1;const a=r.childNodes,l=a.length,u=n._blockCursorElement;i===l&&(o=!0,i=l-1);let c=a[i],d=!1;if(c===u)c=a[i+1],d=!0;else if(u!==null){const f=u.parentNode;r===f&&e>Array.prototype.indexOf.call(f.children,u)&&i--}if(s=Tr(c),z(s))i=po(s,o);else{let f=Tr(r);if(f===null)return null;if(F(f)){const h=n.getElementByKey(f.getKey());h===null&&$(214),[f,i]=f.getDOMSlot(h).resolveChildIndex(f,h,r,e),F(f)||$(215),o&&i>=f.getChildrenSize()&&(i=Math.max(0,f.getChildrenSize()-1));let m=f.getChildAtIndex(i);if(F(m)&&function(y,D,x){const E=y.getParent();return x===null||E===null||!E.canBeEmpty()||E!==x.getNode()}(m,0,t)){const y=o?m.getLastDescendant():m.getFirstDescendant();y===null?f=m:(m=y,f=F(m)?m:m.getParentOrThrow()),i=0}z(m)?(s=m,f=null,i=po(m,o)):m!==f&&o&&!d&&(F(f)||$(216),i=Math.min(f.getChildrenSize(),i+1))}else{const h=f.getIndexWithinParent();i=e===0&&Ce(f)&&Tr(r)===f?h:h+1,f=f.getParentOrThrow()}if(F(f))return It(f.__key,i,"element")}}else s=Tr(r);return z(s)?It(s.__key,i,"text"):null}function Lo(r,e,t){const n=r.offset,s=r.getNode();if(n===0){const i=s.getPreviousSibling(),o=s.getParent();if(e){if((t||!e)&&i===null&&F(o)&&o.isInline()){const a=o.getPreviousSibling();z(a)&&(r.key=a.__key,r.offset=a.getTextContent().length)}}else F(i)&&!t&&i.isInline()?(r.key=i.__key,r.offset=i.getChildrenSize(),r.type="element"):z(i)&&(r.key=i.__key,r.offset=i.getTextContent().length)}else if(n===s.getTextContent().length){const i=s.getNextSibling(),o=s.getParent();if(e&&F(i)&&i.isInline())r.key=i.__key,r.offset=0,r.type="element";else if((t||e)&&i===null&&F(o)&&o.isInline()&&!o.canInsertTextAfter()){const a=o.getNextSibling();z(a)&&(r.key=a.__key,r.offset=0)}}}function ma(r,e,t){if(r.type==="text"&&e.type==="text"){const n=r.isBefore(e),s=r.is(e);Lo(r,n,s),Lo(e,!n,s),s&&(e.key=r.key,e.offset=r.offset,e.type=r.type);const i=Me();if(i.isComposing()&&i._compositionKey!==r.key&&O(t)){const o=t.anchor,a=t.focus;er(r,o.key,o.offset,o.type),er(e,a.key,a.offset,a.type)}}}function ya(r,e,t,n,s,i){if(r===null||t===null||!vn(s,r,t))return null;const o=Ro(r,e,O(i)?i.anchor:null,s);if(o===null)return null;const a=Ro(t,n,O(i)?i.focus:null,s);if(a===null)return null;if(o.type==="element"&&a.type==="element"){const l=Tr(r),u=Tr(t);if(Ce(l)&&Ce(u))return null}return ma(o,a,i),[o,a]}function ci(r){return F(r)&&!r.isInline()}function xa(r,e,t,n,s,i){const o=Qt(),a=new lr(It(r,e,s),It(t,n,i),0,"");return a.dirty=!0,o._selection=a,a}function Yc(){const r=It("root",0,"element"),e=It("root",0,"element");return new lr(r,e,0,"")}function Po(){return new Cs(new Set)}function qi(r,e,t,n){const s=t._window;if(s===null)return null;const i=n||s.event,o=i?i.type:void 0,a=o==="selectionchange",l=!Js&&(a||o==="beforeinput"||o==="compositionstart"||o==="compositionend"||o==="click"&&i&&i.detail===3||o==="drop"||o===void 0);let u,c,d,f;if(O(r)&&!l)return r.clone();if(e===null)return null;if(u=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,a&&O(r)&&!vn(t,u,c))return r.clone();const h=ya(u,d,c,f,t,r);if(h===null)return null;const[p,m]=h;return new lr(p,m,O(r)?r.format:0,O(r)?r.style:"")}function K(){return Qt()._selection}function Sn(){return Me()._editorState._selection}function is(r,e,t,n=1){const s=r.anchor,i=r.focus,o=s.getNode(),a=i.getNode();if(!e.is(o)&&!e.is(a))return;const l=e.__key;if(r.isCollapsed()){const u=s.offset;if(t<=u&&n>0||t<u&&n<0){const c=Math.max(0,u+n);s.set(l,c,"element"),i.set(l,c,"element"),Mo(r)}}else{const u=r.isBackward(),c=u?i:s,d=c.getNode(),f=u?s:i,h=f.getNode();if(e.is(d)){const p=c.offset;(t<=p&&n>0||t<p&&n<0)&&c.set(l,Math.max(0,p+n),"element")}if(e.is(h)){const p=f.offset;(t<=p&&n>0||t<p&&n<0)&&f.set(l,Math.max(0,p+n),"element")}}Mo(r)}function Mo(r){const e=r.anchor,t=e.offset,n=r.focus,s=n.offset,i=e.getNode(),o=n.getNode();if(r.isCollapsed()){if(!F(i))return;const a=i.getChildrenSize(),l=t>=a,u=l?i.getChildAtIndex(a-1):i.getChildAtIndex(t);if(z(u)){let c=0;l&&(c=u.getTextContentSize()),e.set(u.__key,c,"text"),n.set(u.__key,c,"text")}}else{if(F(i)){const a=i.getChildrenSize(),l=t>=a,u=l?i.getChildAtIndex(a-1):i.getChildAtIndex(t);if(z(u)){let c=0;l&&(c=u.getTextContentSize()),e.set(u.__key,c,"text")}}if(F(o)){const a=o.getChildrenSize(),l=s>=a,u=l?o.getChildAtIndex(a-1):o.getChildAtIndex(s);if(z(u)){let c=0;l&&(c=u.getTextContentSize()),n.set(u.__key,c,"text")}}}}function os(r,e,t,n,s){let i=null,o=0,a=null;n!==null?(i=n.__key,z(n)?(o=n.getTextContentSize(),a="text"):F(n)&&(o=n.getChildrenSize(),a="element")):s!==null&&(i=s.__key,z(s)?a="text":F(s)&&(a="element")),i!==null&&a!==null?r.set(i,o,a):(o=e.getIndexWithinParent(),o===-1&&(o=t.getChildrenSize()),r.set(t.__key,o,"element"))}function jo(r,e,t,n,s){r.type==="text"?(r.key=t,e||(r.offset+=s)):r.offset>n.getIndexWithinParent()&&(r.offset-=1)}function Xc(r,e,t,n,s,i,o){const a=n.anchorNode,l=n.focusNode,u=n.anchorOffset,c=n.focusOffset,d=document.activeElement;if(s.has("collaboration")&&d!==i||d!==null&&Fi(d))return;if(!O(e))return void(r!==null&&vn(t,a,l)&&n.removeAllRanges());const f=e.anchor,h=e.focus,p=f.key,m=h.key,y=Zn(t,p),D=Zn(t,m),x=f.offset,E=h.offset,C=e.format,A=e.style,b=e.isCollapsed();let v=y,S=D,k=!1;if(f.type==="text"){v=Jn(y);const M=f.getNode();k=M.getFormat()!==C||M.getStyle()!==A}else O(r)&&r.anchor.type==="text"&&(k=!0);var j,T,B,L,R;if(h.type==="text"&&(S=Jn(D)),v!==null&&S!==null&&(b&&(r===null||k||O(r)&&(r.format!==C||r.style!==A))&&(j=C,T=A,B=x,L=p,R=performance.now(),ua=[j,T,B,L,R]),u!==x||c!==E||a!==v||l!==S||n.type==="Range"&&b||(d!==null&&i.contains(d)||i.focus({preventScroll:!0}),f.type==="element"))){try{n.setBaseAndExtent(v,x,S,E)}catch{}if(!s.has("skip-scroll-into-view")&&e.isCollapsed()&&i!==null&&i===document.activeElement){const M=e instanceof lr&&e.anchor.type==="element"?v.childNodes[x]||null:n.rangeCount>0?n.getRangeAt(0):null;if(M!==null){let Q;if(M instanceof Text){const se=document.createRange();se.selectNode(M),Q=se.getBoundingClientRect()}else Q=M.getBoundingClientRect();(function(se,xe,oe){const Se=oe.ownerDocument,he=Se.defaultView;if(he===null)return;let{top:fe,bottom:pe}=xe,ge=0,Ae=0,be=oe;for(;be!==null;){const we=be===Se.body;if(we)ge=0,Ae=bs(se).innerHeight;else{const ce=be.getBoundingClientRect();ge=ce.top,Ae=ce.bottom}let Re=0;if(fe<ge?Re=-(ge-fe):pe>Ae&&(Re=pe-Ae),Re!==0)if(we)he.scrollBy(0,Re);else{const ce=be.scrollTop;be.scrollTop+=Re;const je=be.scrollTop-ce;fe-=je,pe-=je}if(we)break;be=Cn(be)}})(t,Q,i)}}oi=!0}}function ba(r){let e=K()||Sn();e===null&&(e=Fe().selectEnd()),e.insertNodes(r)}function Us(r){let e=r;r.isCollapsed()||e.removeText();const t=K();O(t)&&(e=t),O(e)||$(161);const n=e.anchor;let s=n.getNode(),i=n.offset;for(;!Zt(s);)[s,i]=Zc(s,i);return i}function Zc(r,e){const t=r.getParent();if(!t){const s=Ue();return Fe().append(s),s.select(),[Fe(),0]}if(z(r)){const s=r.splitText(e);if(s.length===0)return[t,r.getIndexWithinParent()];const i=e===0?0:1;return[t,s[0].getIndexWithinParent()+i]}if(!F(r)||e===0)return[t,r.getIndexWithinParent()];const n=r.getChildAtIndex(e);if(n){const s=new lr(It(r.__key,e,"element"),It(r.__key,e,"element"),0,""),i=r.insertNewAfter(s);i&&i.append(n,...n.getNextSiblings())}return[t,r.getIndexWithinParent()+1]}let Ke=null,He=null,ot=!1,Ws=!1,qn=0;const Oo={characterData:!0,childList:!0,subtree:!0};function An(){return ot||Ke!==null&&Ke._readOnly}function it(){ot&&$(13)}function _a(){qn>99&&$(14)}function Qt(){return Ke===null&&$(195,va()),Ke}function Me(){return He===null&&$(196,va()),He}function va(){let r=0;const e=new Set,t=Ds.version;if(typeof window<"u")for(const s of document.querySelectorAll("[contenteditable]")){const i=ms(s);if(Ri(i))r++;else if(i){let o=String(i.constructor.version||"<0.17.1");o===t&&(o+=" (separately built, likely a bundler configuration issue)"),e.add(o)}}let n=` Detected on the page: ${r} compatible editor(s) with version ${t}`;return e.size&&(n+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),n}function ed(){return He}function Io(r,e,t){const n=e.__type,s=function(a,l){const u=a._nodes.get(l);return u===void 0&&$(30,l),u}(r,n);let i=t.get(n);i===void 0&&(i=Array.from(s.transforms),t.set(n,i));const o=i.length;for(let a=0;a<o&&(i[a](e),e.isAttached());a++);}function $o(r,e){return r!==void 0&&r.__key!==e&&r.isAttached()}function Ca(r,e){if(!e)return;const t=r._updateTags;let n=e;Array.isArray(e)||(n=[e]);for(const s of n)t.add(s)}function td(r){return Ui(r,Me()._nodes)}function Ui(r,e){const t=r.type,n=e.get(t);n===void 0&&$(17,t);const s=n.klass;r.type!==s.getType()&&$(18,s.name);const i=s.importJSON(r),o=r.children;if(F(i)&&Array.isArray(o))for(let a=0;a<o.length;a++){const l=Ui(o[a],e);i.append(l)}return i}function zo(r,e,t){const n=Ke,s=ot,i=He;Ke=e,ot=!0,He=r;try{return t()}finally{Ke=n,ot=s,He=i}}function rr(r,e){const t=r._pendingEditorState,n=r._rootElement,s=r._headless||n===null;if(t===null)return;const i=r._editorState,o=i._selection,a=t._selection,l=r._dirtyType!==gr,u=Ke,c=ot,d=He,f=r._updating,h=r._observer;let p=null;if(r._pendingEditorState=null,r._editorState=t,!s&&l&&h!==null){He=r,Ke=t,ot=!1,r._updating=!0;try{const b=r._dirtyType,v=r._dirtyElements,S=r._dirtyLeaves;h.disconnect(),p=zc(i,t,r,b,v,S)}catch(b){if(b instanceof Error&&r._onError(b),Ws)throw b;return Aa(r,null,n,t),Ul(r),r._dirtyType=Mr,Ws=!0,rr(r,i),void(Ws=!1)}finally{h.observe(n,Oo),r._updating=f,Ke=u,ot=c,He=d}}t._readOnly||(t._readOnly=!0);const m=r._dirtyLeaves,y=r._dirtyElements,D=r._normalizedNodes,x=r._updateTags,E=r._deferred;l&&(r._dirtyType=gr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set,r._updateTags=new Set),function(b,v){const S=b._decorators;let k=b._pendingDecorators||S;const j=v._nodeMap;let T;for(T in k)j.has(T)||(k===S&&(k=Hl(b)),delete k[T])}(r,t);const C=s?null:gt(r._window);if(r._editable&&C!==null&&(l||a===null||a.dirty)){He=r,Ke=t;try{if(h!==null&&h.disconnect(),l||a===null||a.dirty){const b=r._blockCursorElement;b!==null&&Oi(b,r,n),Xc(o,a,r,C,x,n)}Rc(r,n,a),h!==null&&h.observe(n,Oo)}finally{He=d,Ke=u}}p!==null&&function(b,v,S,k,j){const T=Array.from(b._listeners.mutation),B=T.length;for(let L=0;L<B;L++){const[R,M]=T[L],Q=v.get(M);Q!==void 0&&R(Q,{dirtyLeaves:k,prevEditorState:j,updateTags:S})}}(r,p,x,m,i),O(a)||a===null||o!==null&&o.is(a)||r.dispatchCommand(bi,void 0);const A=r._pendingDecorators;A!==null&&(r._decorators=A,r._pendingDecorators=null,un("decorator",r,!0,A)),function(b,v,S){const k=ho(v),j=ho(S);k!==j&&un("textcontent",b,!0,j)}(r,e||i,t),un("update",r,!0,{dirtyElements:y,dirtyLeaves:m,editorState:t,normalizedNodes:D,prevEditorState:e||i,tags:x}),function(b,v){if(b._deferred=[],v.length!==0){const S=b._updating;b._updating=!0;try{for(let k=0;k<v.length;k++)v[k]()}finally{b._updating=S}}}(r,E),function(b){const v=b._updates;if(v.length!==0){const S=v.shift();if(S){const[k,j]=S;Da(b,k,j)}}}(r)}function un(r,e,t,...n){const s=e._updating;e._updating=t;try{const i=Array.from(e._listeners[r]);for(let o=0;o<i.length;o++)i[o].apply(null,n)}finally{e._updating=s}}function wa(r,e,t){if(r._updating===!1||He!==r){let s=!1;return r.update(()=>{s=wa(r,e,t)}),s}const n=Li(r);for(let s=4;s>=0;s--)for(let i=0;i<n.length;i++){const o=n[i]._commands.get(e);if(o!==void 0){const a=o[s];if(a!==void 0){const l=Array.from(a),u=l.length;for(let c=0;c<u;c++)if(l[c](t,r)===!0)return!0}}}return!1}function qo(r,e){const t=r._updates;let n=e||!1;for(;t.length!==0;){const s=t.shift();if(s){const[i,o]=s;let a;if(o!==void 0){if(a=o.onUpdate,o.skipTransforms&&(n=!0),o.discrete){const l=r._pendingEditorState;l===null&&$(191),l._flushSync=!0}a&&r._deferred.push(a),Ca(r,o.tag)}i()}}return n}function Da(r,e,t){const n=r._updateTags;let s,i=!1,o=!1;t!==void 0&&(s=t.onUpdate,Ca(r,t.tag),i=t.skipTransforms||!1,o=t.discrete||!1),s&&r._deferred.push(s);const a=r._editorState;let l=r._pendingEditorState,u=!1;(l===null||l._readOnly)&&(l=r._pendingEditorState=Ea(l||a),u=!0),l._flushSync=o;const c=Ke,d=ot,f=He,h=r._updating;Ke=l,ot=!1,r._updating=!0,He=r;try{u&&(r._headless?a._selection!==null&&(l._selection=a._selection.clone()):l._selection=function(D){const x=D.getEditorState()._selection,E=gt(D._window);return O(x)||x==null?qi(x,E,D,null):x.clone()}(r));const m=r._compositionKey;e(),i=qo(r,i),function(D,x){const E=x.getEditorState()._selection,C=D._selection;if(O(C)){const A=C.anchor,b=C.focus;let v;if(A.type==="text"&&(v=A.getNode(),v.selectionTransform(E,C)),b.type==="text"){const S=b.getNode();v!==S&&S.selectionTransform(E,C)}}}(l,r),r._dirtyType!==gr&&(i?function(D,x){const E=x._dirtyLeaves,C=D._nodeMap;for(const A of E){const b=C.get(A);z(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&co(b)}}(l,r):function(D,x){const E=x._dirtyLeaves,C=x._dirtyElements,A=D._nodeMap,b=tr(),v=new Map;let S=E,k=S.size,j=C,T=j.size;for(;k>0||T>0;){if(k>0){x._dirtyLeaves=new Set;for(const B of S){const L=A.get(B);z(L)&&L.isAttached()&&L.isSimpleText()&&!L.isUnmergeable()&&co(L),L!==void 0&&$o(L,b)&&Io(x,L,v),E.add(B)}if(S=x._dirtyLeaves,k=S.size,k>0){qn++;continue}}x._dirtyLeaves=new Set,x._dirtyElements=new Map;for(const B of j){const L=B[0],R=B[1];if(L!=="root"&&!R)continue;const M=A.get(L);M!==void 0&&$o(M,b)&&Io(x,M,v),C.set(L,R)}S=x._dirtyLeaves,k=S.size,j=x._dirtyElements,T=j.size,qn++}x._dirtyLeaves=E,x._dirtyElements=C}(l,r),qo(r),function(D,x,E,C){const A=D._nodeMap,b=x._nodeMap,v=[];for(const[S]of C){const k=b.get(S);k!==void 0&&(k.isAttached()||(F(k)&&ea(k,S,A,b,v,C),A.has(S)||C.delete(S),v.push(S)))}for(const S of v)b.delete(S);for(const S of E){const k=b.get(S);k===void 0||k.isAttached()||(A.has(S)||E.delete(S),b.delete(S))}}(a,l,r._dirtyLeaves,r._dirtyElements)),m!==r._compositionKey&&(l._flushSync=!0);const y=l._selection;if(O(y)){const D=l._nodeMap,x=y.anchor.key,E=y.focus.key;D.get(x)!==void 0&&D.get(E)!==void 0||$(19)}else Lt(y)&&y._nodes.size===0&&(l._selection=null)}catch(m){return m instanceof Error&&r._onError(m),r._pendingEditorState=a,r._dirtyType=Mr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),void rr(r)}finally{Ke=c,ot=d,He=f,r._updating=h,qn=0}r._dirtyType!==gr||function(m,y){const D=y.getEditorState()._selection,x=m._selection;if(x!==null){if(x.dirty||!x.is(D))return!0}else if(D!==null)return!0;return!1}(l,r)?l._flushSync?(l._flushSync=!1,rr(r)):u&&Ac(()=>{rr(r)}):(l._flushSync=!1,u&&(n.clear(),r._deferred=[],r._pendingEditorState=null))}function ct(r,e,t){r._updating?r._updates.push([e,t]):Da(r,e,t)}class cn{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new cn(this.element,e,this.after)}withAfter(e){return new cn(this.element,this.before,e)}withElement(e){return new cn(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&$(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&$(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&$(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(bn||ps);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n=e.nodeName==="IMG"?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const n=this.element,s=this.before,i=document.createElement("br");if(n.insertBefore(i,s),e){const o=document.createElement("img");o.setAttribute("data-lexical-linebreak","true"),o.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",o.alt="",n.insertBefore(o,i),n.__lexicalLineBreak=o}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;t!==null;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,s){if(n===this.element){const l=this.getFirstChildOffset();return[e,Math.min(l+e.getChildrenSize(),Math.max(l,s))]}const i=Uo(t,n);i.push(s);const o=Uo(t,this.element);let a=e.getIndexWithinParent();for(let l=0;l<o.length;l++){const u=i[l],c=o[l];if(u===void 0||u<c)break;if(u>c){a+=1;break}}return[e.getParentOrThrow(),a]}}function Uo(r,e){const t=[];let n=e;for(;n!==r&&n!==null;n=e.parentNode){let s=0;for(let i=n.previousSibling;i!==null;i=n.previousSibling)s++;t.push(s)}return n!==r&&$(225),t.reverse()}class Jt extends vs{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return yc[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=Me()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(z(t)&&e.push(t),F(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;F(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;F(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const i=t[n-1];return F(i)&&i.getLastDescendant()||i||null}const s=t[e];return F(s)&&s.getFirstDescendant()||s||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:Xe(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&$(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:Xe(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&$(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,s;if(e<t/2){for(n=this.getFirstChild(),s=0;n!==null&&s<=e;){if(s===e)return n;n=n.getNextSibling(),s++}return null}for(n=this.getLastChild(),s=t-1;n!==null&&s>=e;){if(s===e)return n;n=n.getPreviousSibling(),s--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const i=t[s];e+=i.getTextContent(),F(i)&&s!==n-1&&!i.isInline()&&(e+=Kt)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const i=t[s];e+=i.getTextContentSize(),F(i)&&s!==n-1&&!i.isInline()&&(e+=Kt.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=lo[e];return!!(this.getFormat()&t)}return!1}select(e,t){it();const n=K();let s=e,i=t;const o=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const l=this.getFirstChild();if(z(l)||F(l))return l.select(0,0)}else if(!(e!==void 0&&e!==o||t!==void 0&&t!==o)){const l=this.getLastChild();if(z(l)||F(l))return l.select()}}s===void 0&&(s=o),i===void 0&&(i=o);const a=this.__key;return O(n)?(n.anchor.set(a,s,"element"),n.focus.set(a,i,"element"),n.dirty=!0,n):xa(a,s,a,i,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(t=>t.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==""?lo[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){const s=n.length,i=this.getChildrenSize(),o=this.getWritable();e+t<=i||$(226,String(e),String(t),String(i));const a=o.__key,l=[],u=[],c=this.getChildAtIndex(e+t);let d=null,f=i-t+s;if(e!==0)if(e===i)d=this.getLastChild();else{const p=this.getChildAtIndex(e);p!==null&&(d=p.getPreviousSibling())}if(t>0){let p=d===null?this.getFirstChild():d.getNextSibling();for(let m=0;m<t;m++){p===null&&$(100);const y=p.getNextSibling(),D=p.__key;hr(p.getWritable()),u.push(D),p=y}}let h=d;for(let p=0;p<s;p++){const m=n[p];h!==null&&m.is(h)&&(d=h=h.getPreviousSibling());const y=m.getWritable();y.__parent===a&&f--,hr(y);const D=m.__key;if(h===null)o.__first=D,y.__prev=null;else{const x=h.getWritable();x.__next=D,y.__prev=x.__key}m.__key===a&&$(76),y.__parent=a,l.push(D),h=m}if(e+t===i)h!==null&&(h.getWritable().__next=null,o.__last=h.__key);else if(c!==null){const p=c.getWritable();if(h!==null){const m=h.getWritable();p.__prev=h.__key,m.__next=c.__key}else p.__prev=null}if(o.__size=f,u.length){const p=K();if(O(p)){const m=new Set(u),y=new Set(l),{anchor:D,focus:x}=p;Wo(D,m,y)&&os(D,D.getNode(),this,d,c),Wo(x,m,y)&&os(x,x.getNode(),this,d,c),f!==0||this.canBeEmpty()||Ot(this)||this.remove()}}return o}getDOMSlot(e){return new cn(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(t)){const n=this.getIndent();n>0&&(t.style.paddingInlineStart=40*n+"px")}return{element:t}}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let s=n.getFirstChild();for(let i=this.getFirstChild();i;i=i.getNextSibling()){const o=t.getElementByKey(i.getKey());o!==null&&(s==null?(n.insertChild(o),s=o):s!==o&&n.replaceChild(o,s),s=s.nextSibling)}}}function F(r){return r instanceof Jt}function Wo(r,e,t){let n=r.getNode();for(;n;){const s=n.__key;if(e.has(s)&&!t.has(s))return!0;n=n.getParent()}return!1}class Wi extends vs{constructor(e){super(e)}decorate(e,t){$(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Ce(r){return r instanceof Wi}class kn extends Jt{static getType(){return"root"}static clone(){return new kn}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){$(51)}getTextContent(){const e=this.__cachedText;return!An()&&Me()._dirtyType!==gr||e===null?super.getTextContent():e}remove(){$(52)}replace(e){$(53)}insertBefore(e){$(54)}insertAfter(e){$(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];F(n)||Ce(n)||$(56)}return super.append(...e)}static importJSON(e){const t=Fe();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function tt(r){return r instanceof kn}function Ea(r){return new ws(new Map(r._nodeMap))}function Gi(){return new ws(new Map([["root",new kn]]))}function Sa(r){const e=r.exportJSON(),t=r.constructor;if(e.type!==t.getType()&&$(130,t.name),F(r)){const n=e.children;Array.isArray(n)||$(59,t.name);const s=r.getChildren();for(let i=0;i<s.length;i++){const o=Sa(s[i]);n.push(o)}}return e}class ws{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return zo(t&&t.editor||null,this,e)}clone(e){const t=new ws(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return zo(null,this,()=>({root:Sa(Fe())}))}}class Vi extends Jt{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class $r extends Jt{constructor(e){super(e),this.__textFormat=0,this.__textStyle=""}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=mr[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return Yn(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}static clone(e){return new $r(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=sn(e.theme,"paragraph");return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:rd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=Ue();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){const n=Ue();n.setTextFormat(e.format),n.setTextStyle(e.style);const s=this.getDirection();return n.setDirection(s),n.setFormat(this.getFormatType()),n.setStyle(this.getTextStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(e.length===0||z(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function rd(r){const e=Ue();return r.style&&(e.setFormat(r.style.textAlign),$i(r,e)),{node:e}}function Ue(){return $t(new $r)}function Or(r){return r instanceof $r}const ye=0,Nr=1,nd=4;function Aa(r,e,t,n){const s=r._keyToDOMMap;s.clear(),r._editorState=Gi(),r._pendingEditorState=n,r._compositionKey=null,r._dirtyType=gr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),r._normalizedNodes=new Set,r._updateTags=new Set,r._updates=[],r._blockCursorElement=null;const i=r._observer;i!==null&&(i.disconnect(),r._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",s.set("root",t))}function sd(r){const e=r||{},t=ed(),n=e.theme||{},s=r===void 0?t:e.parentEditor||null,i=e.disableEvents||!1,o=Gi(),a=e.namespace||(s!==null?s._config.namespace:Yl()),l=e.editorState,u=[kn,Ir,wn,Dn,$r,Vi,...e.nodes||[]],{onError:c,html:d}=e,f=e.editable===void 0||e.editable;let h;if(r===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let m=0;m<u.length;m++){let y=u[m],D=null,x=null;if(typeof y!="function"){const b=y;y=b.replace,D=b.with,x=b.withKlass||null}const E=y.getType(),C=y.transform(),A=new Set;C!==null&&A.add(C),h.set(E,{exportDOM:d&&d.export?d.export.get(y):void 0,klass:y,replace:D,replaceWithKlass:x,transforms:A})}}const p=new Ds(o,s,h,{disableEvents:i,namespace:a,theme:n},c||console.error,function(m,y){const D=new Map,x=new Set,E=C=>{Object.keys(C).forEach(A=>{let b=D.get(A);b===void 0&&(b=[],D.set(A,b)),b.push(C[A])})};return m.forEach(C=>{const A=C.klass.importDOM;if(A==null||x.has(A))return;x.add(A);const b=A.call(C.klass);b!==null&&E(b)}),y&&E(y),D}(h,d?d.import:void 0),f);return l!==void 0&&(p._pendingEditorState=l,p._dirtyType=Mr),p}class Ds{constructor(e,t,n,s,i,o,a){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=s,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=gr,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Yl(),this._onError=i,this._htmlConversions=o,this._editable=a,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,n){n===void 0&&$(35);const s=this._commands;s.has(e)||s.set(e,[new Set,new Set,new Set,new Set,new Set]);const i=s.get(e);i===void 0&&$(36,String(e));const o=i[n];return o.add(t),()=>{o.delete(t),i.every(a=>a.size===0)&&s.delete(e)}}registerMutationListener(e,t,n){const s=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;i.set(t,s);const o=n&&n.skipInitialization;return o!==void 0&&o||this.initializeMutationListener(t,s),()=>{i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&$(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,s=jc(n).get(t.getType());if(!s)return;const i=new Map;for(const o of s.keys())i.set(o,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),s=[n],i=n.replaceWithKlass;if(i!=null){const l=this.registerNodeTransformToKlass(i,t);s.push(l)}var o,a;return o=this,a=e.getType(),ct(o,()=>{const l=Qt();if(l.isEmpty())return;if(a==="root")return void Fe().markDirty();const u=l._nodeMap;for(const[,c]of u)c.markDirty()},o._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{s.forEach(l=>l.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return G(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=sn(this._config.theme,"root"),s=this._pendingEditorState||this._editorState;if(this._rootElement=e,Aa(this,t,e,s),t!==null&&(this._config.disableEvents||qc(t),n!=null&&t.classList.remove(...n)),e!==null){const i=function(a){const l=a.ownerDocument;return l&&l.defaultView||null}(e),o=e.style;o.userSelect="text",o.whiteSpace="pre-wrap",o.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=Mr,Ul(this),this._updateTags.add("history-merge"),rr(this),this._config.disableEvents||function(a,l){const u=a.ownerDocument,c=ss.get(u);(c===void 0||c<1)&&u.addEventListener("selectionchange",ha),ss.set(u,(c||0)+1),a.__lexicalEditor=l;const d=fa(a);for(let f=0;f<ii.length;f++){const[h,p]=ii[f],m=typeof p=="function"?y=>{So(y)||(Eo(y),(l.isEditable()||h==="click")&&p(y,l))}:y=>{if(So(y))return;Eo(y);const D=l.isEditable();switch(h){case"cut":return D&&G(l,Ci,y);case"copy":return G(l,hs,y);case"paste":return D&&G(l,fs,y);case"dragstart":return D&&G(l,Pl,y);case"dragover":return D&&G(l,Ml,y);case"dragend":return D&&G(l,ec,y);case"focus":return D&&G(l,nc,y);case"blur":return D&&G(l,sc,y);case"drop":return D&&G(l,Ll,y)}};a.addEventListener(h,m),d.push(()=>{a.removeEventListener(h,m)})}}(e,this),n!=null&&e.classList.add(...n)}else this._editorState=s,this._pendingEditorState=null,this._window=null;un("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&$(38);let n=e;n._readOnly&&(n=Ea(e),n._selection=e._selection?e._selection.clone():null),ql(this);const s=this._pendingEditorState,i=this._updateTags,o=t!==void 0?t.tag:null;s===null||s.isEmpty()||(o!=null&&i.add(o),rr(this)),this._pendingEditorState=n,this._dirtyType=Mr,this._dirtyElements.set("root",!1),this._compositionKey=null,o!=null&&i.add(o),this._updating||rr(this)}parseEditorState(e,t){return function(n,s,i){const o=Gi(),a=Ke,l=ot,u=He,c=s._dirtyElements,d=s._dirtyLeaves,f=s._cloneNotNeeded,h=s._dirtyType;s._dirtyElements=new Map,s._dirtyLeaves=new Set,s._cloneNotNeeded=new Set,s._dirtyType=0,Ke=o,ot=!1,He=s;try{const p=s._nodes;Ui(n.root,p),i&&i(),o._readOnly=!0}catch(p){p instanceof Error&&s._onError(p)}finally{s._dirtyElements=c,s._dirtyLeaves=d,s._cloneNotNeeded=f,s._dirtyType=h,Ke=a,ot=l,He=u}return o}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return rr(this),this.getEditorState().read(e,{editor:this})}update(e,t){ct(this,e,t)}focus(e,t={}){const n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),ct(this,()=>{const s=K(),i=Fe();s!==null?s.dirty=!0:i.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?i.selectStart():i.selectEnd())},{onUpdate:()=>{n.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=gt(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,un("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Ds.version="0.21.0+prod.esm";const ka=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,id=ka?w.useLayoutEffect:w.useEffect,Mn={tag:"history-merge"};function od({initialConfig:r,children:e}){const t=w.useMemo(()=>{const{theme:n,namespace:s,nodes:i,onError:o,editorState:a,html:l}=r,u=Wu(null,n),c=sd({editable:r.editable,html:l,namespace:s,nodes:i,onError:d=>o(d,c),theme:n});return function(d,f){if(f!==null){if(f===void 0)d.update(()=>{const h=Fe();if(h.isEmpty()){const p=Ue();h.append(p);const m=ka?document.activeElement:null;(K()!==null||m!==null&&m===d.getRootElement())&&p.select()}},Mn);else if(f!==null)switch(typeof f){case"string":{const h=d.parseEditorState(f);d.setEditorState(h,Mn);break}case"object":d.setEditorState(f,Mn);break;case"function":d.update(()=>{Fe().isEmpty()&&f(d)},Mn)}}}(c,a),[c,u]},[]);return id(()=>{const n=r.editable,[s]=t;s.setEditable(n===void 0||n)},[]),g.jsx(El.Provider,{value:t,children:e})}const ld=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function ad(r){return{initialValueFn:()=>r.isEditable(),subscribe:e=>r.registerEditableListener(e)}}function ud(){return function(r){const[e]=St(),t=w.useMemo(()=>r(e),[e,r]),[n,s]=w.useState(()=>t.initialValueFn()),i=w.useRef(n);return ld(()=>{const{initialValueFn:o,subscribe:a}=t,l=o();return i.current!==l&&(i.current=l,s(l)),a(u=>{i.current=u,s(u)})},[t,r]),n}(ad)}function cd(){return Fe().getTextContent()}function dd(r,e=!0){if(r)return!1;let t=cd();return e&&(t=t.trim()),t===""}function fd(r){if(!dd(r,!1))return!1;const e=Fe().getChildren(),t=e.length;if(t>1)return!1;for(let n=0;n<t;n++){const s=e[n];if(Ce(s))return!1;if(F(s)){if(!Or(s)||s.__indent!==0)return!1;const i=s.getChildren(),o=i.length;for(let a=0;a<o;a++){const l=i[n];if(!z(l))return!1}}}return!0}function Ta(r){return()=>fd(r)}function hd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}hd(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function pd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var gd=pd(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const md=new Map;function yd(r){const e={};if(!r)return e;const t=r.split(";");for(const n of t)if(n!==""){const[s,i]=n.split(/:([^]+)/);s&&i&&(e[s.trim()]=i.trim())}return e}function Na(r,e){const t=r.getStartEndPoints();if(e.isSelected(r)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[n,s]=t,i=r.isBackward(),o=n.getNode(),a=s.getNode(),l=e.is(o),u=e.is(a);if(l||u){const[c,d]=ui(r),f=o.is(a),h=e.is(i?a:o),p=e.is(i?o:a);let m,y=0;return f?(y=c>d?d:c,m=c>d?c:d):h?(y=i?d:c,m=void 0):p&&(y=0,m=i?c:d),e.__text=e.__text.slice(y,m),e}}return e}function xd(r){const e=r.getStyle(),t=yd(e);md.set(e,t)}function bd(r,e){if(r===null)return;const t=r.getStartEndPoints(),n=t?t[0]:null;if(n!==null&&n.key==="root"){const o=e(),a=Fe(),l=a.getFirstChild();return void(l?l.replace(o,!0):a.append(o))}const s=r.getNodes(),i=n!==null&&function(o,a){let l=o;for(;l!==null&&l.getParent()!==null&&!a(l);)l=l.getParentOrThrow();return a(l)?l:null}(n.getNode(),Ko);i&&s.indexOf(i)===-1&&s.push(i);for(let o=0;o<s.length;o++){const a=s[o];if(!Ko(a))continue;F(a)||gd(178);const l=e();l.setFormat(a.getFormatType()),l.setIndent(a.getIndent()),a.replace(l,!0)}}function Go(r,e){const t=pn(r.focus,e);return Ce(t)&&!t.isIsolated()||F(t)&&!t.isInline()&&!t.canBeEmpty()}function _d(r,e,t,n){r.modify(e?"extend":"move",t,n)}function vd(r){const e=r.anchor.getNode();return(tt(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Vo(r,e,t){const n=vd(r);_d(r,e,t?!n:n,"character")}function Ko(r){if(Ce(r)||!F(r)||Ot(r))return!1;const e=r.getFirstChild(),t=e===null||pr(e)||z(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Cd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var wd=Cd(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const Ba=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Dd=Ba&&"documentMode"in document?document.documentMode:null;!(!Ba||!("InputEvent"in window)||Dd)&&"getTargetRanges"in new window.InputEvent("input");function Fa(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}function vr(...r){return()=>{for(let e=r.length-1;e>=0;e--)r[e]();r.length=0}}function Tn(r,...e){const t=Fa(...e);t.length>0&&r.classList.add(...t)}function Ra(r,...e){const t=Fa(...e);t.length>0&&r.classList.remove(...t)}function Ed(r,e){let t=r;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function Sd(r){const e=Es(r,t=>F(t)&&!t.isInline());return F(e)||wd(4,r.__key),e}const Es=(r,e)=>{let t=r;for(;t!==Fe()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function nr(r,e){return r!==null&&Object.getPrototypeOf(r).constructor.name===e.name}function Ad(r){const e=window.location.origin,t=n=>{if(n.origin!==e)return;const s=r.getRootElement();if(document.activeElement!==s)return;const i=n.data;if(typeof i=="string"){let o;try{o=JSON.parse(i)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"){const a=o.payload;if(a&&a.functionId==="makeChanges"){const l=a.args;if(l){const[u,c,d,f,h,p]=l;r.update(()=>{const m=K();if(O(m)){const y=m.anchor;let D=y.getNode(),x=0,E=0;if(z(D)&&u>=0&&c>=0&&(x=u,E=u+c,m.setTextNodeRange(D,x,D,E)),x===E&&d===""||(m.insertRawText(d),D=y.getNode()),z(D)){x=f,E=f+h;const C=D.getTextContentSize();x=x>C?C:x,E=E>C?C:E,m.setTextNodeRange(D,x,D,E)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function La(r,e){const t=e.body?e.body.childNodes:[];let n=[];const s=[];for(let i=0;i<t.length;i++){const o=t[i];if(!ja.has(o.nodeName)){const a=Oa(o,r,s,!1);a!==null&&(n=n.concat(a))}}return function(i){for(const o of i)o.getNextSibling()instanceof Vi&&o.insertAfter(xr());for(const o of i){const a=o.getChildren();for(const l of a)o.insertBefore(l);o.remove()}}(s),n}function Pa(r,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),n=Fe().getChildren();for(let s=0;s<n.length;s++)Ma(r,n[s],t,e);return t.innerHTML}function Ma(r,e,t,n=null){let s=n===null||e.isSelected(n);const i=F(e)&&e.excludeFromCopy("html");let o=e;if(n!==null){let h=Ii(e);h=z(h)&&n!==null?Na(n,h):h,o=h}const a=F(o)?o.getChildren():[],l=r._nodes.get(o.getType());let u;u=l&&l.exportDOM!==void 0?l.exportDOM(r,o):o.exportDOM(r);const{element:c,after:d}=u;if(!c)return!1;const f=document.createDocumentFragment();for(let h=0;h<a.length;h++){const p=a[h],m=Ma(r,p,f,n);!s&&F(e)&&m&&e.extractWithChild(p,n,"html")&&(s=!0)}if(s&&!i){if((Ht(c)||_o(c))&&c.append(f),t.append(c),d){const h=d.call(o,c);h&&(_o(c)?c.replaceChildren(h):c.replaceWith(h))}}else t.append(f);return s}const ja=new Set(["STYLE","SCRIPT"]);function Oa(r,e,t,n,s=new Map,i){let o=[];if(ja.has(r.nodeName))return o;let a=null;const l=function(p,m){const{nodeName:y}=p,D=m._htmlConversions.get(y.toLowerCase());let x=null;if(D!==void 0)for(const E of D){const C=E(p);C!==null&&(x===null||(x.priority||0)<=(C.priority||0))&&(x=C)}return x!==null?x.conversion:null}(r,e),u=l?l(r):null;let c=null;if(u!==null){c=u.after;const p=u.node;if(a=Array.isArray(p)?p[p.length-1]:p,a!==null){for(const[,m]of s)if(a=m(a,i),!a)break;a&&o.push(...Array.isArray(p)?p:[a])}u.forChild!=null&&s.set(r.nodeName,u.forChild)}const d=r.childNodes;let f=[];const h=(a==null||!Ot(a))&&(a!=null&&ci(a)||n);for(let p=0;p<d.length;p++)f.push(...Oa(d[p],e,t,h,new Map(s),a));return c!=null&&(f=c(f)),es(r)&&(f=kd(r,f,h?()=>{const p=new Vi;return t.push(p),p}:Ue)),a==null?f.length>0?o=o.concat(f):es(r)&&function(p){return p.nextSibling==null||p.previousSibling==null?!1:Ys(p.nextSibling)&&Ys(p.previousSibling)}(r)&&(o=o.concat(xr())):F(a)&&a.append(...f),o}function kd(r,e,t){const n=r.style.textAlign,s=[];let i=[];for(let o=0;o<e.length;o++){const a=e[o];if(ci(a))n&&!a.getFormat()&&a.setFormat(n),s.push(a);else if(i.push(a),o===e.length-1||o<e.length-1&&ci(e[o+1])){const l=t();l.setFormat(n),l.append(...i),s.push(l),i=[]}}return s}function Td(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ls=Td(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Nd(r,e=K()){return e==null&&ls(166),O(e)&&e.isCollapsed()||e.getNodes().length===0?"":Pa(r,e)}function Bd(r,e=K()){return e==null&&ls(166),O(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(Fd(r,e))}function Ho(r,e,t){const n=r.getData("application/x-lexical-editor");if(n)try{const o=JSON.parse(n);if(o.namespace===t._config.namespace&&Array.isArray(o.nodes))return Qo(t,Rd(o.nodes),e)}catch{}const s=r.getData("text/html");if(s)try{const o=new DOMParser().parseFromString(function(a){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:l=>l}).createHTML(a):a}(s),"text/html");return Qo(t,La(t,o),e)}catch{}const i=r.getData("text/plain")||r.getData("text/uri-list");if(i!=null)if(O(e)){const o=i.split(/(\r?\n|\t)/);o[o.length-1]===""&&o.pop();for(let a=0;a<o.length;a++){const l=K();if(O(l)){const u=o[a];u===`
71
+ `?n.push(xr()):o===" "?n.push(En()):n.push(Ge(o))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,s=this.format,i=this.style;let o=t,a=n;!this.isCollapsed()&&n.isBefore(t)&&(o=n,a=t),o.type==="element"&&function(y,w,x,E){const D=y.getNode(),A=D.getChildAtIndex(y.offset),b=Ge(),v=tt(D)?Ue().append(b):b;b.setFormat(x),b.setStyle(E),A===null?D.append(v):A.insertBefore(v),y.is(w)&&w.set(b.__key,0,"text"),y.set(b.__key,0,"text")}(o,a,s,i);const l=o.offset;let u=a.offset;const c=this.getNodes(),d=c.length;let f=c[0];z(f)||$(26);const h=f.getTextContent().length,p=f.getParentOrThrow();let m=c[d-1];if(d===1&&a.type==="element"&&(u=h,a.set(o.key,u,"text")),this.isCollapsed()&&l===h&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!p.canInsertTextAfter()&&f.getNextSibling()===null)){let y=f.getNextSibling();if(z(y)&&y.canInsertTextBefore()&&!cr(y)||(y=Ge(),y.setFormat(s),y.setStyle(i),p.canInsertTextAfter()?f.insertAfter(y):p.insertAfter(y)),y.select(0,0),f=y,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&l===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!p.canInsertTextBefore()&&f.getPreviousSibling()===null)){let y=f.getPreviousSibling();if(z(y)&&!cr(y)||(y=Ge(),y.setFormat(s),p.canInsertTextBefore()?f.insertBefore(y):p.insertBefore(y)),y.select(),f=y,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&l!==h){const y=Ge(f.getTextContent());y.setFormat(s),f.replace(y),f=y}else if(!this.isCollapsed()&&e!==""){const y=m.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||F(y)&&(!y.canInsertTextBefore()||!y.canInsertTextAfter()))return this.insertText(""),ma(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(f.isToken()){const E=Ge(e);return E.select(),void f.replace(E)}const y=f.getFormat(),w=f.getStyle();if(l!==u||y===s&&w===i){if(Qc(f)){const E=Ge(e);return E.setFormat(s),E.setStyle(i),E.select(),void f.replace(E)}}else{if(f.getTextContent()!==""){const E=Ge(e);if(E.setFormat(s),E.setStyle(i),E.select(),l===0)f.insertBefore(E,!1);else{const[D]=f.splitText(l);D.insertAfter(E,!1)}return void(E.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(s),f.setStyle(i)}const x=u-l;f=f.spliceText(l,x,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=y,this.style=w))}else{const y=new Set([...f.getParentKeys(),...m.getParentKeys()]),w=F(f)?f:f.getParentOrThrow();let x=F(m)?m:m.getParentOrThrow(),E=m;if(!w.is(x)&&x.isInline())do E=x,x=x.getParentOrThrow();while(x.isInline());if(a.type==="text"&&(u!==0||m.getTextContent()==="")||a.type==="element"&&m.getIndexWithinParent()<u)if(z(m)&&!m.isToken()&&u!==m.getTextContentSize()){if(m.isSegmented()){const S=Ge(m.getTextContent());m.replace(S),m=S}tt(a.getNode())||a.type!=="text"||(m=m.spliceText(0,u,"")),y.add(m.__key)}else{const S=m.getParentOrThrow();S.canBeEmpty()||S.getChildrenSize()!==1?m.remove():S.remove()}else y.add(m.__key);const D=x.getChildren(),A=new Set(c),b=w.is(x),v=w.isInline()&&f.getNextSibling()===null?w:f;for(let S=D.length-1;S>=0;S--){const k=D[S];if(k.is(f)||F(k)&&k.isParentOf(f))break;k.isAttached()&&(!A.has(k)||k.is(E)?b||v.insertAfter(k,!1):k.remove())}if(!b){let S=x,k=null;for(;S!==null;){const j=S.getChildren(),T=j.length;(T===0||j[T-1].is(k))&&(y.delete(S.__key),k=S),S=S.getParent()}}if(f.isToken())if(l===h)f.select();else{const S=Ge(e);S.select(),f.replace(S)}else f=f.spliceText(l,h-l,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let S=1;S<d;S++){const k=c[S],j=k.__key;y.has(j)||k.remove()}}}removeText(){if(this.isCollapsed())return;const{anchor:e,focus:t}=this,n=this.getNodes(),s=this.isBackward()?t:e,i=this.isBackward()?e:t;let o=s.getNode(),a=i.getNode();const l=Hr(o,Zt),u=Hr(a,Zt);z(o)&&o.isToken()&&s.offset<o.getTextContentSize()&&(s.offset=0),i.offset>0&&z(a)&&a.isToken()&&(i.offset=a.getTextContentSize()),n.forEach(d=>{on(o,d)||on(a,d)||d.getKey()===o.getKey()||d.getKey()===a.getKey()||d.remove()});const c=(d,f)=>{if(d.getTextContent()==="")d.remove();else if(f!==0&&cr(d)){const h=Ge(d.getTextContent());return h.setFormat(d.getFormat()),h.setStyle(d.getStyle()),d.replace(h)}};if(o===a&&z(o)){const d=Math.abs(t.offset-e.offset);return o.spliceText(s.offset,d,"",!0),void c(o,d)}if(z(o)){const d=o.getTextContentSize()-s.offset;o.spliceText(s.offset,d,""),o=c(o,d)||o}z(a)&&(a.spliceText(0,i.offset,""),a=c(a,i.offset)||a),o.isAttached()&&z(o)?o.selectEnd():a.isAttached()&&z(a)&&a.selectStart(),F(l)&&F(u)&&l!==u&&(l.append(...u.getChildren()),u.remove(),i.set(s.key,s.offset,s.type))}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void Qe(null);const n=this.getNodes(),s=[];for(const D of n)z(D)&&s.push(D);const i=D=>{n.forEach(A=>{if(Or(A)){const b=A.getFormatFlags(e,D);A.setTextFormat(b)}})},o=s.length;if(o===0)return this.toggleFormat(e),Qe(null),void i(t);const a=this.anchor,l=this.focus,u=this.isBackward(),c=u?l:a,d=u?a:l;let f=0,h=s[0],p=c.type==="element"?0:c.offset;if(c.type==="text"&&p===h.getTextContentSize()&&(f=1,h=s[1],p=0),h==null)return;const m=h.getFormatFlags(e,t);i(m);const y=o-1;let w=s[y];const x=d.type==="text"?d.offset:w.getTextContentSize();if(h.is(w)){if(p===x)return;if(cr(h)||p===0&&x===h.getTextContentSize())h.setFormat(m);else{const D=h.splitText(p,x),A=p===0?D[0]:D[1];A.setFormat(m),c.type==="text"&&c.set(A.__key,0,"text"),d.type==="text"&&d.set(A.__key,x-p,"text")}return void(this.format=m)}p===0||cr(h)||([,h]=h.splitText(p),p=0),h.setFormat(m);const E=w.getFormatFlags(e,m);x>0&&(x===w.getTextContentSize()||cr(w)||([w]=w.splitText(x)),w.setFormat(E));for(let D=f+1;D<y;D++){const A=s[D],b=A.getFormatFlags(e,E);A.setFormat(b)}c.type==="text"&&c.set(h.__key,p,"text"),d.type==="text"&&d.set(w.__key,x,"text"),this.format=m|E}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const p=K();return O(p)||$(134),p.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=Hr(t,Zt),s=e[e.length-1];if(F(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const p=Us(this);n.splice(p,0,e),s.selectEnd()}return}if(!e.some(p=>(F(p)||Ce(p))&&!p.isInline())){F(n)||$(211,t.constructor.name,t.getType());const p=Us(this);return n.splice(p,0,e),void s.selectEnd()}const i=function(p){const m=Ue();let y=null;for(let w=0;w<p.length;w++){const x=p[w],E=pr(x);if(E||Ce(x)&&x.isInline()||F(x)&&x.isInline()||z(x)||x.isParentRequired()){if(y===null&&(y=x.createParentElementNode(),m.append(y),E))continue;y!==null&&y.append(x)}else m.append(x),y=null}return m}(e),o=i.getLastDescendant(),a=i.getChildren(),l=!F(n)||!n.isEmpty()?this.insertParagraph():null,u=a[a.length-1];let c=a[0];var d;F(d=c)&&Zt(d)&&!d.isEmpty()&&F(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(F(n)||$(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=a[1]),c&&(n===null&&$(212,t.constructor.name,t.getType()),function(p,m,y){const w=m.getParentOrThrow().getLastChild();let x=m;const E=[m];for(;x!==w;)x.getNextSibling()||$(140),x=x.getNextSibling(),E.push(x);let D=p;for(const A of E)D=D.insertAfter(A)}(n,c));const f=Hr(o,Zt);l&&F(f)&&(l.canMergeWhenEmpty()||Zt(u))&&(f.append(...l.getChildren()),l.remove()),F(n)&&n.isEmpty()&&n.remove(),o.selectEnd();const h=F(n)?n.getLastChild():null;pr(h)&&f!==n&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const o=Ue();return Fe().splice(this.anchor.offset,0,[o]),o.select(),o}const e=Us(this),t=Hr(this.anchor.getNode(),Zt);F(t)||$(213);const n=t.getChildAtIndex(e),s=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...s),i.selectStart(),i):null}insertLineBreak(e){const t=xr();if(this.insertNodes([t]),e){const n=t.getParentOrThrow(),s=t.getIndexWithinParent();n.select(s,s)}}extract(){const e=this.getNodes(),t=e.length,n=t-1,s=this.anchor,i=this.focus;let o=e[0],a=e[n];const[l,u]=ui(this);if(t===0)return[];if(t===1){if(z(o)&&!this.isCollapsed()){const d=l>u?u:l,f=l>u?l:u,h=o.splitText(d,f),p=d===0?h[0]:h[1];return p!=null?[p]:[]}return[o]}const c=s.isBefore(i);if(z(o)){const d=c?l:u;d===o.getTextContentSize()?e.shift():d!==0&&([,o]=o.splitText(d),e[0]=o)}if(z(a)){const d=a.getTextContent().length,f=c?u:l;f===0?e.pop():f!==d&&([a]=a.splitText(f),e[n]=a)}return e}modify(e,t,n){const s=this.focus,i=this.anchor,o=e==="move",a=pn(s,t);if(Ce(a)&&!a.isIsolated()){if(o&&a.isKeyboardSelectable()){const h=Mo();return h.add(a.__key),void jt(h)}const f=t?a.getPreviousSibling():a.getNextSibling();if(z(f)){const h=f.__key,p=t?f.getTextContent().length:0;return s.set(h,p,"text"),void(o&&i.set(h,p,"text"))}{const h=a.getParentOrThrow();let p,m;return F(f)?(m=f.__key,p=t?f.getChildrenSize():0):(p=a.getIndexWithinParent(),m=h.__key,t||p++),s.set(m,p,"element"),void(o&&i.set(m,p,"element"))}}const l=Pe(),u=gt(l._window);if(!u)return;const c=l._blockCursorElement,d=l._rootElement;if(d===null||c===null||!F(a)||a.isInline()||a.canBeEmpty()||Oi(c,l,d),function(f,h,p,m){f.modify(h,p,m)}(u,e,t?"backward":"forward",n),u.rangeCount>0){const f=u.getRangeAt(0),h=this.anchor.getNode(),p=tt(h)?h:Fc(h);if(this.applyDOMRange(f),this.dirty=!0,!o){const m=this.getNodes(),y=[];let w=!1;for(let x=0;x<m.length;x++){const E=m[x];on(E,p)?y.push(E):w=!0}if(w&&y.length>0)if(t){const x=y[0];F(x)?x.selectStart():x.getParentOrThrow().selectStart()}else{const x=y[y.length-1];F(x)?x.selectEnd():x.getParentOrThrow().selectEnd()}u.anchorNode===f.startContainer&&u.anchorOffset===f.startOffset||function(x){const E=x.focus,D=x.anchor,A=D.key,b=D.offset,v=D.type;er(D,E.key,E.offset,E.type),er(E,A,b,v),x._cachedNodes=null}(this)}}}forwardDeletion(e,t,n){if(!n&&(e.type==="element"&&F(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const s=t.getParent(),i=t.getNextSibling()||(s===null?null:s.getNextSibling());if(F(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const n=this.anchor;let s=n.getNode();if(this.forwardDeletion(n,s,e))return;const i=this.focus,o=pn(i,e);if(Ce(o)&&!o.isIsolated()){if(o.isKeyboardSelectable()&&F(s)&&s.getChildrenSize()===0){s.remove();const a=Mo();a.add(o.__key),jt(a)}else o.remove(),Pe().dispatchCommand(bi,void 0);return}if(!e&&F(o)&&F(s)&&s.isEmpty())return s.remove(),void o.selectStart();if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&n.offset===0&&(n.type==="element"?n.getNode():n.getNode().getParentOrThrow()).collapseAtStart(this))return}else{const a=i.type==="text"?i.getNode():null;if(s=n.type==="text"?n.getNode():null,a!==null&&a.isSegmented()){const l=i.offset,u=a.getTextContentSize();if(a.is(s)||e&&l!==u||!e&&l!==0)return void Fo(a,e,l)}else if(s!==null&&s.isSegmented()){const l=n.offset,u=s.getTextContentSize();if(s.is(a)||e&&l!==0||!e&&l!==u)return void Fo(s,e,l)}(function(l,u){const c=l.anchor,d=l.focus,f=c.getNode(),h=d.getNode();if(f===h&&c.type==="text"&&d.type==="text"){const p=c.offset,m=d.offset,y=p<m,w=y?p:m,x=y?m:p,E=x-1;w!==E&&(Jl(f.getTextContent().slice(w,x))||(u?d.offset=E:c.offset=E))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const n=this.anchor.getNode();n.isEmpty()&&tt(n.getParent())&&n.getIndexWithinParent()===0&&n.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t=this.anchor.type==="element";if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),this.isCollapsed()&&this.anchor.offset===0&&this.modify("extend",e,"character"),t){const n=e?this.anchor:this.focus;n.set(n.key,n.offset+1,n.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Lt(r){return r instanceof Cs}function Bo(r){const e=r.offset;if(r.type==="text")return e;const t=r.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function ui(r){const e=r.getStartEndPoints();if(e===null)return[0,0];const[t,n]=e;return t.type==="element"&&n.type==="element"&&t.key===n.key&&t.offset===n.offset?[0,0]:[Bo(t),Bo(n)]}function Fo(r,e,t){const n=r,s=n.getTextContent().split(/(?=\s)/g),i=s.length;let o=0,a=0;for(let u=0;u<i;u++){const c=u===i-1;if(a=o,o+=s[u].length,e&&o===t||o>t||c){s.splice(u,1),c&&(a=void 0);break}}const l=s.join("").trim();l===""?n.remove():(n.setTextContent(l),n.select(a,a))}function Ro(r,e,t,n){let s,i=e;if(r.nodeType===_n){let o=!1;const a=r.childNodes,l=a.length,u=n._blockCursorElement;i===l&&(o=!0,i=l-1);let c=a[i],d=!1;if(c===u)c=a[i+1],d=!0;else if(u!==null){const f=u.parentNode;r===f&&e>Array.prototype.indexOf.call(f.children,u)&&i--}if(s=Tr(c),z(s))i=po(s,o);else{let f=Tr(r);if(f===null)return null;if(F(f)){const h=n.getElementByKey(f.getKey());h===null&&$(214),[f,i]=f.getDOMSlot(h).resolveChildIndex(f,h,r,e),F(f)||$(215),o&&i>=f.getChildrenSize()&&(i=Math.max(0,f.getChildrenSize()-1));let m=f.getChildAtIndex(i);if(F(m)&&function(y,w,x){const E=y.getParent();return x===null||E===null||!E.canBeEmpty()||E!==x.getNode()}(m,0,t)){const y=o?m.getLastDescendant():m.getFirstDescendant();y===null?f=m:(m=y,f=F(m)?m:m.getParentOrThrow()),i=0}z(m)?(s=m,f=null,i=po(m,o)):m!==f&&o&&!d&&(F(f)||$(216),i=Math.min(f.getChildrenSize(),i+1))}else{const h=f.getIndexWithinParent();i=e===0&&Ce(f)&&Tr(r)===f?h:h+1,f=f.getParentOrThrow()}if(F(f))return It(f.__key,i,"element")}}else s=Tr(r);return z(s)?It(s.__key,i,"text"):null}function Lo(r,e,t){const n=r.offset,s=r.getNode();if(n===0){const i=s.getPreviousSibling(),o=s.getParent();if(e){if((t||!e)&&i===null&&F(o)&&o.isInline()){const a=o.getPreviousSibling();z(a)&&(r.key=a.__key,r.offset=a.getTextContent().length)}}else F(i)&&!t&&i.isInline()?(r.key=i.__key,r.offset=i.getChildrenSize(),r.type="element"):z(i)&&(r.key=i.__key,r.offset=i.getTextContent().length)}else if(n===s.getTextContent().length){const i=s.getNextSibling(),o=s.getParent();if(e&&F(i)&&i.isInline())r.key=i.__key,r.offset=0,r.type="element";else if((t||e)&&i===null&&F(o)&&o.isInline()&&!o.canInsertTextAfter()){const a=o.getNextSibling();z(a)&&(r.key=a.__key,r.offset=0)}}}function ma(r,e,t){if(r.type==="text"&&e.type==="text"){const n=r.isBefore(e),s=r.is(e);Lo(r,n,s),Lo(e,!n,s),s&&(e.key=r.key,e.offset=r.offset,e.type=r.type);const i=Pe();if(i.isComposing()&&i._compositionKey!==r.key&&O(t)){const o=t.anchor,a=t.focus;er(r,o.key,o.offset,o.type),er(e,a.key,a.offset,a.type)}}}function ya(r,e,t,n,s,i){if(r===null||t===null||!vn(s,r,t))return null;const o=Ro(r,e,O(i)?i.anchor:null,s);if(o===null)return null;const a=Ro(t,n,O(i)?i.focus:null,s);if(a===null)return null;if(o.type==="element"&&a.type==="element"){const l=Tr(r),u=Tr(t);if(Ce(l)&&Ce(u))return null}return ma(o,a,i),[o,a]}function ci(r){return F(r)&&!r.isInline()}function xa(r,e,t,n,s,i){const o=Qt(),a=new lr(It(r,e,s),It(t,n,i),0,"");return a.dirty=!0,o._selection=a,a}function Yc(){const r=It("root",0,"element"),e=It("root",0,"element");return new lr(r,e,0,"")}function Mo(){return new Cs(new Set)}function qi(r,e,t,n){const s=t._window;if(s===null)return null;const i=n||s.event,o=i?i.type:void 0,a=o==="selectionchange",l=!Js&&(a||o==="beforeinput"||o==="compositionstart"||o==="compositionend"||o==="click"&&i&&i.detail===3||o==="drop"||o===void 0);let u,c,d,f;if(O(r)&&!l)return r.clone();if(e===null)return null;if(u=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,a&&O(r)&&!vn(t,u,c))return r.clone();const h=ya(u,d,c,f,t,r);if(h===null)return null;const[p,m]=h;return new lr(p,m,O(r)?r.format:0,O(r)?r.style:"")}function K(){return Qt()._selection}function Sn(){return Pe()._editorState._selection}function is(r,e,t,n=1){const s=r.anchor,i=r.focus,o=s.getNode(),a=i.getNode();if(!e.is(o)&&!e.is(a))return;const l=e.__key;if(r.isCollapsed()){const u=s.offset;if(t<=u&&n>0||t<u&&n<0){const c=Math.max(0,u+n);s.set(l,c,"element"),i.set(l,c,"element"),Po(r)}}else{const u=r.isBackward(),c=u?i:s,d=c.getNode(),f=u?s:i,h=f.getNode();if(e.is(d)){const p=c.offset;(t<=p&&n>0||t<p&&n<0)&&c.set(l,Math.max(0,p+n),"element")}if(e.is(h)){const p=f.offset;(t<=p&&n>0||t<p&&n<0)&&f.set(l,Math.max(0,p+n),"element")}}Po(r)}function Po(r){const e=r.anchor,t=e.offset,n=r.focus,s=n.offset,i=e.getNode(),o=n.getNode();if(r.isCollapsed()){if(!F(i))return;const a=i.getChildrenSize(),l=t>=a,u=l?i.getChildAtIndex(a-1):i.getChildAtIndex(t);if(z(u)){let c=0;l&&(c=u.getTextContentSize()),e.set(u.__key,c,"text"),n.set(u.__key,c,"text")}}else{if(F(i)){const a=i.getChildrenSize(),l=t>=a,u=l?i.getChildAtIndex(a-1):i.getChildAtIndex(t);if(z(u)){let c=0;l&&(c=u.getTextContentSize()),e.set(u.__key,c,"text")}}if(F(o)){const a=o.getChildrenSize(),l=s>=a,u=l?o.getChildAtIndex(a-1):o.getChildAtIndex(s);if(z(u)){let c=0;l&&(c=u.getTextContentSize()),n.set(u.__key,c,"text")}}}}function os(r,e,t,n,s){let i=null,o=0,a=null;n!==null?(i=n.__key,z(n)?(o=n.getTextContentSize(),a="text"):F(n)&&(o=n.getChildrenSize(),a="element")):s!==null&&(i=s.__key,z(s)?a="text":F(s)&&(a="element")),i!==null&&a!==null?r.set(i,o,a):(o=e.getIndexWithinParent(),o===-1&&(o=t.getChildrenSize()),r.set(t.__key,o,"element"))}function jo(r,e,t,n,s){r.type==="text"?(r.key=t,e||(r.offset+=s)):r.offset>n.getIndexWithinParent()&&(r.offset-=1)}function Xc(r,e,t,n,s,i,o){const a=n.anchorNode,l=n.focusNode,u=n.anchorOffset,c=n.focusOffset,d=document.activeElement;if(s.has("collaboration")&&d!==i||d!==null&&Fi(d))return;if(!O(e))return void(r!==null&&vn(t,a,l)&&n.removeAllRanges());const f=e.anchor,h=e.focus,p=f.key,m=h.key,y=Zn(t,p),w=Zn(t,m),x=f.offset,E=h.offset,D=e.format,A=e.style,b=e.isCollapsed();let v=y,S=w,k=!1;if(f.type==="text"){v=Jn(y);const P=f.getNode();k=P.getFormat()!==D||P.getStyle()!==A}else O(r)&&r.anchor.type==="text"&&(k=!0);var j,T,B,L,R;if(h.type==="text"&&(S=Jn(w)),v!==null&&S!==null&&(b&&(r===null||k||O(r)&&(r.format!==D||r.style!==A))&&(j=D,T=A,B=x,L=p,R=performance.now(),ua=[j,T,B,L,R]),u!==x||c!==E||a!==v||l!==S||n.type==="Range"&&b||(d!==null&&i.contains(d)||i.focus({preventScroll:!0}),f.type==="element"))){try{n.setBaseAndExtent(v,x,S,E)}catch{}if(!s.has("skip-scroll-into-view")&&e.isCollapsed()&&i!==null&&i===document.activeElement){const P=e instanceof lr&&e.anchor.type==="element"?v.childNodes[x]||null:n.rangeCount>0?n.getRangeAt(0):null;if(P!==null){let Q;if(P instanceof Text){const se=document.createRange();se.selectNode(P),Q=se.getBoundingClientRect()}else Q=P.getBoundingClientRect();(function(se,xe,oe){const Se=oe.ownerDocument,he=Se.defaultView;if(he===null)return;let{top:fe,bottom:pe}=xe,ge=0,Ae=0,be=oe;for(;be!==null;){const we=be===Se.body;if(we)ge=0,Ae=bs(se).innerHeight;else{const ce=be.getBoundingClientRect();ge=ce.top,Ae=ce.bottom}let Re=0;if(fe<ge?Re=-(ge-fe):pe>Ae&&(Re=pe-Ae),Re!==0)if(we)he.scrollBy(0,Re);else{const ce=be.scrollTop;be.scrollTop+=Re;const je=be.scrollTop-ce;fe-=je,pe-=je}if(we)break;be=Cn(be)}})(t,Q,i)}}oi=!0}}function ba(r){let e=K()||Sn();e===null&&(e=Fe().selectEnd()),e.insertNodes(r)}function Us(r){let e=r;r.isCollapsed()||e.removeText();const t=K();O(t)&&(e=t),O(e)||$(161);const n=e.anchor;let s=n.getNode(),i=n.offset;for(;!Zt(s);)[s,i]=Zc(s,i);return i}function Zc(r,e){const t=r.getParent();if(!t){const s=Ue();return Fe().append(s),s.select(),[Fe(),0]}if(z(r)){const s=r.splitText(e);if(s.length===0)return[t,r.getIndexWithinParent()];const i=e===0?0:1;return[t,s[0].getIndexWithinParent()+i]}if(!F(r)||e===0)return[t,r.getIndexWithinParent()];const n=r.getChildAtIndex(e);if(n){const s=new lr(It(r.__key,e,"element"),It(r.__key,e,"element"),0,""),i=r.insertNewAfter(s);i&&i.append(n,...n.getNextSiblings())}return[t,r.getIndexWithinParent()+1]}let Ke=null,He=null,ot=!1,Ws=!1,qn=0;const Oo={characterData:!0,childList:!0,subtree:!0};function An(){return ot||Ke!==null&&Ke._readOnly}function it(){ot&&$(13)}function _a(){qn>99&&$(14)}function Qt(){return Ke===null&&$(195,va()),Ke}function Pe(){return He===null&&$(196,va()),He}function va(){let r=0;const e=new Set,t=Ds.version;if(typeof window<"u")for(const s of document.querySelectorAll("[contenteditable]")){const i=ms(s);if(Ri(i))r++;else if(i){let o=String(i.constructor.version||"<0.17.1");o===t&&(o+=" (separately built, likely a bundler configuration issue)"),e.add(o)}}let n=` Detected on the page: ${r} compatible editor(s) with version ${t}`;return e.size&&(n+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),n}function ed(){return He}function Io(r,e,t){const n=e.__type,s=function(a,l){const u=a._nodes.get(l);return u===void 0&&$(30,l),u}(r,n);let i=t.get(n);i===void 0&&(i=Array.from(s.transforms),t.set(n,i));const o=i.length;for(let a=0;a<o&&(i[a](e),e.isAttached());a++);}function $o(r,e){return r!==void 0&&r.__key!==e&&r.isAttached()}function Ca(r,e){if(!e)return;const t=r._updateTags;let n=e;Array.isArray(e)||(n=[e]);for(const s of n)t.add(s)}function td(r){return Ui(r,Pe()._nodes)}function Ui(r,e){const t=r.type,n=e.get(t);n===void 0&&$(17,t);const s=n.klass;r.type!==s.getType()&&$(18,s.name);const i=s.importJSON(r),o=r.children;if(F(i)&&Array.isArray(o))for(let a=0;a<o.length;a++){const l=Ui(o[a],e);i.append(l)}return i}function zo(r,e,t){const n=Ke,s=ot,i=He;Ke=e,ot=!0,He=r;try{return t()}finally{Ke=n,ot=s,He=i}}function rr(r,e){const t=r._pendingEditorState,n=r._rootElement,s=r._headless||n===null;if(t===null)return;const i=r._editorState,o=i._selection,a=t._selection,l=r._dirtyType!==gr,u=Ke,c=ot,d=He,f=r._updating,h=r._observer;let p=null;if(r._pendingEditorState=null,r._editorState=t,!s&&l&&h!==null){He=r,Ke=t,ot=!1,r._updating=!0;try{const b=r._dirtyType,v=r._dirtyElements,S=r._dirtyLeaves;h.disconnect(),p=zc(i,t,r,b,v,S)}catch(b){if(b instanceof Error&&r._onError(b),Ws)throw b;return Aa(r,null,n,t),Ul(r),r._dirtyType=Pr,Ws=!0,rr(r,i),void(Ws=!1)}finally{h.observe(n,Oo),r._updating=f,Ke=u,ot=c,He=d}}t._readOnly||(t._readOnly=!0);const m=r._dirtyLeaves,y=r._dirtyElements,w=r._normalizedNodes,x=r._updateTags,E=r._deferred;l&&(r._dirtyType=gr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set,r._updateTags=new Set),function(b,v){const S=b._decorators;let k=b._pendingDecorators||S;const j=v._nodeMap;let T;for(T in k)j.has(T)||(k===S&&(k=Hl(b)),delete k[T])}(r,t);const D=s?null:gt(r._window);if(r._editable&&D!==null&&(l||a===null||a.dirty)){He=r,Ke=t;try{if(h!==null&&h.disconnect(),l||a===null||a.dirty){const b=r._blockCursorElement;b!==null&&Oi(b,r,n),Xc(o,a,r,D,x,n)}Rc(r,n,a),h!==null&&h.observe(n,Oo)}finally{He=d,Ke=u}}p!==null&&function(b,v,S,k,j){const T=Array.from(b._listeners.mutation),B=T.length;for(let L=0;L<B;L++){const[R,P]=T[L],Q=v.get(P);Q!==void 0&&R(Q,{dirtyLeaves:k,prevEditorState:j,updateTags:S})}}(r,p,x,m,i),O(a)||a===null||o!==null&&o.is(a)||r.dispatchCommand(bi,void 0);const A=r._pendingDecorators;A!==null&&(r._decorators=A,r._pendingDecorators=null,un("decorator",r,!0,A)),function(b,v,S){const k=ho(v),j=ho(S);k!==j&&un("textcontent",b,!0,j)}(r,e||i,t),un("update",r,!0,{dirtyElements:y,dirtyLeaves:m,editorState:t,normalizedNodes:w,prevEditorState:e||i,tags:x}),function(b,v){if(b._deferred=[],v.length!==0){const S=b._updating;b._updating=!0;try{for(let k=0;k<v.length;k++)v[k]()}finally{b._updating=S}}}(r,E),function(b){const v=b._updates;if(v.length!==0){const S=v.shift();if(S){const[k,j]=S;Da(b,k,j)}}}(r)}function un(r,e,t,...n){const s=e._updating;e._updating=t;try{const i=Array.from(e._listeners[r]);for(let o=0;o<i.length;o++)i[o].apply(null,n)}finally{e._updating=s}}function wa(r,e,t){if(r._updating===!1||He!==r){let s=!1;return r.update(()=>{s=wa(r,e,t)}),s}const n=Li(r);for(let s=4;s>=0;s--)for(let i=0;i<n.length;i++){const o=n[i]._commands.get(e);if(o!==void 0){const a=o[s];if(a!==void 0){const l=Array.from(a),u=l.length;for(let c=0;c<u;c++)if(l[c](t,r)===!0)return!0}}}return!1}function qo(r,e){const t=r._updates;let n=e||!1;for(;t.length!==0;){const s=t.shift();if(s){const[i,o]=s;let a;if(o!==void 0){if(a=o.onUpdate,o.skipTransforms&&(n=!0),o.discrete){const l=r._pendingEditorState;l===null&&$(191),l._flushSync=!0}a&&r._deferred.push(a),Ca(r,o.tag)}i()}}return n}function Da(r,e,t){const n=r._updateTags;let s,i=!1,o=!1;t!==void 0&&(s=t.onUpdate,Ca(r,t.tag),i=t.skipTransforms||!1,o=t.discrete||!1),s&&r._deferred.push(s);const a=r._editorState;let l=r._pendingEditorState,u=!1;(l===null||l._readOnly)&&(l=r._pendingEditorState=Ea(l||a),u=!0),l._flushSync=o;const c=Ke,d=ot,f=He,h=r._updating;Ke=l,ot=!1,r._updating=!0,He=r;try{u&&(r._headless?a._selection!==null&&(l._selection=a._selection.clone()):l._selection=function(w){const x=w.getEditorState()._selection,E=gt(w._window);return O(x)||x==null?qi(x,E,w,null):x.clone()}(r));const m=r._compositionKey;e(),i=qo(r,i),function(w,x){const E=x.getEditorState()._selection,D=w._selection;if(O(D)){const A=D.anchor,b=D.focus;let v;if(A.type==="text"&&(v=A.getNode(),v.selectionTransform(E,D)),b.type==="text"){const S=b.getNode();v!==S&&S.selectionTransform(E,D)}}}(l,r),r._dirtyType!==gr&&(i?function(w,x){const E=x._dirtyLeaves,D=w._nodeMap;for(const A of E){const b=D.get(A);z(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&co(b)}}(l,r):function(w,x){const E=x._dirtyLeaves,D=x._dirtyElements,A=w._nodeMap,b=tr(),v=new Map;let S=E,k=S.size,j=D,T=j.size;for(;k>0||T>0;){if(k>0){x._dirtyLeaves=new Set;for(const B of S){const L=A.get(B);z(L)&&L.isAttached()&&L.isSimpleText()&&!L.isUnmergeable()&&co(L),L!==void 0&&$o(L,b)&&Io(x,L,v),E.add(B)}if(S=x._dirtyLeaves,k=S.size,k>0){qn++;continue}}x._dirtyLeaves=new Set,x._dirtyElements=new Map;for(const B of j){const L=B[0],R=B[1];if(L!=="root"&&!R)continue;const P=A.get(L);P!==void 0&&$o(P,b)&&Io(x,P,v),D.set(L,R)}S=x._dirtyLeaves,k=S.size,j=x._dirtyElements,T=j.size,qn++}x._dirtyLeaves=E,x._dirtyElements=D}(l,r),qo(r),function(w,x,E,D){const A=w._nodeMap,b=x._nodeMap,v=[];for(const[S]of D){const k=b.get(S);k!==void 0&&(k.isAttached()||(F(k)&&ea(k,S,A,b,v,D),A.has(S)||D.delete(S),v.push(S)))}for(const S of v)b.delete(S);for(const S of E){const k=b.get(S);k===void 0||k.isAttached()||(A.has(S)||E.delete(S),b.delete(S))}}(a,l,r._dirtyLeaves,r._dirtyElements)),m!==r._compositionKey&&(l._flushSync=!0);const y=l._selection;if(O(y)){const w=l._nodeMap,x=y.anchor.key,E=y.focus.key;w.get(x)!==void 0&&w.get(E)!==void 0||$(19)}else Lt(y)&&y._nodes.size===0&&(l._selection=null)}catch(m){return m instanceof Error&&r._onError(m),r._pendingEditorState=a,r._dirtyType=Pr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),void rr(r)}finally{Ke=c,ot=d,He=f,r._updating=h,qn=0}r._dirtyType!==gr||function(m,y){const w=y.getEditorState()._selection,x=m._selection;if(x!==null){if(x.dirty||!x.is(w))return!0}else if(w!==null)return!0;return!1}(l,r)?l._flushSync?(l._flushSync=!1,rr(r)):u&&Ac(()=>{rr(r)}):(l._flushSync=!1,u&&(n.clear(),r._deferred=[],r._pendingEditorState=null))}function ct(r,e,t){r._updating?r._updates.push([e,t]):Da(r,e,t)}class cn{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new cn(this.element,e,this.after)}withAfter(e){return new cn(this.element,this.before,e)}withElement(e){return new cn(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&$(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&$(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&$(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(bn||ps);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n=e.nodeName==="IMG"?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const n=this.element,s=this.before,i=document.createElement("br");if(n.insertBefore(i,s),e){const o=document.createElement("img");o.setAttribute("data-lexical-linebreak","true"),o.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",o.alt="",n.insertBefore(o,i),n.__lexicalLineBreak=o}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;t!==null;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,s){if(n===this.element){const l=this.getFirstChildOffset();return[e,Math.min(l+e.getChildrenSize(),Math.max(l,s))]}const i=Uo(t,n);i.push(s);const o=Uo(t,this.element);let a=e.getIndexWithinParent();for(let l=0;l<o.length;l++){const u=i[l],c=o[l];if(u===void 0||u<c)break;if(u>c){a+=1;break}}return[e.getParentOrThrow(),a]}}function Uo(r,e){const t=[];let n=e;for(;n!==r&&n!==null;n=e.parentNode){let s=0;for(let i=n.previousSibling;i!==null;i=n.previousSibling)s++;t.push(s)}return n!==r&&$(225),t.reverse()}class Jt extends vs{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return yc[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=Pe()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(z(t)&&e.push(t),F(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;F(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;F(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const i=t[n-1];return F(i)&&i.getLastDescendant()||i||null}const s=t[e];return F(s)&&s.getFirstDescendant()||s||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:Xe(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&$(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:Xe(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&$(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,s;if(e<t/2){for(n=this.getFirstChild(),s=0;n!==null&&s<=e;){if(s===e)return n;n=n.getNextSibling(),s++}return null}for(n=this.getLastChild(),s=t-1;n!==null&&s>=e;){if(s===e)return n;n=n.getPreviousSibling(),s--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const i=t[s];e+=i.getTextContent(),F(i)&&s!==n-1&&!i.isInline()&&(e+=Kt)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let s=0;s<n;s++){const i=t[s];e+=i.getTextContentSize(),F(i)&&s!==n-1&&!i.isInline()&&(e+=Kt.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=lo[e];return!!(this.getFormat()&t)}return!1}select(e,t){it();const n=K();let s=e,i=t;const o=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const l=this.getFirstChild();if(z(l)||F(l))return l.select(0,0)}else if(!(e!==void 0&&e!==o||t!==void 0&&t!==o)){const l=this.getLastChild();if(z(l)||F(l))return l.select()}}s===void 0&&(s=o),i===void 0&&(i=o);const a=this.__key;return O(n)?(n.anchor.set(a,s,"element"),n.focus.set(a,i,"element"),n.dirty=!0,n):xa(a,s,a,i,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(t=>t.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==""?lo[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){const s=n.length,i=this.getChildrenSize(),o=this.getWritable();e+t<=i||$(226,String(e),String(t),String(i));const a=o.__key,l=[],u=[],c=this.getChildAtIndex(e+t);let d=null,f=i-t+s;if(e!==0)if(e===i)d=this.getLastChild();else{const p=this.getChildAtIndex(e);p!==null&&(d=p.getPreviousSibling())}if(t>0){let p=d===null?this.getFirstChild():d.getNextSibling();for(let m=0;m<t;m++){p===null&&$(100);const y=p.getNextSibling(),w=p.__key;hr(p.getWritable()),u.push(w),p=y}}let h=d;for(let p=0;p<s;p++){const m=n[p];h!==null&&m.is(h)&&(d=h=h.getPreviousSibling());const y=m.getWritable();y.__parent===a&&f--,hr(y);const w=m.__key;if(h===null)o.__first=w,y.__prev=null;else{const x=h.getWritable();x.__next=w,y.__prev=x.__key}m.__key===a&&$(76),y.__parent=a,l.push(w),h=m}if(e+t===i)h!==null&&(h.getWritable().__next=null,o.__last=h.__key);else if(c!==null){const p=c.getWritable();if(h!==null){const m=h.getWritable();p.__prev=h.__key,m.__next=c.__key}else p.__prev=null}if(o.__size=f,u.length){const p=K();if(O(p)){const m=new Set(u),y=new Set(l),{anchor:w,focus:x}=p;Wo(w,m,y)&&os(w,w.getNode(),this,d,c),Wo(x,m,y)&&os(x,x.getNode(),this,d,c),f!==0||this.canBeEmpty()||Ot(this)||this.remove()}}return o}getDOMSlot(e){return new cn(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(t)){const n=this.getIndent();n>0&&(t.style.paddingInlineStart=40*n+"px")}return{element:t}}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let s=n.getFirstChild();for(let i=this.getFirstChild();i;i=i.getNextSibling()){const o=t.getElementByKey(i.getKey());o!==null&&(s==null?(n.insertChild(o),s=o):s!==o&&n.replaceChild(o,s),s=s.nextSibling)}}}function F(r){return r instanceof Jt}function Wo(r,e,t){let n=r.getNode();for(;n;){const s=n.__key;if(e.has(s)&&!t.has(s))return!0;n=n.getParent()}return!1}class Wi extends vs{constructor(e){super(e)}decorate(e,t){$(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Ce(r){return r instanceof Wi}class kn extends Jt{static getType(){return"root"}static clone(){return new kn}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){$(51)}getTextContent(){const e=this.__cachedText;return!An()&&Pe()._dirtyType!==gr||e===null?super.getTextContent():e}remove(){$(52)}replace(e){$(53)}insertBefore(e){$(54)}insertAfter(e){$(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];F(n)||Ce(n)||$(56)}return super.append(...e)}static importJSON(e){const t=Fe();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function tt(r){return r instanceof kn}function Ea(r){return new ws(new Map(r._nodeMap))}function Gi(){return new ws(new Map([["root",new kn]]))}function Sa(r){const e=r.exportJSON(),t=r.constructor;if(e.type!==t.getType()&&$(130,t.name),F(r)){const n=e.children;Array.isArray(n)||$(59,t.name);const s=r.getChildren();for(let i=0;i<s.length;i++){const o=Sa(s[i]);n.push(o)}}return e}class ws{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return zo(t&&t.editor||null,this,e)}clone(e){const t=new ws(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return zo(null,this,()=>({root:Sa(Fe())}))}}class Vi extends Jt{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class $r extends Jt{constructor(e){super(e),this.__textFormat=0,this.__textStyle=""}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=mr[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return Yn(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}static clone(e){return new $r(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),n=sn(e.theme,"paragraph");return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:rd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=Ue();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){const n=Ue();n.setTextFormat(e.format),n.setTextStyle(e.style);const s=this.getDirection();return n.setDirection(s),n.setFormat(this.getFormatType()),n.setStyle(this.getTextStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(e.length===0||z(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function rd(r){const e=Ue();return r.style&&(e.setFormat(r.style.textAlign),$i(r,e)),{node:e}}function Ue(){return $t(new $r)}function Or(r){return r instanceof $r}const ye=0,Nr=1,nd=4;function Aa(r,e,t,n){const s=r._keyToDOMMap;s.clear(),r._editorState=Gi(),r._pendingEditorState=n,r._compositionKey=null,r._dirtyType=gr,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements.clear(),r._normalizedNodes=new Set,r._updateTags=new Set,r._updates=[],r._blockCursorElement=null;const i=r._observer;i!==null&&(i.disconnect(),r._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",s.set("root",t))}function sd(r){const e=r||{},t=ed(),n=e.theme||{},s=r===void 0?t:e.parentEditor||null,i=e.disableEvents||!1,o=Gi(),a=e.namespace||(s!==null?s._config.namespace:Yl()),l=e.editorState,u=[kn,Ir,wn,Dn,$r,Vi,...e.nodes||[]],{onError:c,html:d}=e,f=e.editable===void 0||e.editable;let h;if(r===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let m=0;m<u.length;m++){let y=u[m],w=null,x=null;if(typeof y!="function"){const b=y;y=b.replace,w=b.with,x=b.withKlass||null}const E=y.getType(),D=y.transform(),A=new Set;D!==null&&A.add(D),h.set(E,{exportDOM:d&&d.export?d.export.get(y):void 0,klass:y,replace:w,replaceWithKlass:x,transforms:A})}}const p=new Ds(o,s,h,{disableEvents:i,namespace:a,theme:n},c||console.error,function(m,y){const w=new Map,x=new Set,E=D=>{Object.keys(D).forEach(A=>{let b=w.get(A);b===void 0&&(b=[],w.set(A,b)),b.push(D[A])})};return m.forEach(D=>{const A=D.klass.importDOM;if(A==null||x.has(A))return;x.add(A);const b=A.call(D.klass);b!==null&&E(b)}),y&&E(y),w}(h,d?d.import:void 0),f);return l!==void 0&&(p._pendingEditorState=l,p._dirtyType=Pr),p}class Ds{constructor(e,t,n,s,i,o,a){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=s,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=gr,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Yl(),this._onError=i,this._htmlConversions=o,this._editable=a,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,n){n===void 0&&$(35);const s=this._commands;s.has(e)||s.set(e,[new Set,new Set,new Set,new Set,new Set]);const i=s.get(e);i===void 0&&$(36,String(e));const o=i[n];return o.add(t),()=>{o.delete(t),i.every(a=>a.size===0)&&s.delete(e)}}registerMutationListener(e,t,n){const s=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;i.set(t,s);const o=n&&n.skipInitialization;return o!==void 0&&o||this.initializeMutationListener(t,s),()=>{i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&$(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,s=jc(n).get(t.getType());if(!s)return;const i=new Map;for(const o of s.keys())i.set(o,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),s=[n],i=n.replaceWithKlass;if(i!=null){const l=this.registerNodeTransformToKlass(i,t);s.push(l)}var o,a;return o=this,a=e.getType(),ct(o,()=>{const l=Qt();if(l.isEmpty())return;if(a==="root")return void Fe().markDirty();const u=l._nodeMap;for(const[,c]of u)c.markDirty()},o._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{s.forEach(l=>l.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return G(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=sn(this._config.theme,"root"),s=this._pendingEditorState||this._editorState;if(this._rootElement=e,Aa(this,t,e,s),t!==null&&(this._config.disableEvents||qc(t),n!=null&&t.classList.remove(...n)),e!==null){const i=function(a){const l=a.ownerDocument;return l&&l.defaultView||null}(e),o=e.style;o.userSelect="text",o.whiteSpace="pre-wrap",o.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=Pr,Ul(this),this._updateTags.add("history-merge"),rr(this),this._config.disableEvents||function(a,l){const u=a.ownerDocument,c=ss.get(u);(c===void 0||c<1)&&u.addEventListener("selectionchange",ha),ss.set(u,(c||0)+1),a.__lexicalEditor=l;const d=fa(a);for(let f=0;f<ii.length;f++){const[h,p]=ii[f],m=typeof p=="function"?y=>{So(y)||(Eo(y),(l.isEditable()||h==="click")&&p(y,l))}:y=>{if(So(y))return;Eo(y);const w=l.isEditable();switch(h){case"cut":return w&&G(l,Ci,y);case"copy":return G(l,hs,y);case"paste":return w&&G(l,fs,y);case"dragstart":return w&&G(l,Ml,y);case"dragover":return w&&G(l,Pl,y);case"dragend":return w&&G(l,ec,y);case"focus":return w&&G(l,nc,y);case"blur":return w&&G(l,sc,y);case"drop":return w&&G(l,Ll,y)}};a.addEventListener(h,m),d.push(()=>{a.removeEventListener(h,m)})}}(e,this),n!=null&&e.classList.add(...n)}else this._editorState=s,this._pendingEditorState=null,this._window=null;un("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&$(38);let n=e;n._readOnly&&(n=Ea(e),n._selection=e._selection?e._selection.clone():null),ql(this);const s=this._pendingEditorState,i=this._updateTags,o=t!==void 0?t.tag:null;s===null||s.isEmpty()||(o!=null&&i.add(o),rr(this)),this._pendingEditorState=n,this._dirtyType=Pr,this._dirtyElements.set("root",!1),this._compositionKey=null,o!=null&&i.add(o),this._updating||rr(this)}parseEditorState(e,t){return function(n,s,i){const o=Gi(),a=Ke,l=ot,u=He,c=s._dirtyElements,d=s._dirtyLeaves,f=s._cloneNotNeeded,h=s._dirtyType;s._dirtyElements=new Map,s._dirtyLeaves=new Set,s._cloneNotNeeded=new Set,s._dirtyType=0,Ke=o,ot=!1,He=s;try{const p=s._nodes;Ui(n.root,p),i&&i(),o._readOnly=!0}catch(p){p instanceof Error&&s._onError(p)}finally{s._dirtyElements=c,s._dirtyLeaves=d,s._cloneNotNeeded=f,s._dirtyType=h,Ke=a,ot=l,He=u}return o}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return rr(this),this.getEditorState().read(e,{editor:this})}update(e,t){ct(this,e,t)}focus(e,t={}){const n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),ct(this,()=>{const s=K(),i=Fe();s!==null?s.dirty=!0:i.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?i.selectStart():i.selectEnd())},{onUpdate:()=>{n.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=gt(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,un("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Ds.version="0.21.0+prod.esm";const ka=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,id=ka?C.useLayoutEffect:C.useEffect,Pn={tag:"history-merge"};function od({initialConfig:r,children:e}){const t=C.useMemo(()=>{const{theme:n,namespace:s,nodes:i,onError:o,editorState:a,html:l}=r,u=Wu(null,n),c=sd({editable:r.editable,html:l,namespace:s,nodes:i,onError:d=>o(d,c),theme:n});return function(d,f){if(f!==null){if(f===void 0)d.update(()=>{const h=Fe();if(h.isEmpty()){const p=Ue();h.append(p);const m=ka?document.activeElement:null;(K()!==null||m!==null&&m===d.getRootElement())&&p.select()}},Pn);else if(f!==null)switch(typeof f){case"string":{const h=d.parseEditorState(f);d.setEditorState(h,Pn);break}case"object":d.setEditorState(f,Pn);break;case"function":d.update(()=>{Fe().isEmpty()&&f(d)},Pn)}}}(c,a),[c,u]},[]);return id(()=>{const n=r.editable,[s]=t;s.setEditable(n===void 0||n)},[]),g.jsx(El.Provider,{value:t,children:e})}const ld=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?C.useLayoutEffect:C.useEffect;function ad(r){return{initialValueFn:()=>r.isEditable(),subscribe:e=>r.registerEditableListener(e)}}function ud(){return function(r){const[e]=St(),t=C.useMemo(()=>r(e),[e,r]),[n,s]=C.useState(()=>t.initialValueFn()),i=C.useRef(n);return ld(()=>{const{initialValueFn:o,subscribe:a}=t,l=o();return i.current!==l&&(i.current=l,s(l)),a(u=>{i.current=u,s(u)})},[t,r]),n}(ad)}function cd(){return Fe().getTextContent()}function dd(r,e=!0){if(r)return!1;let t=cd();return e&&(t=t.trim()),t===""}function fd(r){if(!dd(r,!1))return!1;const e=Fe().getChildren(),t=e.length;if(t>1)return!1;for(let n=0;n<t;n++){const s=e[n];if(Ce(s))return!1;if(F(s)){if(!Or(s)||s.__indent!==0)return!1;const i=s.getChildren(),o=i.length;for(let a=0;a<o;a++){const l=i[n];if(!z(l))return!1}}}return!0}function Ta(r){return()=>fd(r)}function hd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}hd(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function pd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var gd=pd(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const md=new Map;function yd(r){const e={};if(!r)return e;const t=r.split(";");for(const n of t)if(n!==""){const[s,i]=n.split(/:([^]+)/);s&&i&&(e[s.trim()]=i.trim())}return e}function Na(r,e){const t=r.getStartEndPoints();if(e.isSelected(r)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[n,s]=t,i=r.isBackward(),o=n.getNode(),a=s.getNode(),l=e.is(o),u=e.is(a);if(l||u){const[c,d]=ui(r),f=o.is(a),h=e.is(i?a:o),p=e.is(i?o:a);let m,y=0;return f?(y=c>d?d:c,m=c>d?c:d):h?(y=i?d:c,m=void 0):p&&(y=0,m=i?c:d),e.__text=e.__text.slice(y,m),e}}return e}function xd(r){const e=r.getStyle(),t=yd(e);md.set(e,t)}function bd(r,e){if(r===null)return;const t=r.getStartEndPoints(),n=t?t[0]:null;if(n!==null&&n.key==="root"){const o=e(),a=Fe(),l=a.getFirstChild();return void(l?l.replace(o,!0):a.append(o))}const s=r.getNodes(),i=n!==null&&function(o,a){let l=o;for(;l!==null&&l.getParent()!==null&&!a(l);)l=l.getParentOrThrow();return a(l)?l:null}(n.getNode(),Ko);i&&s.indexOf(i)===-1&&s.push(i);for(let o=0;o<s.length;o++){const a=s[o];if(!Ko(a))continue;F(a)||gd(178);const l=e();l.setFormat(a.getFormatType()),l.setIndent(a.getIndent()),a.replace(l,!0)}}function Go(r,e){const t=pn(r.focus,e);return Ce(t)&&!t.isIsolated()||F(t)&&!t.isInline()&&!t.canBeEmpty()}function _d(r,e,t,n){r.modify(e?"extend":"move",t,n)}function vd(r){const e=r.anchor.getNode();return(tt(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Vo(r,e,t){const n=vd(r);_d(r,e,t?!n:n,"character")}function Ko(r){if(Ce(r)||!F(r)||Ot(r))return!1;const e=r.getFirstChild(),t=e===null||pr(e)||z(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Cd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var wd=Cd(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const Ba=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Dd=Ba&&"documentMode"in document?document.documentMode:null;!(!Ba||!("InputEvent"in window)||Dd)&&"getTargetRanges"in new window.InputEvent("input");function Fa(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}function vr(...r){return()=>{for(let e=r.length-1;e>=0;e--)r[e]();r.length=0}}function Tn(r,...e){const t=Fa(...e);t.length>0&&r.classList.add(...t)}function Ra(r,...e){const t=Fa(...e);t.length>0&&r.classList.remove(...t)}function Ed(r,e){let t=r;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function Sd(r){const e=Es(r,t=>F(t)&&!t.isInline());return F(e)||wd(4,r.__key),e}const Es=(r,e)=>{let t=r;for(;t!==Fe()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function nr(r,e){return r!==null&&Object.getPrototypeOf(r).constructor.name===e.name}function Ad(r){const e=window.location.origin,t=n=>{if(n.origin!==e)return;const s=r.getRootElement();if(document.activeElement!==s)return;const i=n.data;if(typeof i=="string"){let o;try{o=JSON.parse(i)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"){const a=o.payload;if(a&&a.functionId==="makeChanges"){const l=a.args;if(l){const[u,c,d,f,h,p]=l;r.update(()=>{const m=K();if(O(m)){const y=m.anchor;let w=y.getNode(),x=0,E=0;if(z(w)&&u>=0&&c>=0&&(x=u,E=u+c,m.setTextNodeRange(w,x,w,E)),x===E&&d===""||(m.insertRawText(d),w=y.getNode()),z(w)){x=f,E=f+h;const D=w.getTextContentSize();x=x>D?D:x,E=E>D?D:E,m.setTextNodeRange(w,x,w,E)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function La(r,e){const t=e.body?e.body.childNodes:[];let n=[];const s=[];for(let i=0;i<t.length;i++){const o=t[i];if(!ja.has(o.nodeName)){const a=Oa(o,r,s,!1);a!==null&&(n=n.concat(a))}}return function(i){for(const o of i)o.getNextSibling()instanceof Vi&&o.insertAfter(xr());for(const o of i){const a=o.getChildren();for(const l of a)o.insertBefore(l);o.remove()}}(s),n}function Ma(r,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),n=Fe().getChildren();for(let s=0;s<n.length;s++)Pa(r,n[s],t,e);return t.innerHTML}function Pa(r,e,t,n=null){let s=n===null||e.isSelected(n);const i=F(e)&&e.excludeFromCopy("html");let o=e;if(n!==null){let h=Ii(e);h=z(h)&&n!==null?Na(n,h):h,o=h}const a=F(o)?o.getChildren():[],l=r._nodes.get(o.getType());let u;u=l&&l.exportDOM!==void 0?l.exportDOM(r,o):o.exportDOM(r);const{element:c,after:d}=u;if(!c)return!1;const f=document.createDocumentFragment();for(let h=0;h<a.length;h++){const p=a[h],m=Pa(r,p,f,n);!s&&F(e)&&m&&e.extractWithChild(p,n,"html")&&(s=!0)}if(s&&!i){if((Ht(c)||_o(c))&&c.append(f),t.append(c),d){const h=d.call(o,c);h&&(_o(c)?c.replaceChildren(h):c.replaceWith(h))}}else t.append(f);return s}const ja=new Set(["STYLE","SCRIPT"]);function Oa(r,e,t,n,s=new Map,i){let o=[];if(ja.has(r.nodeName))return o;let a=null;const l=function(p,m){const{nodeName:y}=p,w=m._htmlConversions.get(y.toLowerCase());let x=null;if(w!==void 0)for(const E of w){const D=E(p);D!==null&&(x===null||(x.priority||0)<=(D.priority||0))&&(x=D)}return x!==null?x.conversion:null}(r,e),u=l?l(r):null;let c=null;if(u!==null){c=u.after;const p=u.node;if(a=Array.isArray(p)?p[p.length-1]:p,a!==null){for(const[,m]of s)if(a=m(a,i),!a)break;a&&o.push(...Array.isArray(p)?p:[a])}u.forChild!=null&&s.set(r.nodeName,u.forChild)}const d=r.childNodes;let f=[];const h=(a==null||!Ot(a))&&(a!=null&&ci(a)||n);for(let p=0;p<d.length;p++)f.push(...Oa(d[p],e,t,h,new Map(s),a));return c!=null&&(f=c(f)),es(r)&&(f=kd(r,f,h?()=>{const p=new Vi;return t.push(p),p}:Ue)),a==null?f.length>0?o=o.concat(f):es(r)&&function(p){return p.nextSibling==null||p.previousSibling==null?!1:Ys(p.nextSibling)&&Ys(p.previousSibling)}(r)&&(o=o.concat(xr())):F(a)&&a.append(...f),o}function kd(r,e,t){const n=r.style.textAlign,s=[];let i=[];for(let o=0;o<e.length;o++){const a=e[o];if(ci(a))n&&!a.getFormat()&&a.setFormat(n),s.push(a);else if(i.push(a),o===e.length-1||o<e.length-1&&ci(e[o+1])){const l=t();l.setFormat(n),l.append(...i),s.push(l),i=[]}}return s}function Td(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ls=Td(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Nd(r,e=K()){return e==null&&ls(166),O(e)&&e.isCollapsed()||e.getNodes().length===0?"":Ma(r,e)}function Bd(r,e=K()){return e==null&&ls(166),O(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(Fd(r,e))}function Ho(r,e,t){const n=r.getData("application/x-lexical-editor");if(n)try{const o=JSON.parse(n);if(o.namespace===t._config.namespace&&Array.isArray(o.nodes))return Qo(t,Rd(o.nodes),e)}catch{}const s=r.getData("text/html");if(s)try{const o=new DOMParser().parseFromString(function(a){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:l=>l}).createHTML(a):a}(s),"text/html");return Qo(t,La(t,o),e)}catch{}const i=r.getData("text/plain")||r.getData("text/uri-list");if(i!=null)if(O(e)){const o=i.split(/(\r?\n|\t)/);o[o.length-1]===""&&o.pop();for(let a=0;a<o.length;a++){const l=K();if(O(l)){const u=o[a];u===`
72
72
  `||u===`\r
73
- `?l.insertParagraph():u===" "?l.insertNodes([En()]):l.insertText(u)}}}else e.insertRawText(i)}function Qo(r,e,t){r.dispatchCommand(Gu,{nodes:e,selection:t})||t.insertNodes(e)}function Ia(r,e,t,n=[]){let s=e===null||t.isSelected(e);const i=F(t)&&t.excludeFromCopy("html");let o=t;if(e!==null){let u=Ii(t);u=z(u)&&e!==null?Na(e,u):u,o=u}const a=F(o)?o.getChildren():[],l=function(u){const c=u.exportJSON(),d=u.constructor;if(c.type!==d.getType()&&ls(58,d.name),F(u)){const f=c.children;Array.isArray(f)||ls(59,d.name)}return c}(o);if(z(o)){const u=o.__text;u.length>0?l.text=u:s=!1}for(let u=0;u<a.length;u++){const c=a[u],d=Ia(r,e,c,l.children);!s&&F(t)&&d&&t.extractWithChild(c,e,"clone")&&(s=!0)}if(s&&!i)n.push(l);else if(Array.isArray(l.children))for(let u=0;u<l.children.length;u++){const c=l.children[u];n.push(c)}return s}function Fd(r,e){const t=[],n=Fe().getChildren();for(let s=0;s<n.length;s++)Ia(r,e,n[s],t);return{namespace:r._config.namespace,nodes:t}}function Rd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t],s=td(n);z(s)&&xd(s),e.push(s)}return e}let Sr=null;async function Jo(r,e,t){if(Sr!==null)return!1;if(e!==null)return new Promise((l,u)=>{r.update(()=>{l(Yo(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,i=gt(r._window);if(n===null||i===null)return!1;const o=s.createElement("span");o.style.cssText="position: fixed; top: -1000px;",o.append(s.createTextNode("#")),n.append(o);const a=new Range;return a.setStart(o,0),a.setEnd(o,1),i.removeAllRanges(),i.addRange(a),new Promise((l,u)=>{const c=r.registerCommand(hs,d=>(nr(d,ClipboardEvent)&&(c(),Sr!==null&&(window.clearTimeout(Sr),Sr=null),l(Yo(r,d,t))),!0),nd);Sr=window.setTimeout(()=>{c(),Sr=null,l(!1)},50),s.execCommand("copy"),o.remove()})}function Yo(r,e,t){if(t===void 0){const s=gt(r._window);if(!s)return!1;const i=s.anchorNode,o=s.focusNode;if(i!==null&&o!==null&&!vn(r,i,o))return!1;const a=K();if(a===null)return!1;t=Pd(a)}e.preventDefault();const n=e.clipboardData;return n!==null&&(Md(n,t),!0)}const Ld=[["text/html",Nd],["application/x-lexical-editor",Bd]];function Pd(r=K()){const e={"text/plain":r?r.getTextContent():""};if(r){const t=Pc();for(const[n,s]of Ld){const i=s(t,r);i!==null&&(e[n]=i)}}return e}function Md(r,e){for(const t in e){const n=e[t];n!==void 0&&r.setData(t,n)}}function Xo(r,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(r,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(r,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const zr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,jd=zr&&"documentMode"in document?document.documentMode:null,Od=!(!zr||!("InputEvent"in window)||jd)&&"getTargetRanges"in new window.InputEvent("input"),Id=zr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Zo=zr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,$d=zr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),zd=zr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!$d,el=xn();class Ss extends Jt{static getType(){return"quote"}static clone(e){return new Ss(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return Tn(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:qd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=Ki();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,t){const n=Ue(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=Ue();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Ki(){return $t(new Ss)}class As extends Jt{static getType(){return"heading"}static clone(e){return new As(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}createDOM(e){const t=this.__tag,n=document.createElement(t),s=e.theme.heading;if(s!==void 0){const i=s[t];Tn(n,i)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:Ar,priority:0}),h2:e=>({conversion:Ar,priority:0}),h3:e=>({conversion:Ar,priority:0}),h4:e=>({conversion:Ar,priority:0}),h5:e=>({conversion:Ar,priority:0}),h6:e=>({conversion:Ar,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&tl(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>tl(e)?{conversion:t=>({node:en("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=en(e.tag);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,s=this.getLastDescendant(),i=!s||e&&e.anchor.key===s.getKey()&&n===s.getTextContentSize()||!e?Ue():en(this.getTag()),o=this.getDirection();if(i.setDirection(o),this.insertAfter(i,t),n===0&&!this.isEmpty()&&e){const a=Ue();a.select(),this.replace(a,!0)}return i}collapseAtStart(){const e=this.isEmpty()?Ue():en(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function tl(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function Ar(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=en(e),r.style!==null&&($i(r,t),t.setFormat(r.style.textAlign))),{node:t}}function qd(r){const e=Ki();return r.style!==null&&(e.setFormat(r.style.textAlign),$i(r,e)),{node:e}}function en(r){return $t(new As(r))}function jn(r){let e=null;if(nr(r,DragEvent)?e=r.dataTransfer:nr(r,ClipboardEvent)&&(e=r.clipboardData),e===null)return[!1,[],!1];const t=e.types,n=t.includes("Files"),s=t.includes("text/html")||t.includes("text/plain");return[n,Array.from(e.files),s]}function rl(r){const e=K();if(!O(e))return!1;const t=new Set,n=e.getNodes();for(let s=0;s<n.length;s++){const i=n[s],o=i.getKey();if(t.has(o))continue;const a=Es(i,u=>F(u)&&!u.isInline());if(a===null)continue;const l=a.getKey();a.canIndent()&&!t.has(l)&&(t.add(l),r(a))}return t.size>0}function On(r){const e=jr(r);return Ce(e)}function Ud(r){return vr(r.registerCommand(Sl,e=>{const t=K();return!!Lt(t)&&(t.clear(),!0)},0),r.registerCommand(fr,e=>{const t=K();return!!O(t)&&(t.deleteCharacter(e),!0)},ye),r.registerCommand(fn,e=>{const t=K();return!!O(t)&&(t.deleteWord(e),!0)},ye),r.registerCommand(hn,e=>{const t=K();return!!O(t)&&(t.deleteLine(e),!0)},ye),r.registerCommand(Rr,e=>{const t=K();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const n=e.dataTransfer;if(n!=null)Ho(n,t,r);else if(O(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},ye),r.registerCommand(Hs,()=>{const e=K();return!!O(e)&&(e.removeText(),!0)},ye),r.registerCommand(Dt,e=>{const t=K();return!!O(t)&&(t.formatText(e),!0)},ye),r.registerCommand(Zu,e=>{const t=K();if(!O(t)&&!Lt(t))return!1;const n=t.getNodes();for(const s of n){const i=Es(s,o=>F(o)&&!o.isInline());i!==null&&i.setFormat(e)}return!0},ye),r.registerCommand(Fr,e=>{const t=K();return!!O(t)&&(t.insertLineBreak(e),!0)},ye),r.registerCommand(dn,()=>{const e=K();return!!O(e)&&(e.insertParagraph(),!0)},ye),r.registerCommand(Yu,()=>(ba([En()]),!0),ye),r.registerCommand(Xu,()=>rl(e=>{const t=e.getIndent();e.setIndent(t+1)}),ye),r.registerCommand(oo,()=>rl(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),ye),r.registerCommand(Tl,e=>{const t=K();if(Lt(t)&&!On(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(O(t)){const n=pn(t.focus,!0);if(!e.shiftKey&&Ce(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},ye),r.registerCommand(Nl,e=>{const t=K();if(Lt(t)){const n=t.getNodes();if(n.length>0)return n[0].selectNext(0,0),!0}else if(O(t)){if(function(s){const i=s.focus;return i.key==="root"&&i.offset===Fe().getChildrenSize()}(t))return e.preventDefault(),!0;const n=pn(t.focus,!1);if(!e.shiftKey&&Ce(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},ye),r.registerCommand(kl,e=>{const t=K();if(Lt(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!O(t))return!1;if(Go(t,!0)){const n=e.shiftKey;return e.preventDefault(),Vo(t,n,!0),!0}return!1},ye),r.registerCommand(Al,e=>{const t=K();if(Lt(t)&&!On(e.target)){const s=t.getNodes();if(s.length>0)return e.preventDefault(),s[0].selectNext(0,0),!0}if(!O(t))return!1;const n=e.shiftKey;return!!Go(t,!1)&&(e.preventDefault(),Vo(t,n,!1),!0)},ye),r.registerCommand(Bl,e=>{if(On(e.target))return!1;const t=K();if(!O(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!tt(s)&&Sd(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(oo,void 0)):(!Zo||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(fr,!0))},ye),r.registerCommand(Rl,e=>{if(On(e.target))return!1;const t=K();return!!O(t)&&(e.preventDefault(),r.dispatchCommand(fr,!1))},ye),r.registerCommand(Gn,e=>{const t=K();if(!O(t))return!1;if(e!==null){if((Zo||Id||zd)&&Od)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(Fr,!1)}return r.dispatchCommand(dn,void 0)},ye),r.registerCommand(Fl,()=>{const e=K();return!!O(e)&&(r.blur(),!0)},ye),r.registerCommand(Ll,e=>{const[,t]=jn(e);if(t.length>0){const s=Xo(e.clientX,e.clientY);if(s!==null){const{offset:i,node:o}=s,a=jr(o);if(a!==null){const l=Yc();if(z(a))l.anchor.set(a.getKey(),i,"text"),l.focus.set(a.getKey(),i,"text");else{const c=a.getParentOrThrow().getKey(),d=a.getIndexWithinParent()+1;l.anchor.set(c,d,"element"),l.focus.set(c,d,"element")}const u=Wl(l);jt(u)}r.dispatchCommand(el,t)}return e.preventDefault(),!0}const n=K();return!!O(n)},ye),r.registerCommand(Pl,e=>{const[t]=jn(e),n=K();return!(t&&!O(n))},ye),r.registerCommand(Ml,e=>{const[t]=jn(e),n=K();if(t&&!O(n))return!1;const s=Xo(e.clientX,e.clientY);if(s!==null){const i=jr(s.node);Ce(i)&&e.preventDefault()}return!0},ye),r.registerCommand(Qs,()=>(Bc(),!0),ye),r.registerCommand(hs,e=>(Jo(r,nr(e,ClipboardEvent)?e:null),!0),ye),r.registerCommand(Ci,e=>(async function(t,n){await Jo(n,nr(t,ClipboardEvent)?t:null),n.update(()=>{const s=K();O(s)?s.removeText():Lt(s)&&s.getNodes().forEach(i=>i.remove())})}(e,r),!0),ye),r.registerCommand(fs,e=>{const[,t,n]=jn(e);return t.length>0&&!n?(r.dispatchCommand(el,t),!0):Fi(e.target)?!1:K()!==null&&(function(s,i){s.preventDefault(),i.update(()=>{const o=K(),a=nr(s,InputEvent)||nr(s,KeyboardEvent)?null:s.clipboardData;a!=null&&o!==null&&Ho(a,o,i)},{tag:"paste"})}(e,r),!0)},ye))}const di=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function nl(r){return r.getEditorState().read(Ta(r.isComposing()))}function Wd({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=St(),s=function(i,o){const[a,l]=w.useState(()=>i.getDecorators());return di(()=>i.registerDecoratorListener(u=>{Ji.flushSync(()=>{l(u)})}),[i]),w.useEffect(()=>{l(i.getDecorators())},[i]),w.useMemo(()=>{const u=[],c=Object.keys(a);for(let d=0;d<c.length;d++){const f=c[d],h=g.jsx(o,{onError:m=>i._onError(m),children:g.jsx(w.Suspense,{fallback:null,children:a[f]})}),p=i.getElementByKey(f);p!==null&&u.push(Ji.createPortal(h,p,f))}return u},[o,a,i])}(n,t);return function(i){di(()=>vr(Ud(i),Ad(i)),[i])}(n),g.jsxs(g.Fragment,{children:[r,g.jsx(Gd,{content:e}),s]})}function Gd({content:r}){const[e]=St(),t=function(s){const[i,o]=w.useState(()=>nl(s));return di(()=>{function a(){const l=nl(s);o(l)}return a(),vr(s.registerUpdateListener(()=>{a()}),s.registerEditableListener(()=>{a()}))},[s]),i}(e),n=ud();return t?typeof r=="function"?r(n):r:null}const $a=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function Vd({editor:r,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:s,ariaErrorMessage:i,ariaExpanded:o,ariaInvalid:a,ariaLabel:l,ariaLabelledBy:u,ariaMultiline:c,ariaOwns:d,ariaRequired:f,autoCapitalize:h,className:p,id:m,role:y="textbox",spellCheck:D=!0,style:x,tabIndex:E,"data-testid":C,...A},b){const[v,S]=w.useState(r.isEditable()),k=w.useCallback(T=>{T&&T.ownerDocument&&T.ownerDocument.defaultView?r.setRootElement(T):r.setRootElement(null)},[r]),j=w.useMemo(()=>function(...T){return B=>{T.forEach(L=>{typeof L=="function"?L(B):L!=null&&(L.current=B)})}}(b,k),[k,b]);return $a(()=>(S(r.isEditable()),r.registerEditableListener(T=>{S(T)})),[r]),g.jsx("div",{"aria-activedescendant":v?e:void 0,"aria-autocomplete":v?t:"none","aria-controls":v?n:void 0,"aria-describedby":s,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":v&&y==="combobox"?!!o:void 0,...a!=null?{"aria-invalid":a}:{},"aria-label":l,"aria-labelledby":u,"aria-multiline":c,"aria-owns":v?d:void 0,"aria-readonly":!v||void 0,"aria-required":f,autoCapitalize:h,className:p,contentEditable:v,"data-testid":C,id:m,ref:j,role:v?y:void 0,spellCheck:D,style:x,tabIndex:E,...A})}const Kd=w.forwardRef(Vd);function sl(r){return r.getEditorState().read(Ta(r.isComposing()))}const Hd=w.forwardRef(Qd);function Qd(r,e){const{placeholder:t,...n}=r,[s]=St();return g.jsxs(g.Fragment,{children:[g.jsx(Kd,{editor:s,...n,ref:e}),t!=null&&g.jsx(Jd,{editor:s,content:t})]})}function Jd({content:r,editor:e}){const t=function(o){const[a,l]=w.useState(()=>sl(o));return $a(()=>{function u(){const c=sl(o);l(c)}return u(),vr(o.registerUpdateListener(()=>{u()}),o.registerEditableListener(()=>{u()}))},[o]),a}(e),[n,s]=w.useState(e.isEditable());if(w.useLayoutEffect(()=>(s(e.isEditable()),e.registerEditableListener(o=>{s(o)})),[e]),!t)return null;let i=null;return typeof r=="function"?i=r(n):r!==null&&(i=r),i===null?null:g.jsx("div",{"aria-hidden":!0,children:i})}const In=0,fi=1,hi=2,wt=0,Yd=1,il=2,Xd=3,Zd=4;function ef(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return wt;const i=e._selection,o=r._selection;if(s)return Yd;if(!(O(i)&&O(o)&&o.isCollapsed()&&i.isCollapsed()))return wt;const a=function(D,x,E){const C=D._nodeMap,A=[];for(const b of x){const v=C.get(b);v!==void 0&&A.push(v)}for(const[b,v]of E){if(!v)continue;const S=C.get(b);S===void 0||tt(S)||A.push(S)}return A}(e,t,n);if(a.length===0)return wt;if(a.length>1){const D=e._nodeMap,x=D.get(i.anchor.key),E=D.get(o.anchor.key);return x&&E&&!r._nodeMap.has(x.__key)&&z(x)&&x.__text.length===1&&i.anchor.offset===1?il:wt}const l=a[0],u=r._nodeMap.get(l.__key);if(!z(u)||!z(l)||u.__mode!==l.__mode)return wt;const c=u.__text,d=l.__text;if(c===d)return wt;const f=i.anchor,h=o.anchor;if(f.key!==h.key||f.type!=="text")return wt;const p=f.offset,m=h.offset,y=d.length-c.length;return y===1&&m===p-1?il:y===-1&&m===p+1?Xd:y===-1&&m===p?Zd:wt}function tf(r,e){let t=Date.now(),n=wt;return(s,i,o,a,l,u)=>{const c=Date.now();if(u.has("historic"))return n=wt,t=c,hi;const d=ef(s,i,a,l,r.isComposing()),f=(()=>{const h=o===null||o.editor===r,p=u.has("history-push");if(!p&&h&&u.has("history-merge"))return In;if(s===null)return fi;const m=i._selection;return a.size>0||l.size>0?p===!1&&d!==wt&&d===n&&c<t+e&&h||a.size===1&&function(y,D,x){const E=D._nodeMap.get(y),C=x._nodeMap.get(y),A=D._selection,b=x._selection;return!(O(A)&&O(b)&&A.anchor.type==="element"&&A.focus.type==="element"&&b.anchor.type==="text"&&b.focus.type==="text"||!z(E)||!z(C)||E.__parent!==C.__parent)&&JSON.stringify(D.read(()=>E.exportJSON()))===JSON.stringify(x.read(()=>C.exportJSON()))}(Array.from(a)[0],s,i)?In:fi:m!==null?In:hi})();return t=c,n=d,f}}function ol(r){r.undoStack=[],r.redoStack=[],r.current=null}function rf(r,e,t){const n=tf(r,t);return vr(r.registerCommand(_i,()=>(function(i,o){const a=o.redoStack,l=o.undoStack;if(l.length!==0){const u=o.current,c=l.pop();u!==null&&(a.push(u),i.dispatchCommand(Fn,!0)),l.length===0&&i.dispatchCommand(Rn,!1),o.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),ye),r.registerCommand(vi,()=>(function(i,o){const a=o.redoStack,l=o.undoStack;if(a.length!==0){const u=o.current;u!==null&&(l.push(u),i.dispatchCommand(Rn,!0));const c=a.pop();a.length===0&&i.dispatchCommand(Fn,!1),o.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),ye),r.registerCommand(tc,()=>(ol(e),!1),ye),r.registerCommand(rc,()=>(ol(e),r.dispatchCommand(Fn,!1),r.dispatchCommand(Rn,!1),!0),ye),r.registerUpdateListener(({editorState:i,prevEditorState:o,dirtyLeaves:a,dirtyElements:l,tags:u})=>{const c=e.current,d=e.redoStack,f=e.undoStack,h=c===null?null:c.editorState;if(c!==null&&i===h)return;const p=n(o,i,c,a,l,u);if(p===fi)d.length!==0&&(e.redoStack=[],r.dispatchCommand(Fn,!1)),c!==null&&(f.push({...c}),r.dispatchCommand(Rn,!0));else if(p===hi)return;e.current={editor:r,editorState:i}}))}function nf(){return{current:null,redoStack:[],undoStack:[]}}function sf({delay:r,externalHistoryState:e}){const[t]=St();return function(n,s,i=1e3){const o=w.useMemo(()=>s||nf(),[s]);w.useEffect(()=>rf(n,o,i),[i,n,o])}(t,e,r),null}const of=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?w.useLayoutEffect:w.useEffect;function lf({ignoreHistoryMergeTagChange:r=!0,ignoreSelectionChange:e=!1,onChange:t}){const[n]=St();return of(()=>{if(t)return n.registerUpdateListener(({editorState:s,dirtyElements:i,dirtyLeaves:o,prevEditorState:a,tags:l})=>{e&&i.size===0&&o.size===0||r&&l.has("history-merge")||a.isEmpty()||t(s,n,l)})},[n,r,e,t]),null}function pi(r,e){return pi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},pi(r,e)}var ll={error:null},af=function(r){var e,t;function n(){for(var i,o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return(i=r.call.apply(r,[this].concat(a))||this).state=ll,i.resetErrorBoundary=function(){for(var u,c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];i.props.onReset==null||(u=i.props).onReset.apply(u,d),i.reset()},i}t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,pi(e,t),n.getDerivedStateFromError=function(i){return{error:i}};var s=n.prototype;return s.reset=function(){this.setState(ll)},s.componentDidCatch=function(i,o){var a,l;(a=(l=this.props).onError)==null||a.call(l,i,o)},s.componentDidUpdate=function(i,o){var a,l,u,c,d=this.state.error,f=this.props.resetKeys;d!==null&&o.error!==null&&((u=i.resetKeys)===void 0&&(u=[]),(c=f)===void 0&&(c=[]),u.length!==c.length||u.some(function(h,p){return!Object.is(h,c[p])}))&&((a=(l=this.props).onResetKeysChange)==null||a.call(l,i.resetKeys,f),this.reset())},s.render=function(){var i=this.state.error,o=this.props,a=o.fallbackRender,l=o.FallbackComponent,u=o.fallback;if(i!==null){var c={error:i,resetErrorBoundary:this.resetErrorBoundary};if(Ns.isValidElement(u))return u;if(typeof a=="function")return a(c);if(l)return Ns.createElement(l,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(Ns.Component);function uf({children:r,onError:e}){return g.jsx(af,{fallback:g.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function cf(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Pt=cf(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function df(r){let e=1,t=r.getParent();for(;t!=null;){if(Pe(t)){const n=t.getParent();if(de(n)){e++,t=n.getParent();continue}Pt(40)}return e}return e}function gi(r){let e=r.getParent();de(e)||Pt(40);let t=e;for(;t!==null;)t=t.getParent(),de(t)&&(e=t);return e}function za(r){let e=[];const t=r.getChildren().filter(Pe);for(let n=0;n<t.length;n++){const s=t[n],i=s.getFirstChild();de(i)?e=e.concat(za(i)):e.push(s)}return e}function Mt(r){return Pe(r)&&de(r.getFirstChild())}function al(r){return dt().append(r)}function qa(r,e){return Pe(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function ul(r,e){r.update(()=>{const t=K();if(t!==null){const n=t.getNodes();if(O(t)){const i=t.getStartEndPoints();i===null&&Pt(143);const[o]=i,a=o.getNode(),l=a.getParent();if(qa(a,n)){const u=lt(e);if(Ot(l)){a.replace(u);const c=dt();F(a)&&(c.setFormat(a.getFormatType()),c.setIndent(a.getIndent())),u.append(c)}else if(Pe(a)){const c=a.getParentOrThrow();br(u,c.getChildren()),c.replace(u)}return}}const s=new Set;for(let i=0;i<n.length;i++){const o=n[i];if(!F(o)||!o.isEmpty()||Pe(o)||s.has(o.getKey())){if(Vl(o)){let a=o.getParent();for(;a!=null;){const l=a.getKey();if(de(a)){if(!s.has(l)){const u=lt(e);br(u,a.getChildren()),a.replace(u),s.add(l)}break}{const u=a.getParent();if(Ot(u)&&!s.has(l)){s.add(l),cl(a,e);break}a=u}}}}else cl(o,e)}}})}function br(r,e){r.splice(r.getChildrenSize(),0,e)}function cl(r,e){if(de(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=dt();let i;if(br(s,r.getChildren()),de(t)&&e===t.getListType())t.append(s),de(n)&&e===n.getListType()&&(br(t,n.getChildren()),n.remove()),i=t;else if(de(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),i=n;else{const o=lt(e);o.append(s),r.replace(o),i=o}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),i}function Hi(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&Mt(t)&&Mt(n)&&(Hi(t.getFirstChild(),n.getFirstChild()),n.remove());const s=e.getChildren();s.length>0&&r.append(...s),e.remove()}function ff(r){r.update(()=>{const e=K();if(O(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(qa(s,n))t.add(gi(s));else for(let i=0;i<n.length;i++){const o=n[i];if(Vl(o)){const a=Ed(o,Cr);a!=null&&t.add(gi(a))}}for(const i of t){let o=i;const a=za(i);for(const l of a){const u=Ue();br(u,l.getChildren()),o.insertAfter(u),o=u,l.__key===e.anchor.key&&e.anchor.set(u.getKey(),0,"element"),l.__key===e.focus.key&&e.focus.set(u.getKey(),0,"element"),l.remove()}i.remove()}}})}function hf(r){const e=new Set;if(Mt(r)||e.has(r.getKey()))return;const t=r.getParent(),n=r.getNextSibling(),s=r.getPreviousSibling();if(Mt(n)&&Mt(s)){const i=s.getFirstChild();if(de(i)){i.append(r);const o=n.getFirstChild();de(o)&&(br(i,o.getChildren()),n.remove(),e.add(n.getKey()))}}else if(Mt(n)){const i=n.getFirstChild();if(de(i)){const o=i.getFirstChild();o!==null&&o.insertBefore(r)}}else if(Mt(s)){const i=s.getFirstChild();de(i)&&i.append(r)}else if(de(t)){const i=dt(),o=lt(t.getListType());i.append(o),o.append(r),s?s.insertAfter(i):n?n.insertBefore(i):t.append(i)}}function pf(r){if(Mt(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(de(t?t.getParent():void 0)&&Pe(t)&&de(e)){const n=e?e.getFirstChild():void 0,s=e?e.getLastChild():void 0;if(r.is(n))t.insertBefore(r),e.isEmpty()&&t.remove();else if(r.is(s))t.insertAfter(r),e.isEmpty()&&t.remove();else{const i=e.getListType(),o=dt(),a=lt(i);o.append(a),r.getPreviousSiblings().forEach(c=>a.append(c));const l=dt(),u=lt(i);l.append(u),br(u,r.getNextSiblings()),t.insertBefore(o),t.insertAfter(l),t.replace(r)}}}function gf(){const r=K();if(!O(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!Pe(e)||e.getChildrenSize()!==0)return!1;const t=gi(e),n=e.getParent();de(n)||Pt(40);const s=n.getParent();let i;if(Ot(s))i=Ue(),t.insertAfter(i);else{if(!Pe(s))return!1;i=dt(),s.insertAfter(i)}i.select();const o=e.getNextSiblings();if(o.length>0){const a=lt(n.getListType());if(Or(i))i.insertAfter(a);else{const l=dt();l.append(a),i.insertAfter(l)}o.forEach(l=>{l.remove(),a.append(l)})}return function(a){let l=a;for(;l.getNextSibling()==null&&l.getPreviousSibling()==null;){const u=l.getParent();if(u==null||!Pe(l)&&!de(l))break;l=u}l.remove()}(e),!0}function as(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}class Cr extends Jt{static getType(){return"listitem"}static clone(e){return new Cr(e.__value,e.__checked,e.__key)}constructor(e,t,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}createDOM(e){const t=document.createElement("li"),n=this.getParent();return de(n)&&n.getListType()==="check"&&fl(t,this,null),t.value=this.__value,dl(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return de(s)&&s.getListType()==="check"&&fl(t,this,e),t.value=this.__value,dl(t,n.theme,this),!1}static transform(){return e=>{if(Pe(e)||Pt(144),e.__checked==null)return;const t=e.getParent();de(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:mf,priority:0})}}static importJSON(e){const t=dt();return t.setChecked(e.checked),t.setValue(e.value),t.setFormat(e.format),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config);return t.style.textAlign=this.getFormatType(),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(F(n)&&this.canMergeWith(n)){const s=n.getChildren();this.append(...s),n.remove()}else super.append(n)}return this}replace(e,t){if(Pe(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!de(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=lt(n.getListType());let i=this.getNextSibling();for(;i;){const o=i;i=i.getNextSibling(),s.append(o)}n.insertAfter(e),e.insertAfter(s)}return t&&(F(e)||Pt(139),this.getChildren().forEach(s=>{e.append(s)})),this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(de(n)||Pt(39),Pe(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const i=lt(n.getListType());s.forEach(o=>i.append(o)),e.insertAfter(i,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&Mt(t)&&Mt(n)&&(Hi(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=dt(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=Ue();this.getChildren().forEach(o=>t.append(o));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),i=Pe(s);if(n.getChildrenSize()===1)if(i)n.remove(),s.select();else{n.insertBefore(t),n.remove();const o=e.anchor,a=e.focus,l=t.getKey();o.type==="element"&&o.getNode().is(this)&&o.set(l,o.offset,"element"),a.type==="element"&&a.getNode().is(this)&&a.set(l,a.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){this.getWritable().__value=e}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return de(n)&&(t=n.getListType()),t==="check"?!!e.__checked:void 0}setChecked(e){this.getWritable().__checked=e}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){const e=this.getParent();if(e===null)return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;Pe(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&Pt(117),(e=Math.floor(e))>=0||Pt(199);let t=this.getIndent();for(;t!==e;)t<e?(hf(this),t++):(pf(this),t--);return this}canInsertAfter(e){return Pe(e)}canReplaceWith(e){return Pe(e)}canMergeWith(e){return Or(e)||Pe(e)}extractWithChild(e,t){if(!O(t))return!1;const n=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(s)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return lt("bullet")}canMergeWhenEmpty(){return!0}}function dl(r,e,t){const n=[],s=[],i=e.list,o=i?i.listitem:void 0;let a;if(i&&i.nested&&(a=i.nested.listitem),o!==void 0&&n.push(...as(o)),i){const l=t.getParent(),u=de(l)&&l.getListType()==="check",c=t.getChecked();u&&!c||s.push(i.listitemUnchecked),u&&c||s.push(i.listitemChecked),u&&n.push(c?i.listitemChecked:i.listitemUnchecked)}if(a!==void 0){const l=as(a);t.getChildren().some(u=>de(u))?n.push(...l):s.push(...l)}s.length>0&&Ra(r,...s),n.length>0&&Tn(r,...n)}function fl(r,e,t,n){de(e.getFirstChild())?(r.removeAttribute("role"),r.removeAttribute("tabIndex"),r.removeAttribute("aria-checked")):(r.setAttribute("role","checkbox"),r.setAttribute("tabIndex","-1"),t&&e.__checked===t.__checked||r.setAttribute("aria-checked",e.getChecked()?"true":"false"))}function mf(r){if(r.classList.contains("task-list-item")){for(const t of r.children)if(t.tagName==="INPUT")return yf(t)}const e=r.getAttribute("aria-checked");return{node:dt(e==="true"||e!=="false"&&void 0)}}function yf(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:dt(r.hasAttribute("checked"))}}function dt(r){return $t(new Cr(void 0,r))}function Pe(r){return r instanceof Cr}class qr extends Jt{static getType(){return"list"}static clone(e){const t=e.__listType||gl[e.__tag];return new qr(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=gl[e]||e;this.__listType=s,this.__tag=s==="number"?"ol":"ul",this.__start=t}getTag(){return this.__tag}setListType(e){const t=this.getWritable();t.__listType=e,t.__tag=e==="number"?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(e,t){const n=this.__tag,s=document.createElement(n);return this.__start!==1&&s.setAttribute("start",String(this.__start)),s.__lexicalListType=this.__listType,hl(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(hl(t,n.theme,this),!1)}static transform(){return e=>{de(e)||Pt(163),function(t){const n=t.getNextSibling();de(n)&&t.getListType()===n.getListType()&&Hi(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const i of t.getChildren())Pe(i)&&(i.getValue()!==s&&i.setValue(s),n&&i.getLatest().__checked!=null&&i.setChecked(void 0),de(i.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:pl,priority:0}),ul:()=>({conversion:pl,priority:0})}}static importJSON(e){const t=lt(e.listType,e.start);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config,e);return t&&Ht(t)&&(this.__start!==1&&t.setAttribute("start",String(this.__start)),this.__listType==="check"&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(Pe(n))super.append(n);else{const s=dt();if(de(n))s.append(n);else if(F(n))if(n.isInline())s.append(n);else{const i=Ge(n.getTextContent());s.append(i)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return Pe(e)}}function hl(r,e,t){const n=[],s=[],i=e.list;if(i!==void 0){const o=i[`${t.__tag}Depth`]||[],a=df(t)-1,l=a%o.length,u=o[l],c=i[t.__tag];let d;const f=i.nested,h=i.checklist;if(f!==void 0&&f.list&&(d=f.list),c!==void 0&&n.push(c),h!==void 0&&t.__listType==="check"&&n.push(h),u!==void 0){n.push(...as(u));for(let p=0;p<o.length;p++)p!==l&&s.push(t.__tag+p)}if(d!==void 0){const p=as(d);a>1?n.push(...p):s.push(...p)}}s.length>0&&Ra(r,...s),n.length>0&&Tn(r,...n)}function xf(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(Pe(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(i=>{de(i)&&e.push(al(i))})}else e.push(al(n))}return e}function pl(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=lt("number",r.start):e==="ul"&&(t=function(n){if(n.getAttribute("__lexicallisttype")==="check"||n.classList.contains("contains-task-list"))return!0;for(const s of n.childNodes)if(Ht(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?lt("check"):lt("bullet")),{after:xf,node:t}}const gl={ol:"number",ul:"bullet"};function lt(r,e=1){return $t(new qr(r,e))}function de(r){return r instanceof qr}const Ua=xn(),Wa=xn(),bf=xn();function _f(r){return vr(r.registerCommand(Wa,()=>(ul(r,"number"),!0),Nr),r.registerCommand(Ua,()=>(ul(r,"bullet"),!0),Nr),r.registerCommand(bf,()=>(ff(r),!0),Nr),r.registerCommand(dn,()=>!!gf(),Nr))}function vf(){const[r]=St();return w.useEffect(()=>{if(!r.hasNodes([qr,Cr]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[r]),function(e){w.useEffect(()=>_f(e),[e])}(r),null}const Cf=new Set(["http:","https:","mailto:","sms:","tel:"]);class wr extends Jt{static getType(){return"link"}static clone(e){return new wr(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},n){super(n);const{target:s=null,rel:i=null,title:o=null}=t;this.__url=e,this.__target=s,this.__rel=i,this.__title=o}createDOM(e){const t=document.createElement("a");return t.href=this.sanitizeUrl(this.__url),this.__target!==null&&(t.target=this.__target),this.__rel!==null&&(t.rel=this.__rel),this.__title!==null&&(t.title=this.__title),Tn(t,e.theme.link),t}updateDOM(e,t,n){if(t instanceof HTMLAnchorElement){const s=this.__url,i=this.__target,o=this.__rel,a=this.__title;s!==e.__url&&(t.href=s),i!==e.__target&&(i?t.target=i:t.removeAttribute("target")),o!==e.__rel&&(o?t.rel=o:t.removeAttribute("rel")),a!==e.__title&&(a?t.title=a:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:wf,priority:1})}}static importJSON(e){const t=us(e.url,{rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}sanitizeUrl(e){try{const t=new URL(e);if(!Cf.has(t.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){this.getWritable().__title=e}insertNewAfter(e,t=!0){const n=us(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!O(t))return!1;const s=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(s)&&this.isParentOf(i)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function wf(r){let e=null;if(Lc(r)){const t=r.textContent;(t!==null&&t!==""||r.children.length>0)&&(e=us(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function us(r,e){return $t(new wr(r,e))}function Jr(r){return r instanceof wr}class Nn extends wr{constructor(e,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new Nn(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){const t=ml(e.url,{isUnlinked:e.isUnlinked,rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked,type:"autolink",version:1}}insertNewAfter(e,t=!0){const n=this.getParentOrThrow().insertNewAfter(e,t);if(F(n)){const s=ml(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function ml(r,e){return $t(new Nn(r,e))}function Df(r){return r instanceof Nn}const yl=xn();function Gs(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,i=K();if(!O(i))return;const o=i.extract();if(r===null)o.forEach(a=>{const l=Es(a,u=>!Df(u)&&Jr(u));if(l){const u=l.getChildren();for(let c=0;c<u.length;c++)l.insertBefore(u[c]);l.remove()}});else{if(o.length===1){const u=function(c,d){let f=c;for(;f!==null&&f.getParent()!==null&&!d(f);)f=f.getParentOrThrow();return d(f)?f:null}(o[0],Jr);if(u!==null)return u.setURL(r),t!==void 0&&u.setTarget(t),s!==null&&u.setRel(s),void(n!==void 0&&u.setTitle(n))}let a=null,l=null;o.forEach(u=>{const c=u.getParent();if(c!==l&&c!==null&&(!F(u)||u.isInline())){if(Jr(c))return l=c,c.setURL(r),t!==void 0&&c.setTarget(t),s!==null&&l.setRel(s),void(n!==void 0&&l.setTitle(n));if(c.is(a)||(a=c,l=us(r,{rel:s,target:t,title:n}),Jr(c)?u.getPreviousSibling()===null?c.insertBefore(l):c.insertAfter(l):u.insertBefore(l)),Jr(u)){if(u.is(l))return;if(l!==null){const d=u.getChildren();for(let f=0;f<d.length;f++)l.append(d[f])}u.remove()}else l!==null&&l.append(u)}})}}function Ef({validateUrl:r,attributes:e}){const[t]=St();return w.useEffect(()=>{if(!t.hasNodes([wr]))throw new Error("LinkPlugin: LinkNode not registered on editor");return vr(t.registerCommand(yl,n=>{if(n===null)return Gs(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(Gs(n,e),!0);{const{url:s,target:i,rel:o,title:a}=n;return Gs(s,{...e,rel:o,target:i,title:a}),!0}},Nr),r!==void 0?t.registerCommand(fs,n=>{const s=K();if(!O(s)||s.isCollapsed()||!nr(n,ClipboardEvent))return!1;const i=n;if(i.clipboardData===null)return!1;const o=i.clipboardData.getData("text");return!!r(o)&&!s.getNodes().some(a=>F(a))&&(t.dispatchCommand(yl,{...e,url:o}),n.preventDefault(),!0)},Nr):()=>{})},[t,r,e]),null}function Sf(r){if(r instanceof HTMLImageElement){const e=r.getAttribute("src")||"",t=r.getAttribute("alt")||"",n=r.getAttribute("width"),s=r.getAttribute("height");return{node:Ga({src:e,altText:t,width:n?parseInt(n,10):void 0,height:s?parseInt(s,10):void 0})}}return null}function Af({src:r,alt:e,width:t,height:n}){return g.jsx("img",{src:r,alt:e,width:t,height:n,style:{maxWidth:"100%",height:"auto",display:"block",margin:"8px 0",borderRadius:"4px"}})}class ks extends Wi{constructor(t,n,s,i,o){super(o);_t(this,"__src");_t(this,"__altText");_t(this,"__width");_t(this,"__height");this.__src=t,this.__altText=n||"",this.__width=s,this.__height=i}static getType(){return"image"}static clone(t){return new ks(t.__src,t.__altText,t.__width,t.__height,t.__key)}static importJSON(t){const{src:n,altText:s,width:i,height:o}=t;return Ga({src:n,altText:s,width:i,height:o})}exportJSON(){return{type:"image",version:1,src:this.__src,altText:this.__altText,width:this.__width,height:this.__height}}static importDOM(){return{img:()=>({conversion:Sf,priority:0})}}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),this.__altText&&t.setAttribute("alt",this.__altText),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),t.style.maxWidth="100%",t.style.height="auto",{element:t}}createDOM(){const t=document.createElement("span");return t.style.display="inline-block",t}updateDOM(){return!1}decorate(){return g.jsx(Af,{src:this.__src,alt:this.__altText,width:this.__width,height:this.__height})}}function Ga(r){return new ks(r.src,r.altText,r.width,r.height)}var kf=Object.defineProperty,cs=Object.getOwnPropertySymbols,Va=Object.prototype.hasOwnProperty,Ka=Object.prototype.propertyIsEnumerable,xl=(r,e,t)=>e in r?kf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,mi=(r,e)=>{for(var t in e||(e={}))Va.call(e,t)&&xl(r,t,e[t]);if(cs)for(var t of cs(e))Ka.call(e,t)&&xl(r,t,e[t]);return r},yi=(r,e)=>{var t={};for(var n in r)Va.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&cs)for(var n of cs(r))e.indexOf(n)<0&&Ka.call(r,n)&&(t[n]=r[n]);return t};/**
73
+ `?l.insertParagraph():u===" "?l.insertNodes([En()]):l.insertText(u)}}}else e.insertRawText(i)}function Qo(r,e,t){r.dispatchCommand(Gu,{nodes:e,selection:t})||t.insertNodes(e)}function Ia(r,e,t,n=[]){let s=e===null||t.isSelected(e);const i=F(t)&&t.excludeFromCopy("html");let o=t;if(e!==null){let u=Ii(t);u=z(u)&&e!==null?Na(e,u):u,o=u}const a=F(o)?o.getChildren():[],l=function(u){const c=u.exportJSON(),d=u.constructor;if(c.type!==d.getType()&&ls(58,d.name),F(u)){const f=c.children;Array.isArray(f)||ls(59,d.name)}return c}(o);if(z(o)){const u=o.__text;u.length>0?l.text=u:s=!1}for(let u=0;u<a.length;u++){const c=a[u],d=Ia(r,e,c,l.children);!s&&F(t)&&d&&t.extractWithChild(c,e,"clone")&&(s=!0)}if(s&&!i)n.push(l);else if(Array.isArray(l.children))for(let u=0;u<l.children.length;u++){const c=l.children[u];n.push(c)}return s}function Fd(r,e){const t=[],n=Fe().getChildren();for(let s=0;s<n.length;s++)Ia(r,e,n[s],t);return{namespace:r._config.namespace,nodes:t}}function Rd(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t],s=td(n);z(s)&&xd(s),e.push(s)}return e}let Sr=null;async function Jo(r,e,t){if(Sr!==null)return!1;if(e!==null)return new Promise((l,u)=>{r.update(()=>{l(Yo(r,e,t))})});const n=r.getRootElement(),s=r._window==null?window.document:r._window.document,i=gt(r._window);if(n===null||i===null)return!1;const o=s.createElement("span");o.style.cssText="position: fixed; top: -1000px;",o.append(s.createTextNode("#")),n.append(o);const a=new Range;return a.setStart(o,0),a.setEnd(o,1),i.removeAllRanges(),i.addRange(a),new Promise((l,u)=>{const c=r.registerCommand(hs,d=>(nr(d,ClipboardEvent)&&(c(),Sr!==null&&(window.clearTimeout(Sr),Sr=null),l(Yo(r,d,t))),!0),nd);Sr=window.setTimeout(()=>{c(),Sr=null,l(!1)},50),s.execCommand("copy"),o.remove()})}function Yo(r,e,t){if(t===void 0){const s=gt(r._window);if(!s)return!1;const i=s.anchorNode,o=s.focusNode;if(i!==null&&o!==null&&!vn(r,i,o))return!1;const a=K();if(a===null)return!1;t=Md(a)}e.preventDefault();const n=e.clipboardData;return n!==null&&(Pd(n,t),!0)}const Ld=[["text/html",Nd],["application/x-lexical-editor",Bd]];function Md(r=K()){const e={"text/plain":r?r.getTextContent():""};if(r){const t=Mc();for(const[n,s]of Ld){const i=s(t,r);i!==null&&(e[n]=i)}}return e}function Pd(r,e){for(const t in e){const n=e[t];n!==void 0&&r.setData(t,n)}}function Xo(r,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(r,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(r,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const zr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,jd=zr&&"documentMode"in document?document.documentMode:null,Od=!(!zr||!("InputEvent"in window)||jd)&&"getTargetRanges"in new window.InputEvent("input"),Id=zr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Zo=zr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,$d=zr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),zd=zr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!$d,el=xn();class Ss extends Jt{static getType(){return"quote"}static clone(e){return new Ss(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return Tn(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:qd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=Ki();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,t){const n=Ue(),s=this.getDirection();return n.setDirection(s),this.insertAfter(n,t),n}collapseAtStart(){const e=Ue();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Ki(){return $t(new Ss)}class As extends Jt{static getType(){return"heading"}static clone(e){return new As(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}createDOM(e){const t=this.__tag,n=document.createElement(t),s=e.theme.heading;if(s!==void 0){const i=s[t];Tn(n,i)}return n}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:Ar,priority:0}),h2:e=>({conversion:Ar,priority:0}),h3:e=>({conversion:Ar,priority:0}),h4:e=>({conversion:Ar,priority:0}),h5:e=>({conversion:Ar,priority:0}),h6:e=>({conversion:Ar,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&tl(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>tl(e)?{conversion:t=>({node:en("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ht(t)){this.isEmpty()&&t.append(document.createElement("br"));const n=this.getFormatType();t.style.textAlign=n;const s=this.getDirection();s&&(t.dir=s)}return{element:t}}static importJSON(e){const t=en(e.tag);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,s=this.getLastDescendant(),i=!s||e&&e.anchor.key===s.getKey()&&n===s.getTextContentSize()||!e?Ue():en(this.getTag()),o=this.getDirection();if(i.setDirection(o),this.insertAfter(i,t),n===0&&!this.isEmpty()&&e){const a=Ue();a.select(),this.replace(a,!0)}return i}collapseAtStart(){const e=this.isEmpty()?Ue():en(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function tl(r){return r.nodeName.toLowerCase()==="span"&&r.style.fontSize==="26pt"}function Ar(r){const e=r.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=en(e),r.style!==null&&($i(r,t),t.setFormat(r.style.textAlign))),{node:t}}function qd(r){const e=Ki();return r.style!==null&&(e.setFormat(r.style.textAlign),$i(r,e)),{node:e}}function en(r){return $t(new As(r))}function jn(r){let e=null;if(nr(r,DragEvent)?e=r.dataTransfer:nr(r,ClipboardEvent)&&(e=r.clipboardData),e===null)return[!1,[],!1];const t=e.types,n=t.includes("Files"),s=t.includes("text/html")||t.includes("text/plain");return[n,Array.from(e.files),s]}function rl(r){const e=K();if(!O(e))return!1;const t=new Set,n=e.getNodes();for(let s=0;s<n.length;s++){const i=n[s],o=i.getKey();if(t.has(o))continue;const a=Es(i,u=>F(u)&&!u.isInline());if(a===null)continue;const l=a.getKey();a.canIndent()&&!t.has(l)&&(t.add(l),r(a))}return t.size>0}function On(r){const e=jr(r);return Ce(e)}function Ud(r){return vr(r.registerCommand(Sl,e=>{const t=K();return!!Lt(t)&&(t.clear(),!0)},0),r.registerCommand(fr,e=>{const t=K();return!!O(t)&&(t.deleteCharacter(e),!0)},ye),r.registerCommand(fn,e=>{const t=K();return!!O(t)&&(t.deleteWord(e),!0)},ye),r.registerCommand(hn,e=>{const t=K();return!!O(t)&&(t.deleteLine(e),!0)},ye),r.registerCommand(Rr,e=>{const t=K();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const n=e.dataTransfer;if(n!=null)Ho(n,t,r);else if(O(t)){const s=e.data;return s&&t.insertText(s),!0}}return!0},ye),r.registerCommand(Hs,()=>{const e=K();return!!O(e)&&(e.removeText(),!0)},ye),r.registerCommand(Dt,e=>{const t=K();return!!O(t)&&(t.formatText(e),!0)},ye),r.registerCommand(Zu,e=>{const t=K();if(!O(t)&&!Lt(t))return!1;const n=t.getNodes();for(const s of n){const i=Es(s,o=>F(o)&&!o.isInline());i!==null&&i.setFormat(e)}return!0},ye),r.registerCommand(Fr,e=>{const t=K();return!!O(t)&&(t.insertLineBreak(e),!0)},ye),r.registerCommand(dn,()=>{const e=K();return!!O(e)&&(e.insertParagraph(),!0)},ye),r.registerCommand(Yu,()=>(ba([En()]),!0),ye),r.registerCommand(Xu,()=>rl(e=>{const t=e.getIndent();e.setIndent(t+1)}),ye),r.registerCommand(oo,()=>rl(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),ye),r.registerCommand(Tl,e=>{const t=K();if(Lt(t)&&!On(e.target)){const n=t.getNodes();if(n.length>0)return n[0].selectPrevious(),!0}else if(O(t)){const n=pn(t.focus,!0);if(!e.shiftKey&&Ce(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},ye),r.registerCommand(Nl,e=>{const t=K();if(Lt(t)){const n=t.getNodes();if(n.length>0)return n[0].selectNext(0,0),!0}else if(O(t)){if(function(s){const i=s.focus;return i.key==="root"&&i.offset===Fe().getChildrenSize()}(t))return e.preventDefault(),!0;const n=pn(t.focus,!1);if(!e.shiftKey&&Ce(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},ye),r.registerCommand(kl,e=>{const t=K();if(Lt(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!O(t))return!1;if(Go(t,!0)){const n=e.shiftKey;return e.preventDefault(),Vo(t,n,!0),!0}return!1},ye),r.registerCommand(Al,e=>{const t=K();if(Lt(t)&&!On(e.target)){const s=t.getNodes();if(s.length>0)return e.preventDefault(),s[0].selectNext(0,0),!0}if(!O(t))return!1;const n=e.shiftKey;return!!Go(t,!1)&&(e.preventDefault(),Vo(t,n,!1),!0)},ye),r.registerCommand(Bl,e=>{if(On(e.target))return!1;const t=K();if(!O(t))return!1;const{anchor:n}=t,s=n.getNode();return t.isCollapsed()&&n.offset===0&&!tt(s)&&Sd(s).getIndent()>0?(e.preventDefault(),r.dispatchCommand(oo,void 0)):(!Zo||navigator.language!=="ko-KR")&&(e.preventDefault(),r.dispatchCommand(fr,!0))},ye),r.registerCommand(Rl,e=>{if(On(e.target))return!1;const t=K();return!!O(t)&&(e.preventDefault(),r.dispatchCommand(fr,!1))},ye),r.registerCommand(Gn,e=>{const t=K();if(!O(t))return!1;if(e!==null){if((Zo||Id||zd)&&Od)return!1;if(e.preventDefault(),e.shiftKey)return r.dispatchCommand(Fr,!1)}return r.dispatchCommand(dn,void 0)},ye),r.registerCommand(Fl,()=>{const e=K();return!!O(e)&&(r.blur(),!0)},ye),r.registerCommand(Ll,e=>{const[,t]=jn(e);if(t.length>0){const s=Xo(e.clientX,e.clientY);if(s!==null){const{offset:i,node:o}=s,a=jr(o);if(a!==null){const l=Yc();if(z(a))l.anchor.set(a.getKey(),i,"text"),l.focus.set(a.getKey(),i,"text");else{const c=a.getParentOrThrow().getKey(),d=a.getIndexWithinParent()+1;l.anchor.set(c,d,"element"),l.focus.set(c,d,"element")}const u=Wl(l);jt(u)}r.dispatchCommand(el,t)}return e.preventDefault(),!0}const n=K();return!!O(n)},ye),r.registerCommand(Ml,e=>{const[t]=jn(e),n=K();return!(t&&!O(n))},ye),r.registerCommand(Pl,e=>{const[t]=jn(e),n=K();if(t&&!O(n))return!1;const s=Xo(e.clientX,e.clientY);if(s!==null){const i=jr(s.node);Ce(i)&&e.preventDefault()}return!0},ye),r.registerCommand(Qs,()=>(Bc(),!0),ye),r.registerCommand(hs,e=>(Jo(r,nr(e,ClipboardEvent)?e:null),!0),ye),r.registerCommand(Ci,e=>(async function(t,n){await Jo(n,nr(t,ClipboardEvent)?t:null),n.update(()=>{const s=K();O(s)?s.removeText():Lt(s)&&s.getNodes().forEach(i=>i.remove())})}(e,r),!0),ye),r.registerCommand(fs,e=>{const[,t,n]=jn(e);return t.length>0&&!n?(r.dispatchCommand(el,t),!0):Fi(e.target)?!1:K()!==null&&(function(s,i){s.preventDefault(),i.update(()=>{const o=K(),a=nr(s,InputEvent)||nr(s,KeyboardEvent)?null:s.clipboardData;a!=null&&o!==null&&Ho(a,o,i)},{tag:"paste"})}(e,r),!0)},ye))}const di=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?C.useLayoutEffect:C.useEffect;function nl(r){return r.getEditorState().read(Ta(r.isComposing()))}function Wd({contentEditable:r,placeholder:e=null,ErrorBoundary:t}){const[n]=St(),s=function(i,o){const[a,l]=C.useState(()=>i.getDecorators());return di(()=>i.registerDecoratorListener(u=>{Ji.flushSync(()=>{l(u)})}),[i]),C.useEffect(()=>{l(i.getDecorators())},[i]),C.useMemo(()=>{const u=[],c=Object.keys(a);for(let d=0;d<c.length;d++){const f=c[d],h=g.jsx(o,{onError:m=>i._onError(m),children:g.jsx(C.Suspense,{fallback:null,children:a[f]})}),p=i.getElementByKey(f);p!==null&&u.push(Ji.createPortal(h,p,f))}return u},[o,a,i])}(n,t);return function(i){di(()=>vr(Ud(i),Ad(i)),[i])}(n),g.jsxs(g.Fragment,{children:[r,g.jsx(Gd,{content:e}),s]})}function Gd({content:r}){const[e]=St(),t=function(s){const[i,o]=C.useState(()=>nl(s));return di(()=>{function a(){const l=nl(s);o(l)}return a(),vr(s.registerUpdateListener(()=>{a()}),s.registerEditableListener(()=>{a()}))},[s]),i}(e),n=ud();return t?typeof r=="function"?r(n):r:null}const $a=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?C.useLayoutEffect:C.useEffect;function Vd({editor:r,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:n,ariaDescribedBy:s,ariaErrorMessage:i,ariaExpanded:o,ariaInvalid:a,ariaLabel:l,ariaLabelledBy:u,ariaMultiline:c,ariaOwns:d,ariaRequired:f,autoCapitalize:h,className:p,id:m,role:y="textbox",spellCheck:w=!0,style:x,tabIndex:E,"data-testid":D,...A},b){const[v,S]=C.useState(r.isEditable()),k=C.useCallback(T=>{T&&T.ownerDocument&&T.ownerDocument.defaultView?r.setRootElement(T):r.setRootElement(null)},[r]),j=C.useMemo(()=>function(...T){return B=>{T.forEach(L=>{typeof L=="function"?L(B):L!=null&&(L.current=B)})}}(b,k),[k,b]);return $a(()=>(S(r.isEditable()),r.registerEditableListener(T=>{S(T)})),[r]),g.jsx("div",{"aria-activedescendant":v?e:void 0,"aria-autocomplete":v?t:"none","aria-controls":v?n:void 0,"aria-describedby":s,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":v&&y==="combobox"?!!o:void 0,...a!=null?{"aria-invalid":a}:{},"aria-label":l,"aria-labelledby":u,"aria-multiline":c,"aria-owns":v?d:void 0,"aria-readonly":!v||void 0,"aria-required":f,autoCapitalize:h,className:p,contentEditable:v,"data-testid":D,id:m,ref:j,role:v?y:void 0,spellCheck:w,style:x,tabIndex:E,...A})}const Kd=C.forwardRef(Vd);function sl(r){return r.getEditorState().read(Ta(r.isComposing()))}const Hd=C.forwardRef(Qd);function Qd(r,e){const{placeholder:t,...n}=r,[s]=St();return g.jsxs(g.Fragment,{children:[g.jsx(Kd,{editor:s,...n,ref:e}),t!=null&&g.jsx(Jd,{editor:s,content:t})]})}function Jd({content:r,editor:e}){const t=function(o){const[a,l]=C.useState(()=>sl(o));return $a(()=>{function u(){const c=sl(o);l(c)}return u(),vr(o.registerUpdateListener(()=>{u()}),o.registerEditableListener(()=>{u()}))},[o]),a}(e),[n,s]=C.useState(e.isEditable());if(C.useLayoutEffect(()=>(s(e.isEditable()),e.registerEditableListener(o=>{s(o)})),[e]),!t)return null;let i=null;return typeof r=="function"?i=r(n):r!==null&&(i=r),i===null?null:g.jsx("div",{"aria-hidden":!0,children:i})}const In=0,fi=1,hi=2,wt=0,Yd=1,il=2,Xd=3,Zd=4;function ef(r,e,t,n,s){if(r===null||t.size===0&&n.size===0&&!s)return wt;const i=e._selection,o=r._selection;if(s)return Yd;if(!(O(i)&&O(o)&&o.isCollapsed()&&i.isCollapsed()))return wt;const a=function(w,x,E){const D=w._nodeMap,A=[];for(const b of x){const v=D.get(b);v!==void 0&&A.push(v)}for(const[b,v]of E){if(!v)continue;const S=D.get(b);S===void 0||tt(S)||A.push(S)}return A}(e,t,n);if(a.length===0)return wt;if(a.length>1){const w=e._nodeMap,x=w.get(i.anchor.key),E=w.get(o.anchor.key);return x&&E&&!r._nodeMap.has(x.__key)&&z(x)&&x.__text.length===1&&i.anchor.offset===1?il:wt}const l=a[0],u=r._nodeMap.get(l.__key);if(!z(u)||!z(l)||u.__mode!==l.__mode)return wt;const c=u.__text,d=l.__text;if(c===d)return wt;const f=i.anchor,h=o.anchor;if(f.key!==h.key||f.type!=="text")return wt;const p=f.offset,m=h.offset,y=d.length-c.length;return y===1&&m===p-1?il:y===-1&&m===p+1?Xd:y===-1&&m===p?Zd:wt}function tf(r,e){let t=Date.now(),n=wt;return(s,i,o,a,l,u)=>{const c=Date.now();if(u.has("historic"))return n=wt,t=c,hi;const d=ef(s,i,a,l,r.isComposing()),f=(()=>{const h=o===null||o.editor===r,p=u.has("history-push");if(!p&&h&&u.has("history-merge"))return In;if(s===null)return fi;const m=i._selection;return a.size>0||l.size>0?p===!1&&d!==wt&&d===n&&c<t+e&&h||a.size===1&&function(y,w,x){const E=w._nodeMap.get(y),D=x._nodeMap.get(y),A=w._selection,b=x._selection;return!(O(A)&&O(b)&&A.anchor.type==="element"&&A.focus.type==="element"&&b.anchor.type==="text"&&b.focus.type==="text"||!z(E)||!z(D)||E.__parent!==D.__parent)&&JSON.stringify(w.read(()=>E.exportJSON()))===JSON.stringify(x.read(()=>D.exportJSON()))}(Array.from(a)[0],s,i)?In:fi:m!==null?In:hi})();return t=c,n=d,f}}function ol(r){r.undoStack=[],r.redoStack=[],r.current=null}function rf(r,e,t){const n=tf(r,t);return vr(r.registerCommand(_i,()=>(function(i,o){const a=o.redoStack,l=o.undoStack;if(l.length!==0){const u=o.current,c=l.pop();u!==null&&(a.push(u),i.dispatchCommand(Fn,!0)),l.length===0&&i.dispatchCommand(Rn,!1),o.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),ye),r.registerCommand(vi,()=>(function(i,o){const a=o.redoStack,l=o.undoStack;if(a.length!==0){const u=o.current;u!==null&&(l.push(u),i.dispatchCommand(Rn,!0));const c=a.pop();a.length===0&&i.dispatchCommand(Fn,!1),o.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:"historic"})}}(r,e),!0),ye),r.registerCommand(tc,()=>(ol(e),!1),ye),r.registerCommand(rc,()=>(ol(e),r.dispatchCommand(Fn,!1),r.dispatchCommand(Rn,!1),!0),ye),r.registerUpdateListener(({editorState:i,prevEditorState:o,dirtyLeaves:a,dirtyElements:l,tags:u})=>{const c=e.current,d=e.redoStack,f=e.undoStack,h=c===null?null:c.editorState;if(c!==null&&i===h)return;const p=n(o,i,c,a,l,u);if(p===fi)d.length!==0&&(e.redoStack=[],r.dispatchCommand(Fn,!1)),c!==null&&(f.push({...c}),r.dispatchCommand(Rn,!0));else if(p===hi)return;e.current={editor:r,editorState:i}}))}function nf(){return{current:null,redoStack:[],undoStack:[]}}function sf({delay:r,externalHistoryState:e}){const[t]=St();return function(n,s,i=1e3){const o=C.useMemo(()=>s||nf(),[s]);C.useEffect(()=>rf(n,o,i),[i,n,o])}(t,e,r),null}const of=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?C.useLayoutEffect:C.useEffect;function lf({ignoreHistoryMergeTagChange:r=!0,ignoreSelectionChange:e=!1,onChange:t}){const[n]=St();return of(()=>{if(t)return n.registerUpdateListener(({editorState:s,dirtyElements:i,dirtyLeaves:o,prevEditorState:a,tags:l})=>{e&&i.size===0&&o.size===0||r&&l.has("history-merge")||a.isEmpty()||t(s,n,l)})},[n,r,e,t]),null}function pi(r,e){return pi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},pi(r,e)}var ll={error:null},af=function(r){var e,t;function n(){for(var i,o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return(i=r.call.apply(r,[this].concat(a))||this).state=ll,i.resetErrorBoundary=function(){for(var u,c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];i.props.onReset==null||(u=i.props).onReset.apply(u,d),i.reset()},i}t=r,(e=n).prototype=Object.create(t.prototype),e.prototype.constructor=e,pi(e,t),n.getDerivedStateFromError=function(i){return{error:i}};var s=n.prototype;return s.reset=function(){this.setState(ll)},s.componentDidCatch=function(i,o){var a,l;(a=(l=this.props).onError)==null||a.call(l,i,o)},s.componentDidUpdate=function(i,o){var a,l,u,c,d=this.state.error,f=this.props.resetKeys;d!==null&&o.error!==null&&((u=i.resetKeys)===void 0&&(u=[]),(c=f)===void 0&&(c=[]),u.length!==c.length||u.some(function(h,p){return!Object.is(h,c[p])}))&&((a=(l=this.props).onResetKeysChange)==null||a.call(l,i.resetKeys,f),this.reset())},s.render=function(){var i=this.state.error,o=this.props,a=o.fallbackRender,l=o.FallbackComponent,u=o.fallback;if(i!==null){var c={error:i,resetErrorBoundary:this.resetErrorBoundary};if(Ns.isValidElement(u))return u;if(typeof a=="function")return a(c);if(l)return Ns.createElement(l,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(Ns.Component);function uf({children:r,onError:e}){return g.jsx(af,{fallback:g.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:r})}function cf(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Mt=cf(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function df(r){let e=1,t=r.getParent();for(;t!=null;){if(Me(t)){const n=t.getParent();if(de(n)){e++,t=n.getParent();continue}Mt(40)}return e}return e}function gi(r){let e=r.getParent();de(e)||Mt(40);let t=e;for(;t!==null;)t=t.getParent(),de(t)&&(e=t);return e}function za(r){let e=[];const t=r.getChildren().filter(Me);for(let n=0;n<t.length;n++){const s=t[n],i=s.getFirstChild();de(i)?e=e.concat(za(i)):e.push(s)}return e}function Pt(r){return Me(r)&&de(r.getFirstChild())}function al(r){return dt().append(r)}function qa(r,e){return Me(r)&&(e.length===0||e.length===1&&r.is(e[0])&&r.getChildrenSize()===0)}function ul(r,e){r.update(()=>{const t=K();if(t!==null){const n=t.getNodes();if(O(t)){const i=t.getStartEndPoints();i===null&&Mt(143);const[o]=i,a=o.getNode(),l=a.getParent();if(qa(a,n)){const u=lt(e);if(Ot(l)){a.replace(u);const c=dt();F(a)&&(c.setFormat(a.getFormatType()),c.setIndent(a.getIndent())),u.append(c)}else if(Me(a)){const c=a.getParentOrThrow();br(u,c.getChildren()),c.replace(u)}return}}const s=new Set;for(let i=0;i<n.length;i++){const o=n[i];if(!F(o)||!o.isEmpty()||Me(o)||s.has(o.getKey())){if(Vl(o)){let a=o.getParent();for(;a!=null;){const l=a.getKey();if(de(a)){if(!s.has(l)){const u=lt(e);br(u,a.getChildren()),a.replace(u),s.add(l)}break}{const u=a.getParent();if(Ot(u)&&!s.has(l)){s.add(l),cl(a,e);break}a=u}}}}else cl(o,e)}}})}function br(r,e){r.splice(r.getChildrenSize(),0,e)}function cl(r,e){if(de(r))return r;const t=r.getPreviousSibling(),n=r.getNextSibling(),s=dt();let i;if(br(s,r.getChildren()),de(t)&&e===t.getListType())t.append(s),de(n)&&e===n.getListType()&&(br(t,n.getChildren()),n.remove()),i=t;else if(de(n)&&e===n.getListType())n.getFirstChildOrThrow().insertBefore(s),i=n;else{const o=lt(e);o.append(s),r.replace(o),i=o}return s.setFormat(r.getFormatType()),s.setIndent(r.getIndent()),r.remove(),i}function Hi(r,e){const t=r.getLastChild(),n=e.getFirstChild();t&&n&&Pt(t)&&Pt(n)&&(Hi(t.getFirstChild(),n.getFirstChild()),n.remove());const s=e.getChildren();s.length>0&&r.append(...s),e.remove()}function ff(r){r.update(()=>{const e=K();if(O(e)){const t=new Set,n=e.getNodes(),s=e.anchor.getNode();if(qa(s,n))t.add(gi(s));else for(let i=0;i<n.length;i++){const o=n[i];if(Vl(o)){const a=Ed(o,Cr);a!=null&&t.add(gi(a))}}for(const i of t){let o=i;const a=za(i);for(const l of a){const u=Ue();br(u,l.getChildren()),o.insertAfter(u),o=u,l.__key===e.anchor.key&&e.anchor.set(u.getKey(),0,"element"),l.__key===e.focus.key&&e.focus.set(u.getKey(),0,"element"),l.remove()}i.remove()}}})}function hf(r){const e=new Set;if(Pt(r)||e.has(r.getKey()))return;const t=r.getParent(),n=r.getNextSibling(),s=r.getPreviousSibling();if(Pt(n)&&Pt(s)){const i=s.getFirstChild();if(de(i)){i.append(r);const o=n.getFirstChild();de(o)&&(br(i,o.getChildren()),n.remove(),e.add(n.getKey()))}}else if(Pt(n)){const i=n.getFirstChild();if(de(i)){const o=i.getFirstChild();o!==null&&o.insertBefore(r)}}else if(Pt(s)){const i=s.getFirstChild();de(i)&&i.append(r)}else if(de(t)){const i=dt(),o=lt(t.getListType());i.append(o),o.append(r),s?s.insertAfter(i):n?n.insertBefore(i):t.append(i)}}function pf(r){if(Pt(r))return;const e=r.getParent(),t=e?e.getParent():void 0;if(de(t?t.getParent():void 0)&&Me(t)&&de(e)){const n=e?e.getFirstChild():void 0,s=e?e.getLastChild():void 0;if(r.is(n))t.insertBefore(r),e.isEmpty()&&t.remove();else if(r.is(s))t.insertAfter(r),e.isEmpty()&&t.remove();else{const i=e.getListType(),o=dt(),a=lt(i);o.append(a),r.getPreviousSiblings().forEach(c=>a.append(c));const l=dt(),u=lt(i);l.append(u),br(u,r.getNextSiblings()),t.insertBefore(o),t.insertAfter(l),t.replace(r)}}}function gf(){const r=K();if(!O(r)||!r.isCollapsed())return!1;const e=r.anchor.getNode();if(!Me(e)||e.getChildrenSize()!==0)return!1;const t=gi(e),n=e.getParent();de(n)||Mt(40);const s=n.getParent();let i;if(Ot(s))i=Ue(),t.insertAfter(i);else{if(!Me(s))return!1;i=dt(),s.insertAfter(i)}i.select();const o=e.getNextSiblings();if(o.length>0){const a=lt(n.getListType());if(Or(i))i.insertAfter(a);else{const l=dt();l.append(a),i.insertAfter(l)}o.forEach(l=>{l.remove(),a.append(l)})}return function(a){let l=a;for(;l.getNextSibling()==null&&l.getPreviousSibling()==null;){const u=l.getParent();if(u==null||!Me(l)&&!de(l))break;l=u}l.remove()}(e),!0}function as(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}class Cr extends Jt{static getType(){return"listitem"}static clone(e){return new Cr(e.__value,e.__checked,e.__key)}constructor(e,t,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}createDOM(e){const t=document.createElement("li"),n=this.getParent();return de(n)&&n.getListType()==="check"&&fl(t,this,null),t.value=this.__value,dl(t,e.theme,this),t}updateDOM(e,t,n){const s=this.getParent();return de(s)&&s.getListType()==="check"&&fl(t,this,e),t.value=this.__value,dl(t,n.theme,this),!1}static transform(){return e=>{if(Me(e)||Mt(144),e.__checked==null)return;const t=e.getParent();de(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:mf,priority:0})}}static importJSON(e){const t=dt();return t.setChecked(e.checked),t.setValue(e.value),t.setFormat(e.format),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config);return t.style.textAlign=this.getFormatType(),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(F(n)&&this.canMergeWith(n)){const s=n.getChildren();this.append(...s),n.remove()}else super.append(n)}return this}replace(e,t){if(Me(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!de(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const s=lt(n.getListType());let i=this.getNextSibling();for(;i;){const o=i;i=i.getNextSibling(),s.append(o)}n.insertAfter(e),e.insertAfter(s)}return t&&(F(e)||Mt(139),this.getChildren().forEach(s=>{e.append(s)})),this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(de(n)||Mt(39),Me(e))return super.insertAfter(e,t);const s=this.getNextSiblings();if(n.insertAfter(e,t),s.length!==0){const i=lt(n.getListType());s.forEach(o=>i.append(o)),e.insertAfter(i,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&Pt(t)&&Pt(n)&&(Hi(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=dt(this.__checked==null&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=Ue();this.getChildren().forEach(o=>t.append(o));const n=this.getParentOrThrow(),s=n.getParentOrThrow(),i=Me(s);if(n.getChildrenSize()===1)if(i)n.remove(),s.select();else{n.insertBefore(t),n.remove();const o=e.anchor,a=e.focus,l=t.getKey();o.type==="element"&&o.getNode().is(this)&&o.set(l,o.offset,"element"),a.type==="element"&&a.getNode().is(this)&&a.set(l,a.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){this.getWritable().__value=e}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return de(n)&&(t=n.getListType()),t==="check"?!!e.__checked:void 0}setChecked(e){this.getWritable().__checked=e}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){const e=this.getParent();if(e===null)return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;Me(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!="number"&&Mt(117),(e=Math.floor(e))>=0||Mt(199);let t=this.getIndent();for(;t!==e;)t<e?(hf(this),t++):(pf(this),t--);return this}canInsertAfter(e){return Me(e)}canReplaceWith(e){return Me(e)}canMergeWith(e){return Or(e)||Me(e)}extractWithChild(e,t){if(!O(t))return!1;const n=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(s)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return lt("bullet")}canMergeWhenEmpty(){return!0}}function dl(r,e,t){const n=[],s=[],i=e.list,o=i?i.listitem:void 0;let a;if(i&&i.nested&&(a=i.nested.listitem),o!==void 0&&n.push(...as(o)),i){const l=t.getParent(),u=de(l)&&l.getListType()==="check",c=t.getChecked();u&&!c||s.push(i.listitemUnchecked),u&&c||s.push(i.listitemChecked),u&&n.push(c?i.listitemChecked:i.listitemUnchecked)}if(a!==void 0){const l=as(a);t.getChildren().some(u=>de(u))?n.push(...l):s.push(...l)}s.length>0&&Ra(r,...s),n.length>0&&Tn(r,...n)}function fl(r,e,t,n){de(e.getFirstChild())?(r.removeAttribute("role"),r.removeAttribute("tabIndex"),r.removeAttribute("aria-checked")):(r.setAttribute("role","checkbox"),r.setAttribute("tabIndex","-1"),t&&e.__checked===t.__checked||r.setAttribute("aria-checked",e.getChecked()?"true":"false"))}function mf(r){if(r.classList.contains("task-list-item")){for(const t of r.children)if(t.tagName==="INPUT")return yf(t)}const e=r.getAttribute("aria-checked");return{node:dt(e==="true"||e!=="false"&&void 0)}}function yf(r){return r.getAttribute("type")!=="checkbox"?{node:null}:{node:dt(r.hasAttribute("checked"))}}function dt(r){return $t(new Cr(void 0,r))}function Me(r){return r instanceof Cr}class qr extends Jt{static getType(){return"list"}static clone(e){const t=e.__listType||gl[e.__tag];return new qr(t,e.__start,e.__key)}constructor(e,t,n){super(n);const s=gl[e]||e;this.__listType=s,this.__tag=s==="number"?"ol":"ul",this.__start=t}getTag(){return this.__tag}setListType(e){const t=this.getWritable();t.__listType=e,t.__tag=e==="number"?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(e,t){const n=this.__tag,s=document.createElement(n);return this.__start!==1&&s.setAttribute("start",String(this.__start)),s.__lexicalListType=this.__listType,hl(s,e.theme,this),s}updateDOM(e,t,n){return e.__tag!==this.__tag||(hl(t,n.theme,this),!1)}static transform(){return e=>{de(e)||Mt(163),function(t){const n=t.getNextSibling();de(n)&&t.getListType()===n.getListType()&&Hi(t,n)}(e),function(t){const n=t.getListType()!=="check";let s=t.getStart();for(const i of t.getChildren())Me(i)&&(i.getValue()!==s&&i.setValue(s),n&&i.getLatest().__checked!=null&&i.setChecked(void 0),de(i.getFirstChild())||s++)}(e)}}static importDOM(){return{ol:()=>({conversion:pl,priority:0}),ul:()=>({conversion:pl,priority:0})}}static importJSON(e){const t=lt(e.listType,e.start);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportDOM(e){const t=this.createDOM(e._config,e);return t&&Ht(t)&&(this.__start!==1&&t.setAttribute("start",String(this.__start)),this.__listType==="check"&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(Me(n))super.append(n);else{const s=dt();if(de(n))s.append(n);else if(F(n))if(n.isInline())s.append(n);else{const i=Ge(n.getTextContent());s.append(i)}else s.append(n);super.append(s)}}return this}extractWithChild(e){return Me(e)}}function hl(r,e,t){const n=[],s=[],i=e.list;if(i!==void 0){const o=i[`${t.__tag}Depth`]||[],a=df(t)-1,l=a%o.length,u=o[l],c=i[t.__tag];let d;const f=i.nested,h=i.checklist;if(f!==void 0&&f.list&&(d=f.list),c!==void 0&&n.push(c),h!==void 0&&t.__listType==="check"&&n.push(h),u!==void 0){n.push(...as(u));for(let p=0;p<o.length;p++)p!==l&&s.push(t.__tag+p)}if(d!==void 0){const p=as(d);a>1?n.push(...p):s.push(...p)}}s.length>0&&Ra(r,...s),n.length>0&&Tn(r,...n)}function xf(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];if(Me(n)){e.push(n);const s=n.getChildren();s.length>1&&s.forEach(i=>{de(i)&&e.push(al(i))})}else e.push(al(n))}return e}function pl(r){const e=r.nodeName.toLowerCase();let t=null;return e==="ol"?t=lt("number",r.start):e==="ul"&&(t=function(n){if(n.getAttribute("__lexicallisttype")==="check"||n.classList.contains("contains-task-list"))return!0;for(const s of n.childNodes)if(Ht(s)&&s.hasAttribute("aria-checked"))return!0;return!1}(r)?lt("check"):lt("bullet")),{after:xf,node:t}}const gl={ol:"number",ul:"bullet"};function lt(r,e=1){return $t(new qr(r,e))}function de(r){return r instanceof qr}const Ua=xn(),Wa=xn(),bf=xn();function _f(r){return vr(r.registerCommand(Wa,()=>(ul(r,"number"),!0),Nr),r.registerCommand(Ua,()=>(ul(r,"bullet"),!0),Nr),r.registerCommand(bf,()=>(ff(r),!0),Nr),r.registerCommand(dn,()=>!!gf(),Nr))}function vf(){const[r]=St();return C.useEffect(()=>{if(!r.hasNodes([qr,Cr]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[r]),function(e){C.useEffect(()=>_f(e),[e])}(r),null}const Cf=new Set(["http:","https:","mailto:","sms:","tel:"]);class wr extends Jt{static getType(){return"link"}static clone(e){return new wr(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},n){super(n);const{target:s=null,rel:i=null,title:o=null}=t;this.__url=e,this.__target=s,this.__rel=i,this.__title=o}createDOM(e){const t=document.createElement("a");return t.href=this.sanitizeUrl(this.__url),this.__target!==null&&(t.target=this.__target),this.__rel!==null&&(t.rel=this.__rel),this.__title!==null&&(t.title=this.__title),Tn(t,e.theme.link),t}updateDOM(e,t,n){if(t instanceof HTMLAnchorElement){const s=this.__url,i=this.__target,o=this.__rel,a=this.__title;s!==e.__url&&(t.href=s),i!==e.__target&&(i?t.target=i:t.removeAttribute("target")),o!==e.__rel&&(o?t.rel=o:t.removeAttribute("rel")),a!==e.__title&&(a?t.title=a:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:wf,priority:1})}}static importJSON(e){const t=us(e.url,{rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}sanitizeUrl(e){try{const t=new URL(e);if(!Cf.has(t.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){this.getWritable().__title=e}insertNewAfter(e,t=!0){const n=us(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!O(t))return!1;const s=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(s)&&this.isParentOf(i)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function wf(r){let e=null;if(Lc(r)){const t=r.textContent;(t!==null&&t!==""||r.children.length>0)&&(e=us(r.getAttribute("href")||"",{rel:r.getAttribute("rel"),target:r.getAttribute("target"),title:r.getAttribute("title")}))}return{node:e}}function us(r,e){return $t(new wr(r,e))}function Jr(r){return r instanceof wr}class Nn extends wr{constructor(e,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new Nn(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){const t=ml(e.url,{isUnlinked:e.isUnlinked,rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked,type:"autolink",version:1}}insertNewAfter(e,t=!0){const n=this.getParentOrThrow().insertNewAfter(e,t);if(F(n)){const s=ml(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(s),s}return null}}function ml(r,e){return $t(new Nn(r,e))}function Df(r){return r instanceof Nn}const yl=xn();function Gs(r,e={}){const{target:t,title:n}=e,s=e.rel===void 0?"noreferrer":e.rel,i=K();if(!O(i))return;const o=i.extract();if(r===null)o.forEach(a=>{const l=Es(a,u=>!Df(u)&&Jr(u));if(l){const u=l.getChildren();for(let c=0;c<u.length;c++)l.insertBefore(u[c]);l.remove()}});else{if(o.length===1){const u=function(c,d){let f=c;for(;f!==null&&f.getParent()!==null&&!d(f);)f=f.getParentOrThrow();return d(f)?f:null}(o[0],Jr);if(u!==null)return u.setURL(r),t!==void 0&&u.setTarget(t),s!==null&&u.setRel(s),void(n!==void 0&&u.setTitle(n))}let a=null,l=null;o.forEach(u=>{const c=u.getParent();if(c!==l&&c!==null&&(!F(u)||u.isInline())){if(Jr(c))return l=c,c.setURL(r),t!==void 0&&c.setTarget(t),s!==null&&l.setRel(s),void(n!==void 0&&l.setTitle(n));if(c.is(a)||(a=c,l=us(r,{rel:s,target:t,title:n}),Jr(c)?u.getPreviousSibling()===null?c.insertBefore(l):c.insertAfter(l):u.insertBefore(l)),Jr(u)){if(u.is(l))return;if(l!==null){const d=u.getChildren();for(let f=0;f<d.length;f++)l.append(d[f])}u.remove()}else l!==null&&l.append(u)}})}}function Ef({validateUrl:r,attributes:e}){const[t]=St();return C.useEffect(()=>{if(!t.hasNodes([wr]))throw new Error("LinkPlugin: LinkNode not registered on editor");return vr(t.registerCommand(yl,n=>{if(n===null)return Gs(n),!0;if(typeof n=="string")return!(r!==void 0&&!r(n))&&(Gs(n,e),!0);{const{url:s,target:i,rel:o,title:a}=n;return Gs(s,{...e,rel:o,target:i,title:a}),!0}},Nr),r!==void 0?t.registerCommand(fs,n=>{const s=K();if(!O(s)||s.isCollapsed()||!nr(n,ClipboardEvent))return!1;const i=n;if(i.clipboardData===null)return!1;const o=i.clipboardData.getData("text");return!!r(o)&&!s.getNodes().some(a=>F(a))&&(t.dispatchCommand(yl,{...e,url:o}),n.preventDefault(),!0)},Nr):()=>{})},[t,r,e]),null}function Sf(r){if(r instanceof HTMLImageElement){const e=r.getAttribute("src")||"",t=r.getAttribute("alt")||"",n=r.getAttribute("width"),s=r.getAttribute("height");return{node:Ga({src:e,altText:t,width:n?parseInt(n,10):void 0,height:s?parseInt(s,10):void 0})}}return null}function Af({src:r,alt:e,width:t,height:n}){return g.jsx("img",{src:r,alt:e,width:t,height:n,style:{maxWidth:"100%",height:"auto",display:"block",margin:"8px 0",borderRadius:"4px"}})}class ks extends Wi{constructor(t,n,s,i,o){super(o);_t(this,"__src");_t(this,"__altText");_t(this,"__width");_t(this,"__height");this.__src=t,this.__altText=n||"",this.__width=s,this.__height=i}static getType(){return"image"}static clone(t){return new ks(t.__src,t.__altText,t.__width,t.__height,t.__key)}static importJSON(t){const{src:n,altText:s,width:i,height:o}=t;return Ga({src:n,altText:s,width:i,height:o})}exportJSON(){return{type:"image",version:1,src:this.__src,altText:this.__altText,width:this.__width,height:this.__height}}static importDOM(){return{img:()=>({conversion:Sf,priority:0})}}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),this.__altText&&t.setAttribute("alt",this.__altText),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),t.style.maxWidth="100%",t.style.height="auto",{element:t}}createDOM(){const t=document.createElement("span");return t.style.display="inline-block",t}updateDOM(){return!1}decorate(){return g.jsx(Af,{src:this.__src,alt:this.__altText,width:this.__width,height:this.__height})}}function Ga(r){return new ks(r.src,r.altText,r.width,r.height)}var kf=Object.defineProperty,cs=Object.getOwnPropertySymbols,Va=Object.prototype.hasOwnProperty,Ka=Object.prototype.propertyIsEnumerable,xl=(r,e,t)=>e in r?kf(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,mi=(r,e)=>{for(var t in e||(e={}))Va.call(e,t)&&xl(r,t,e[t]);if(cs)for(var t of cs(e))Ka.call(e,t)&&xl(r,t,e[t]);return r},yi=(r,e)=>{var t={};for(var n in r)Va.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&cs)for(var n of cs(r))e.indexOf(n)<0&&Ka.call(r,n)&&(t[n]=r[n]);return t};/**
74
74
  * @license QR Code generator library (TypeScript)
75
75
  * Copyright (c) Project Nayuki.
76
76
  * SPDX-License-Identifier: MIT
77
- */var _r;(r=>{const e=class ie{constructor(l,u,c,d){if(this.version=l,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],l<ie.MIN_VERSION||l>ie.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=l*4+17;let f=[];for(let p=0;p<this.size;p++)f.push(!1);for(let p=0;p<this.size;p++)this.modules.push(f.slice()),this.isFunction.push(f.slice());this.drawFunctionPatterns();const h=this.addEccAndInterleave(c);if(this.drawCodewords(h),d==-1){let p=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const y=this.getPenaltyScore();y<p&&(d=m,p=y),this.applyMask(m)}}s(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(l,u){const c=r.QrSegment.makeSegments(l);return ie.encodeSegments(c,u)}static encodeBinary(l,u){const c=r.QrSegment.makeBytes(l);return ie.encodeSegments([c],u)}static encodeSegments(l,u,c=1,d=40,f=-1,h=!0){if(!(ie.MIN_VERSION<=c&&c<=d&&d<=ie.MAX_VERSION)||f<-1||f>7)throw new RangeError("Invalid value");let p,m;for(p=c;;p++){const E=ie.getNumDataCodewords(p,u)*8,C=o.getTotalBits(l,p);if(C<=E){m=C;break}if(p>=d)throw new RangeError("Data too long")}for(const E of[ie.Ecc.MEDIUM,ie.Ecc.QUARTILE,ie.Ecc.HIGH])h&&m<=ie.getNumDataCodewords(p,E)*8&&(u=E);let y=[];for(const E of l){t(E.mode.modeBits,4,y),t(E.numChars,E.mode.numCharCountBits(p),y);for(const C of E.getData())y.push(C)}s(y.length==m);const D=ie.getNumDataCodewords(p,u)*8;s(y.length<=D),t(0,Math.min(4,D-y.length),y),t(0,(8-y.length%8)%8,y),s(y.length%8==0);for(let E=236;y.length<D;E^=253)t(E,8,y);let x=[];for(;x.length*8<y.length;)x.push(0);return y.forEach((E,C)=>x[C>>>3]|=E<<7-(C&7)),new ie(p,u,x,f)}getModule(l,u){return 0<=l&&l<this.size&&0<=u&&u<this.size&&this.modules[u][l]}getModules(){return this.modules}drawFunctionPatterns(){for(let c=0;c<this.size;c++)this.setFunctionModule(6,c,c%2==0),this.setFunctionModule(c,6,c%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const l=this.getAlignmentPatternPositions(),u=l.length;for(let c=0;c<u;c++)for(let d=0;d<u;d++)c==0&&d==0||c==0&&d==u-1||c==u-1&&d==0||this.drawAlignmentPattern(l[c],l[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(l){const u=this.errorCorrectionLevel.formatBits<<3|l;let c=u;for(let f=0;f<10;f++)c=c<<1^(c>>>9)*1335;const d=(u<<10|c)^21522;s(d>>>15==0);for(let f=0;f<=5;f++)this.setFunctionModule(8,f,n(d,f));this.setFunctionModule(8,7,n(d,6)),this.setFunctionModule(8,8,n(d,7)),this.setFunctionModule(7,8,n(d,8));for(let f=9;f<15;f++)this.setFunctionModule(14-f,8,n(d,f));for(let f=0;f<8;f++)this.setFunctionModule(this.size-1-f,8,n(d,f));for(let f=8;f<15;f++)this.setFunctionModule(8,this.size-15+f,n(d,f));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let l=this.version;for(let c=0;c<12;c++)l=l<<1^(l>>>11)*7973;const u=this.version<<12|l;s(u>>>18==0);for(let c=0;c<18;c++){const d=n(u,c),f=this.size-11+c%3,h=Math.floor(c/3);this.setFunctionModule(f,h,d),this.setFunctionModule(h,f,d)}}drawFinderPattern(l,u){for(let c=-4;c<=4;c++)for(let d=-4;d<=4;d++){const f=Math.max(Math.abs(d),Math.abs(c)),h=l+d,p=u+c;0<=h&&h<this.size&&0<=p&&p<this.size&&this.setFunctionModule(h,p,f!=2&&f!=4)}}drawAlignmentPattern(l,u){for(let c=-2;c<=2;c++)for(let d=-2;d<=2;d++)this.setFunctionModule(l+d,u+c,Math.max(Math.abs(d),Math.abs(c))!=1)}setFunctionModule(l,u,c){this.modules[u][l]=c,this.isFunction[u][l]=!0}addEccAndInterleave(l){const u=this.version,c=this.errorCorrectionLevel;if(l.length!=ie.getNumDataCodewords(u,c))throw new RangeError("Invalid argument");const d=ie.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][u],f=ie.ECC_CODEWORDS_PER_BLOCK[c.ordinal][u],h=Math.floor(ie.getNumRawDataModules(u)/8),p=d-h%d,m=Math.floor(h/d);let y=[];const D=ie.reedSolomonComputeDivisor(f);for(let E=0,C=0;E<d;E++){let A=l.slice(C,C+m-f+(E<p?0:1));C+=A.length;const b=ie.reedSolomonComputeRemainder(A,D);E<p&&A.push(0),y.push(A.concat(b))}let x=[];for(let E=0;E<y[0].length;E++)y.forEach((C,A)=>{(E!=m-f||A>=p)&&x.push(C[E])});return s(x.length==h),x}drawCodewords(l){if(l.length!=Math.floor(ie.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let c=this.size-1;c>=1;c-=2){c==6&&(c=5);for(let d=0;d<this.size;d++)for(let f=0;f<2;f++){const h=c-f,m=(c+1&2)==0?this.size-1-d:d;!this.isFunction[m][h]&&u<l.length*8&&(this.modules[m][h]=n(l[u>>>3],7-(u&7)),u++)}}s(u==l.length*8)}applyMask(l){if(l<0||l>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let c=0;c<this.size;c++){let d;switch(l){case 0:d=(c+u)%2==0;break;case 1:d=u%2==0;break;case 2:d=c%3==0;break;case 3:d=(c+u)%3==0;break;case 4:d=(Math.floor(c/3)+Math.floor(u/2))%2==0;break;case 5:d=c*u%2+c*u%3==0;break;case 6:d=(c*u%2+c*u%3)%2==0;break;case 7:d=((c+u)%2+c*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][c]&&d&&(this.modules[u][c]=!this.modules[u][c])}}getPenaltyScore(){let l=0;for(let f=0;f<this.size;f++){let h=!1,p=0,m=[0,0,0,0,0,0,0];for(let y=0;y<this.size;y++)this.modules[f][y]==h?(p++,p==5?l+=ie.PENALTY_N1:p>5&&l++):(this.finderPenaltyAddHistory(p,m),h||(l+=this.finderPenaltyCountPatterns(m)*ie.PENALTY_N3),h=this.modules[f][y],p=1);l+=this.finderPenaltyTerminateAndCount(h,p,m)*ie.PENALTY_N3}for(let f=0;f<this.size;f++){let h=!1,p=0,m=[0,0,0,0,0,0,0];for(let y=0;y<this.size;y++)this.modules[y][f]==h?(p++,p==5?l+=ie.PENALTY_N1:p>5&&l++):(this.finderPenaltyAddHistory(p,m),h||(l+=this.finderPenaltyCountPatterns(m)*ie.PENALTY_N3),h=this.modules[y][f],p=1);l+=this.finderPenaltyTerminateAndCount(h,p,m)*ie.PENALTY_N3}for(let f=0;f<this.size-1;f++)for(let h=0;h<this.size-1;h++){const p=this.modules[f][h];p==this.modules[f][h+1]&&p==this.modules[f+1][h]&&p==this.modules[f+1][h+1]&&(l+=ie.PENALTY_N2)}let u=0;for(const f of this.modules)u=f.reduce((h,p)=>h+(p?1:0),u);const c=this.size*this.size,d=Math.ceil(Math.abs(u*20-c*10)/c)-1;return s(0<=d&&d<=9),l+=d*ie.PENALTY_N4,s(0<=l&&l<=2568888),l}getAlignmentPatternPositions(){if(this.version==1)return[];{const l=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(l*2-2))*2;let c=[6];for(let d=this.size-7;c.length<l;d-=u)c.splice(1,0,d);return c}}static getNumRawDataModules(l){if(l<ie.MIN_VERSION||l>ie.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*l+128)*l+64;if(l>=2){const c=Math.floor(l/7)+2;u-=(25*c-10)*c-55,l>=7&&(u-=36)}return s(208<=u&&u<=29648),u}static getNumDataCodewords(l,u){return Math.floor(ie.getNumRawDataModules(l)/8)-ie.ECC_CODEWORDS_PER_BLOCK[u.ordinal][l]*ie.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][l]}static reedSolomonComputeDivisor(l){if(l<1||l>255)throw new RangeError("Degree out of range");let u=[];for(let d=0;d<l-1;d++)u.push(0);u.push(1);let c=1;for(let d=0;d<l;d++){for(let f=0;f<u.length;f++)u[f]=ie.reedSolomonMultiply(u[f],c),f+1<u.length&&(u[f]^=u[f+1]);c=ie.reedSolomonMultiply(c,2)}return u}static reedSolomonComputeRemainder(l,u){let c=u.map(d=>0);for(const d of l){const f=d^c.shift();c.push(0),u.forEach((h,p)=>c[p]^=ie.reedSolomonMultiply(h,f))}return c}static reedSolomonMultiply(l,u){if(l>>>8||u>>>8)throw new RangeError("Byte out of range");let c=0;for(let d=7;d>=0;d--)c=c<<1^(c>>>7)*285,c^=(u>>>d&1)*l;return s(c>>>8==0),c}finderPenaltyCountPatterns(l){const u=l[1];s(u<=this.size*3);const c=u>0&&l[2]==u&&l[3]==u*3&&l[4]==u&&l[5]==u;return(c&&l[0]>=u*4&&l[6]>=u?1:0)+(c&&l[6]>=u*4&&l[0]>=u?1:0)}finderPenaltyTerminateAndCount(l,u,c){return l&&(this.finderPenaltyAddHistory(u,c),u=0),u+=this.size,this.finderPenaltyAddHistory(u,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(l,u){u[0]==0&&(l+=this.size),u.pop(),u.unshift(l)}};e.MIN_VERSION=1,e.MAX_VERSION=40,e.PENALTY_N1=3,e.PENALTY_N2=3,e.PENALTY_N3=40,e.PENALTY_N4=10,e.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],e.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],r.QrCode=e;function t(a,l,u){if(l<0||l>31||a>>>l)throw new RangeError("Value out of range");for(let c=l-1;c>=0;c--)u.push(a>>>c&1)}function n(a,l){return(a>>>l&1)!=0}function s(a){if(!a)throw new Error("Assertion error")}const i=class Le{constructor(l,u,c){if(this.mode=l,this.numChars=u,this.bitData=c,u<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}static makeBytes(l){let u=[];for(const c of l)t(c,8,u);return new Le(Le.Mode.BYTE,l.length,u)}static makeNumeric(l){if(!Le.isNumeric(l))throw new RangeError("String contains non-numeric characters");let u=[];for(let c=0;c<l.length;){const d=Math.min(l.length-c,3);t(parseInt(l.substring(c,c+d),10),d*3+1,u),c+=d}return new Le(Le.Mode.NUMERIC,l.length,u)}static makeAlphanumeric(l){if(!Le.isAlphanumeric(l))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],c;for(c=0;c+2<=l.length;c+=2){let d=Le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(c))*45;d+=Le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(c+1)),t(d,11,u)}return c<l.length&&t(Le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(c)),6,u),new Le(Le.Mode.ALPHANUMERIC,l.length,u)}static makeSegments(l){return l==""?[]:Le.isNumeric(l)?[Le.makeNumeric(l)]:Le.isAlphanumeric(l)?[Le.makeAlphanumeric(l)]:[Le.makeBytes(Le.toUtf8ByteArray(l))]}static makeEci(l){let u=[];if(l<0)throw new RangeError("ECI assignment value out of range");if(l<128)t(l,8,u);else if(l<16384)t(2,2,u),t(l,14,u);else if(l<1e6)t(6,3,u),t(l,21,u);else throw new RangeError("ECI assignment value out of range");return new Le(Le.Mode.ECI,0,u)}static isNumeric(l){return Le.NUMERIC_REGEX.test(l)}static isAlphanumeric(l){return Le.ALPHANUMERIC_REGEX.test(l)}getData(){return this.bitData.slice()}static getTotalBits(l,u){let c=0;for(const d of l){const f=d.mode.numCharCountBits(u);if(d.numChars>=1<<f)return 1/0;c+=4+f+d.bitData.length}return c}static toUtf8ByteArray(l){l=encodeURI(l);let u=[];for(let c=0;c<l.length;c++)l.charAt(c)!="%"?u.push(l.charCodeAt(c)):(u.push(parseInt(l.substring(c+1,c+3),16)),c+=2);return u}};i.NUMERIC_REGEX=/^[0-9]*$/,i.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,i.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let o=i;r.QrSegment=i})(_r||(_r={}));(r=>{(e=>{const t=class{constructor(s,i){this.ordinal=s,this.formatBits=i}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(r.QrCode||(r.QrCode={}))})(_r||(_r={}));(r=>{(e=>{const t=class{constructor(s,i){this.modeBits=s,this.numBitsCharCount=i}numCharCountBits(s){return this.numBitsCharCount[Math.floor((s+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(r.QrSegment||(r.QrSegment={}))})(_r||(_r={}));var Br=_r;/**
77
+ */var _r;(r=>{const e=class ie{constructor(l,u,c,d){if(this.version=l,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],l<ie.MIN_VERSION||l>ie.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=l*4+17;let f=[];for(let p=0;p<this.size;p++)f.push(!1);for(let p=0;p<this.size;p++)this.modules.push(f.slice()),this.isFunction.push(f.slice());this.drawFunctionPatterns();const h=this.addEccAndInterleave(c);if(this.drawCodewords(h),d==-1){let p=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const y=this.getPenaltyScore();y<p&&(d=m,p=y),this.applyMask(m)}}s(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(l,u){const c=r.QrSegment.makeSegments(l);return ie.encodeSegments(c,u)}static encodeBinary(l,u){const c=r.QrSegment.makeBytes(l);return ie.encodeSegments([c],u)}static encodeSegments(l,u,c=1,d=40,f=-1,h=!0){if(!(ie.MIN_VERSION<=c&&c<=d&&d<=ie.MAX_VERSION)||f<-1||f>7)throw new RangeError("Invalid value");let p,m;for(p=c;;p++){const E=ie.getNumDataCodewords(p,u)*8,D=o.getTotalBits(l,p);if(D<=E){m=D;break}if(p>=d)throw new RangeError("Data too long")}for(const E of[ie.Ecc.MEDIUM,ie.Ecc.QUARTILE,ie.Ecc.HIGH])h&&m<=ie.getNumDataCodewords(p,E)*8&&(u=E);let y=[];for(const E of l){t(E.mode.modeBits,4,y),t(E.numChars,E.mode.numCharCountBits(p),y);for(const D of E.getData())y.push(D)}s(y.length==m);const w=ie.getNumDataCodewords(p,u)*8;s(y.length<=w),t(0,Math.min(4,w-y.length),y),t(0,(8-y.length%8)%8,y),s(y.length%8==0);for(let E=236;y.length<w;E^=253)t(E,8,y);let x=[];for(;x.length*8<y.length;)x.push(0);return y.forEach((E,D)=>x[D>>>3]|=E<<7-(D&7)),new ie(p,u,x,f)}getModule(l,u){return 0<=l&&l<this.size&&0<=u&&u<this.size&&this.modules[u][l]}getModules(){return this.modules}drawFunctionPatterns(){for(let c=0;c<this.size;c++)this.setFunctionModule(6,c,c%2==0),this.setFunctionModule(c,6,c%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const l=this.getAlignmentPatternPositions(),u=l.length;for(let c=0;c<u;c++)for(let d=0;d<u;d++)c==0&&d==0||c==0&&d==u-1||c==u-1&&d==0||this.drawAlignmentPattern(l[c],l[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(l){const u=this.errorCorrectionLevel.formatBits<<3|l;let c=u;for(let f=0;f<10;f++)c=c<<1^(c>>>9)*1335;const d=(u<<10|c)^21522;s(d>>>15==0);for(let f=0;f<=5;f++)this.setFunctionModule(8,f,n(d,f));this.setFunctionModule(8,7,n(d,6)),this.setFunctionModule(8,8,n(d,7)),this.setFunctionModule(7,8,n(d,8));for(let f=9;f<15;f++)this.setFunctionModule(14-f,8,n(d,f));for(let f=0;f<8;f++)this.setFunctionModule(this.size-1-f,8,n(d,f));for(let f=8;f<15;f++)this.setFunctionModule(8,this.size-15+f,n(d,f));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let l=this.version;for(let c=0;c<12;c++)l=l<<1^(l>>>11)*7973;const u=this.version<<12|l;s(u>>>18==0);for(let c=0;c<18;c++){const d=n(u,c),f=this.size-11+c%3,h=Math.floor(c/3);this.setFunctionModule(f,h,d),this.setFunctionModule(h,f,d)}}drawFinderPattern(l,u){for(let c=-4;c<=4;c++)for(let d=-4;d<=4;d++){const f=Math.max(Math.abs(d),Math.abs(c)),h=l+d,p=u+c;0<=h&&h<this.size&&0<=p&&p<this.size&&this.setFunctionModule(h,p,f!=2&&f!=4)}}drawAlignmentPattern(l,u){for(let c=-2;c<=2;c++)for(let d=-2;d<=2;d++)this.setFunctionModule(l+d,u+c,Math.max(Math.abs(d),Math.abs(c))!=1)}setFunctionModule(l,u,c){this.modules[u][l]=c,this.isFunction[u][l]=!0}addEccAndInterleave(l){const u=this.version,c=this.errorCorrectionLevel;if(l.length!=ie.getNumDataCodewords(u,c))throw new RangeError("Invalid argument");const d=ie.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][u],f=ie.ECC_CODEWORDS_PER_BLOCK[c.ordinal][u],h=Math.floor(ie.getNumRawDataModules(u)/8),p=d-h%d,m=Math.floor(h/d);let y=[];const w=ie.reedSolomonComputeDivisor(f);for(let E=0,D=0;E<d;E++){let A=l.slice(D,D+m-f+(E<p?0:1));D+=A.length;const b=ie.reedSolomonComputeRemainder(A,w);E<p&&A.push(0),y.push(A.concat(b))}let x=[];for(let E=0;E<y[0].length;E++)y.forEach((D,A)=>{(E!=m-f||A>=p)&&x.push(D[E])});return s(x.length==h),x}drawCodewords(l){if(l.length!=Math.floor(ie.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let c=this.size-1;c>=1;c-=2){c==6&&(c=5);for(let d=0;d<this.size;d++)for(let f=0;f<2;f++){const h=c-f,m=(c+1&2)==0?this.size-1-d:d;!this.isFunction[m][h]&&u<l.length*8&&(this.modules[m][h]=n(l[u>>>3],7-(u&7)),u++)}}s(u==l.length*8)}applyMask(l){if(l<0||l>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let c=0;c<this.size;c++){let d;switch(l){case 0:d=(c+u)%2==0;break;case 1:d=u%2==0;break;case 2:d=c%3==0;break;case 3:d=(c+u)%3==0;break;case 4:d=(Math.floor(c/3)+Math.floor(u/2))%2==0;break;case 5:d=c*u%2+c*u%3==0;break;case 6:d=(c*u%2+c*u%3)%2==0;break;case 7:d=((c+u)%2+c*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][c]&&d&&(this.modules[u][c]=!this.modules[u][c])}}getPenaltyScore(){let l=0;for(let f=0;f<this.size;f++){let h=!1,p=0,m=[0,0,0,0,0,0,0];for(let y=0;y<this.size;y++)this.modules[f][y]==h?(p++,p==5?l+=ie.PENALTY_N1:p>5&&l++):(this.finderPenaltyAddHistory(p,m),h||(l+=this.finderPenaltyCountPatterns(m)*ie.PENALTY_N3),h=this.modules[f][y],p=1);l+=this.finderPenaltyTerminateAndCount(h,p,m)*ie.PENALTY_N3}for(let f=0;f<this.size;f++){let h=!1,p=0,m=[0,0,0,0,0,0,0];for(let y=0;y<this.size;y++)this.modules[y][f]==h?(p++,p==5?l+=ie.PENALTY_N1:p>5&&l++):(this.finderPenaltyAddHistory(p,m),h||(l+=this.finderPenaltyCountPatterns(m)*ie.PENALTY_N3),h=this.modules[y][f],p=1);l+=this.finderPenaltyTerminateAndCount(h,p,m)*ie.PENALTY_N3}for(let f=0;f<this.size-1;f++)for(let h=0;h<this.size-1;h++){const p=this.modules[f][h];p==this.modules[f][h+1]&&p==this.modules[f+1][h]&&p==this.modules[f+1][h+1]&&(l+=ie.PENALTY_N2)}let u=0;for(const f of this.modules)u=f.reduce((h,p)=>h+(p?1:0),u);const c=this.size*this.size,d=Math.ceil(Math.abs(u*20-c*10)/c)-1;return s(0<=d&&d<=9),l+=d*ie.PENALTY_N4,s(0<=l&&l<=2568888),l}getAlignmentPatternPositions(){if(this.version==1)return[];{const l=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(l*2-2))*2;let c=[6];for(let d=this.size-7;c.length<l;d-=u)c.splice(1,0,d);return c}}static getNumRawDataModules(l){if(l<ie.MIN_VERSION||l>ie.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*l+128)*l+64;if(l>=2){const c=Math.floor(l/7)+2;u-=(25*c-10)*c-55,l>=7&&(u-=36)}return s(208<=u&&u<=29648),u}static getNumDataCodewords(l,u){return Math.floor(ie.getNumRawDataModules(l)/8)-ie.ECC_CODEWORDS_PER_BLOCK[u.ordinal][l]*ie.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][l]}static reedSolomonComputeDivisor(l){if(l<1||l>255)throw new RangeError("Degree out of range");let u=[];for(let d=0;d<l-1;d++)u.push(0);u.push(1);let c=1;for(let d=0;d<l;d++){for(let f=0;f<u.length;f++)u[f]=ie.reedSolomonMultiply(u[f],c),f+1<u.length&&(u[f]^=u[f+1]);c=ie.reedSolomonMultiply(c,2)}return u}static reedSolomonComputeRemainder(l,u){let c=u.map(d=>0);for(const d of l){const f=d^c.shift();c.push(0),u.forEach((h,p)=>c[p]^=ie.reedSolomonMultiply(h,f))}return c}static reedSolomonMultiply(l,u){if(l>>>8||u>>>8)throw new RangeError("Byte out of range");let c=0;for(let d=7;d>=0;d--)c=c<<1^(c>>>7)*285,c^=(u>>>d&1)*l;return s(c>>>8==0),c}finderPenaltyCountPatterns(l){const u=l[1];s(u<=this.size*3);const c=u>0&&l[2]==u&&l[3]==u*3&&l[4]==u&&l[5]==u;return(c&&l[0]>=u*4&&l[6]>=u?1:0)+(c&&l[6]>=u*4&&l[0]>=u?1:0)}finderPenaltyTerminateAndCount(l,u,c){return l&&(this.finderPenaltyAddHistory(u,c),u=0),u+=this.size,this.finderPenaltyAddHistory(u,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(l,u){u[0]==0&&(l+=this.size),u.pop(),u.unshift(l)}};e.MIN_VERSION=1,e.MAX_VERSION=40,e.PENALTY_N1=3,e.PENALTY_N2=3,e.PENALTY_N3=40,e.PENALTY_N4=10,e.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],e.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],r.QrCode=e;function t(a,l,u){if(l<0||l>31||a>>>l)throw new RangeError("Value out of range");for(let c=l-1;c>=0;c--)u.push(a>>>c&1)}function n(a,l){return(a>>>l&1)!=0}function s(a){if(!a)throw new Error("Assertion error")}const i=class Le{constructor(l,u,c){if(this.mode=l,this.numChars=u,this.bitData=c,u<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}static makeBytes(l){let u=[];for(const c of l)t(c,8,u);return new Le(Le.Mode.BYTE,l.length,u)}static makeNumeric(l){if(!Le.isNumeric(l))throw new RangeError("String contains non-numeric characters");let u=[];for(let c=0;c<l.length;){const d=Math.min(l.length-c,3);t(parseInt(l.substring(c,c+d),10),d*3+1,u),c+=d}return new Le(Le.Mode.NUMERIC,l.length,u)}static makeAlphanumeric(l){if(!Le.isAlphanumeric(l))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],c;for(c=0;c+2<=l.length;c+=2){let d=Le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(c))*45;d+=Le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(c+1)),t(d,11,u)}return c<l.length&&t(Le.ALPHANUMERIC_CHARSET.indexOf(l.charAt(c)),6,u),new Le(Le.Mode.ALPHANUMERIC,l.length,u)}static makeSegments(l){return l==""?[]:Le.isNumeric(l)?[Le.makeNumeric(l)]:Le.isAlphanumeric(l)?[Le.makeAlphanumeric(l)]:[Le.makeBytes(Le.toUtf8ByteArray(l))]}static makeEci(l){let u=[];if(l<0)throw new RangeError("ECI assignment value out of range");if(l<128)t(l,8,u);else if(l<16384)t(2,2,u),t(l,14,u);else if(l<1e6)t(6,3,u),t(l,21,u);else throw new RangeError("ECI assignment value out of range");return new Le(Le.Mode.ECI,0,u)}static isNumeric(l){return Le.NUMERIC_REGEX.test(l)}static isAlphanumeric(l){return Le.ALPHANUMERIC_REGEX.test(l)}getData(){return this.bitData.slice()}static getTotalBits(l,u){let c=0;for(const d of l){const f=d.mode.numCharCountBits(u);if(d.numChars>=1<<f)return 1/0;c+=4+f+d.bitData.length}return c}static toUtf8ByteArray(l){l=encodeURI(l);let u=[];for(let c=0;c<l.length;c++)l.charAt(c)!="%"?u.push(l.charCodeAt(c)):(u.push(parseInt(l.substring(c+1,c+3),16)),c+=2);return u}};i.NUMERIC_REGEX=/^[0-9]*$/,i.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,i.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let o=i;r.QrSegment=i})(_r||(_r={}));(r=>{(e=>{const t=class{constructor(s,i){this.ordinal=s,this.formatBits=i}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(r.QrCode||(r.QrCode={}))})(_r||(_r={}));(r=>{(e=>{const t=class{constructor(s,i){this.modeBits=s,this.numBitsCharCount=i}numCharCountBits(s){return this.numBitsCharCount[Math.floor((s+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(r.QrSegment||(r.QrSegment={}))})(_r||(_r={}));var Br=_r;/**
78
78
  * @license qrcode.react
79
79
  * Copyright (c) Paul O'Shannessy
80
80
  * SPDX-License-Identifier: ISC
81
- */var Tf={L:Br.QrCode.Ecc.LOW,M:Br.QrCode.Ecc.MEDIUM,Q:Br.QrCode.Ecc.QUARTILE,H:Br.QrCode.Ecc.HIGH},Ha=128,Qa="L",Ja="#FFFFFF",Ya="#000000",Xa=!1,Za=1,Nf=4,Bf=0,Ff=.1;function eu(r,e=0){const t=[];return r.forEach(function(n,s){let i=null;n.forEach(function(o,a){if(!o&&i!==null){t.push(`M${i+e} ${s+e}h${a-i}v1H${i+e}z`),i=null;return}if(a===n.length-1){if(!o)return;i===null?t.push(`M${a+e},${s+e} h1v1H${a+e}z`):t.push(`M${i+e},${s+e} h${a+1-i}v1H${i+e}z`);return}o&&i===null&&(i=a)})}),t.join("")}function tu(r,e){return r.slice().map((t,n)=>n<e.y||n>=e.y+e.h?t:t.map((s,i)=>i<e.x||i>=e.x+e.w?s:!1))}function Rf(r,e,t,n){if(n==null)return null;const s=r.length+t*2,i=Math.floor(e*Ff),o=s/e,a=(n.width||i)*o,l=(n.height||i)*o,u=n.x==null?r.length/2-a/2:n.x*o,c=n.y==null?r.length/2-l/2:n.y*o,d=n.opacity==null?1:n.opacity;let f=null;if(n.excavate){let p=Math.floor(u),m=Math.floor(c),y=Math.ceil(a+u-p),D=Math.ceil(l+c-m);f={x:p,y:m,w:y,h:D}}const h=n.crossOrigin;return{x:u,y:c,h:l,w:a,excavation:f,opacity:d,crossOrigin:h}}function Lf(r,e){return e!=null?Math.max(Math.floor(e),0):r?Nf:Bf}function ru({value:r,level:e,minVersion:t,includeMargin:n,marginSize:s,imageSettings:i,size:o,boostLevel:a}){let l=w.useMemo(()=>{const p=(Array.isArray(r)?r:[r]).reduce((m,y)=>(m.push(...Br.QrSegment.makeSegments(y)),m),[]);return Br.QrCode.encodeSegments(p,Tf[e],t,void 0,void 0,a)},[r,e,t,a]);const{cells:u,margin:c,numCells:d,calculatedImageSettings:f}=w.useMemo(()=>{let h=l.getModules();const p=Lf(n,s),m=h.length+p*2,y=Rf(h,o,p,i);return{cells:h,margin:p,numCells:m,calculatedImageSettings:y}},[l,o,i,n,s]);return{qrcode:l,margin:c,cells:u,numCells:d,calculatedImageSettings:f}}var Pf=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Mf=w.forwardRef(function(e,t){const n=e,{value:s,size:i=Ha,level:o=Qa,bgColor:a=Ja,fgColor:l=Ya,includeMargin:u=Xa,minVersion:c=Za,boostLevel:d,marginSize:f,imageSettings:h}=n,m=yi(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:y}=m,D=yi(m,["style"]),x=h==null?void 0:h.src,E=w.useRef(null),C=w.useRef(null),A=w.useCallback(R=>{E.current=R,typeof t=="function"?t(R):t&&(t.current=R)},[t]),[b,v]=w.useState(!1),{margin:S,cells:k,numCells:j,calculatedImageSettings:T}=ru({value:s,level:o,minVersion:c,boostLevel:d,includeMargin:u,marginSize:f,imageSettings:h,size:i});w.useEffect(()=>{if(E.current!=null){const R=E.current,M=R.getContext("2d");if(!M)return;let Q=k;const se=C.current,xe=T!=null&&se!==null&&se.complete&&se.naturalHeight!==0&&se.naturalWidth!==0;xe&&T.excavation!=null&&(Q=tu(k,T.excavation));const oe=window.devicePixelRatio||1;R.height=R.width=i*oe;const Se=i/j*oe;M.scale(Se,Se),M.fillStyle=a,M.fillRect(0,0,j,j),M.fillStyle=l,Pf?M.fill(new Path2D(eu(Q,S))):k.forEach(function(he,fe){he.forEach(function(pe,ge){pe&&M.fillRect(ge+S,fe+S,1,1)})}),T&&(M.globalAlpha=T.opacity),xe&&M.drawImage(se,T.x+S,T.y+S,T.w,T.h)}}),w.useEffect(()=>{v(!1)},[x]);const B=mi({height:i,width:i},y);let L=null;return x!=null&&(L=w.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{v(!0)},ref:C,crossOrigin:T==null?void 0:T.crossOrigin})),w.createElement(w.Fragment,null,w.createElement("canvas",mi({style:B,height:i,width:i,ref:A,role:"img"},D)),L)});Mf.displayName="QRCodeCanvas";var nu=w.forwardRef(function(e,t){const n=e,{value:s,size:i=Ha,level:o=Qa,bgColor:a=Ja,fgColor:l=Ya,includeMargin:u=Xa,minVersion:c=Za,boostLevel:d,title:f,marginSize:h,imageSettings:p}=n,m=yi(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:y,cells:D,numCells:x,calculatedImageSettings:E}=ru({value:s,level:o,minVersion:c,boostLevel:d,includeMargin:u,marginSize:h,imageSettings:p,size:i});let C=D,A=null;p!=null&&E!=null&&(E.excavation!=null&&(C=tu(D,E.excavation)),A=w.createElement("image",{href:p.src,height:E.h,width:E.w,x:E.x+y,y:E.y+y,preserveAspectRatio:"none",opacity:E.opacity,crossOrigin:E.crossOrigin}));const b=eu(C,y);return w.createElement("svg",mi({height:i,width:i,viewBox:`0 0 ${x} ${x}`,ref:t,role:"img"},m),!!f&&w.createElement("title",null,f),w.createElement("path",{fill:a,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),w.createElement("path",{fill:l,d:b,shapeRendering:"crispEdges"}),A)});nu.displayName="QRCodeSVG";function jf(r){if(r instanceof HTMLElement&&r.dataset.qrcodeData){const e=r.dataset.qrcodeData,t=r.dataset.qrcodeSize?parseInt(r.dataset.qrcodeSize,10):void 0;return{node:Qi({data:e,size:t})}}return null}function Of({data:r,size:e=150}){return g.jsx("div",{style:{display:"inline-block",background:"#f9f9f9",padding:"12px",borderRadius:"8px",margin:"8px 0"},children:g.jsx(nu,{value:r,size:e,level:"M"})})}class Ur extends Wi{constructor(t,n=150,s){super(s);_t(this,"__data");_t(this,"__size");this.__data=t,this.__size=n}static getType(){return"qrcode"}static clone(t){return new Ur(t.__data,t.__size,t.__key)}static importJSON(t){const{data:n,size:s}=t;return Qi({data:n,size:s})}exportJSON(){return{type:"qrcode",version:1,data:this.__data,size:this.__size}}static importDOM(){return{div:t=>t.dataset.qrcodeData?{conversion:jf,priority:1}:null}}exportDOM(){const t=document.createElement("div");return t.dataset.qrcodeData=this.__data,t.dataset.qrcodeSize=String(this.__size),t.style.display="inline-block",t.style.background="#f9f9f9",t.style.padding="12px",t.style.borderRadius="8px",t.textContent="[QR Code]",{element:t}}createDOM(){const t=document.createElement("span");return t.style.display="inline-block",t}updateDOM(){return!1}decorate(){return g.jsx(Of,{data:this.__data,size:this.__size})}getData(){return this.__data}getSize(){return this.__size}}function Qi(r){return new Ur(r.data,r.size)}function If(r){return r instanceof Ur}const $f={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6"},zf={paragraph:"mail-editor-paragraph",text:{bold:"mail-editor-bold",italic:"mail-editor-italic",underline:"mail-editor-underline"},list:{ul:"mail-editor-ul",ol:"mail-editor-ol",listitem:"mail-editor-li"},link:"mail-editor-link",quote:"mail-editor-quote",heading:{h1:"mail-editor-h1",h2:"mail-editor-h2",h3:"mail-editor-h3"}};function qf({theme:r,disabled:e,onAiRestructure:t,onAiProofread:n,onAiRewrite:s,aiProcessing:i,aiProcessingAction:o,onAiAction:a,hasContent:l}){const[u]=St(),[c,d]=w.useState(!1),f=w.useRef(null),h=t||n||s,p=w.useCallback(()=>{u.dispatchCommand(Dt,"bold")},[u]),m=w.useCallback(()=>{u.dispatchCommand(Dt,"italic")},[u]),y=w.useCallback(()=>{u.dispatchCommand(Dt,"underline")},[u]),D=w.useCallback(()=>{u.dispatchCommand(Ua,void 0)},[u]),x=w.useCallback(()=>{u.dispatchCommand(Wa,void 0)},[u]),E=w.useCallback(()=>{u.update(()=>{const v=K();O(v)&&bd(v,()=>Ki())})},[u]),C={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",borderRadius:"4px",cursor:e?"not-allowed":"pointer",color:e?r.textSecondary:r.text,fontSize:"14px",fontWeight:600,opacity:e?.5:1},A=`
81
+ */var Tf={L:Br.QrCode.Ecc.LOW,M:Br.QrCode.Ecc.MEDIUM,Q:Br.QrCode.Ecc.QUARTILE,H:Br.QrCode.Ecc.HIGH},Ha=128,Qa="L",Ja="#FFFFFF",Ya="#000000",Xa=!1,Za=1,Nf=4,Bf=0,Ff=.1;function eu(r,e=0){const t=[];return r.forEach(function(n,s){let i=null;n.forEach(function(o,a){if(!o&&i!==null){t.push(`M${i+e} ${s+e}h${a-i}v1H${i+e}z`),i=null;return}if(a===n.length-1){if(!o)return;i===null?t.push(`M${a+e},${s+e} h1v1H${a+e}z`):t.push(`M${i+e},${s+e} h${a+1-i}v1H${i+e}z`);return}o&&i===null&&(i=a)})}),t.join("")}function tu(r,e){return r.slice().map((t,n)=>n<e.y||n>=e.y+e.h?t:t.map((s,i)=>i<e.x||i>=e.x+e.w?s:!1))}function Rf(r,e,t,n){if(n==null)return null;const s=r.length+t*2,i=Math.floor(e*Ff),o=s/e,a=(n.width||i)*o,l=(n.height||i)*o,u=n.x==null?r.length/2-a/2:n.x*o,c=n.y==null?r.length/2-l/2:n.y*o,d=n.opacity==null?1:n.opacity;let f=null;if(n.excavate){let p=Math.floor(u),m=Math.floor(c),y=Math.ceil(a+u-p),w=Math.ceil(l+c-m);f={x:p,y:m,w:y,h:w}}const h=n.crossOrigin;return{x:u,y:c,h:l,w:a,excavation:f,opacity:d,crossOrigin:h}}function Lf(r,e){return e!=null?Math.max(Math.floor(e),0):r?Nf:Bf}function ru({value:r,level:e,minVersion:t,includeMargin:n,marginSize:s,imageSettings:i,size:o,boostLevel:a}){let l=C.useMemo(()=>{const p=(Array.isArray(r)?r:[r]).reduce((m,y)=>(m.push(...Br.QrSegment.makeSegments(y)),m),[]);return Br.QrCode.encodeSegments(p,Tf[e],t,void 0,void 0,a)},[r,e,t,a]);const{cells:u,margin:c,numCells:d,calculatedImageSettings:f}=C.useMemo(()=>{let h=l.getModules();const p=Lf(n,s),m=h.length+p*2,y=Rf(h,o,p,i);return{cells:h,margin:p,numCells:m,calculatedImageSettings:y}},[l,o,i,n,s]);return{qrcode:l,margin:c,cells:u,numCells:d,calculatedImageSettings:f}}var Mf=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Pf=C.forwardRef(function(e,t){const n=e,{value:s,size:i=Ha,level:o=Qa,bgColor:a=Ja,fgColor:l=Ya,includeMargin:u=Xa,minVersion:c=Za,boostLevel:d,marginSize:f,imageSettings:h}=n,m=yi(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:y}=m,w=yi(m,["style"]),x=h==null?void 0:h.src,E=C.useRef(null),D=C.useRef(null),A=C.useCallback(R=>{E.current=R,typeof t=="function"?t(R):t&&(t.current=R)},[t]),[b,v]=C.useState(!1),{margin:S,cells:k,numCells:j,calculatedImageSettings:T}=ru({value:s,level:o,minVersion:c,boostLevel:d,includeMargin:u,marginSize:f,imageSettings:h,size:i});C.useEffect(()=>{if(E.current!=null){const R=E.current,P=R.getContext("2d");if(!P)return;let Q=k;const se=D.current,xe=T!=null&&se!==null&&se.complete&&se.naturalHeight!==0&&se.naturalWidth!==0;xe&&T.excavation!=null&&(Q=tu(k,T.excavation));const oe=window.devicePixelRatio||1;R.height=R.width=i*oe;const Se=i/j*oe;P.scale(Se,Se),P.fillStyle=a,P.fillRect(0,0,j,j),P.fillStyle=l,Mf?P.fill(new Path2D(eu(Q,S))):k.forEach(function(he,fe){he.forEach(function(pe,ge){pe&&P.fillRect(ge+S,fe+S,1,1)})}),T&&(P.globalAlpha=T.opacity),xe&&P.drawImage(se,T.x+S,T.y+S,T.w,T.h)}}),C.useEffect(()=>{v(!1)},[x]);const B=mi({height:i,width:i},y);let L=null;return x!=null&&(L=C.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{v(!0)},ref:D,crossOrigin:T==null?void 0:T.crossOrigin})),C.createElement(C.Fragment,null,C.createElement("canvas",mi({style:B,height:i,width:i,ref:A,role:"img"},w)),L)});Pf.displayName="QRCodeCanvas";var nu=C.forwardRef(function(e,t){const n=e,{value:s,size:i=Ha,level:o=Qa,bgColor:a=Ja,fgColor:l=Ya,includeMargin:u=Xa,minVersion:c=Za,boostLevel:d,title:f,marginSize:h,imageSettings:p}=n,m=yi(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:y,cells:w,numCells:x,calculatedImageSettings:E}=ru({value:s,level:o,minVersion:c,boostLevel:d,includeMargin:u,marginSize:h,imageSettings:p,size:i});let D=w,A=null;p!=null&&E!=null&&(E.excavation!=null&&(D=tu(w,E.excavation)),A=C.createElement("image",{href:p.src,height:E.h,width:E.w,x:E.x+y,y:E.y+y,preserveAspectRatio:"none",opacity:E.opacity,crossOrigin:E.crossOrigin}));const b=eu(D,y);return C.createElement("svg",mi({height:i,width:i,viewBox:`0 0 ${x} ${x}`,ref:t,role:"img"},m),!!f&&C.createElement("title",null,f),C.createElement("path",{fill:a,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),C.createElement("path",{fill:l,d:b,shapeRendering:"crispEdges"}),A)});nu.displayName="QRCodeSVG";function jf(r){if(r instanceof HTMLElement&&r.dataset.qrcodeData){const e=r.dataset.qrcodeData,t=r.dataset.qrcodeSize?parseInt(r.dataset.qrcodeSize,10):void 0;return{node:Qi({data:e,size:t})}}return null}function Of({data:r,size:e=150}){return g.jsx("div",{style:{display:"inline-block",background:"#f9f9f9",padding:"12px",borderRadius:"8px",margin:"8px 0"},children:g.jsx(nu,{value:r,size:e,level:"M"})})}class Ur extends Wi{constructor(t,n=150,s){super(s);_t(this,"__data");_t(this,"__size");this.__data=t,this.__size=n}static getType(){return"qrcode"}static clone(t){return new Ur(t.__data,t.__size,t.__key)}static importJSON(t){const{data:n,size:s}=t;return Qi({data:n,size:s})}exportJSON(){return{type:"qrcode",version:1,data:this.__data,size:this.__size}}static importDOM(){return{div:t=>t.dataset.qrcodeData?{conversion:jf,priority:1}:null}}exportDOM(){const t=document.createElement("div");return t.dataset.qrcodeData=this.__data,t.dataset.qrcodeSize=String(this.__size),t.style.display="inline-block",t.style.background="#f9f9f9",t.style.padding="12px",t.style.borderRadius="8px",t.textContent="[QR Code]",{element:t}}createDOM(){const t=document.createElement("span");return t.style.display="inline-block",t}updateDOM(){return!1}decorate(){return g.jsx(Of,{data:this.__data,size:this.__size})}getData(){return this.__data}getSize(){return this.__size}}function Qi(r){return new Ur(r.data,r.size)}function If(r){return r instanceof Ur}const $f={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6"},zf={paragraph:"mail-editor-paragraph",text:{bold:"mail-editor-bold",italic:"mail-editor-italic",underline:"mail-editor-underline"},list:{ul:"mail-editor-ul",ol:"mail-editor-ol",listitem:"mail-editor-li"},link:"mail-editor-link",quote:"mail-editor-quote",heading:{h1:"mail-editor-h1",h2:"mail-editor-h2",h3:"mail-editor-h3"}};function qf({theme:r,disabled:e,onAiRestructure:t,onAiProofread:n,onAiRewrite:s,aiProcessing:i,aiProcessingAction:o,onAiAction:a,hasContent:l}){const[u]=St(),[c,d]=C.useState(!1),f=C.useRef(null),h=t||n||s,p=C.useCallback(()=>{u.dispatchCommand(Dt,"bold")},[u]),m=C.useCallback(()=>{u.dispatchCommand(Dt,"italic")},[u]),y=C.useCallback(()=>{u.dispatchCommand(Dt,"underline")},[u]),w=C.useCallback(()=>{u.dispatchCommand(Ua,void 0)},[u]),x=C.useCallback(()=>{u.dispatchCommand(Wa,void 0)},[u]),E=C.useCallback(()=>{u.update(()=>{const v=K();O(v)&&bd(v,()=>Ki())})},[u]),D={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",borderRadius:"4px",cursor:e?"not-allowed":"pointer",color:e?r.textSecondary:r.text,fontSize:"14px",fontWeight:600,opacity:e?.5:1},A=`
82
82
  .mail-editor-toolbar-btn:hover:not(:disabled) {
83
83
  background: ${r.border};
84
84
  }
85
- `,b=()=>{setTimeout(()=>{var v;(v=f.current)!=null&&v.contains(document.activeElement)||d(!1)},150)};return g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px",borderBottom:`1px solid ${r.border}`,background:r.toolbarBackground},children:[g.jsx("style",{children:A}),g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px"},children:[g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:p,disabled:e,style:C,title:"Bold (Ctrl+B)",children:"B"}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:m,disabled:e,style:{...C,fontStyle:"italic"},title:"Italic (Ctrl+I)",children:"I"}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:y,disabled:e,style:{...C,textDecoration:"underline"},title:"Underline (Ctrl+U)",children:"U"}),g.jsx("div",{style:{width:"1px",height:"20px",background:r.border,margin:"0 6px"}}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:D,disabled:e,style:C,title:"Bullet List",children:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[g.jsx("circle",{cx:"4",cy:"6",r:"2"}),g.jsx("circle",{cx:"4",cy:"12",r:"2"}),g.jsx("circle",{cx:"4",cy:"18",r:"2"}),g.jsx("rect",{x:"8",y:"5",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"11",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"17",width:"14",height:"2"})]})}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:x,disabled:e,style:C,title:"Numbered List",children:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[g.jsx("text",{x:"2",y:"8",fontSize:"8",fontFamily:"sans-serif",children:"1"}),g.jsx("text",{x:"2",y:"14",fontSize:"8",fontFamily:"sans-serif",children:"2"}),g.jsx("text",{x:"2",y:"20",fontSize:"8",fontFamily:"sans-serif",children:"3"}),g.jsx("rect",{x:"8",y:"5",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"11",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"17",width:"14",height:"2"})]})}),g.jsx("div",{style:{width:"1px",height:"20px",background:r.border,margin:"0 6px"}}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:E,disabled:e,style:C,title:"Quote",children:g.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:g.jsx("path",{d:"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"})})})]}),h&&g.jsxs("div",{style:{position:"relative"},ref:f,children:[g.jsx("button",{type:"button",onClick:()=>d(!c),disabled:i||!l||e,onBlur:b,style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",fontSize:"13px",color:i||!l?r.textSecondary:"#9333ea",background:"transparent",border:"none",borderRadius:"4px",cursor:i||!l||e?"not-allowed":"pointer",opacity:i||!l?.5:1},children:i?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"material-icons",style:{fontSize:"16px",animation:"spin 1s linear infinite"},children:"hourglass_empty"}),o==="restructure"&&"Restructuring...",o==="proofread"&&"Proofreading...",o==="rewrite"&&"Rewriting..."]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"material-icons",style:{fontSize:"16px"},children:"auto_fix_high"}),"AI",g.jsx("span",{className:"material-icons",style:{fontSize:"14px"},children:"expand_more"})]})}),c&&!i&&g.jsxs("div",{style:{position:"absolute",right:0,top:"100%",marginTop:"4px",background:"#ffffff",border:"1px solid #e5e7eb",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",zIndex:50,minWidth:"200px",padding:"4px 0"},children:[t&&g.jsxs("button",{type:"button",onClick:()=>{a==null||a("restructure"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:v=>v.currentTarget.style.background="#f3f4f6",onMouseLeave:v=>v.currentTarget.style.background="transparent",children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#3b82f6"},children:"format_list_bulleted"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontWeight:500},children:"Restructure"}),g.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Organize & clarify"})]})]}),n&&g.jsxs("button",{type:"button",onClick:()=>{a==null||a("proofread"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:v=>v.currentTarget.style.background="#f3f4f6",onMouseLeave:v=>v.currentTarget.style.background="transparent",children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#22c55e"},children:"spellcheck"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontWeight:500},children:"Proofread"}),g.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Fix grammar & spelling"})]})]}),s&&g.jsxs("button",{type:"button",onClick:()=>{a==null||a("rewrite"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:v=>v.currentTarget.style.background="#f3f4f6",onMouseLeave:v=>v.currentTarget.style.background="transparent",children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#9333ea"},children:"brush"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontWeight:500},children:"Rewrite"}),g.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Your voice & style"})]})]})]})]})]})}function Uf({html:r,isExternalUpdate:e,onImportComplete:t}){const[n]=St(),s=w.useRef(!1);return w.useEffect(()=>{r&&(s.current&&!e||(s.current=!0,n.update(()=>{const i=Fe();i.clear();const o=Ue();i.append(o),o.select();const l=new DOMParser().parseFromString(r,"text/html"),c=La(n,l).filter(d=>d.getParent()===null);c.length>0&&ba(c),o.getTextContent()===""&&i.getChildrenSize()>1&&o.remove(),i.selectEnd()},{discrete:!0}),t(),setTimeout(()=>{n.focus()},0)))},[r,e,n,t]),null}function Wf({text:r,trigger:e}){const[t]=St(),n=w.useRef(void 0);return w.useEffect(()=>{if(e===void 0||e===n.current||!r)return;n.current=e;const s=r.trim();s&&(t.update(()=>{const i=K();if(O(i))i.insertText(s);else{const o=Fe(),a=o.getLastChild();if(a){a.selectEnd();const l=K();O(l)&&l.insertText(s)}else{const l=Ue(),u=Ge(s);l.append(u),o.append(l)}}}),setTimeout(()=>{t.focus()},0))},[r,e,t]),null}function Gf({replyTo:r,theme:e}){const t=n=>{try{return new Date(n).toLocaleString()}catch{return n}};return g.jsxs("div",{style:{marginTop:"16px",paddingTop:"16px",borderTop:`1px solid ${e.border}`},children:[g.jsxs("div",{style:{fontSize:"12px",color:e.textSecondary,marginBottom:"8px"},children:["On ",t(r.date),", ",r.from," wrote:"]}),g.jsx("blockquote",{style:{margin:0,padding:"12px 16px",borderLeft:`3px solid ${e.quoteBorder}`,background:e.quoteBackground,fontSize:"14px",color:e.textSecondary,maxHeight:"200px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:r.body}})]})}function su({value:r="",onChange:e,placeholder:t="Write your message...",replyTo:n,theme:s={},disabled:i=!1,className:o="",minHeight:a="200px",externalUpdate:l,insertText:u,insertTextTrigger:c,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:p,aiProcessingAction:m,renderAboveToolbar:y}){const D={...$f,...s},[x,E]=w.useState(!1),C=w.useRef(void 0),[A,b]=w.useState(r),[v,S]=w.useState(!1),[k,j]=w.useState(null),T=p??v,B=m??k;w.useEffect(()=>{l!==void 0&&l!==C.current&&(C.current=l,E(!0))},[l]);const L=w.useCallback(()=>{E(!1)},[]),R=he=>he.replace(/<[^>]*>/g,"").trim(),M=he=>he.split(`
86
- `).map(fe=>`<p>${fe||"<br>"}</p>`).join(""),Q=async he=>{const fe=R(A);if(!fe)return;const pe=he==="restructure"?d:he==="proofread"?f:h;if(pe){S(!0),j(he);try{const ge=await pe(fe),Ae=M(ge);b(Ae),e==null||e(Ae),C.current=Date.now(),E(!0)}catch(ge){console.error(`AI ${he} failed:`,ge)}finally{S(!1),j(null)}}},se=R(A).length>0,xe={namespace:"MailEditor",theme:zf,onError:he=>{console.error("Lexical error:",he)},nodes:[qr,Cr,wr,Nn,As,Ss,ks,Ur],editable:!i},oe=w.useCallback((he,fe)=>{he.read(()=>{const pe=Pa(fe,null);b(pe),e==null||e(pe)})},[e]),Se=`
85
+ `,b=()=>{setTimeout(()=>{var v;(v=f.current)!=null&&v.contains(document.activeElement)||d(!1)},150)};return g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px",borderBottom:`1px solid ${r.border}`,background:r.toolbarBackground},children:[g.jsx("style",{children:A}),g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px"},children:[g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:p,disabled:e,style:D,title:"Bold (Ctrl+B)",children:"B"}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:m,disabled:e,style:{...D,fontStyle:"italic"},title:"Italic (Ctrl+I)",children:"I"}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:y,disabled:e,style:{...D,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:w,disabled:e,style:D,title:"Bullet List",children:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[g.jsx("circle",{cx:"4",cy:"6",r:"2"}),g.jsx("circle",{cx:"4",cy:"12",r:"2"}),g.jsx("circle",{cx:"4",cy:"18",r:"2"}),g.jsx("rect",{x:"8",y:"5",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"11",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"17",width:"14",height:"2"})]})}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:x,disabled:e,style:D,title:"Numbered List",children:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[g.jsx("text",{x:"2",y:"8",fontSize:"8",fontFamily:"sans-serif",children:"1"}),g.jsx("text",{x:"2",y:"14",fontSize:"8",fontFamily:"sans-serif",children:"2"}),g.jsx("text",{x:"2",y:"20",fontSize:"8",fontFamily:"sans-serif",children:"3"}),g.jsx("rect",{x:"8",y:"5",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"11",width:"14",height:"2"}),g.jsx("rect",{x:"8",y:"17",width:"14",height:"2"})]})}),g.jsx("div",{style:{width:"1px",height:"20px",background:r.border,margin:"0 6px"}}),g.jsx("button",{type:"button",className:"mail-editor-toolbar-btn",onClick:E,disabled:e,style:D,title:"Quote",children:g.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:g.jsx("path",{d:"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"})})})]}),h&&g.jsxs("div",{style:{position:"relative"},ref:f,children:[g.jsx("button",{type:"button",onClick:()=>d(!c),disabled:i||!l||e,onBlur:b,style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",fontSize:"13px",color:i||!l?r.textSecondary:"#9333ea",background:"transparent",border:"none",borderRadius:"4px",cursor:i||!l||e?"not-allowed":"pointer",opacity:i||!l?.5:1},children:i?g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"material-icons",style:{fontSize:"16px",animation:"spin 1s linear infinite"},children:"hourglass_empty"}),o==="restructure"&&"Restructuring...",o==="proofread"&&"Proofreading...",o==="rewrite"&&"Rewriting..."]}):g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"material-icons",style:{fontSize:"16px"},children:"auto_fix_high"}),"AI",g.jsx("span",{className:"material-icons",style:{fontSize:"14px"},children:"expand_more"})]})}),c&&!i&&g.jsxs("div",{style:{position:"absolute",right:0,top:"100%",marginTop:"4px",background:"#ffffff",border:"1px solid #e5e7eb",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",zIndex:50,minWidth:"200px",padding:"4px 0"},children:[t&&g.jsxs("button",{type:"button",onClick:()=>{a==null||a("restructure"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:v=>v.currentTarget.style.background="#f3f4f6",onMouseLeave:v=>v.currentTarget.style.background="transparent",children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#3b82f6"},children:"format_list_bulleted"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontWeight:500},children:"Restructure"}),g.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Organize & clarify"})]})]}),n&&g.jsxs("button",{type:"button",onClick:()=>{a==null||a("proofread"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:v=>v.currentTarget.style.background="#f3f4f6",onMouseLeave:v=>v.currentTarget.style.background="transparent",children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#22c55e"},children:"spellcheck"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontWeight:500},children:"Proofread"}),g.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Fix grammar & spelling"})]})]}),s&&g.jsxs("button",{type:"button",onClick:()=>{a==null||a("rewrite"),d(!1)},style:{width:"100%",padding:"8px 12px",textAlign:"left",fontSize:"14px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:v=>v.currentTarget.style.background="#f3f4f6",onMouseLeave:v=>v.currentTarget.style.background="transparent",children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",color:"#9333ea"},children:"brush"}),g.jsxs("div",{children:[g.jsx("div",{style:{fontWeight:500},children:"Rewrite"}),g.jsx("div",{style:{fontSize:"12px",color:"#6b7280"},children:"Your voice & style"})]})]})]})]})]})}function Uf({html:r,isExternalUpdate:e,onImportComplete:t}){const[n]=St(),s=C.useRef(!1);return C.useEffect(()=>{r&&(s.current&&!e||(s.current=!0,n.update(()=>{const i=Fe();i.clear();const o=Ue();i.append(o),o.select();const l=new DOMParser().parseFromString(r,"text/html"),c=La(n,l).filter(d=>d.getParent()===null);c.length>0&&ba(c),o.getTextContent()===""&&i.getChildrenSize()>1&&o.remove(),i.selectEnd()},{discrete:!0}),t(),setTimeout(()=>{n.focus()},0)))},[r,e,n,t]),null}function Wf({text:r,trigger:e}){const[t]=St(),n=C.useRef(void 0);return C.useEffect(()=>{if(e===void 0||e===n.current||!r)return;n.current=e;const s=r.trim();s&&(t.update(()=>{const i=K();if(O(i))i.insertText(s);else{const o=Fe(),a=o.getLastChild();if(a){a.selectEnd();const l=K();O(l)&&l.insertText(s)}else{const l=Ue(),u=Ge(s);l.append(u),o.append(l)}}}),setTimeout(()=>{t.focus()},0))},[r,e,t]),null}function Gf({replyTo:r,theme:e}){const t=n=>{try{return new Date(n).toLocaleString()}catch{return n}};return g.jsxs("div",{style:{marginTop:"16px",paddingTop:"16px",borderTop:`1px solid ${e.border}`},children:[g.jsxs("div",{style:{fontSize:"12px",color:e.textSecondary,marginBottom:"8px"},children:["On ",t(r.date),", ",r.from," wrote:"]}),g.jsx("blockquote",{style:{margin:0,padding:"12px 16px",borderLeft:`3px solid ${e.quoteBorder}`,background:e.quoteBackground,fontSize:"14px",color:e.textSecondary,maxHeight:"200px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:r.body}})]})}function su({value:r="",onChange:e,placeholder:t="Write your message...",replyTo:n,theme:s={},disabled:i=!1,className:o="",minHeight:a="200px",externalUpdate:l,insertText:u,insertTextTrigger:c,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:p,aiProcessingAction:m,renderAboveToolbar:y}){const w={...$f,...s},[x,E]=C.useState(!1),D=C.useRef(void 0),[A,b]=C.useState(r),[v,S]=C.useState(!1),[k,j]=C.useState(null),T=p??v,B=m??k;C.useEffect(()=>{l!==void 0&&l!==D.current&&(D.current=l,E(!0))},[l]);const L=C.useCallback(()=>{E(!1)},[]),R=he=>he.replace(/<[^>]*>/g,"").trim(),P=he=>he.split(`
86
+ `).map(fe=>`<p>${fe||"<br>"}</p>`).join(""),Q=async he=>{const fe=R(A);if(!fe)return;const pe=he==="restructure"?d:he==="proofread"?f:h;if(pe){S(!0),j(he);try{const ge=await pe(fe),Ae=P(ge);b(Ae),e==null||e(Ae),D.current=Date.now(),E(!0)}catch(ge){console.error(`AI ${he} failed:`,ge)}finally{S(!1),j(null)}}},se=R(A).length>0,xe={namespace:"MailEditor",theme:zf,onError:he=>{console.error("Lexical error:",he)},nodes:[qr,Cr,wr,Nn,As,Ss,ks,Ur],editable:!i},oe=C.useCallback((he,fe)=>{he.read(()=>{const pe=Ma(fe,null);b(pe),e==null||e(pe)})},[e]),Se=`
87
87
  .mail-editor-paragraph {
88
88
  margin: 0 0 8px 0;
89
89
  line-height: 1.5;
@@ -105,15 +105,15 @@ React keys must be passed directly to JSX without using spread:
105
105
  margin: 4px 0;
106
106
  }
107
107
  .mail-editor-link {
108
- color: ${D.primary};
108
+ color: ${w.primary};
109
109
  text-decoration: underline;
110
110
  }
111
111
  .mail-editor-quote {
112
112
  margin: 8px 0;
113
113
  padding: 8px 16px;
114
- border-left: 3px solid ${D.quoteBorder};
115
- background: ${D.quoteBackground};
116
- color: ${D.textSecondary};
114
+ border-left: 3px solid ${w.quoteBorder};
115
+ background: ${w.quoteBackground};
116
+ color: ${w.textSecondary};
117
117
  }
118
118
  .mail-editor-h1 {
119
119
  font-size: 24px;
@@ -136,7 +136,7 @@ React keys must be passed directly to JSX without using spread:
136
136
  padding: 16px;
137
137
  font-size: 14px;
138
138
  line-height: 1.6;
139
- color: ${D.text};
139
+ color: ${w.text};
140
140
  }
141
141
  .mail-editor-content:focus {
142
142
  outline: none;
@@ -145,7 +145,7 @@ React keys must be passed directly to JSX without using spread:
145
145
  position: absolute;
146
146
  top: 16px;
147
147
  left: 16px;
148
- color: ${D.textSecondary};
148
+ color: ${w.textSecondary};
149
149
  pointer-events: none;
150
150
  font-size: 14px;
151
151
  }
@@ -153,9 +153,9 @@ React keys must be passed directly to JSX without using spread:
153
153
  from { transform: rotate(0deg); }
154
154
  to { transform: rotate(360deg); }
155
155
  }
156
- `;return g.jsxs("div",{className:o,style:{border:`1px solid ${D.border}`,borderRadius:"8px",background:D.background,overflow:"hidden",display:"flex",flexDirection:"column",height:"100%",minHeight:a},children:[g.jsx("style",{children:Se}),y,g.jsxs(od,{initialConfig:xe,children:[g.jsx(qf,{theme:D,disabled:i,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:T,aiProcessingAction:B,onAiAction:Q,hasContent:se}),g.jsx("div",{style:{position:"relative",flex:1,display:"flex",flexDirection:"column"},children:g.jsx(Wd,{contentEditable:g.jsx(Hd,{className:"mail-editor-content",style:{outline:"none",flex:1,minHeight:"100px",padding:"16px",fontSize:"14px",lineHeight:1.6,color:D.text}}),placeholder:g.jsx("div",{className:"mail-editor-placeholder",children:t}),ErrorBoundary:uf})}),g.jsx(vf,{}),g.jsx(Ef,{}),g.jsx(sf,{}),g.jsx(lf,{onChange:oe}),g.jsx(Uf,{html:x?A:r,isExternalUpdate:x,onImportComplete:L}),g.jsx(Wf,{text:u,trigger:c})]}),n&&g.jsx(Gf,{replyTo:n,theme:D})]})}const Vf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6",inputBackground:"#ffffff",inputBorder:"#d1d5db",inputFocus:"#3b82f6",buttonPrimary:"#3b82f6",buttonPrimaryHover:"#2563eb",buttonSecondary:"#f3f4f6",buttonSecondaryHover:"#e5e7eb",attachmentBackground:"#f9fafb",attachmentBorder:"#e5e7eb"};function Kf({to:r="",subject:e="",body:t="",replyTo:n,onSend:s,onCancel:i,onBodyChange:o,externalUpdate:a,insertText:l,insertTextTrigger:u,theme:c={},disabled:d=!1,showCcBcc:f=!1,placeholder:h="Write your message...",className:p="",minHeight:m="200px",sendButtonText:y="Send",hideCancelButton:D=!1,onAiRestructure:x,onAiProofread:E,onAiRewrite:C,renderAboveToolbar:A}){const b={...Vf,...c},[v,S]=w.useState(r),[k,j]=w.useState(""),[T,B]=w.useState(""),[L,R]=w.useState(e),[M,Q]=w.useState(t),[se,xe]=w.useState([]),[oe,Se]=w.useState(!1),[he,fe]=w.useState(""),[pe,ge]=w.useState(f),[Ae,be]=w.useState(!1),we=w.useRef(void 0);w.useEffect(()=>{a!==void 0&&a!==we.current&&(we.current=a,Q(t),be(!0))},[a,t]);const Re=W=>{Q(W),be(!1),o==null||o(W)},ce=w.useRef(null),[je,at]=w.useState(!1),kt=W=>{const De=W.target.files;if(De){const Te=Array.from(De);console.log("[MailComposer] Files selected:",Te.map(ke=>({name:ke.name,size:ke.size,type:ke.type}))),xe(ke=>[...ke,...Te])}ce.current&&(ce.current.value="")},zt=W=>{W.preventDefault(),W.stopPropagation(),at(!0)},nt=W=>{W.preventDefault(),W.stopPropagation(),at(!1)},mt=W=>{if(W.preventDefault(),W.stopPropagation(),at(!1),W.dataTransfer.files&&W.dataTransfer.files.length>0){const De=Array.from(W.dataTransfer.files);console.log("[MailComposer] Files dropped:",De.map(Te=>({name:Te.name,size:Te.size,type:Te.type}))),xe(Te=>[...Te,...De])}else console.log("[MailComposer] Drop event but no files:",W.dataTransfer.types)},ft=W=>W.type.startsWith("image/")?"image":W.type==="application/pdf"?"picture_as_pdf":W.type.includes("spreadsheet")||W.type.includes("excel")?"table_chart":W.type.includes("document")||W.type.includes("word")?"description":"attach_file",Yt=W=>{xe(De=>De.filter((Te,ke)=>ke!==W))},qt=W=>W<1024?`${W} B`:W<1024*1024?`${(W/1024).toFixed(1)} KB`:`${(W/(1024*1024)).toFixed(1)} MB`,Tt=async()=>{if(!v.trim()){fe("Recipient email is required");return}if(!L.trim()){fe("Subject is required");return}Se(!0),fe("");try{const W=await Promise.all(se.map(async ke=>{const Bt=await ke.arrayBuffer(),Ft=btoa(new Uint8Array(Bt).reduce((Ut,V)=>Ut+String.fromCharCode(V),""));return{filename:ke.name,content_type:ke.type||"application/octet-stream",data:Ft,size:ke.size}})),De=M.replace(/>\n+</g,"><").replace(/<p class="[^"]*"><\/p>/g,"<br>").trim(),Te={to:v.trim(),cc:k.trim()||void 0,bcc:T.trim()||void 0,subject:L.trim(),html:De,attachments:W,inReplyTo:n==null?void 0:n.messageId};console.log("[MailComposer] Sending email - to:",Te.to,"subject:",Te.subject,"attachmentsCount:",Te.attachments.length),Te.attachments.length>0&&Te.attachments.forEach((ke,Bt)=>{var Ft;console.log(`[MailComposer] Attachment ${Bt+1}:`,ke.filename,"size:",ke.size,"type:",ke.content_type,"data length:",((Ft=ke.data)==null?void 0:Ft.length)||0)}),await s(Te),S(""),j(""),B(""),R(""),Q(""),xe([])}catch(W){fe(W instanceof Error?W.message:"Failed to send email")}finally{Se(!1)}},Nt={width:"100%",padding:"8px 12px",fontSize:"14px",border:`1px solid ${b.inputBorder}`,borderRadius:"6px",background:b.inputBackground,color:b.text,outline:"none"},ut={display:"block",fontSize:"12px",fontWeight:500,color:b.textSecondary,marginBottom:"4px",textTransform:"uppercase"},yt=(W,De=!1)=>({padding:"10px 20px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",cursor:De?"not-allowed":"pointer",opacity:De?.6:1,background:W?b.buttonPrimary:b.buttonSecondary,color:W?"#ffffff":b.text,display:"flex",alignItems:"center",gap:"8px"});return g.jsxs("div",{className:p,style:{display:"flex",flexDirection:"column",gap:"16px",padding:"16px",background:b.background},children:[he&&g.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:"6px",color:"#dc2626",fontSize:"14px"},children:he}),g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"To"}),g.jsx("input",{type:"email",value:v,onChange:W=>S(W.target.value),placeholder:"recipient@example.com",disabled:d||oe,style:Nt})]}),!pe&&g.jsx("button",{type:"button",onClick:()=>ge(!0),disabled:d||oe,style:{background:"none",border:"none",padding:0,fontSize:"12px",color:b.primary,cursor:"pointer",textAlign:"left"},children:"+ Add CC/BCC"}),pe&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"CC"}),g.jsx("input",{type:"email",value:k,onChange:W=>j(W.target.value),placeholder:"cc@example.com",disabled:d||oe,style:Nt})]}),g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"BCC"}),g.jsx("input",{type:"email",value:T,onChange:W=>B(W.target.value),placeholder:"bcc@example.com",disabled:d||oe,style:Nt})]})]}),g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"Subject"}),g.jsx("input",{type:"text",value:L,onChange:W=>R(W.target.value),placeholder:"Email subject",disabled:d||oe,style:Nt})]}),g.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:g.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:g.jsx(su,{value:M,onChange:Re,placeholder:h,replyTo:n,theme:b,disabled:d||oe,minHeight:m,externalUpdate:Ae?a:void 0,insertText:l,insertTextTrigger:u,onAiRestructure:x,onAiProofread:E,onAiRewrite:C,renderAboveToolbar:A})})}),g.jsxs("div",{children:[g.jsx("label",{style:{...ut,marginBottom:"8px"},children:"Attachments"}),g.jsx("input",{ref:ce,type:"file",multiple:!0,onChange:kt,style:{display:"none"}}),g.jsxs("div",{onClick:()=>{var W;return(W=ce.current)==null?void 0:W.click()},onDragOver:zt,onDragLeave:nt,onDrop:mt,style:{width:"100%",padding:"24px 16px",border:`2px dashed ${je?b.primary:b.border}`,borderRadius:"8px",background:je?`${b.primary}10`:"transparent",color:je?b.primary:b.textSecondary,cursor:d||oe?"not-allowed":"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s",marginBottom:se.length>0?"12px":0},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"24px"},children:je?"file_download":"attach_file"}),g.jsx("span",{style:{fontSize:"14px"},children:je?"Drop files here":"Drop files or click to add"})]}),se.length>0&&g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:se.map((W,De)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:b.attachmentBackground,borderRadius:"8px"},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b.textSecondary},children:ft(W)}),g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:b.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W.name}),g.jsx("div",{style:{fontSize:"12px",color:b.textSecondary},children:qt(W.size)})]}),g.jsx("button",{type:"button",onClick:()=>Yt(De),disabled:d||oe,style:{background:"none",border:"none",padding:"4px",cursor:"pointer",color:b.textSecondary,display:"flex",borderRadius:"4px"},children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px"},children:"close"})})]},`${W.name}-${De}`))})]}),g.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"12px"},children:[!D&&i&&g.jsx("button",{type:"button",onClick:i,disabled:d||oe,style:yt(!1,d||oe),children:"Cancel"}),g.jsxs("button",{type:"button",onClick:Tt,disabled:d||oe||!v.trim()||!L.trim(),style:yt(!0,d||oe||!v.trim()||!L.trim()),children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",animation:oe?"spin 1s linear infinite":"none"},children:oe?"sync":"send"}),oe?"Sending...":y]})]}),g.jsx("style",{children:`
156
+ `;return g.jsxs("div",{className:o,style:{border:`1px solid ${w.border}`,borderRadius:"8px",background:w.background,overflow:"hidden",display:"flex",flexDirection:"column",height:"100%",minHeight:a},children:[g.jsx("style",{children:Se}),y,g.jsxs(od,{initialConfig:xe,children:[g.jsx(qf,{theme:w,disabled:i,onAiRestructure:d,onAiProofread:f,onAiRewrite:h,aiProcessing:T,aiProcessingAction:B,onAiAction:Q,hasContent:se}),g.jsx("div",{style:{position:"relative",flex:1,display:"flex",flexDirection:"column"},children:g.jsx(Wd,{contentEditable:g.jsx(Hd,{className:"mail-editor-content",style:{outline:"none",flex:1,minHeight:"100px",padding:"16px",fontSize:"14px",lineHeight:1.6,color:w.text}}),placeholder:g.jsx("div",{className:"mail-editor-placeholder",children:t}),ErrorBoundary:uf})}),g.jsx(vf,{}),g.jsx(Ef,{}),g.jsx(sf,{}),g.jsx(lf,{onChange:oe}),g.jsx(Uf,{html:x?A:r,isExternalUpdate:x,onImportComplete:L}),g.jsx(Wf,{text:u,trigger:c})]}),n&&g.jsx(Gf,{replyTo:n,theme:w})]})}const Vf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",toolbarBackground:"#f9fafb",quoteBorder:"#d1d5db",quoteBackground:"#f3f4f6",inputBackground:"#ffffff",inputBorder:"#d1d5db",inputFocus:"#3b82f6",buttonPrimary:"#3b82f6",buttonPrimaryHover:"#2563eb",buttonSecondary:"#f3f4f6",buttonSecondaryHover:"#e5e7eb",attachmentBackground:"#f9fafb",attachmentBorder:"#e5e7eb"};function Kf({to:r="",subject:e="",body:t="",replyTo:n,onSend:s,onCancel:i,onBodyChange:o,externalUpdate:a,insertText:l,insertTextTrigger:u,theme:c={},disabled:d=!1,showCcBcc:f=!1,placeholder:h="Write your message...",className:p="",minHeight:m="200px",sendButtonText:y="Send",hideCancelButton:w=!1,onAiRestructure:x,onAiProofread:E,onAiRewrite:D,renderAboveToolbar:A}){const b={...Vf,...c},[v,S]=C.useState(r),[k,j]=C.useState(""),[T,B]=C.useState(""),[L,R]=C.useState(e),[P,Q]=C.useState(t),[se,xe]=C.useState([]),[oe,Se]=C.useState(!1),[he,fe]=C.useState(""),[pe,ge]=C.useState(f),[Ae,be]=C.useState(!1),we=C.useRef(void 0);C.useEffect(()=>{a!==void 0&&a!==we.current&&(we.current=a,Q(t),be(!0))},[a,t]);const Re=W=>{Q(W),be(!1),o==null||o(W)},ce=C.useRef(null),[je,at]=C.useState(!1),kt=W=>{const De=W.target.files;if(De){const Te=Array.from(De);console.log("[MailComposer] Files selected:",Te.map(ke=>({name:ke.name,size:ke.size,type:ke.type}))),xe(ke=>[...ke,...Te])}ce.current&&(ce.current.value="")},zt=W=>{W.preventDefault(),W.stopPropagation(),at(!0)},nt=W=>{W.preventDefault(),W.stopPropagation(),at(!1)},mt=W=>{if(W.preventDefault(),W.stopPropagation(),at(!1),W.dataTransfer.files&&W.dataTransfer.files.length>0){const De=Array.from(W.dataTransfer.files);console.log("[MailComposer] Files dropped:",De.map(Te=>({name:Te.name,size:Te.size,type:Te.type}))),xe(Te=>[...Te,...De])}else console.log("[MailComposer] Drop event but no files:",W.dataTransfer.types)},ft=W=>W.type.startsWith("image/")?"image":W.type==="application/pdf"?"picture_as_pdf":W.type.includes("spreadsheet")||W.type.includes("excel")?"table_chart":W.type.includes("document")||W.type.includes("word")?"description":"attach_file",Yt=W=>{xe(De=>De.filter((Te,ke)=>ke!==W))},qt=W=>W<1024?`${W} B`:W<1024*1024?`${(W/1024).toFixed(1)} KB`:`${(W/(1024*1024)).toFixed(1)} MB`,Tt=async()=>{if(!v.trim()){fe("Recipient email is required");return}if(!L.trim()){fe("Subject is required");return}Se(!0),fe("");try{const W=await Promise.all(se.map(async ke=>{const Bt=await ke.arrayBuffer(),Ft=btoa(new Uint8Array(Bt).reduce((Ut,V)=>Ut+String.fromCharCode(V),""));return{filename:ke.name,content_type:ke.type||"application/octet-stream",data:Ft,size:ke.size}})),De=P.replace(/>\n+</g,"><").replace(/<p class="[^"]*"><\/p>/g,"<br>").trim(),Te={to:v.trim(),cc:k.trim()||void 0,bcc:T.trim()||void 0,subject:L.trim(),html:De,attachments:W,inReplyTo:n==null?void 0:n.messageId};console.log("[MailComposer] Sending email - to:",Te.to,"subject:",Te.subject,"attachmentsCount:",Te.attachments.length),Te.attachments.length>0&&Te.attachments.forEach((ke,Bt)=>{var Ft;console.log(`[MailComposer] Attachment ${Bt+1}:`,ke.filename,"size:",ke.size,"type:",ke.content_type,"data length:",((Ft=ke.data)==null?void 0:Ft.length)||0)}),await s(Te),S(""),j(""),B(""),R(""),Q(""),xe([])}catch(W){fe(W instanceof Error?W.message:"Failed to send email")}finally{Se(!1)}},Nt={width:"100%",padding:"8px 12px",fontSize:"14px",border:`1px solid ${b.inputBorder}`,borderRadius:"6px",background:b.inputBackground,color:b.text,outline:"none"},ut={display:"block",fontSize:"12px",fontWeight:500,color:b.textSecondary,marginBottom:"4px",textTransform:"uppercase"},yt=(W,De=!1)=>({padding:"10px 20px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",cursor:De?"not-allowed":"pointer",opacity:De?.6:1,background:W?b.buttonPrimary:b.buttonSecondary,color:W?"#ffffff":b.text,display:"flex",alignItems:"center",gap:"8px"});return g.jsxs("div",{className:p,style:{display:"flex",flexDirection:"column",gap:"16px",padding:"16px",background:b.background},children:[he&&g.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:"6px",color:"#dc2626",fontSize:"14px"},children:he}),g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"To"}),g.jsx("input",{type:"email",value:v,onChange:W=>S(W.target.value),placeholder:"recipient@example.com",disabled:d||oe,style:Nt})]}),!pe&&g.jsx("button",{type:"button",onClick:()=>ge(!0),disabled:d||oe,style:{background:"none",border:"none",padding:0,fontSize:"12px",color:b.primary,cursor:"pointer",textAlign:"left"},children:"+ Add CC/BCC"}),pe&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"CC"}),g.jsx("input",{type:"email",value:k,onChange:W=>j(W.target.value),placeholder:"cc@example.com",disabled:d||oe,style:Nt})]}),g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"BCC"}),g.jsx("input",{type:"email",value:T,onChange:W=>B(W.target.value),placeholder:"bcc@example.com",disabled:d||oe,style:Nt})]})]}),g.jsxs("div",{children:[g.jsx("label",{style:ut,children:"Subject"}),g.jsx("input",{type:"text",value:L,onChange:W=>R(W.target.value),placeholder:"Email subject",disabled:d||oe,style:Nt})]}),g.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:g.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:g.jsx(su,{value:P,onChange:Re,placeholder:h,replyTo:n,theme:b,disabled:d||oe,minHeight:m,externalUpdate:Ae?a:void 0,insertText:l,insertTextTrigger:u,onAiRestructure:x,onAiProofread:E,onAiRewrite:D,renderAboveToolbar:A})})}),g.jsxs("div",{children:[g.jsx("label",{style:{...ut,marginBottom:"8px"},children:"Attachments"}),g.jsx("input",{ref:ce,type:"file",multiple:!0,onChange:kt,style:{display:"none"}}),g.jsxs("div",{onClick:()=>{var W;return(W=ce.current)==null?void 0:W.click()},onDragOver:zt,onDragLeave:nt,onDrop:mt,style:{width:"100%",padding:"24px 16px",border:`2px dashed ${je?b.primary:b.border}`,borderRadius:"8px",background:je?`${b.primary}10`:"transparent",color:je?b.primary:b.textSecondary,cursor:d||oe?"not-allowed":"pointer",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s",marginBottom:se.length>0?"12px":0},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"24px"},children:je?"file_download":"attach_file"}),g.jsx("span",{style:{fontSize:"14px"},children:je?"Drop files here":"Drop files or click to add"})]}),se.length>0&&g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:se.map((W,De)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:b.attachmentBackground,borderRadius:"8px"},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b.textSecondary},children:ft(W)}),g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:b.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W.name}),g.jsx("div",{style:{fontSize:"12px",color:b.textSecondary},children:qt(W.size)})]}),g.jsx("button",{type:"button",onClick:()=>Yt(De),disabled:d||oe,style:{background:"none",border:"none",padding:"4px",cursor:"pointer",color:b.textSecondary,display:"flex",borderRadius:"4px"},children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px"},children:"close"})})]},`${W.name}-${De}`))})]}),g.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"12px"},children:[!w&&i&&g.jsx("button",{type:"button",onClick:i,disabled:d||oe,style:yt(!1,d||oe),children:"Cancel"}),g.jsxs("button",{type:"button",onClick:Tt,disabled:d||oe||!v.trim()||!L.trim(),style:yt(!0,d||oe||!v.trim()||!L.trim()),children:[g.jsx("span",{className:"material-icons",style:{fontSize:"18px",animation:oe?"spin 1s linear infinite":"none"},children:oe?"sync":"send"}),oe?"Sending...":y]})]}),g.jsx("style",{children:`
157
157
  @keyframes spin {
158
158
  from { transform: rotate(0deg); }
159
159
  to { transform: rotate(360deg); }
160
160
  }
161
- `})]})}const Hf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",chipBackground:"#f3f4f6",chipText:"#374151",hoverBackground:"#f9fafb"};function Qf({options:r,value:e,onChange:t,placeholder:n="Search or select...",allowCreate:s=!0,onCreate:i,allowDelete:o=!1,onDelete:a,label:l,disabled:u=!1,max:c=0,theme:d={},className:f=""}){const h={...Hf,...d},[p,m]=w.useState(!1),[y,D]=w.useState(""),x=w.useRef(null),E=w.useRef(null);w.useEffect(()=>{function T(B){x.current&&!x.current.contains(B.target)&&(m(!1),D(""))}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const C=r.filter(T=>{var B;return((B=T.label)==null?void 0:B.toLowerCase().includes(y.toLowerCase()))&&!e.includes(T.id)}),A=s&&y.trim()&&!r.some(T=>{var B;return((B=T.label)==null?void 0:B.toLowerCase())===y.toLowerCase()}),b=e.map(T=>r.find(B=>B.id===T)).filter(Boolean),v=w.useCallback(T=>{var B;c>0&&e.length>=c||(t([...e,T]),D(""),c===1?m(!1):(B=E.current)==null||B.focus())},[e,t,c]),S=w.useCallback(T=>{t(e.filter(B=>B!==T))},[e,t]),k=w.useCallback(async()=>{if(!A)return;const T=await(i==null?void 0:i(y.trim()));T&&v(T.id),D("")},[A,y,i,v]),j=w.useCallback(T=>{T.key==="Enter"?(T.preventDefault(),A?k():C.length>0&&v(C[0].id)):T.key==="Backspace"&&!y&&e.length>0?S(e[e.length-1]):T.key==="Escape"&&(m(!1),D(""))},[A,C,y,e,k,v,S]);return g.jsxs("div",{ref:x,className:f,style:{position:"relative"},children:[l&&g.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:l}),g.jsxs("div",{onClick:()=>!u&&m(!0),style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 12px",border:`1px solid ${p?h.primary:h.border}`,borderRadius:"8px",background:u?h.hoverBackground:h.background,cursor:u?"not-allowed":"text",minHeight:"42px",alignItems:"center"},children:[b.map(T=>g.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"4px",fontSize:"13px",background:T.color||h.chipBackground,color:T.color?"#fff":h.chipText},children:[T.label,!u&&g.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),S(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 2px",fontSize:"14px",color:"inherit",opacity:.7},children:"×"})]},T.id)),g.jsx("input",{ref:E,type:"text",value:y,onChange:T=>{D(T.target.value),p||m(!0)},onFocus:()=>m(!0),onKeyDown:j,placeholder:b.length===0?n:"",disabled:u||c>0&&e.length>=c,style:{flex:1,minWidth:"60px",border:"none",outline:"none",fontSize:"14px",background:"transparent",color:h.text}})]}),p&&!u&&g.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",background:h.background,border:`1px solid ${h.border}`,borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",maxHeight:"200px",overflowY:"auto",zIndex:50},children:C.length===0&&!A?g.jsx("div",{style:{padding:"12px",fontSize:"14px",color:h.textSecondary,textAlign:"center"},children:y?"No matches":"No options available"}):g.jsxs(g.Fragment,{children:[C.map(T=>g.jsxs("div",{onClick:()=>v(T.id),style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.text,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseEnter:B=>{B.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:B=>{B.currentTarget.style.background=""},children:[T.label,o&&a&&g.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),a(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",fontSize:"14px",color:h.textSecondary,opacity:.5},onMouseEnter:B=>{B.currentTarget.style.opacity="1",B.currentTarget.style.color="#ef4444"},onMouseLeave:B=>{B.currentTarget.style.opacity="0.5",B.currentTarget.style.color=h.textSecondary||""},children:"×"})]},T.id)),A&&g.jsxs("div",{onClick:k,style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.primary,borderTop:C.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 Jf({items:r,columns:e,getItemId:t,getItemColumn:n,getItemOrder:s,renderItem:i,onItemMove:o,onItemReorder:a,onItemClick:l,renderColumnHeader:u,renderColumnFooter:c,className:d="",columnClassName:f="",itemClassName:h=""}){const[p,m]=w.useState(null),[y,D]=w.useState(null),[x,E]=w.useState(null),C=w.useRef(null),A=e.reduce((B,L)=>{let R=r.filter(M=>n(M)===L.id);return s&&(R=R.sort((M,Q)=>s(M)-s(Q))),B[L.id]=R,B},{}),b=w.useCallback((B,L)=>{const R=t(L),M=n(L);m(R),C.current=M,B.dataTransfer.effectAllowed="move",B.dataTransfer.setData("text/plain",R),requestAnimationFrame(()=>{const Q=B.target;Q.style.opacity="0.5"})},[t,n]),v=w.useCallback(B=>{const L=B.target;L.style.opacity="1",m(null),D(null),E(null),C.current=null},[]),S=w.useCallback((B,L,R)=>{B.preventDefault(),B.dataTransfer.dropEffect="move",D(L),E(R)},[]),k=w.useCallback(B=>{const L=B.relatedTarget;L!=null&&L.closest("[data-kanban-column]")||(D(null),E(null))},[]),j=w.useCallback((B,L,R)=>{if(B.preventDefault(),!p)return;const M=C.current;M===L?a==null||a(p,L,R):M&&o(p,M,L,R),m(null),D(null),E(null),C.current=null},[p,o,a]),T=(B,L)=>g.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[B.color&&g.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:B.color}}),g.jsx("span",{className:"font-medium text-sm text-neutral-700",children:B.label})]}),g.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:L})]});return g.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${d}`,style:{minHeight:"400px"},children:e.map(B=>{const L=A[B.id]||[],R=y===B.id;return g.jsxs("div",{"data-kanban-column":B.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,onDragOver:M=>{M.preventDefault(),p&&!R&&D(B.id)},onDragLeave:k,onDrop:M=>j(M,B.id,x??L.length),children:[g.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:u?u(B,L.length):T(B,L.length)}),g.jsxs("div",{className:`flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${R?"bg-blue-50":""}`,children:[L.map((M,Q)=>{const se=t(M),xe=p===se,oe=R&&x===Q&&!xe;return g.jsxs("div",{children:[oe&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mb-2 mx-1"}),g.jsx("div",{draggable:!0,onDragStart:Se=>b(Se,M),onDragEnd:v,onDragOver:Se=>S(Se,B.id,Q),onClick:()=>l==null?void 0:l(M),className:`cursor-grab active:cursor-grabbing transition-all ${xe?"opacity-50 scale-95":""} ${h}`,children:i(M,xe)})]},se)}),g.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:M=>{M.preventDefault(),S(M,B.id,L.length)},children:R&&x===L.length&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),L.length===0&&R&&g.jsx("div",{className:"h-20 border-2 border-dashed border-blue-300 rounded-lg bg-blue-50/50 flex items-center justify-center",children:g.jsx("span",{className:"text-sm text-blue-400",children:"Drop here"})})]}),c&&g.jsx("div",{className:"flex-shrink-0 border-t border-neutral-200 p-2",children:c(B)})]},B.id)})})}const Yf={background:"#ffffff",hourLineColor:"#e5e7eb",halfHourLineColor:"#f3f4f6",hourTextColor:"#9ca3af",currentTimeColor:"#ef4444",allDayBackground:"#f9fafb",allDayBorder:"#e5e7eb"};function Xf(r){const e=r.match(/^(\d{1,2}):(\d{2})$/);return e?{hours:parseInt(e[1],10),minutes:parseInt(e[2],10)}:null}function Zf(r){const e=r%12||12,t=r<12?"AM":"PM";return`${e} ${t}`}function eh(r){const e=new Date;return r.getDate()===e.getDate()&&r.getMonth()===e.getMonth()&&r.getFullYear()===e.getFullYear()}function th({items:r,date:e,startHour:t=7,endHour:n=22,hourHeight:s=60,getItemTime:i,getItemDuration:o,getItemIsAllDay:a,getItemId:l,renderItem:u,onItemClick:c,onTimeSlotClick:d,showCurrentTime:f=!0,className:h="",theme:p={}}){const m={...Yf,...p},{allDayItems:y,timedItems:D}=w.useMemo(()=>{const v=[],S=[];for(const k of r)a(k)?v.push(k):S.push(k);return{allDayItems:v,timedItems:S}},[r,a]),x=w.useMemo(()=>{const v=[];for(let S=t;S<=n;S++)v.push(S);return v},[t,n]),E=(n-t+1)*s,C=w.useCallback(v=>{const S=i(v);if(!S)return null;const k=Xf(S);if(!k)return null;const{hours:j,minutes:T}=k,B=Math.max(t,Math.min(n,j)),L=j<t?0:T,R=(B-t)*s+L/60*s,M=o(v),Q=Math.max(20,M/60*s);return{top:R,height:Q}},[i,o,t,n,s]),A=w.useMemo(()=>{if(!f||!eh(e))return null;const v=new Date,S=v.getHours(),k=v.getMinutes();return S<t||S>n?null:(S-t)*s+k/60*s},[e,f,t,n,s]),b=w.useCallback(v=>{if(!d)return;const S=v.currentTarget.getBoundingClientRect(),j=(v.clientY-S.top)/s*60,T=Math.floor(j/60)+t,B=Math.round(j%60/15)*15,L=Math.min(n,Math.max(t,T)),R=B>=60?0:B,M=`${L.toString().padStart(2,"0")}:${R.toString().padStart(2,"0")}`;d(M)},[d,s,t,n]);return g.jsxs("div",{className:h,style:{background:m.background},children:[y.length>0&&g.jsxs("div",{style:{padding:"8px 0 8px 60px",borderBottom:`1px solid ${m.allDayBorder}`,background:m.allDayBackground},children:[g.jsx("div",{style:{fontSize:"11px",color:m.hourTextColor,marginBottom:"4px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"All Day"}),g.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:y.map(v=>g.jsx("div",{onClick:()=>c==null?void 0:c(v),style:{cursor:c?"pointer":"default"},children:u(v)},l(v)))})]}),g.jsxs("div",{style:{position:"relative",height:E},children:[x.map((v,S)=>g.jsxs("div",{style:{position:"absolute",top:S*s,left:0,right:0},children:[g.jsx("div",{style:{position:"absolute",left:0,top:-8,width:"50px",textAlign:"right",paddingRight:"10px",fontSize:"11px",color:m.hourTextColor},children:Zf(v)}),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),S<x.length-1&&g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},v)),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:d?"pointer":"default"},onClick:b}),A!==null&&g.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:A,zIndex:20,pointerEvents:"none"},children:[g.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:m.currentTimeColor,marginLeft:"-5px",marginTop:"-5px",position:"absolute"}}),g.jsx("div",{style:{marginLeft:"5px",height:"2px",background:m.currentTimeColor}})]}),D.map(v=>{const S=C(v);return S?g.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:S.top,height:S.height,zIndex:10,cursor:c?"pointer":"default"},onClick:k=>{k.stopPropagation(),c==null||c(v)},children:u(v)},l(v)):null})]})]})}function rh({onComplete:r,onCancel:e,onTranscribe:t,onTranscriptionComplete:n,variant:s="widget",hideSaveButton:i=!1,maxDuration:o=180}){const a=s==="widget",[l,u]=w.useState("idle"),[c,d]=w.useState(0),[f,h]=w.useState(0),[p,m]=w.useState(!1),[y,D]=w.useState(0),[x,E]=w.useState(null),[C,A]=w.useState(!1),[b,v]=w.useState(null),[S,k]=w.useState(!0),[j,T]=w.useState([]),[B,L]=w.useState({completed:0,total:0}),R=w.useRef(!1),M=w.useRef(!0);w.useEffect(()=>{M.current=S},[S]);const Q=w.useRef(null),se=w.useRef(null),xe=w.useRef(null),oe=w.useRef(null),Se=w.useRef(null),he=w.useRef([]),fe=w.useRef(null),pe=w.useRef(null),ge=w.useRef(null),Ae=w.useRef(null),be=w.useRef(!1),we=w.useRef([]),Re=w.useRef(null),ce=w.useRef(null),je=w.useRef([]),at=w.useRef([]),kt=w.useRef("insert"),zt=w.useRef(!1),nt=w.useRef(0),mt=w.useRef(0),ft=w.useRef(0),Yt=q=>{const N=Math.floor(q/60),H=Math.floor(q%60);return`${N.toString().padStart(2,"0")}:${H.toString().padStart(2,"0")}`},qt=async q=>{const N=await q.arrayBuffer(),H=new AudioContext,Y=await H.decodeAudioData(N);return await H.close(),Y},Tt=q=>{const N=q.numberOfChannels,H=q.sampleRate,Y=1,I=16,re=I/8,Z=N*re,ee=H*Z,me=q.length*Z,Ee=new ArrayBuffer(44+me),te=new DataView(Ee),ne=(Be,ve)=>{for(let Je=0;Je<ve.length;Je++)te.setUint8(Be+Je,ve.charCodeAt(Je))};ne(0,"RIFF"),te.setUint32(4,36+me,!0),ne(8,"WAVE"),ne(12,"fmt "),te.setUint32(16,16,!0),te.setUint16(20,Y,!0),te.setUint16(22,N,!0),te.setUint32(24,H,!0),te.setUint32(28,ee,!0),te.setUint16(32,Z,!0),te.setUint16(34,I,!0),ne(36,"data"),te.setUint32(40,me,!0);const ze=[];for(let Be=0;Be<N;Be++)ze.push(q.getChannelData(Be));let We=44;for(let Be=0;Be<q.length;Be++)for(let ve=0;ve<N;ve++){const Je=Math.max(-1,Math.min(1,ze[ve][Be])),Ye=Je<0?Je*32768:Je*32767;te.setInt16(We,Ye,!0),We+=2}return new Blob([Ee],{type:"audio/wav"})},Nt=async(q,N,H,Y)=>{const I=new AudioContext,re=q.sampleRate,Z=Math.max(q.numberOfChannels,N.numberOfChannels),ee=Math.min(H,q.length),me=Math.max(0,q.length-H),Ee=Y==="insert"?ee+N.length+me:ee+N.length,te=I.createBuffer(Z,Ee,re);for(let ne=0;ne<Z;ne++){const ze=te.getChannelData(ne),We=ne<q.numberOfChannels?q.getChannelData(ne):q.getChannelData(0);for(let ve=0;ve<ee;ve++)ze[ve]=We[ve];const Be=ne<N.numberOfChannels?N.getChannelData(ne):N.getChannelData(0);for(let ve=0;ve<N.length;ve++)ze[ee+ve]=Be[ve];if(Y==="insert")for(let ve=0;ve<me;ve++)ze[ee+N.length+ve]=We[H+ve]}return await I.close(),te},ut=w.useCallback(()=>{const q=Q.current;if(!q)return;const N=q.getContext("2d");if(!N)return;const H=q.getBoundingClientRect(),Y=H.width,I=H.height,re=we.current,Z=f||c||1,ee=l==="recording"?c:y;N.fillStyle="#2d3b35",N.fillRect(0,0,Y,I);const me=8,Ee="rgba(0, 0, 0, 0.4)",te=N.createLinearGradient(0,0,0,me);te.addColorStop(0,Ee),te.addColorStop(1,"transparent"),N.fillStyle=te,N.fillRect(0,0,Y,me);const ne=N.createLinearGradient(0,I-me,0,I);ne.addColorStop(0,"transparent"),ne.addColorStop(1,Ee),N.fillStyle=ne,N.fillRect(0,I-me,Y,me);const ze=N.createLinearGradient(0,0,me,0);ze.addColorStop(0,Ee),ze.addColorStop(1,"transparent"),N.fillStyle=ze,N.fillRect(0,0,me,I);const We=N.createLinearGradient(Y-me,0,Y,0);We.addColorStop(0,"transparent"),We.addColorStop(1,Ee),N.fillStyle=We,N.fillRect(Y-me,0,me,I),N.strokeStyle="#5a6b62",N.lineWidth=1,N.beginPath(),N.moveTo(0,I/2),N.lineTo(Y,I/2),N.stroke();const Be=Y/2;if(re.length>0)if(l==="recording")for(let Ye=0;Ye<re.length;Ye++){const ht=re.length-1-Ye,Wt=Be-ht*4;if(Wt<-3||Wt>Y)continue;const bt=re[Ye]*(I/2-12),_=I/2-bt;N.fillStyle="#10b981",N.fillRect(Wt,_,3,bt*2)}else{const Ye=Z>0?ee/Z*re.length:0;for(let ht=0;ht<re.length;ht++){const Wt=Ye-ht,bt=Be-Wt*4;if(bt<-3||bt>Y)continue;const _=re[ht]*(I/2-12),P=I/2-_;N.fillStyle=ht<=Ye?"#10b981":"#4b5563",N.fillRect(bt,P,3,_*2)}}N.strokeStyle="#ef4444",N.lineWidth=1,N.beginPath(),N.moveTo(Be,0),N.lineTo(Be,I),N.stroke(),N.fillStyle="#fff",N.font="bold 18px monospace",N.textAlign="center",N.fillText(Yt(ee),Be,I-6),l==="recording"&&(N.fillStyle="#ef4444",N.beginPath(),N.arc(20,20,8,0,Math.PI*2),N.fill(),N.fillStyle="#fff",N.font="10px sans-serif",N.textAlign="left",N.fillText("REC",34,24)),N.textAlign="left"},[l,y,c,f]),yt=()=>{const q=Se.current;if(!q||!be.current)return;const N=q.frequencyBinCount,H=new Uint8Array(N);q.getByteTimeDomainData(H);let Y=0;for(let Z=0;Z<N;Z++){const ee=(H[Z]-128)/128;Y+=ee*ee}const I=Math.sqrt(Y/N),re=Math.min(1,I*3);we.current.push(re),ut(),be.current&&(pe.current=requestAnimationFrame(yt))},W=async()=>{try{E(null),A(!1),Re.current===null&&(we.current=[]);const q=await navigator.mediaDevices.getUserMedia({audio:!0});xe.current=q;const N=new AudioContext;oe.current=N;const H=N.createAnalyser();H.fftSize=2048,Se.current=H,N.createMediaStreamSource(q).connect(H);const I=new MediaRecorder(q);se.current=I,he.current=[],I.ondataavailable=re=>{re.data.size>0&&he.current.push(re.data)},I.onstop=async()=>{try{if(be.current=!1,he.current.length===0){E("No audio was recorded. Please try again."),u("idle"),q.getTracks().forEach(te=>te.stop());return}const re=new Blob(he.current,{type:"audio/webm"});let Z,ee;if(Re.current!==null&&ce.current)try{const te=await qt(re),ne=ce.current.sampleRate,ze=Math.floor(Re.current*ne),We=await Nt(ce.current,te,ze,kt.current);Z=Tt(We),ee=We.length/We.sampleRate,kt.current==="insert"&&(we.current=[...we.current,...at.current]),Re.current=null,ce.current=null,je.current=[],at.current=[]}catch{Z=re,ee=nt.current>0?nt.current:1}else Z=re,ee=nt.current>0?nt.current:1;if(Ae.current=Z,q.getTracks().forEach(te=>te.stop()),M.current&&t){T(te=>[...te,Z]),L(te=>({...te,total:te.total+1})),Ae.current=null,we.current=[],D(0),h(0),d(0),u("idle");return}const me=URL.createObjectURL(Z),Ee=new Audio(me);Ee.ontimeupdate=()=>{D(Ee.currentTime)},Ee.onended=()=>{m(!1)},ge.current=Ee,h(ee),D(ee),u("editing")}catch{E("Failed to process recording"),u("idle")}},I.start(100),be.current=!0,u("recording"),d(0),nt.current=0,fe.current=setInterval(()=>{nt.current+=1,d(nt.current),nt.current>=o&&(se.current&&se.current.state!=="inactive"&&se.current.stop(),be.current=!1,v(null),fe.current&&(clearInterval(fe.current),fe.current=null),pe.current&&(cancelAnimationFrame(pe.current),pe.current=null),setTimeout(()=>{alert(`Maximum recording time of ${Math.floor(o/60)} minutes reached.`)},100))},1e3)}catch{E("Could not access microphone. Please allow microphone access.")}},De=()=>{be.current=!1,A(!1),v(null),pe.current&&(cancelAnimationFrame(pe.current),pe.current=null),fe.current&&(clearInterval(fe.current),fe.current=null),se.current&&se.current.state!=="inactive"&&se.current.stop()},Te=q=>{const N=Q.current;if(!N)return;const H=f||c;if(H<=0)return;const Y=we.current;if(Y.length===0)return;const I=N.getBoundingClientRect(),re=q-mt.current,Z=4,ee=I.width/N.width,me=Y.length/H*Z,Ee=-re/(me*ee),te=ft.current+Ee,ne=Math.max(0,Math.min(te,H));ge.current&&(ge.current.currentTime=ne),D(ne)},ke=()=>{ge.current&&(ge.current.currentTime=0),D(0)},Bt=()=>{const q=f||c;ge.current&&(ge.current.currentTime=q),D(q)},Ft=()=>{const q=ge.current;q&&(p?(q.pause(),D(q.currentTime),m(!1)):(q.currentTime=y,q.play().catch(()=>{}),m(!0)))},Ut=async q=>{if(!Ae.current){W();return}try{ge.current&&(ge.current.pause(),m(!1)),kt.current=q,ce.current=await qt(Ae.current);const N=f||c;Re.current=y;const H=N>0?y/N:0,Y=Math.floor(H*we.current.length);je.current=we.current.slice(0,Y),at.current=we.current.slice(Y),we.current=[...je.current],W()}catch{E("Failed to prepare recording. Please try again.")}},V=()=>{ge.current&&(ge.current.pause(),ge.current=null),Ae.current=null,ce.current=null,Re.current=null,je.current=[],m(!1),D(0),h(0),d(0),W()},J=()=>{Ae.current?r(Ae.current,f||c):alert("No audio recorded yet!")};w.useEffect(()=>{l==="recording"&&Q.current&&Se.current&&be.current&&(pe.current=requestAnimationFrame(yt))},[l]),w.useEffect(()=>{const q=Q.current;if(!q)return;const N=()=>{const H=window.devicePixelRatio||1,Y=q.getBoundingClientRect();q.width=Y.width*H,q.height=Y.height*H;const I=q.getContext("2d");I&&I.scale(H,H)};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]),w.useEffect(()=>{if(l==="idle"){const q=Q.current;if(!q)return;const N=q.getContext("2d");if(!N)return;const H=q.getBoundingClientRect(),Y=H.width,I=H.height;N.fillStyle="#2d3b35",N.fillRect(0,0,Y,I);const re=8,Z="rgba(0, 0, 0, 0.4)",ee=N.createLinearGradient(0,0,0,re);ee.addColorStop(0,Z),ee.addColorStop(1,"transparent"),N.fillStyle=ee,N.fillRect(0,0,Y,re);const me=N.createLinearGradient(0,I-re,0,I);me.addColorStop(0,"transparent"),me.addColorStop(1,Z),N.fillStyle=me,N.fillRect(0,I-re,Y,re);const Ee=N.createLinearGradient(0,0,re,0);Ee.addColorStop(0,Z),Ee.addColorStop(1,"transparent"),N.fillStyle=Ee,N.fillRect(0,0,re,I);const te=N.createLinearGradient(Y-re,0,Y,0);te.addColorStop(0,"transparent"),te.addColorStop(1,Z),N.fillStyle=te,N.fillRect(Y-re,0,re,I),N.strokeStyle="#5a6b62",N.lineWidth=1,N.beginPath(),N.moveTo(0,I/2),N.lineTo(Y,I/2),N.stroke();const ne=Y/2;N.strokeStyle="#ef4444",N.lineWidth=1,N.beginPath(),N.moveTo(ne,0),N.lineTo(ne,I),N.stroke(),N.fillStyle="#fff",N.font="bold 18px monospace",N.textAlign="center",N.fillText("00:00",ne,I-6)}},[l]);const Ne=w.useCallback(q=>{T(N=>[...N,q]),L(N=>({...N,total:N.total+1}))},[]);if(w.useEffect(()=>{(async()=>{if(R.current||j.length===0||!t)return;R.current=!0;const N=j[0];try{const H=await t(N);H&&n&&n(H)}catch(H){console.error("Transcription failed:",H)}finally{T(H=>H.slice(1)),L(H=>({...H,completed:H.completed+1})),R.current=!1}})()},[j,t,n]),w.useEffect(()=>()=>{be.current=!1,fe.current&&clearInterval(fe.current),pe.current&&cancelAnimationFrame(pe.current),xe.current&&xe.current.getTracks().forEach(q=>q.stop()),oe.current&&oe.current.state!=="closed"&&oe.current.close()},[]),w.useEffect(()=>{if(l==="editing"&&p){let q;const N=()=>{const H=ge.current;if(H&&p){const Y=Q.current;if(Y){const I=Y.getContext("2d");if(I){const re=Y.getBoundingClientRect(),Z=re.width,ee=re.height,me=we.current,Ee=f||c||1,te=H.currentTime;I.fillStyle="#2d3b35",I.fillRect(0,0,Z,ee);const ne=8,ze="rgba(0, 0, 0, 0.4)",We=I.createLinearGradient(0,0,0,ne);We.addColorStop(0,ze),We.addColorStop(1,"transparent"),I.fillStyle=We,I.fillRect(0,0,Z,ne);const Be=I.createLinearGradient(0,ee-ne,0,ee);Be.addColorStop(0,"transparent"),Be.addColorStop(1,ze),I.fillStyle=Be,I.fillRect(0,ee-ne,Z,ne);const ve=I.createLinearGradient(0,0,ne,0);ve.addColorStop(0,ze),ve.addColorStop(1,"transparent"),I.fillStyle=ve,I.fillRect(0,0,ne,ee);const Je=I.createLinearGradient(Z-ne,0,Z,0);Je.addColorStop(0,"transparent"),Je.addColorStop(1,ze),I.fillStyle=Je,I.fillRect(Z-ne,0,ne,ee),I.strokeStyle="#5a6b62",I.lineWidth=1,I.beginPath(),I.moveTo(0,ee/2),I.lineTo(Z,ee/2),I.stroke();const Ye=Z/2,ht=3,Wt=4,bt=Ee>0?te/Ee*me.length:0;for(let U=0;U<me.length;U++){const X=bt-U,ue=Ye-X*Wt;if(ue<-ht||ue>Z)continue;const _e=me[U]*(ee/2-12),le=ee/2-_e;I.fillStyle=U<=bt?"#10b981":"#4b5563",I.fillRect(ue,le,ht,_e*2)}I.strokeStyle="#ef4444",I.lineWidth=1,I.beginPath(),I.moveTo(Ye,0),I.lineTo(Ye,ee),I.stroke(),I.fillStyle="#fff",I.font="bold 18px monospace",I.textAlign="center";const _=Math.floor(te/60),P=Math.floor(te%60);I.fillText(`${_.toString().padStart(2,"0")}:${P.toString().padStart(2,"0")}`,Ye,ee-6),I.textAlign="left"}}q=requestAnimationFrame(N)}};return q=requestAnimationFrame(N),()=>cancelAnimationFrame(q)}},[l,p,f,c]),w.useEffect(()=>{l==="editing"&&!p&&ut()},[l,y,p,ut]),x)return g.jsxs("div",{style:{border:"1px solid #fecaca",borderRadius:"12px",padding:"16px",background:"#fef2f2"},children:[g.jsx("p",{style:{fontSize:"14px",color:"#dc2626",marginBottom:"12px"},children:x}),g.jsx("button",{onClick:()=>{E(null),W()},style:{padding:"8px 16px",fontSize:"14px",background:"#171717",color:"white",borderRadius:"8px",border:"none",cursor:"pointer"},children:"Try Again"})]});const Oe={padding:"8px",borderRadius:"8px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},Ie={...Oe,opacity:.3,cursor:"not-allowed"},xt=a?{border:"1px solid #e5e5e5",borderRadius:"12px",overflow:"hidden",background:"white"}:{overflow:"hidden",background:"white",flexShrink:0};return g.jsxs("div",{style:xt,children:[g.jsx("canvas",{ref:Q,style:{width:"100%",height:"32px",cursor:"pointer",flexShrink:0},onMouseDown:q=>{if(l==="editing"){zt.current=!0,mt.current=q.clientX,ft.current=y;const N=Y=>{zt.current&&Te(Y.clientX)},H=()=>{zt.current=!1,window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",H)};window.addEventListener("mousemove",N),window.addEventListener("mouseup",H)}}}),g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:a?"6px 8px":"4px",borderTop:"1px solid #d4d4d4",background:"linear-gradient(to bottom, #e0e0e0 0%, #c8c8c8 100%)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(0,0,0,0.1)",flexShrink:0},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[g.jsx("button",{onClick:ke,disabled:l==="idle"||l==="recording",style:l==="idle"||l==="recording"?Ie:Oe,title:"Go to start",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"first_page"})}),g.jsx("button",{onClick:()=>{if(l==="recording"){const q=se.current;q&&(q.state==="recording"?(q.pause(),A(!0)):q.state==="paused"&&(q.resume(),A(!1)))}else Ft()},disabled:l==="idle",style:l==="idle"?Ie:Oe,title:p||l==="recording"&&!C?"Pause":"Play",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:p||l==="recording"&&!C?"pause":"play_arrow"})}),g.jsx("button",{onClick:Bt,disabled:l==="idle"||l==="recording",style:l==="idle"||l==="recording"?Ie:Oe,title:"Go to end",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"last_page"})}),g.jsx("div",{style:{width:"1px",height:"24px",margin:"0 4px",background:"linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(0,0,0,0.15))"}}),g.jsx("button",{onClick:()=>{b==="insert"?De():l==="idle"?(v("insert"),W()):l==="editing"&&(v("insert"),Ut("insert"))},disabled:l==="recording"&&b!=="insert"||p,style:l==="recording"&&b!=="insert"||p?Ie:Oe,title:b==="insert"?"Stop recording":"Insert recording",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="insert"?"#ef4444":"#171717"},children:"add"})}),g.jsx("button",{onClick:()=>{M.current||(b==="mic"?De():l==="idle"?(v("mic"),W()):l==="editing"&&(v("mic"),Ut("replace")))},onMouseDown:()=>{M.current&&l==="idle"&&!p&&(v("mic"),W())},onMouseUp:()=>{M.current&&l==="recording"&&b==="mic"&&De()},onMouseLeave:()=>{M.current&&l==="recording"&&b==="mic"&&De()},onTouchStart:()=>{M.current&&l==="idle"&&!p&&(v("mic"),W())},onTouchEnd:()=>{M.current&&l==="recording"&&b==="mic"&&De()},disabled:l==="recording"&&b!=="mic"||p,style:l==="recording"&&b!=="mic"||p?Ie:Oe,title:S?"Hold to record (walkie-talkie)":b==="mic"?"Stop recording":"Record",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="mic"?"#ef4444":"#171717"},children:"mic"})}),g.jsx("button",{onClick:()=>{b==="startover"?De():l==="editing"&&(v("startover"),V())},disabled:l==="idle"||l==="recording"&&b!=="startover"||p,style:l==="idle"||l==="recording"&&b!=="startover"||p?Ie:Oe,title:b==="startover"?"Stop recording":"Start over",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="startover"?"#ef4444":"#171717"},children:"refresh"})})]}),g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[B.total>0&&B.completed<B.total&&g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",background:"rgba(16, 185, 129, 0.1)",borderRadius:"4px",fontSize:"11px",color:"#10b981"},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"14px",animation:"spin 1s linear infinite"},children:"sync"}),B.completed,"/",B.total]}),t&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginRight:"4px"},children:[g.jsx("button",{onClick:()=>k(!S),style:{width:"28px",height:"16px",borderRadius:"8px",border:"none",background:S?"#10b981":"#9ca3af",cursor:"pointer",position:"relative",transition:"background 0.2s",padding:0},title:S?"Auto-transcribe ON":"Auto-transcribe OFF",children:g.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",background:"white",position:"absolute",top:"2px",left:S?"14px":"2px",transition:"left 0.2s",boxShadow:"0 1px 2px rgba(0,0,0,0.2)"}})}),g.jsx("span",{style:{fontSize:"10px",color:"#666"},children:"auto"})]}),g.jsx("button",{onClick:()=>{l==="editing"&&Ae.current&&Ne(Ae.current)},disabled:l!=="editing",style:l!=="editing"?Ie:Oe,title:"Transcribe audio",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:S?"#10b981":"#171717"},children:"subtitles"})})]}),!i&&g.jsx("button",{onClick:J,disabled:l!=="editing",style:l!=="editing"?Ie:Oe,title:"Save recording",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"save"})})]})]}),B.total>0&&B.completed<B.total&&g.jsx("div",{style:{height:"3px",background:"#e5e5e5",overflow:"hidden"},children:g.jsx("div",{style:{height:"100%",background:"#10b981",width:`${B.completed/B.total*100}%`,transition:"width 0.3s ease"}})})]})}exports.$createQRCodeNode=Qi;exports.$isQRCodeNode=If;exports.AnimatedCardFlip=Ou;exports.ApiClient=wl;exports.AudioEditor=rh;exports.AuthManager=Cl;exports.Card=Pu;exports.ComboBox=Qf;exports.DataOperations=$n;exports.Detail=Mu;exports.GraphClient=cu;exports.KanbanBoard=Jf;exports.Mail=$u;exports.MailClient=vl;exports.MailComposer=Kf;exports.MailEditor=su;exports.QRCodeNode=Ur;exports.SelectableList=zu;exports.Stack=Lu;exports.Timeline=th;exports.getApiClient=xi;exports.initializeApiClient=Nu;exports.useMutation=Bu;exports.useQuery=Dl;
161
+ `})]})}const Hf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",chipBackground:"#f3f4f6",chipText:"#374151",hoverBackground:"#f9fafb"};function Qf({options:r,value:e,onChange:t,placeholder:n="Search or select...",allowCreate:s=!0,onCreate:i,allowDelete:o=!1,onDelete:a,label:l,disabled:u=!1,max:c=0,theme:d={},className:f=""}){const h={...Hf,...d},[p,m]=C.useState(!1),[y,w]=C.useState(""),x=C.useRef(null),E=C.useRef(null);C.useEffect(()=>{function T(B){x.current&&!x.current.contains(B.target)&&(m(!1),w(""))}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const D=r.filter(T=>{var B;return((B=T.label)==null?void 0:B.toLowerCase().includes(y.toLowerCase()))&&!e.includes(T.id)}),A=s&&y.trim()&&!r.some(T=>{var B;return((B=T.label)==null?void 0:B.toLowerCase())===y.toLowerCase()}),b=e.map(T=>r.find(B=>B.id===T)).filter(Boolean),v=C.useCallback(T=>{var B;c>0&&e.length>=c||(t([...e,T]),w(""),c===1?m(!1):(B=E.current)==null||B.focus())},[e,t,c]),S=C.useCallback(T=>{t(e.filter(B=>B!==T))},[e,t]),k=C.useCallback(async()=>{if(!A)return;const T=await(i==null?void 0:i(y.trim()));T&&v(T.id),w("")},[A,y,i,v]),j=C.useCallback(T=>{T.key==="Enter"?(T.preventDefault(),A?k():D.length>0&&v(D[0].id)):T.key==="Backspace"&&!y&&e.length>0?S(e[e.length-1]):T.key==="Escape"&&(m(!1),w(""))},[A,D,y,e,k,v,S]);return g.jsxs("div",{ref:x,className:f,style:{position:"relative"},children:[l&&g.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:l}),g.jsxs("div",{onClick:()=>!u&&m(!0),style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 12px",border:`1px solid ${p?h.primary:h.border}`,borderRadius:"8px",background:u?h.hoverBackground:h.background,cursor:u?"not-allowed":"text",minHeight:"42px",alignItems:"center"},children:[b.map(T=>g.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"4px",fontSize:"13px",background:T.color||h.chipBackground,color:T.color?"#fff":h.chipText},children:[T.label,!u&&g.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),S(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 2px",fontSize:"14px",color:"inherit",opacity:.7},children:"×"})]},T.id)),g.jsx("input",{ref:E,type:"text",value:y,onChange:T=>{w(T.target.value),p||m(!0)},onFocus:()=>m(!0),onKeyDown:j,placeholder:b.length===0?n:"",disabled:u||c>0&&e.length>=c,style:{flex:1,minWidth:"60px",border:"none",outline:"none",fontSize:"14px",background:"transparent",color:h.text}})]}),p&&!u&&g.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",background:h.background,border:`1px solid ${h.border}`,borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",maxHeight:"200px",overflowY:"auto",zIndex:50},children:D.length===0&&!A?g.jsx("div",{style:{padding:"12px",fontSize:"14px",color:h.textSecondary,textAlign:"center"},children:y?"No matches":"No options available"}):g.jsxs(g.Fragment,{children:[D.map(T=>g.jsxs("div",{onClick:()=>v(T.id),style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.text,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseEnter:B=>{B.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:B=>{B.currentTarget.style.background=""},children:[T.label,o&&a&&g.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),a(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",fontSize:"14px",color:h.textSecondary,opacity:.5},onMouseEnter:B=>{B.currentTarget.style.opacity="1",B.currentTarget.style.color="#ef4444"},onMouseLeave:B=>{B.currentTarget.style.opacity="0.5",B.currentTarget.style.color=h.textSecondary||""},children:"×"})]},T.id)),A&&g.jsxs("div",{onClick:k,style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.primary,borderTop: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(),'"']})]})})]})}const Jf={background:"#ffffff",cardBackground:"#f9fafb",cardHover:"#f3f4f6",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6"};function Yf({options:r,type:e,placeholder:t="Rechercher...",onItemClick:n,onCreate:s,maxHeight:i=400,className:o="",theme:a={}}){const l={...Jf,...a},[u,c]=C.useState(""),d=C.useRef(null),f=C.useMemo(()=>{if(!u.trim())return r;const m=u.toLowerCase();return r.filter(y=>{var w,x;return((w=y.label)==null?void 0:w.toLowerCase().includes(m))||((x=y.notes)==null?void 0:x.toLowerCase().includes(m))})},[r,u]),h=m=>{n&&n(m)},p=()=>{s&&s()};return g.jsxs("div",{className:`combostack ${o}`,style:{width:"100%"},children:[g.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"12px"},children:[g.jsxs("div",{style:{flex:1,position:"relative"},children:[g.jsx("span",{style:{position:"absolute",left:"12px",top:"50%",transform:"translateY(-50%)",color:l.textSecondary,fontSize:"16px"},children:"🔍"}),g.jsx("input",{ref:d,type:"text",value:u,onChange:m=>c(m.target.value),placeholder:t,style:{width:"100%",padding:"10px 12px 10px 40px",fontSize:"14px",border:`1px solid ${l.border}`,borderRadius:"8px",background:l.background,color:l.text,outline:"none",boxSizing:"border-box"}})]}),s&&g.jsx("button",{onClick:p,style:{width:"42px",height:"42px",display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${l.border}`,borderRadius:"8px",background:l.background,color:l.primary,cursor:"pointer",fontSize:"20px",fontWeight:"bold",transition:"background 0.15s"},onMouseEnter:m=>{m.currentTarget.style.background=l.cardHover||"#f3f4f6"},onMouseLeave:m=>{m.currentTarget.style.background=l.background||"#ffffff"},title:`Créer ${e||"item"}`,children:"+"})]}),g.jsx("div",{style:{maxHeight:typeof i=="number"?`${i}px`:i,overflowY:"auto",border:`1px solid ${l.border}`,borderRadius:"8px",background:l.background},children:f.length===0?g.jsx("div",{style:{padding:"24px",textAlign:"center",color:l.textSecondary,fontSize:"14px"},children:u?`Aucun résultat pour "${u}"`:"Aucun élément"}):f.map((m,y)=>g.jsxs("div",{onClick:()=>h(m),style:{padding:"12px 16px",cursor:"pointer",borderBottom:y<f.length-1?`1px solid ${l.border}`:"none",background:l.cardBackground,transition:"background 0.15s"},onMouseEnter:w=>{w.currentTarget.style.background=l.cardHover||"#f3f4f6"},onMouseLeave:w=>{w.currentTarget.style.background=l.cardBackground||"#f9fafb"},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:m.color||l.text,marginBottom:m.notes?"4px":0},children:m.label}),m.notes&&g.jsx("div",{style:{fontSize:"13px",color:l.textSecondary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:m.notes})]},m.id))})]})}function Xf({items:r,columns:e,getItemId:t,getItemColumn:n,getItemOrder:s,renderItem:i,onItemMove:o,onItemReorder:a,onItemClick:l,renderColumnHeader:u,renderColumnFooter:c,className:d="",columnClassName:f="",itemClassName:h=""}){const[p,m]=C.useState(null),[y,w]=C.useState(null),[x,E]=C.useState(null),D=C.useRef(null),A=e.reduce((B,L)=>{let R=r.filter(P=>n(P)===L.id);return s&&(R=R.sort((P,Q)=>s(P)-s(Q))),B[L.id]=R,B},{}),b=C.useCallback((B,L)=>{const R=t(L),P=n(L);m(R),D.current=P,B.dataTransfer.effectAllowed="move",B.dataTransfer.setData("text/plain",R),requestAnimationFrame(()=>{const Q=B.target;Q.style.opacity="0.5"})},[t,n]),v=C.useCallback(B=>{const L=B.target;L.style.opacity="1",m(null),w(null),E(null),D.current=null},[]),S=C.useCallback((B,L,R)=>{B.preventDefault(),B.dataTransfer.dropEffect="move",w(L),E(R)},[]),k=C.useCallback(B=>{const L=B.relatedTarget;L!=null&&L.closest("[data-kanban-column]")||(w(null),E(null))},[]),j=C.useCallback((B,L,R)=>{if(B.preventDefault(),!p)return;const P=D.current;P===L?a==null||a(p,L,R):P&&o(p,P,L,R),m(null),w(null),E(null),D.current=null},[p,o,a]),T=(B,L)=>g.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[B.color&&g.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:B.color}}),g.jsx("span",{className:"font-medium text-sm text-neutral-700",children:B.label})]}),g.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:L})]});return g.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${d}`,style:{minHeight:"400px"},children:e.map(B=>{const L=A[B.id]||[],R=y===B.id;return g.jsxs("div",{"data-kanban-column":B.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,onDragOver:P=>{P.preventDefault(),p&&!R&&w(B.id)},onDragLeave:k,onDrop:P=>j(P,B.id,x??L.length),children:[g.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:u?u(B,L.length):T(B,L.length)}),g.jsxs("div",{className:`flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${R?"bg-blue-50":""}`,children:[L.map((P,Q)=>{const se=t(P),xe=p===se,oe=R&&x===Q&&!xe;return g.jsxs("div",{children:[oe&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mb-2 mx-1"}),g.jsx("div",{draggable:!0,onDragStart:Se=>b(Se,P),onDragEnd:v,onDragOver:Se=>S(Se,B.id,Q),onClick:()=>l==null?void 0:l(P),className:`cursor-grab active:cursor-grabbing transition-all ${xe?"opacity-50 scale-95":""} ${h}`,children:i(P,xe)})]},se)}),g.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:P=>{P.preventDefault(),S(P,B.id,L.length)},children:R&&x===L.length&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),L.length===0&&R&&g.jsx("div",{className:"h-20 border-2 border-dashed border-blue-300 rounded-lg bg-blue-50/50 flex items-center justify-center",children:g.jsx("span",{className:"text-sm text-blue-400",children:"Drop here"})})]}),c&&g.jsx("div",{className:"flex-shrink-0 border-t border-neutral-200 p-2",children:c(B)})]},B.id)})})}const Zf={background:"#ffffff",hourLineColor:"#e5e7eb",halfHourLineColor:"#f3f4f6",hourTextColor:"#9ca3af",currentTimeColor:"#ef4444",allDayBackground:"#f9fafb",allDayBorder:"#e5e7eb"};function eh(r){const e=r.match(/^(\d{1,2}):(\d{2})$/);return e?{hours:parseInt(e[1],10),minutes:parseInt(e[2],10)}:null}function th(r){const e=r%12||12,t=r<12?"AM":"PM";return`${e} ${t}`}function rh(r){const e=new Date;return r.getDate()===e.getDate()&&r.getMonth()===e.getMonth()&&r.getFullYear()===e.getFullYear()}function nh({items:r,date:e,startHour:t=7,endHour:n=22,hourHeight:s=60,getItemTime:i,getItemDuration:o,getItemIsAllDay:a,getItemId:l,renderItem:u,onItemClick:c,onTimeSlotClick:d,showCurrentTime:f=!0,className:h="",theme:p={}}){const m={...Zf,...p},{allDayItems:y,timedItems:w}=C.useMemo(()=>{const v=[],S=[];for(const k of r)a(k)?v.push(k):S.push(k);return{allDayItems:v,timedItems:S}},[r,a]),x=C.useMemo(()=>{const v=[];for(let S=t;S<=n;S++)v.push(S);return v},[t,n]),E=(n-t+1)*s,D=C.useCallback(v=>{const S=i(v);if(!S)return null;const k=eh(S);if(!k)return null;const{hours:j,minutes:T}=k,B=Math.max(t,Math.min(n,j)),L=j<t?0:T,R=(B-t)*s+L/60*s,P=o(v),Q=Math.max(20,P/60*s);return{top:R,height:Q}},[i,o,t,n,s]),A=C.useMemo(()=>{if(!f||!rh(e))return null;const v=new Date,S=v.getHours(),k=v.getMinutes();return S<t||S>n?null:(S-t)*s+k/60*s},[e,f,t,n,s]),b=C.useCallback(v=>{if(!d)return;const S=v.currentTarget.getBoundingClientRect(),j=(v.clientY-S.top)/s*60,T=Math.floor(j/60)+t,B=Math.round(j%60/15)*15,L=Math.min(n,Math.max(t,T)),R=B>=60?0:B,P=`${L.toString().padStart(2,"0")}:${R.toString().padStart(2,"0")}`;d(P)},[d,s,t,n]);return g.jsxs("div",{className:h,style:{background:m.background},children:[y.length>0&&g.jsxs("div",{style:{padding:"8px 0 8px 60px",borderBottom:`1px solid ${m.allDayBorder}`,background:m.allDayBackground},children:[g.jsx("div",{style:{fontSize:"11px",color:m.hourTextColor,marginBottom:"4px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"All Day"}),g.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:y.map(v=>g.jsx("div",{onClick:()=>c==null?void 0:c(v),style:{cursor:c?"pointer":"default"},children:u(v)},l(v)))})]}),g.jsxs("div",{style:{position:"relative",height:E},children:[x.map((v,S)=>g.jsxs("div",{style:{position:"absolute",top:S*s,left:0,right:0},children:[g.jsx("div",{style:{position:"absolute",left:0,top:-8,width:"50px",textAlign:"right",paddingRight:"10px",fontSize:"11px",color:m.hourTextColor},children:th(v)}),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),S<x.length-1&&g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},v)),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:d?"pointer":"default"},onClick:b}),A!==null&&g.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:A,zIndex:20,pointerEvents:"none"},children:[g.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:m.currentTimeColor,marginLeft:"-5px",marginTop:"-5px",position:"absolute"}}),g.jsx("div",{style:{marginLeft:"5px",height:"2px",background:m.currentTimeColor}})]}),w.map(v=>{const S=D(v);return S?g.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:S.top,height:S.height,zIndex:10,cursor:c?"pointer":"default"},onClick:k=>{k.stopPropagation(),c==null||c(v)},children:u(v)},l(v)):null})]})]})}function sh({onComplete:r,onCancel:e,onTranscribe:t,onTranscriptionComplete:n,variant:s="widget",hideSaveButton:i=!1,maxDuration:o=180}){const a=s==="widget",[l,u]=C.useState("idle"),[c,d]=C.useState(0),[f,h]=C.useState(0),[p,m]=C.useState(!1),[y,w]=C.useState(0),[x,E]=C.useState(null),[D,A]=C.useState(!1),[b,v]=C.useState(null),[S,k]=C.useState(!0),[j,T]=C.useState([]),[B,L]=C.useState({completed:0,total:0}),R=C.useRef(!1),P=C.useRef(!0);C.useEffect(()=>{P.current=S},[S]);const Q=C.useRef(null),se=C.useRef(null),xe=C.useRef(null),oe=C.useRef(null),Se=C.useRef(null),he=C.useRef([]),fe=C.useRef(null),pe=C.useRef(null),ge=C.useRef(null),Ae=C.useRef(null),be=C.useRef(!1),we=C.useRef([]),Re=C.useRef(null),ce=C.useRef(null),je=C.useRef([]),at=C.useRef([]),kt=C.useRef("insert"),zt=C.useRef(!1),nt=C.useRef(0),mt=C.useRef(0),ft=C.useRef(0),Yt=q=>{const N=Math.floor(q/60),H=Math.floor(q%60);return`${N.toString().padStart(2,"0")}:${H.toString().padStart(2,"0")}`},qt=async q=>{const N=await q.arrayBuffer(),H=new AudioContext,Y=await H.decodeAudioData(N);return await H.close(),Y},Tt=q=>{const N=q.numberOfChannels,H=q.sampleRate,Y=1,I=16,re=I/8,Z=N*re,ee=H*Z,me=q.length*Z,Ee=new ArrayBuffer(44+me),te=new DataView(Ee),ne=(Be,ve)=>{for(let Je=0;Je<ve.length;Je++)te.setUint8(Be+Je,ve.charCodeAt(Je))};ne(0,"RIFF"),te.setUint32(4,36+me,!0),ne(8,"WAVE"),ne(12,"fmt "),te.setUint32(16,16,!0),te.setUint16(20,Y,!0),te.setUint16(22,N,!0),te.setUint32(24,H,!0),te.setUint32(28,ee,!0),te.setUint16(32,Z,!0),te.setUint16(34,I,!0),ne(36,"data"),te.setUint32(40,me,!0);const ze=[];for(let Be=0;Be<N;Be++)ze.push(q.getChannelData(Be));let We=44;for(let Be=0;Be<q.length;Be++)for(let ve=0;ve<N;ve++){const Je=Math.max(-1,Math.min(1,ze[ve][Be])),Ye=Je<0?Je*32768:Je*32767;te.setInt16(We,Ye,!0),We+=2}return new Blob([Ee],{type:"audio/wav"})},Nt=async(q,N,H,Y)=>{const I=new AudioContext,re=q.sampleRate,Z=Math.max(q.numberOfChannels,N.numberOfChannels),ee=Math.min(H,q.length),me=Math.max(0,q.length-H),Ee=Y==="insert"?ee+N.length+me:ee+N.length,te=I.createBuffer(Z,Ee,re);for(let ne=0;ne<Z;ne++){const ze=te.getChannelData(ne),We=ne<q.numberOfChannels?q.getChannelData(ne):q.getChannelData(0);for(let ve=0;ve<ee;ve++)ze[ve]=We[ve];const Be=ne<N.numberOfChannels?N.getChannelData(ne):N.getChannelData(0);for(let ve=0;ve<N.length;ve++)ze[ee+ve]=Be[ve];if(Y==="insert")for(let ve=0;ve<me;ve++)ze[ee+N.length+ve]=We[H+ve]}return await I.close(),te},ut=C.useCallback(()=>{const q=Q.current;if(!q)return;const N=q.getContext("2d");if(!N)return;const H=q.getBoundingClientRect(),Y=H.width,I=H.height,re=we.current,Z=f||c||1,ee=l==="recording"?c:y;N.fillStyle="#2d3b35",N.fillRect(0,0,Y,I);const me=8,Ee="rgba(0, 0, 0, 0.4)",te=N.createLinearGradient(0,0,0,me);te.addColorStop(0,Ee),te.addColorStop(1,"transparent"),N.fillStyle=te,N.fillRect(0,0,Y,me);const ne=N.createLinearGradient(0,I-me,0,I);ne.addColorStop(0,"transparent"),ne.addColorStop(1,Ee),N.fillStyle=ne,N.fillRect(0,I-me,Y,me);const ze=N.createLinearGradient(0,0,me,0);ze.addColorStop(0,Ee),ze.addColorStop(1,"transparent"),N.fillStyle=ze,N.fillRect(0,0,me,I);const We=N.createLinearGradient(Y-me,0,Y,0);We.addColorStop(0,"transparent"),We.addColorStop(1,Ee),N.fillStyle=We,N.fillRect(Y-me,0,me,I),N.strokeStyle="#5a6b62",N.lineWidth=1,N.beginPath(),N.moveTo(0,I/2),N.lineTo(Y,I/2),N.stroke();const Be=Y/2;if(re.length>0)if(l==="recording")for(let Ye=0;Ye<re.length;Ye++){const ht=re.length-1-Ye,Wt=Be-ht*4;if(Wt<-3||Wt>Y)continue;const bt=re[Ye]*(I/2-12),_=I/2-bt;N.fillStyle="#10b981",N.fillRect(Wt,_,3,bt*2)}else{const Ye=Z>0?ee/Z*re.length:0;for(let ht=0;ht<re.length;ht++){const Wt=Ye-ht,bt=Be-Wt*4;if(bt<-3||bt>Y)continue;const _=re[ht]*(I/2-12),M=I/2-_;N.fillStyle=ht<=Ye?"#10b981":"#4b5563",N.fillRect(bt,M,3,_*2)}}N.strokeStyle="#ef4444",N.lineWidth=1,N.beginPath(),N.moveTo(Be,0),N.lineTo(Be,I),N.stroke(),N.fillStyle="#fff",N.font="bold 18px monospace",N.textAlign="center",N.fillText(Yt(ee),Be,I-6),l==="recording"&&(N.fillStyle="#ef4444",N.beginPath(),N.arc(20,20,8,0,Math.PI*2),N.fill(),N.fillStyle="#fff",N.font="10px sans-serif",N.textAlign="left",N.fillText("REC",34,24)),N.textAlign="left"},[l,y,c,f]),yt=()=>{const q=Se.current;if(!q||!be.current)return;const N=q.frequencyBinCount,H=new Uint8Array(N);q.getByteTimeDomainData(H);let Y=0;for(let Z=0;Z<N;Z++){const ee=(H[Z]-128)/128;Y+=ee*ee}const I=Math.sqrt(Y/N),re=Math.min(1,I*3);we.current.push(re),ut(),be.current&&(pe.current=requestAnimationFrame(yt))},W=async()=>{try{E(null),A(!1),Re.current===null&&(we.current=[]);const q=await navigator.mediaDevices.getUserMedia({audio:!0});xe.current=q;const N=new AudioContext;oe.current=N;const H=N.createAnalyser();H.fftSize=2048,Se.current=H,N.createMediaStreamSource(q).connect(H);const I=new MediaRecorder(q);se.current=I,he.current=[],I.ondataavailable=re=>{re.data.size>0&&he.current.push(re.data)},I.onstop=async()=>{try{if(be.current=!1,he.current.length===0){E("No audio was recorded. Please try again."),u("idle"),q.getTracks().forEach(te=>te.stop());return}const re=new Blob(he.current,{type:"audio/webm"});let Z,ee;if(Re.current!==null&&ce.current)try{const te=await qt(re),ne=ce.current.sampleRate,ze=Math.floor(Re.current*ne),We=await Nt(ce.current,te,ze,kt.current);Z=Tt(We),ee=We.length/We.sampleRate,kt.current==="insert"&&(we.current=[...we.current,...at.current]),Re.current=null,ce.current=null,je.current=[],at.current=[]}catch{Z=re,ee=nt.current>0?nt.current:1}else Z=re,ee=nt.current>0?nt.current:1;if(Ae.current=Z,q.getTracks().forEach(te=>te.stop()),P.current&&t){T(te=>[...te,Z]),L(te=>({...te,total:te.total+1})),Ae.current=null,we.current=[],w(0),h(0),d(0),u("idle");return}const me=URL.createObjectURL(Z),Ee=new Audio(me);Ee.ontimeupdate=()=>{w(Ee.currentTime)},Ee.onended=()=>{m(!1)},ge.current=Ee,h(ee),w(ee),u("editing")}catch{E("Failed to process recording"),u("idle")}},I.start(100),be.current=!0,u("recording"),d(0),nt.current=0,fe.current=setInterval(()=>{nt.current+=1,d(nt.current),nt.current>=o&&(se.current&&se.current.state!=="inactive"&&se.current.stop(),be.current=!1,v(null),fe.current&&(clearInterval(fe.current),fe.current=null),pe.current&&(cancelAnimationFrame(pe.current),pe.current=null),setTimeout(()=>{alert(`Maximum recording time of ${Math.floor(o/60)} minutes reached.`)},100))},1e3)}catch{E("Could not access microphone. Please allow microphone access.")}},De=()=>{be.current=!1,A(!1),v(null),pe.current&&(cancelAnimationFrame(pe.current),pe.current=null),fe.current&&(clearInterval(fe.current),fe.current=null),se.current&&se.current.state!=="inactive"&&se.current.stop()},Te=q=>{const N=Q.current;if(!N)return;const H=f||c;if(H<=0)return;const Y=we.current;if(Y.length===0)return;const I=N.getBoundingClientRect(),re=q-mt.current,Z=4,ee=I.width/N.width,me=Y.length/H*Z,Ee=-re/(me*ee),te=ft.current+Ee,ne=Math.max(0,Math.min(te,H));ge.current&&(ge.current.currentTime=ne),w(ne)},ke=()=>{ge.current&&(ge.current.currentTime=0),w(0)},Bt=()=>{const q=f||c;ge.current&&(ge.current.currentTime=q),w(q)},Ft=()=>{const q=ge.current;q&&(p?(q.pause(),w(q.currentTime),m(!1)):(q.currentTime=y,q.play().catch(()=>{}),m(!0)))},Ut=async q=>{if(!Ae.current){W();return}try{ge.current&&(ge.current.pause(),m(!1)),kt.current=q,ce.current=await qt(Ae.current);const N=f||c;Re.current=y;const H=N>0?y/N:0,Y=Math.floor(H*we.current.length);je.current=we.current.slice(0,Y),at.current=we.current.slice(Y),we.current=[...je.current],W()}catch{E("Failed to prepare recording. Please try again.")}},V=()=>{ge.current&&(ge.current.pause(),ge.current=null),Ae.current=null,ce.current=null,Re.current=null,je.current=[],m(!1),w(0),h(0),d(0),W()},J=()=>{Ae.current?r(Ae.current,f||c):alert("No audio recorded yet!")};C.useEffect(()=>{l==="recording"&&Q.current&&Se.current&&be.current&&(pe.current=requestAnimationFrame(yt))},[l]),C.useEffect(()=>{const q=Q.current;if(!q)return;const N=()=>{const H=window.devicePixelRatio||1,Y=q.getBoundingClientRect();q.width=Y.width*H,q.height=Y.height*H;const I=q.getContext("2d");I&&I.scale(H,H)};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]),C.useEffect(()=>{if(l==="idle"){const q=Q.current;if(!q)return;const N=q.getContext("2d");if(!N)return;const H=q.getBoundingClientRect(),Y=H.width,I=H.height;N.fillStyle="#2d3b35",N.fillRect(0,0,Y,I);const re=8,Z="rgba(0, 0, 0, 0.4)",ee=N.createLinearGradient(0,0,0,re);ee.addColorStop(0,Z),ee.addColorStop(1,"transparent"),N.fillStyle=ee,N.fillRect(0,0,Y,re);const me=N.createLinearGradient(0,I-re,0,I);me.addColorStop(0,"transparent"),me.addColorStop(1,Z),N.fillStyle=me,N.fillRect(0,I-re,Y,re);const Ee=N.createLinearGradient(0,0,re,0);Ee.addColorStop(0,Z),Ee.addColorStop(1,"transparent"),N.fillStyle=Ee,N.fillRect(0,0,re,I);const te=N.createLinearGradient(Y-re,0,Y,0);te.addColorStop(0,"transparent"),te.addColorStop(1,Z),N.fillStyle=te,N.fillRect(Y-re,0,re,I),N.strokeStyle="#5a6b62",N.lineWidth=1,N.beginPath(),N.moveTo(0,I/2),N.lineTo(Y,I/2),N.stroke();const ne=Y/2;N.strokeStyle="#ef4444",N.lineWidth=1,N.beginPath(),N.moveTo(ne,0),N.lineTo(ne,I),N.stroke(),N.fillStyle="#fff",N.font="bold 18px monospace",N.textAlign="center",N.fillText("00:00",ne,I-6)}},[l]);const Ne=C.useCallback(q=>{T(N=>[...N,q]),L(N=>({...N,total:N.total+1}))},[]);if(C.useEffect(()=>{(async()=>{if(R.current||j.length===0||!t)return;R.current=!0;const N=j[0];try{const H=await t(N);H&&n&&n(H)}catch(H){console.error("Transcription failed:",H)}finally{T(H=>H.slice(1)),L(H=>({...H,completed:H.completed+1})),R.current=!1}})()},[j,t,n]),C.useEffect(()=>()=>{be.current=!1,fe.current&&clearInterval(fe.current),pe.current&&cancelAnimationFrame(pe.current),xe.current&&xe.current.getTracks().forEach(q=>q.stop()),oe.current&&oe.current.state!=="closed"&&oe.current.close()},[]),C.useEffect(()=>{if(l==="editing"&&p){let q;const N=()=>{const H=ge.current;if(H&&p){const Y=Q.current;if(Y){const I=Y.getContext("2d");if(I){const re=Y.getBoundingClientRect(),Z=re.width,ee=re.height,me=we.current,Ee=f||c||1,te=H.currentTime;I.fillStyle="#2d3b35",I.fillRect(0,0,Z,ee);const ne=8,ze="rgba(0, 0, 0, 0.4)",We=I.createLinearGradient(0,0,0,ne);We.addColorStop(0,ze),We.addColorStop(1,"transparent"),I.fillStyle=We,I.fillRect(0,0,Z,ne);const Be=I.createLinearGradient(0,ee-ne,0,ee);Be.addColorStop(0,"transparent"),Be.addColorStop(1,ze),I.fillStyle=Be,I.fillRect(0,ee-ne,Z,ne);const ve=I.createLinearGradient(0,0,ne,0);ve.addColorStop(0,ze),ve.addColorStop(1,"transparent"),I.fillStyle=ve,I.fillRect(0,0,ne,ee);const Je=I.createLinearGradient(Z-ne,0,Z,0);Je.addColorStop(0,"transparent"),Je.addColorStop(1,ze),I.fillStyle=Je,I.fillRect(Z-ne,0,ne,ee),I.strokeStyle="#5a6b62",I.lineWidth=1,I.beginPath(),I.moveTo(0,ee/2),I.lineTo(Z,ee/2),I.stroke();const Ye=Z/2,ht=3,Wt=4,bt=Ee>0?te/Ee*me.length:0;for(let U=0;U<me.length;U++){const X=bt-U,ue=Ye-X*Wt;if(ue<-ht||ue>Z)continue;const _e=me[U]*(ee/2-12),le=ee/2-_e;I.fillStyle=U<=bt?"#10b981":"#4b5563",I.fillRect(ue,le,ht,_e*2)}I.strokeStyle="#ef4444",I.lineWidth=1,I.beginPath(),I.moveTo(Ye,0),I.lineTo(Ye,ee),I.stroke(),I.fillStyle="#fff",I.font="bold 18px monospace",I.textAlign="center";const _=Math.floor(te/60),M=Math.floor(te%60);I.fillText(`${_.toString().padStart(2,"0")}:${M.toString().padStart(2,"0")}`,Ye,ee-6),I.textAlign="left"}}q=requestAnimationFrame(N)}};return q=requestAnimationFrame(N),()=>cancelAnimationFrame(q)}},[l,p,f,c]),C.useEffect(()=>{l==="editing"&&!p&&ut()},[l,y,p,ut]),x)return g.jsxs("div",{style:{border:"1px solid #fecaca",borderRadius:"12px",padding:"16px",background:"#fef2f2"},children:[g.jsx("p",{style:{fontSize:"14px",color:"#dc2626",marginBottom:"12px"},children:x}),g.jsx("button",{onClick:()=>{E(null),W()},style:{padding:"8px 16px",fontSize:"14px",background:"#171717",color:"white",borderRadius:"8px",border:"none",cursor:"pointer"},children:"Try Again"})]});const Oe={padding:"8px",borderRadius:"8px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},Ie={...Oe,opacity:.3,cursor:"not-allowed"},xt=a?{border:"1px solid #e5e5e5",borderRadius:"12px",overflow:"hidden",background:"white"}:{overflow:"hidden",background:"white",flexShrink:0};return g.jsxs("div",{style:xt,children:[g.jsx("canvas",{ref:Q,style:{width:"100%",height:"32px",cursor:"pointer",flexShrink:0},onMouseDown:q=>{if(l==="editing"){zt.current=!0,mt.current=q.clientX,ft.current=y;const N=Y=>{zt.current&&Te(Y.clientX)},H=()=>{zt.current=!1,window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",H)};window.addEventListener("mousemove",N),window.addEventListener("mouseup",H)}}}),g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:a?"6px 8px":"4px",borderTop:"1px solid #d4d4d4",background:"linear-gradient(to bottom, #e0e0e0 0%, #c8c8c8 100%)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(0,0,0,0.1)",flexShrink:0},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[g.jsx("button",{onClick:ke,disabled:l==="idle"||l==="recording",style:l==="idle"||l==="recording"?Ie:Oe,title:"Go to start",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"first_page"})}),g.jsx("button",{onClick:()=>{if(l==="recording"){const q=se.current;q&&(q.state==="recording"?(q.pause(),A(!0)):q.state==="paused"&&(q.resume(),A(!1)))}else Ft()},disabled:l==="idle",style:l==="idle"?Ie:Oe,title:p||l==="recording"&&!D?"Pause":"Play",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:p||l==="recording"&&!D?"pause":"play_arrow"})}),g.jsx("button",{onClick:Bt,disabled:l==="idle"||l==="recording",style:l==="idle"||l==="recording"?Ie:Oe,title:"Go to end",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"last_page"})}),g.jsx("div",{style:{width:"1px",height:"24px",margin:"0 4px",background:"linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(0,0,0,0.15))"}}),g.jsx("button",{onClick:()=>{b==="insert"?De():l==="idle"?(v("insert"),W()):l==="editing"&&(v("insert"),Ut("insert"))},disabled:l==="recording"&&b!=="insert"||p,style:l==="recording"&&b!=="insert"||p?Ie:Oe,title:b==="insert"?"Stop recording":"Insert recording",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="insert"?"#ef4444":"#171717"},children:"add"})}),g.jsx("button",{onClick:()=>{P.current||(b==="mic"?De():l==="idle"?(v("mic"),W()):l==="editing"&&(v("mic"),Ut("replace")))},onMouseDown:()=>{P.current&&l==="idle"&&!p&&(v("mic"),W())},onMouseUp:()=>{P.current&&l==="recording"&&b==="mic"&&De()},onMouseLeave:()=>{P.current&&l==="recording"&&b==="mic"&&De()},onTouchStart:()=>{P.current&&l==="idle"&&!p&&(v("mic"),W())},onTouchEnd:()=>{P.current&&l==="recording"&&b==="mic"&&De()},disabled:l==="recording"&&b!=="mic"||p,style:l==="recording"&&b!=="mic"||p?Ie:Oe,title:S?"Hold to record (walkie-talkie)":b==="mic"?"Stop recording":"Record",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="mic"?"#ef4444":"#171717"},children:"mic"})}),g.jsx("button",{onClick:()=>{b==="startover"?De():l==="editing"&&(v("startover"),V())},disabled:l==="idle"||l==="recording"&&b!=="startover"||p,style:l==="idle"||l==="recording"&&b!=="startover"||p?Ie:Oe,title:b==="startover"?"Stop recording":"Start over",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="startover"?"#ef4444":"#171717"},children:"refresh"})})]}),g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[B.total>0&&B.completed<B.total&&g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",background:"rgba(16, 185, 129, 0.1)",borderRadius:"4px",fontSize:"11px",color:"#10b981"},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"14px",animation:"spin 1s linear infinite"},children:"sync"}),B.completed,"/",B.total]}),t&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginRight:"4px"},children:[g.jsx("button",{onClick:()=>k(!S),style:{width:"28px",height:"16px",borderRadius:"8px",border:"none",background:S?"#10b981":"#9ca3af",cursor:"pointer",position:"relative",transition:"background 0.2s",padding:0},title:S?"Auto-transcribe ON":"Auto-transcribe OFF",children:g.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",background:"white",position:"absolute",top:"2px",left:S?"14px":"2px",transition:"left 0.2s",boxShadow:"0 1px 2px rgba(0,0,0,0.2)"}})}),g.jsx("span",{style:{fontSize:"10px",color:"#666"},children:"auto"})]}),g.jsx("button",{onClick:()=>{l==="editing"&&Ae.current&&Ne(Ae.current)},disabled:l!=="editing",style:l!=="editing"?Ie:Oe,title:"Transcribe audio",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:S?"#10b981":"#171717"},children:"subtitles"})})]}),!i&&g.jsx("button",{onClick:J,disabled:l!=="editing",style:l!=="editing"?Ie:Oe,title:"Save recording",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"save"})})]})]}),B.total>0&&B.completed<B.total&&g.jsx("div",{style:{height:"3px",background:"#e5e5e5",overflow:"hidden"},children:g.jsx("div",{style:{height:"100%",background:"#10b981",width:`${B.completed/B.total*100}%`,transition:"width 0.3s ease"}})})]})}exports.$createQRCodeNode=Qi;exports.$isQRCodeNode=If;exports.AnimatedCardFlip=Ou;exports.ApiClient=wl;exports.AudioEditor=sh;exports.AuthManager=Cl;exports.Card=Mu;exports.ComboBox=Qf;exports.ComboStack=Yf;exports.DataOperations=$n;exports.Detail=Pu;exports.GraphClient=cu;exports.KanbanBoard=Xf;exports.Mail=$u;exports.MailClient=vl;exports.MailComposer=Kf;exports.MailEditor=su;exports.QRCodeNode=Ur;exports.SelectableList=zu;exports.Stack=Lu;exports.Timeline=nh;exports.getApiClient=xi;exports.initializeApiClient=Nu;exports.useMutation=Bu;exports.useQuery=Dl;